diff --git a/.mailmap b/.mailmap index 1118955016bd0..a586e7047769c 100644 --- a/.mailmap +++ b/.mailmap @@ -83,6 +83,7 @@ Ben Sago Ben Striegel Benjamin Jackman Benoรฎt Cortier +binarycat lolbinarycat Bheesham Persaud Bheesham Persaud bjorn3 <17426603+bjorn3@users.noreply.github.com> bjorn3 <17426603+bjorn3@users.noreply.github.com> diff --git a/compiler/rustc_ast_lowering/src/contract.rs b/compiler/rustc_ast_lowering/src/contract.rs index 56413160e04de..6cffd8e119b7e 100644 --- a/compiler/rustc_ast_lowering/src/contract.rs +++ b/compiler/rustc_ast_lowering/src/contract.rs @@ -23,7 +23,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // The order in which things are lowered is important! I.e to // refer to variables in contract_decls from postcond/precond, // we must lower it first! - let contract_decls = self.lower_stmts(&contract.declarations).0; + let contract_decls = self.lower_decls(contract); match (&contract.requires, &contract.ensures) { (Some(req), Some(ens)) => { @@ -124,6 +124,18 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } + fn lower_decls(&mut self, contract: &rustc_ast::FnContract) -> &'hir [rustc_hir::Stmt<'hir>] { + let (decls, decls_tail) = self.lower_stmts(&contract.declarations); + + if let Some(e) = decls_tail { + // include the tail expression in the declaration statements + let tail = self.stmt_expr(e.span, *e); + self.arena.alloc_from_iter(decls.into_iter().map(|d| *d).chain([tail].into_iter())) + } else { + decls + } + } + /// Lower the precondition check intrinsic. fn lower_precond(&mut self, req: &Box) -> rustc_hir::Stmt<'hir> { let lowered_req = self.lower_expr_mut(&req); diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 2d87d8c84d7c9..ee868296d9dce 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -301,17 +301,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_ty(self, ty) } - fn visit_generics(&mut self, g: &'a ast::Generics) { - for predicate in &g.where_clause.predicates { - match &predicate.kind { - ast::WherePredicateKind::BoundPredicate(bound_pred) => { - // A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). - self.check_late_bound_lifetime_defs(&bound_pred.bound_generic_params); - } - _ => {} - } + fn visit_where_predicate_kind(&mut self, kind: &'a ast::WherePredicateKind) { + if let ast::WherePredicateKind::BoundPredicate(bound) = kind { + // A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). + self.check_late_bound_lifetime_defs(&bound.bound_generic_params); } - visit::walk_generics(self, g); + visit::walk_where_predicate_kind(self, kind); } fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FnRetTy) { diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 0e3992c4ffdd6..31c56c44430c8 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -1753,7 +1753,8 @@ impl f128 { q } - /// Calculates the least nonnegative remainder of `self (mod rhs)`. + /// Calculates the least nonnegative remainder of `self` when + /// divided by `rhs`. /// /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in /// most cases. However, due to a floating point round-off error it can diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 1845246959371..1f40175eda041 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -1728,7 +1728,8 @@ impl f16 { q } - /// Calculates the least nonnegative remainder of `self (mod rhs)`. + /// Calculates the least nonnegative remainder of `self` when + /// divided by `rhs`. /// /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in /// most cases. However, due to a floating point round-off error it can diff --git a/library/core/src/num/int_log10.rs b/library/core/src/num/int_log10.rs index 649a736b6e7b5..af8e1f90968d6 100644 --- a/library/core/src/num/int_log10.rs +++ b/library/core/src/num/int_log10.rs @@ -1,9 +1,11 @@ //! These functions compute the integer logarithm of their type, assuming //! that someone has already checked that the value is strictly positive. +use crate::num::NonZero; + // 0 < val <= u8::MAX #[inline] -pub(super) const fn u8(val: u8) -> u32 { +const fn u8_impl(val: u8) -> u32 { let val = val as u32; // For better performance, avoid branches by assembling the solution @@ -45,13 +47,13 @@ const fn less_than_5(val: u32) -> u32 { // 0 < val <= u16::MAX #[inline] -pub(super) const fn u16(val: u16) -> u32 { +const fn u16_impl(val: u16) -> u32 { less_than_5(val as u32) } // 0 < val <= u32::MAX #[inline] -pub(super) const fn u32(mut val: u32) -> u32 { +const fn u32_impl(mut val: u32) -> u32 { let mut log = 0; if val >= 100_000 { val /= 100_000; @@ -62,7 +64,7 @@ pub(super) const fn u32(mut val: u32) -> u32 { // 0 < val <= u64::MAX #[inline] -pub(super) const fn u64(mut val: u64) -> u32 { +const fn u64_impl(mut val: u64) -> u32 { let mut log = 0; if val >= 10_000_000_000 { val /= 10_000_000_000; @@ -77,66 +79,87 @@ pub(super) const fn u64(mut val: u64) -> u32 { // 0 < val <= u128::MAX #[inline] -pub(super) const fn u128(mut val: u128) -> u32 { +const fn u128_impl(mut val: u128) -> u32 { let mut log = 0; if val >= 100_000_000_000_000_000_000_000_000_000_000 { val /= 100_000_000_000_000_000_000_000_000_000_000; log += 32; - return log + u32(val as u32); + return log + u32_impl(val as u32); } if val >= 10_000_000_000_000_000 { val /= 10_000_000_000_000_000; log += 16; } - log + u64(val as u64) + log + u64_impl(val as u64) } -#[cfg(target_pointer_width = "16")] -#[inline] -pub(super) const fn usize(val: usize) -> u32 { - u16(val as _) -} +macro_rules! define_unsigned_ilog10 { + ($($ty:ident => $impl_fn:ident,)*) => {$( + #[inline] + pub(super) const fn $ty(val: NonZero<$ty>) -> u32 { + let result = $impl_fn(val.get()); -#[cfg(target_pointer_width = "32")] -#[inline] -pub(super) const fn usize(val: usize) -> u32 { - u32(val as _) -} + // SAFETY: Integer logarithm is monotonic non-decreasing, so the computed `result` cannot + // exceed the value produced for the maximum input. + unsafe { crate::hint::assert_unchecked(result <= const { $impl_fn($ty::MAX) }) }; -#[cfg(target_pointer_width = "64")] -#[inline] -pub(super) const fn usize(val: usize) -> u32 { - u64(val as _) + result + } + )*}; } -// 0 < val <= i8::MAX -#[inline] -pub(super) const fn i8(val: i8) -> u32 { - u8(val as u8) +define_unsigned_ilog10! { + u8 => u8_impl, + u16 => u16_impl, + u32 => u32_impl, + u64 => u64_impl, + u128 => u128_impl, } -// 0 < val <= i16::MAX #[inline] -pub(super) const fn i16(val: i16) -> u32 { - u16(val as u16) -} +pub(super) const fn usize(val: NonZero) -> u32 { + #[cfg(target_pointer_width = "16")] + let impl_fn = u16; -// 0 < val <= i32::MAX -#[inline] -pub(super) const fn i32(val: i32) -> u32 { - u32(val as u32) + #[cfg(target_pointer_width = "32")] + let impl_fn = u32; + + #[cfg(target_pointer_width = "64")] + let impl_fn = u64; + + // SAFETY: We have selected the correct `impl_fn`, so the converting `val` to the argument is + // safe. + impl_fn(unsafe { NonZero::new_unchecked(val.get() as _) }) } -// 0 < val <= i64::MAX -#[inline] -pub(super) const fn i64(val: i64) -> u32 { - u64(val as u64) +macro_rules! define_signed_ilog10 { + ($($ty:ident => $impl_fn:ident,)*) => {$( + // 0 < val <= $ty::MAX + #[inline] + pub(super) const fn $ty(val: $ty) -> Option { + if val > 0 { + let result = $impl_fn(val.cast_unsigned()); + + // SAFETY: Integer logarithm is monotonic non-decreasing, so the computed `result` + // cannot exceed the value produced for the maximum input. + unsafe { + crate::hint::assert_unchecked(result <= const { $impl_fn($ty::MAX.cast_unsigned()) }); + } + + Some(result) + } else { + None + } + } + )*}; } -// 0 < val <= i128::MAX -#[inline] -pub(super) const fn i128(val: i128) -> u32 { - u128(val as u128) +define_signed_ilog10! { + i8 => u8_impl, + i16 => u16_impl, + i32 => u32_impl, + i64 => u64_impl, + i128 => u128_impl, } /// Instantiate this panic logic once, rather than for all the ilog methods diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 99662768a29f2..4a3ceb3afa389 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -3147,7 +3147,8 @@ macro_rules! int_impl { } - /// Calculates the least nonnegative remainder of `self (mod rhs)`. + /// Calculates the least nonnegative remainder of `self` when + /// divided by `rhs`. /// /// This is done as if by the Euclidean division algorithm -- given /// `r = self.rem_euclid(rhs)`, the result satisfies @@ -3527,11 +3528,7 @@ macro_rules! int_impl { without modifying the original"] #[inline] pub const fn checked_ilog10(self) -> Option { - if self > 0 { - Some(int_log10::$ActualT(self as $ActualT)) - } else { - None - } + int_log10::$ActualT(self as $ActualT) } /// Computes the absolute value of `self`. diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index ee375dbaaab2d..2b5279efb7f79 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -1657,7 +1657,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods { without modifying the original"] #[inline] pub const fn ilog10(self) -> u32 { - super::int_log10::$Int(self.get()) + super::int_log10::$Int(self) } /// Calculates the midpoint (average) between `self` and `rhs`. diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index c8224e92b17e4..34f377661bb7f 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -3481,7 +3481,8 @@ macro_rules! uint_impl { } - /// Calculates the least remainder of `self (mod rhs)`. + /// Calculates the least remainder of `self` when divided by + /// `rhs`. /// /// Since, for the positive integers, all common /// definitions of division are equal, this diff --git a/library/std/src/num/f32.rs b/library/std/src/num/f32.rs index 97ae334e19946..34827a04a699d 100644 --- a/library/std/src/num/f32.rs +++ b/library/std/src/num/f32.rs @@ -252,7 +252,8 @@ impl f32 { core::f32::math::div_euclid(self, rhs) } - /// Calculates the least nonnegative remainder of `self (mod rhs)`. + /// Calculates the least nonnegative remainder of `self` when divided by + /// `rhs`. /// /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in /// most cases. However, due to a floating point round-off error it can diff --git a/library/std/src/num/f64.rs b/library/std/src/num/f64.rs index aaeaa86ca77e1..5f9d63f0c57c4 100644 --- a/library/std/src/num/f64.rs +++ b/library/std/src/num/f64.rs @@ -252,7 +252,8 @@ impl f64 { core::f64::math::div_euclid(self, rhs) } - /// Calculates the least nonnegative remainder of `self (mod rhs)`. + /// Calculates the least nonnegative remainder of `self` when divided by + /// `rhs`. /// /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in /// most cases. However, due to a floating point round-off error it can diff --git a/src/bootstrap/src/core/debuggers/android.rs b/src/bootstrap/src/core/android.rs similarity index 84% rename from src/bootstrap/src/core/debuggers/android.rs rename to src/bootstrap/src/core/android.rs index b1ad9ca555fbd..60f7ca4dbcd0c 100644 --- a/src/bootstrap/src/core/debuggers/android.rs +++ b/src/bootstrap/src/core/android.rs @@ -10,11 +10,15 @@ pub(crate) struct Android { } pub(crate) fn discover_android(builder: &Builder<'_>, target: TargetSelection) -> Option { + if !target.contains("android") { + return None; + } + let adb_path = "adb"; // See . let adb_test_dir = "/data/local/tmp/work"; - let android_cross_path = if target.contains("android") && !builder.config.dry_run() { + let android_cross_path = if !builder.config.dry_run() { builder.cc(target).parent().unwrap().parent().unwrap().to_owned() } else { PathBuf::new() diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index eb3ea1ab51208..09c98bd7c88b4 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -29,7 +29,7 @@ use crate::core::builder::{ }; use crate::core::config::TargetSelection; use crate::core::config::flags::{Subcommand, get_completion, top_level_help}; -use crate::core::debuggers; +use crate::core::{android, debuggers}; use crate::utils::build_stamp::{self, BuildStamp}; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{ @@ -2114,21 +2114,18 @@ Please disable assertions with `rust.debug-assertions = false`. builder.config.python.as_ref().expect("python is required for running rustdoc tests"), ); - // FIXME(#148099): Currently we set these Android-related flags in all - // modes, even though they should only be needed in "debuginfo" mode, - // because the GDB-discovery code in compiletest currently assumes that - // `--android-cross-path` is always set for Android targets. - if let Some(debuggers::Android { adb_path, adb_test_dir, android_cross_path }) = - debuggers::discover_android(builder, target) - { + // Discover and set some flags related to running tests on Android targets. + let android = android::discover_android(builder, target); + if let Some(android::Android { adb_path, adb_test_dir, android_cross_path }) = &android { cmd.arg("--adb-path").arg(adb_path); cmd.arg("--adb-test-dir").arg(adb_test_dir); cmd.arg("--android-cross-path").arg(android_cross_path); } if mode == "debuginfo" { - if let Some(debuggers::Gdb { gdb }) = debuggers::discover_gdb(builder) { - cmd.arg("--gdb").arg(gdb); + if let Some(debuggers::Gdb { gdb }) = debuggers::discover_gdb(builder, android.as_ref()) + { + cmd.arg("--gdb").arg(gdb.as_ref()); } if let Some(debuggers::Lldb { lldb_exe, lldb_version }) = diff --git a/src/bootstrap/src/core/debuggers/gdb.rs b/src/bootstrap/src/core/debuggers/gdb.rs index ddad0909e4f07..2eb441ee98523 100644 --- a/src/bootstrap/src/core/debuggers/gdb.rs +++ b/src/bootstrap/src/core/debuggers/gdb.rs @@ -1,13 +1,42 @@ +use std::borrow::Cow; use std::path::Path; +use crate::core::android; use crate::core::builder::Builder; +use crate::utils::exec::BootstrapCommand; pub(crate) struct Gdb<'a> { - pub(crate) gdb: &'a Path, + pub(crate) gdb: Cow<'a, Path>, } -pub(crate) fn discover_gdb<'a>(builder: &'a Builder<'_>) -> Option> { - let gdb = builder.config.gdb.as_deref()?; +pub(crate) fn discover_gdb<'a>( + builder: &'a Builder<'_>, + android: Option<&android::Android>, +) -> Option> { + // If there's an explicitly-configured gdb, use that. + if let Some(gdb) = builder.config.gdb.as_deref() { + // FIXME(Zalathar): Consider returning None if gdb is an empty string, + // as a way to explicitly disable ambient gdb discovery. + let gdb = Cow::Borrowed(gdb); + return Some(Gdb { gdb }); + } - Some(Gdb { gdb }) + // Otherwise, fall back to whatever gdb is sitting around in PATH. + // (That's the historical behavior, but maybe we should require opt-in?) + + let gdb: Cow<'_, Path> = match android { + Some(android::Android { android_cross_path, .. }) => { + android_cross_path.join("bin/gdb").into() + } + None => Path::new("gdb").into(), + }; + + // Check whether an ambient gdb exists, by running `gdb --version`. + let output = { + let mut gdb_command = BootstrapCommand::new(gdb.as_ref()).allow_failure(); + gdb_command.arg("--version"); + gdb_command.run_capture(builder) + }; + + if output.is_success() { Some(Gdb { gdb }) } else { None } } diff --git a/src/bootstrap/src/core/debuggers/mod.rs b/src/bootstrap/src/core/debuggers/mod.rs index 011ce4081a43e..a11eda8e686e3 100644 --- a/src/bootstrap/src/core/debuggers/mod.rs +++ b/src/bootstrap/src/core/debuggers/mod.rs @@ -1,10 +1,8 @@ //! Code for discovering debuggers and debugger-related configuration, so that //! it can be passed to compiletest when running debuginfo tests. -pub(crate) use self::android::{Android, discover_android}; pub(crate) use self::gdb::{Gdb, discover_gdb}; pub(crate) use self::lldb::{Lldb, discover_lldb}; -mod android; mod gdb; mod lldb; diff --git a/src/bootstrap/src/core/mod.rs b/src/bootstrap/src/core/mod.rs index f27a09c81c55b..4df2ed319da68 100644 --- a/src/bootstrap/src/core/mod.rs +++ b/src/bootstrap/src/core/mod.rs @@ -1,3 +1,4 @@ +pub(crate) mod android; pub(crate) mod build_steps; pub(crate) mod builder; pub(crate) mod config; diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index d8472691afdf7..02b93593cbbd4 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -566,7 +566,7 @@ pub struct Config { /// /// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for /// `arm-linux-androideabi` target. - pub android_cross_path: Utf8PathBuf, + pub android_cross_path: Option, /// Extra parameter to run adb on `arm-linux-androideabi`. /// diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index 791c5f03c21a6..b0d0372454e2d 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -54,15 +54,6 @@ pub(crate) fn configure_lldb(config: &Config) -> Option> { Some(Arc::new(Config { debugger: Some(Debugger::Lldb), ..config.clone() })) } -/// Returns `true` if the given target is an Android target for the -/// purposes of GDB testing. -pub(crate) fn is_android_gdb_target(target: &str) -> bool { - matches!( - &target[..], - "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" - ) -} - /// Returns `true` if the given target is a MSVC target for the purposes of CDB testing. fn is_pc_windows_msvc_target(target: &str) -> bool { target.ends_with("-pc-windows-msvc") @@ -129,35 +120,6 @@ pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> { Some([major, minor, patch, build]) } -pub(crate) fn discover_gdb( - gdb: Option, - target: &str, - android_cross_path: &Utf8Path, -) -> Option { - #[cfg(not(windows))] - const GDB_FALLBACK: &str = "gdb"; - #[cfg(windows)] - const GDB_FALLBACK: &str = "gdb.exe"; - - let fallback_gdb = || { - if is_android_gdb_target(target) { - let mut gdb_path = android_cross_path.to_string(); - gdb_path.push_str("/bin/gdb"); - gdb_path - } else { - GDB_FALLBACK.to_owned() - } - }; - - let gdb = match gdb { - None => fallback_gdb(), - Some(ref s) if s.is_empty() => fallback_gdb(), // may be empty if configure found no gdb - Some(ref s) => s.to_owned(), - }; - - Some(Utf8PathBuf::from(gdb)) -} - pub(crate) fn query_gdb_version(gdb: &Utf8Path) -> Option { let mut version_line = None; if let Ok(output) = Command::new(&gdb).arg("--version").output() { diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index acd0d70d081f1..f3bd467db3e41 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -256,12 +256,12 @@ fn parse_config(args: Vec) -> Config { } let target = opt_str2(matches.opt_str("target")); - let android_cross_path = opt_path(matches, "android-cross-path"); + let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from); // FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config! let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target); let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version); // FIXME: `gdb_version` is *derived* from gdb, but it's *not* technically a config! - let gdb = debuggers::discover_gdb(matches.opt_str("gdb"), &target, &android_cross_path); + let gdb = matches.opt_str("gdb").map(Utf8PathBuf::from); let gdb_version = gdb.as_deref().and_then(debuggers::query_gdb_version); // FIXME: `lldb_version` is *derived* from lldb, but it's *not* technically a config! let lldb = matches.opt_str("lldb").map(Utf8PathBuf::from); diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 5ef4366b68be3..ac935910205b7 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -8,7 +8,7 @@ use tracing::debug; use super::debugger::DebuggerCommands; use super::{Debugger, Emit, ProcRes, TestCx, Truncated, WillExecute}; -use crate::debuggers::{extract_gdb_version, is_android_gdb_target}; +use crate::debuggers::extract_gdb_version; impl TestCx<'_> { pub(super) fn run_debuginfo_test(&self) { @@ -122,13 +122,15 @@ impl TestCx<'_> { let exe_file = self.make_exe_name(); let debugger_run_result; - if is_android_gdb_target(&self.config.target) { + // If bootstrap gave us an `--android-cross-path`, assume the target + // needs Android-specific handling. + if let Some(android_cross_path) = self.config.android_cross_path.as_deref() { cmds = cmds.replace("run", "continue"); // write debugger script let mut script_str = String::with_capacity(2048); script_str.push_str(&format!("set charset {}\n", Self::charset())); - script_str.push_str(&format!("set sysroot {}\n", &self.config.android_cross_path)); + script_str.push_str(&format!("set sysroot {android_cross_path}\n")); script_str.push_str(&format!("file {}\n", exe_file)); script_str.push_str("target remote :5039\n"); script_str.push_str(&format!( diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 0f3f2f37ebf26..1500c82c411ac 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2892,7 +2892,6 @@ ui/typeck/issue-105946.rs ui/typeck/issue-106929.rs ui/typeck/issue-107087.rs ui/typeck/issue-107775.rs -ui/typeck/issue-10969.rs ui/typeck/issue-110017-format-into-help-deletes-macro.rs ui/typeck/issue-110052.rs ui/typeck/issue-112007-leaked-writeln-macro-internals.rs diff --git a/tests/codegen-llvm/lib-optimizations/ilog10-range.rs b/tests/codegen-llvm/lib-optimizations/ilog10-range.rs new file mode 100644 index 0000000000000..b466855389fb4 --- /dev/null +++ b/tests/codegen-llvm/lib-optimizations/ilog10-range.rs @@ -0,0 +1,213 @@ +//! Make sure the compiler knows the result range of `ilog10`. + +//@ compile-flags: -O -Z merge-functions=disabled + +#![crate_type = "lib"] + +use std::num::NonZero; + +// Signed integers. + +#[no_mangle] +fn i8_ilog10_range(value: i8) { + const MAX_RESULT: u32 = i8::MAX.ilog10(); + + // CHECK-LABEL: @i8_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn i16_ilog10_range(value: i16) { + const MAX_RESULT: u32 = i16::MAX.ilog10(); + + // CHECK-LABEL: @i16_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn i32_ilog10_range(value: i32) { + const MAX_RESULT: u32 = i32::MAX.ilog10(); + + // CHECK-LABEL: @i32_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn i64_ilog10_range(value: i64) { + const MAX_RESULT: u32 = i64::MAX.ilog10(); + + // CHECK-LABEL: @i64_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn i128_ilog10_range(value: i128) { + const MAX_RESULT: u32 = i128::MAX.ilog10(); + + // CHECK-LABEL: @i128_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn isize_ilog10_range(value: isize) { + const MAX_RESULT: u32 = isize::MAX.ilog10(); + + // CHECK-LABEL: @isize_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value <= 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +// Unsigned integer types. + +#[no_mangle] +fn u8_ilog10_range(value: u8) { + const MAX_RESULT: u32 = u8::MAX.ilog10(); + + // CHECK-LABEL: @u8_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn u16_ilog10_range(value: u16) { + const MAX_RESULT: u32 = u16::MAX.ilog10(); + + // CHECK-LABEL: @u16_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn u32_ilog10_range(value: u32) { + const MAX_RESULT: u32 = u32::MAX.ilog10(); + + // CHECK-LABEL: @u32_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn u64_ilog10_range(value: u64) { + const MAX_RESULT: u32 = u64::MAX.ilog10(); + + // CHECK-LABEL: @u64_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn u128_ilog10_range(value: u128) { + const MAX_RESULT: u32 = u128::MAX.ilog10(); + + // CHECK-LABEL: @u128_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +#[no_mangle] +fn usize_ilog10_range(value: usize) { + const MAX_RESULT: u32 = usize::MAX.ilog10(); + + // CHECK-LABEL: @usize_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value == 0 || value.ilog10() <= MAX_RESULT); + assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT)); +} + +// Signed non-zero integers do not have `ilog10` methods. + +// Unsigned non-zero integers. + +#[no_mangle] +fn non_zero_u8_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_u8_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { u8::MAX.ilog10() }); +} + +#[no_mangle] +fn non_zero_u16_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_u16_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { u16::MAX.ilog10() }); +} + +#[no_mangle] +fn non_zero_u32_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_u32_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { u32::MAX.ilog10() }); +} + +#[no_mangle] +fn non_zero_u64_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_u64_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { u64::MAX.ilog10() }); +} + +#[no_mangle] +fn non_zero_u128_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_u128_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { u128::MAX.ilog10() }); +} + +#[no_mangle] +fn non_zero_usize_ilog10_range(value: NonZero) { + // CHECK-LABEL: @non_zero_usize_ilog10_range( + // CHECK-NOT: panic + // CHECK: ret void + // CHECK-NEXT: } + assert!(value.ilog10() <= const { usize::MAX.ilog10() }); +} diff --git a/tests/ui/associated-types/associated-type-where-non-lifetime-const.rs b/tests/ui/associated-types/associated-type-where-non-lifetime-const.rs new file mode 100644 index 0000000000000..31bf139e39cdc --- /dev/null +++ b/tests/ui/associated-types/associated-type-where-non-lifetime-const.rs @@ -0,0 +1,13 @@ +//! regression test for #148627 + +#![feature(associated_type_defaults)] + +trait Trait { + type Assoc2 + = () + where + for [(); C]: Copy; + //~^ ERROR: only lifetime parameters can be used in this context +} + +fn main() {} diff --git a/tests/ui/associated-types/associated-type-where-non-lifetime-const.stderr b/tests/ui/associated-types/associated-type-where-non-lifetime-const.stderr new file mode 100644 index 0000000000000..bd1d6e13893ae --- /dev/null +++ b/tests/ui/associated-types/associated-type-where-non-lifetime-const.stderr @@ -0,0 +1,13 @@ +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/associated-type-where-non-lifetime-const.rs:9:19 + | +LL | for [(); C]: Copy; + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/associated-types/associated-type-where-non-lifetime-type.rs b/tests/ui/associated-types/associated-type-where-non-lifetime-type.rs new file mode 100644 index 0000000000000..d4624619e6d88 --- /dev/null +++ b/tests/ui/associated-types/associated-type-where-non-lifetime-type.rs @@ -0,0 +1,18 @@ +//! regression test for #149233 + +trait Foo { + type Bar<'a> + where + Self: Sized; + fn test(&self); +} +impl Foo for () { + type Bar<'a> + = () + where + for T:; + //~^ ERROR: only lifetime parameters can be used in this context + fn test(&self) {} +} + +fn main() {} diff --git a/tests/ui/associated-types/associated-type-where-non-lifetime-type.stderr b/tests/ui/associated-types/associated-type-where-non-lifetime-type.stderr new file mode 100644 index 0000000000000..a8a71b929d952 --- /dev/null +++ b/tests/ui/associated-types/associated-type-where-non-lifetime-type.stderr @@ -0,0 +1,13 @@ +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/associated-type-where-non-lifetime-type.rs:13:13 + | +LL | for T:; + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/closures/simple-capture-and-call.rs b/tests/ui/closures/simple-capture-and-call.rs new file mode 100644 index 0000000000000..112324eb72045 --- /dev/null +++ b/tests/ui/closures/simple-capture-and-call.rs @@ -0,0 +1,8 @@ +//! regression test for issue #1895 +//@ run-pass + +fn main() { + let x = 1_usize; + let y = || x; + let _z = y(); +} diff --git a/tests/ui/contracts/associated-item.rs b/tests/ui/contracts/associated-item.rs index 4a2d05abbc53c..86ff05f6c0f4f 100644 --- a/tests/ui/contracts/associated-item.rs +++ b/tests/ui/contracts/associated-item.rs @@ -3,8 +3,8 @@ //@ compile-flags: --crate-type=lib //@ check-pass +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use extern crate core; diff --git a/tests/ui/contracts/async-fn-contract-ice-145333.rs b/tests/ui/contracts/async-fn-contract-ice-145333.rs index a6de8a786af96..e9e2877cd2de2 100644 --- a/tests/ui/contracts/async-fn-contract-ice-145333.rs +++ b/tests/ui/contracts/async-fn-contract-ice-145333.rs @@ -1,7 +1,7 @@ //@ compile-flags: --crate-type=lib //@ edition: 2021 +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete #[core::contracts::ensures(|ret| *ret)] //~^ ERROR contract annotations are not yet supported on async or gen functions diff --git a/tests/ui/contracts/async-fn-contract-ice-145333.stderr b/tests/ui/contracts/async-fn-contract-ice-145333.stderr index 77f5379e6fb54..031cff5cad1b0 100644 --- a/tests/ui/contracts/async-fn-contract-ice-145333.stderr +++ b/tests/ui/contracts/async-fn-contract-ice-145333.stderr @@ -4,14 +4,5 @@ error: contract annotations are not yet supported on async or gen functions LL | #[core::contracts::ensures(|ret| *ret)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/async-fn-contract-ice-145333.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/contracts/contract-annotation-limitations.rs b/tests/ui/contracts/contract-annotation-limitations.rs index 10b3bacab5cfa..0ecc1d15aa7b4 100644 --- a/tests/ui/contracts/contract-annotation-limitations.rs +++ b/tests/ui/contracts/contract-annotation-limitations.rs @@ -1,8 +1,8 @@ //! Test for some of the existing limitations and the current error messages. //! Some of these limitations may be removed in the future. +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![allow(dead_code)] /// Represent a 5-star system. diff --git a/tests/ui/contracts/contract-annotation-limitations.stderr b/tests/ui/contracts/contract-annotation-limitations.stderr index 14338cf4b8687..c0dc37fee4c4e 100644 --- a/tests/ui/contracts/contract-annotation-limitations.stderr +++ b/tests/ui/contracts/contract-annotation-limitations.stderr @@ -10,14 +10,5 @@ error: contract annotations is only supported in functions with bodies LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-annotation-limitations.rs:4:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr b/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr deleted file mode 100644 index 0630811d4f7ea..0000000000000 --- a/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-generics.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr deleted file mode 100644 index 0630811d4f7ea..0000000000000 --- a/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-generics.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr deleted file mode 100644 index 0630811d4f7ea..0000000000000 --- a/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-generics.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr deleted file mode 100644 index 0630811d4f7ea..0000000000000 --- a/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-generics.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-generics.rs b/tests/ui/contracts/contract-attributes-generics.rs index 3763ce116f844..6fd4c0a9790b2 100644 --- a/tests/ui/contracts/contract-attributes-generics.rs +++ b/tests/ui/contracts/contract-attributes-generics.rs @@ -16,8 +16,8 @@ //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes //@ [chk_const_fail] compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] use std::ops::Sub; diff --git a/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr deleted file mode 100644 index 0630811d4f7ea..0000000000000 --- a/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-generics.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.rs b/tests/ui/contracts/contract-attributes-nest.rs index d367687b84e31..89bd0a2b1136a 100644 --- a/tests/ui/contracts/contract-attributes-nest.rs +++ b/tests/ui/contracts/contract-attributes-nest.rs @@ -16,8 +16,8 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::requires(x.baz > 0)] #[core::contracts::ensures(|ret| *ret > 100)] diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr deleted file mode 100644 index 9ca95b8bb01a4..0000000000000 --- a/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-nest.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.rs b/tests/ui/contracts/contract-attributes-tail.rs index 43edfe5e803fe..361725474099e 100644 --- a/tests/ui/contracts/contract-attributes-tail.rs +++ b/tests/ui/contracts/contract-attributes-tail.rs @@ -16,8 +16,8 @@ //@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes //@ [chk_fail_post] compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::requires(x.baz > 0)] #[core::contracts::ensures(|ret| *ret > 100)] diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr deleted file mode 100644 index f87e7e19fa3db..0000000000000 --- a/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-attributes-tail.rs:19:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.rs b/tests/ui/contracts/contract-captures-via-closure-copy.rs index bc7e5b9b6f101..a5453503b4bd1 100644 --- a/tests/ui/contracts/contract-captures-via-closure-copy.rs +++ b/tests/ui/contracts/contract-captures-via-closure-copy.rs @@ -1,8 +1,8 @@ //@ run-crash //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Baz { baz: i32 diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.stderr b/tests/ui/contracts/contract-captures-via-closure-copy.stderr deleted file mode 100644 index d92db601608f5..0000000000000 --- a/tests/ui/contracts/contract-captures-via-closure-copy.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-captures-via-closure-copy.rs:4:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.rs b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs index 1ec2feb045a33..c7aa72d2b0f67 100644 --- a/tests/ui/contracts/contract-captures-via-closure-noncopy.rs +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs @@ -1,8 +1,8 @@ //@ edition:2015..2021 //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Baz { baz: i32 diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr index 29adeaec3e167..5f55faed80c89 100644 --- a/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr @@ -1,12 +1,3 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-captures-via-closure-noncopy.rs:4:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:13:42: 13:57}` --> $DIR/contract-captures-via-closure-noncopy.rs:13:1 | @@ -32,6 +23,6 @@ LL + #[derive(Copy)] LL | struct Baz { | -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/contracts/contract-const-fn.all_pass.stderr b/tests/ui/contracts/contract-const-fn.all_pass.stderr deleted file mode 100644 index e5b1df6558235..0000000000000 --- a/tests/ui/contracts/contract-const-fn.all_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-const-fn.rs:17:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-const-fn.rs b/tests/ui/contracts/contract-const-fn.rs index fe8dd37b1f52d..c79ab33e8ec85 100644 --- a/tests/ui/contracts/contract-const-fn.rs +++ b/tests/ui/contracts/contract-const-fn.rs @@ -14,8 +14,8 @@ //@ [all_pass] compile-flags: -Zcontract-checks=yes //@ [runtime_fail_pre] compile-flags: -Zcontract-checks=yes //@ [runtime_fail_post] compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::*; diff --git a/tests/ui/contracts/contract-const-fn.runtime_fail_post.stderr b/tests/ui/contracts/contract-const-fn.runtime_fail_post.stderr deleted file mode 100644 index e5b1df6558235..0000000000000 --- a/tests/ui/contracts/contract-const-fn.runtime_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-const-fn.rs:17:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contract-const-fn.runtime_fail_pre.stderr b/tests/ui/contracts/contract-const-fn.runtime_fail_pre.stderr deleted file mode 100644 index e5b1df6558235..0000000000000 --- a/tests/ui/contracts/contract-const-fn.runtime_fail_pre.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-const-fn.rs:17:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-disabled-side-effect-declarations.rs b/tests/ui/contracts/contracts-disabled-side-effect-declarations.rs index fc07729e9132b..4b2d4a80237fe 100644 --- a/tests/ui/contracts/contracts-disabled-side-effect-declarations.rs +++ b/tests/ui/contracts/contracts-disabled-side-effect-declarations.rs @@ -1,6 +1,6 @@ //@ run-pass +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::requires; diff --git a/tests/ui/contracts/contracts-disabled-side-effect-declarations.stderr b/tests/ui/contracts/contracts-disabled-side-effect-declarations.stderr deleted file mode 100644 index 4c8a125384334..0000000000000 --- a/tests/ui/contracts/contracts-disabled-side-effect-declarations.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-disabled-side-effect-declarations.rs:2:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-disabled-side-effect-ensures.rs b/tests/ui/contracts/contracts-disabled-side-effect-ensures.rs index a3a77b0de9a2b..1488b8f8d3fd5 100644 --- a/tests/ui/contracts/contracts-disabled-side-effect-ensures.rs +++ b/tests/ui/contracts/contracts-disabled-side-effect-ensures.rs @@ -1,6 +1,6 @@ //@ run-pass +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::ensures; diff --git a/tests/ui/contracts/contracts-disabled-side-effect-ensures.stderr b/tests/ui/contracts/contracts-disabled-side-effect-ensures.stderr deleted file mode 100644 index dd9ebe9bd3556..0000000000000 --- a/tests/ui/contracts/contracts-disabled-side-effect-ensures.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-disabled-side-effect-ensures.rs:2:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr deleted file mode 100644 index d693fad446a4d..0000000000000 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr deleted file mode 100644 index d693fad446a4d..0000000000000 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr deleted file mode 100644 index d693fad446a4d..0000000000000 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr deleted file mode 100644 index d693fad446a4d..0000000000000 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.rs b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs index 44ae07d8c95c0..71c69fa83ccb2 100644 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.rs +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs @@ -13,8 +13,8 @@ //@ [chk_fail_yeet] compile-flags: -Zcontract-checks=yes //! This test ensures that ensures clauses are checked for different return points of a function. +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![feature(yeet_expr)] /// This ensures will fail in different return points depending on the input. diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr deleted file mode 100644 index d693fad446a4d..0000000000000 --- a/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs index f01a852fbff34..0fc9e5590f02a 100644 --- a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs @@ -1,7 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #[core::contracts::ensures(|ret| *ret > 0)] fn outer() -> i32 { diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr deleted file mode 100644 index 49a372b53c7d8..0000000000000 --- a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-ensures-is-not-inherited-when-nesting.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs index 2c2a4a6978550..3ac539adb247c 100644 --- a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs +++ b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs @@ -1,7 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] struct Outer { outer: std::cell::Cell } diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr deleted file mode 100644 index 48898c4434ad5..0000000000000 --- a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contracts-requires-is-not-inherited-when-nesting.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/declared-vars-referring-to-params.rs b/tests/ui/contracts/declared-vars-referring-to-params.rs index 52885da048e20..d915dc09cfe20 100644 --- a/tests/ui/contracts/declared-vars-referring-to-params.rs +++ b/tests/ui/contracts/declared-vars-referring-to-params.rs @@ -1,7 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::{ensures, requires}; diff --git a/tests/ui/contracts/declared-vars-referring-to-params.stderr b/tests/ui/contracts/declared-vars-referring-to-params.stderr deleted file mode 100644 index 0ad9064e8606b..0000000000000 --- a/tests/ui/contracts/declared-vars-referring-to-params.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/declared-vars-referring-to-params.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/declared-vars-used-in-ensures.rs b/tests/ui/contracts/declared-vars-used-in-ensures.rs index 9703709e2b8e0..ddab57483668b 100644 --- a/tests/ui/contracts/declared-vars-used-in-ensures.rs +++ b/tests/ui/contracts/declared-vars-used-in-ensures.rs @@ -1,7 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::{ensures, requires}; diff --git a/tests/ui/contracts/declared-vars-used-in-ensures.stderr b/tests/ui/contracts/declared-vars-used-in-ensures.stderr deleted file mode 100644 index 000a1b239932c..0000000000000 --- a/tests/ui/contracts/declared-vars-used-in-ensures.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/declared-vars-used-in-ensures.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.rs b/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.rs index e066a95314a98..6b7896101ca04 100644 --- a/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.rs +++ b/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.rs @@ -1,7 +1,7 @@ //@ run-pass //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::{ensures, requires}; diff --git a/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.stderr b/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.stderr deleted file mode 100644 index 52b163553fba9..0000000000000 --- a/tests/ui/contracts/declared-vars-used-in-requires-and-ensures.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/declared-vars-used-in-requires-and-ensures.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs index 69be906782a67..fecac593f0e5a 100644 --- a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs @@ -1,7 +1,7 @@ //! Checks for compilation errors related to adding contracts to non-function items. +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![allow(dead_code)] #[core::contracts::requires(true)] diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr index 0a7fff8183e09..864e94997a2e3 100644 --- a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr @@ -40,14 +40,5 @@ error: contract annotations can only be used on functions LL | #[core::contracts::requires(true)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/disallow-contract-annotation-on-non-fn.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 7 previous errors; 1 warning emitted +error: aborting due to 7 previous errors diff --git a/tests/ui/contracts/empty-ensures.rs b/tests/ui/contracts/empty-ensures.rs index d897f27bf6c94..0a52391117861 100644 --- a/tests/ui/contracts/empty-ensures.rs +++ b/tests/ui/contracts/empty-ensures.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::ensures; diff --git a/tests/ui/contracts/empty-ensures.stderr b/tests/ui/contracts/empty-ensures.stderr index 407a253bd8565..6a19d234b52c2 100644 --- a/tests/ui/contracts/empty-ensures.stderr +++ b/tests/ui/contracts/empty-ensures.stderr @@ -1,12 +1,3 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/empty-ensures.rs:2:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: expected a `Fn(&_)` closure, found `()` --> $DIR/empty-ensures.rs:8:1 | @@ -20,6 +11,6 @@ LL | #[ensures()] note: required by a bound in `build_check_ensures` --> $SRC_DIR/core/src/contracts.rs:LL:COL -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/contracts/empty-requires.rs b/tests/ui/contracts/empty-requires.rs index e3c72dcd66a17..dedcc10d52cb0 100644 --- a/tests/ui/contracts/empty-requires.rs +++ b/tests/ui/contracts/empty-requires.rs @@ -1,7 +1,7 @@ //@ dont-require-annotations: NOTE //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::requires; diff --git a/tests/ui/contracts/empty-requires.stderr b/tests/ui/contracts/empty-requires.stderr index b48e547b8cda7..702b8a23c55e3 100644 --- a/tests/ui/contracts/empty-requires.stderr +++ b/tests/ui/contracts/empty-requires.stderr @@ -1,18 +1,9 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/empty-requires.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types --> $DIR/empty-requires.rs:9:1 | LL | #[requires()] | ^^^^^^^^^^^^^ expected `bool`, found `()` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/contracts/incomplete-feature.rs b/tests/ui/contracts/incomplete-feature.rs new file mode 100644 index 0000000000000..f1351e2f87e34 --- /dev/null +++ b/tests/ui/contracts/incomplete-feature.rs @@ -0,0 +1,17 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes + +// This test specifically checks that the [incomplete_features] warning is +// emitted when the `contracts` feature gate is enabled, so that it can be +// marked as `expect`ed in other tests in order to reduce duplication. +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +extern crate core; +use core::contracts::requires; + +#[requires(true)] +fn foo() {} + +fn main() { + foo() +} diff --git a/tests/ui/contracts/associated-item.stderr b/tests/ui/contracts/incomplete-feature.stderr similarity index 90% rename from tests/ui/contracts/associated-item.stderr rename to tests/ui/contracts/incomplete-feature.stderr index 20651026b87a2..7683926df073a 100644 --- a/tests/ui/contracts/associated-item.stderr +++ b/tests/ui/contracts/incomplete-feature.stderr @@ -1,5 +1,5 @@ warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/associated-item.rs:6:12 + --> $DIR/incomplete-feature.rs:7:12 | LL | #![feature(contracts)] | ^^^^^^^^^ diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr deleted file mode 100644 index acce6b1fbc729..0000000000000 --- a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-lang-items.rs:8:12 - | -LL | #![feature(contracts)] // to access core::contracts - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr deleted file mode 100644 index acce6b1fbc729..0000000000000 --- a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-lang-items.rs:8:12 - | -LL | #![feature(contracts)] // to access core::contracts - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.rs b/tests/ui/contracts/internal_machinery/contract-lang-items.rs index ad88ebfe22e3b..d675601036447 100644 --- a/tests/ui/contracts/internal_machinery/contract-lang-items.rs +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.rs @@ -5,8 +5,8 @@ // //@ [chk_fail_post] run-crash +#![expect(incomplete_features)] #![feature(contracts)] // to access core::contracts -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] #![feature(contracts_internals)] // to access check_requires lang item #![feature(core_intrinsics)] fn foo(x: Baz) -> i32 { diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr deleted file mode 100644 index acce6b1fbc729..0000000000000 --- a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/contract-lang-items.rs:8:12 - | -LL | #![feature(contracts)] // to access core::contracts - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/internal_machinery/lowering/basics.rs b/tests/ui/contracts/internal_machinery/lowering/basics.rs index 9160517a79322..7b3a769af8258 100644 --- a/tests/ui/contracts/internal_machinery/lowering/basics.rs +++ b/tests/ui/contracts/internal_machinery/lowering/basics.rs @@ -1,6 +1,6 @@ //@ run-pass +#![expect(incomplete_features)] #![feature(contracts, cfg_contract_checks, contracts_internals, core_intrinsics)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; diff --git a/tests/ui/contracts/internal_machinery/lowering/basics.stderr b/tests/ui/contracts/internal_machinery/lowering/basics.stderr deleted file mode 100644 index 118229694a906..0000000000000 --- a/tests/ui/contracts/internal_machinery/lowering/basics.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basics.rs:2:12 - | -LL | #![feature(contracts, cfg_contract_checks, contracts_internals, core_intrinsics)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/contracts/requires-block-stmt.rs b/tests/ui/contracts/requires-block-stmt.rs new file mode 100644 index 0000000000000..0f0801bb65f5b --- /dev/null +++ b/tests/ui/contracts/requires-block-stmt.rs @@ -0,0 +1,22 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes + +#![expect(incomplete_features)] +#![feature(contracts)] +extern crate core; +use core::contracts::requires; + +// Compound statements (those using [ExpressionWithBlock] +// (https://doc.rust-lang.org/beta/reference/expressions.html#railroad-ExpressionWithBlock)) +// like blocks, if-expressions, and loops require no trailing semicolon. This +// regression test captures the case where the last statement in the contract +// declarations has no trailing semicolon. +#[requires( + {} + true +)] +fn foo() {} + +fn main() { + foo() +} diff --git a/tests/ui/contracts/requires-bool-expr-with-semicolon.rs b/tests/ui/contracts/requires-bool-expr-with-semicolon.rs index d0b3ed661ed69..3a1a6549a343a 100644 --- a/tests/ui/contracts/requires-bool-expr-with-semicolon.rs +++ b/tests/ui/contracts/requires-bool-expr-with-semicolon.rs @@ -1,7 +1,7 @@ //@ dont-require-annotations: NOTE //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::requires; diff --git a/tests/ui/contracts/requires-bool-expr-with-semicolon.stderr b/tests/ui/contracts/requires-bool-expr-with-semicolon.stderr index fd38fa4edcf51..559c710b14566 100644 --- a/tests/ui/contracts/requires-bool-expr-with-semicolon.stderr +++ b/tests/ui/contracts/requires-bool-expr-with-semicolon.stderr @@ -1,18 +1,9 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/requires-bool-expr-with-semicolon.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types --> $DIR/requires-bool-expr-with-semicolon.rs:9:1 | LL | #[requires(true;)] | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/contracts/requires-no-final-expression.rs b/tests/ui/contracts/requires-no-final-expression.rs index 474b29d63ba61..0188a9f607a35 100644 --- a/tests/ui/contracts/requires-no-final-expression.rs +++ b/tests/ui/contracts/requires-no-final-expression.rs @@ -1,7 +1,7 @@ //@ dont-require-annotations: NOTE //@ compile-flags: -Zcontract-checks=yes +#![expect(incomplete_features)] #![feature(contracts)] -//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] extern crate core; use core::contracts::requires; diff --git a/tests/ui/contracts/requires-no-final-expression.stderr b/tests/ui/contracts/requires-no-final-expression.stderr index 0db1648573945..ae71ee3c996c2 100644 --- a/tests/ui/contracts/requires-no-final-expression.stderr +++ b/tests/ui/contracts/requires-no-final-expression.stderr @@ -1,18 +1,9 @@ -warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/requires-no-final-expression.rs:3:12 - | -LL | #![feature(contracts)] - | ^^^^^^^^^ - | - = note: see issue #128044 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types --> $DIR/requires-no-final-expression.rs:9:1 | LL | #[requires(let y = 1;)] | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-2642.rs b/tests/ui/for-loop-while/nested-loop-break-unit.rs similarity index 75% rename from tests/ui/issues/issue-2642.rs rename to tests/ui/for-loop-while/nested-loop-break-unit.rs index ad5721495090f..b31d9ee8f50db 100644 --- a/tests/ui/issues/issue-2642.rs +++ b/tests/ui/for-loop-while/nested-loop-break-unit.rs @@ -1,3 +1,4 @@ +//! regression test for issue #2642 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-47673.rs b/tests/ui/imports/duplicate-empty-imports.rs similarity index 65% rename from tests/ui/issues/issue-47673.rs rename to tests/ui/imports/duplicate-empty-imports.rs index d395ac677e751..7768dcfbbdac4 100644 --- a/tests/ui/issues/issue-47673.rs +++ b/tests/ui/imports/duplicate-empty-imports.rs @@ -1,3 +1,4 @@ +//! regression test for issue #47673 //@ check-pass #![allow(unused_imports)] diff --git a/tests/ui/issues/issue-22468.rs b/tests/ui/issues/issue-22468.rs deleted file mode 100644 index 197a19c038c4b..0000000000000 --- a/tests/ui/issues/issue-22468.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let foo = "bar"; - let x = foo("baz"); - //~^ ERROR: expected function, found `&str` -} - -fn foo(file: &str) -> bool { - true -} diff --git a/tests/ui/issues/issue-22468.stderr b/tests/ui/issues/issue-22468.stderr deleted file mode 100644 index 052888d2029b9..0000000000000 --- a/tests/ui/issues/issue-22468.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0618]: expected function, found `&str` - --> $DIR/issue-22468.rs:3:13 - | -LL | let foo = "bar"; - | --- `foo` has type `&str` -LL | let x = foo("baz"); - | ^^^------- - | | - | call expression requires function -... -LL | fn foo(file: &str) -> bool { - | -------------------------- this function of the same name is available here, but it's shadowed by the local binding - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-3429.rs b/tests/ui/issues/issue-3429.rs deleted file mode 100644 index 39d657573db76..0000000000000 --- a/tests/ui/issues/issue-3429.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass - -pub fn main() { - let x = 1_usize; - let y = || x; - let _z = y(); -} diff --git a/tests/ui/issues/issue-3993.rs b/tests/ui/issues/issue-3993.rs deleted file mode 100644 index 9dea54ea779e1..0000000000000 --- a/tests/ui/issues/issue-3993.rs +++ /dev/null @@ -1,10 +0,0 @@ -use zoo::fly; //~ ERROR: function `fly` is private - -mod zoo { - fn fly() {} -} - - -fn main() { - fly(); -} diff --git a/tests/ui/issues/issue-3993.stderr b/tests/ui/issues/issue-3993.stderr deleted file mode 100644 index cf839a1314065..0000000000000 --- a/tests/ui/issues/issue-3993.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0603]: function `fly` is private - --> $DIR/issue-3993.rs:1:10 - | -LL | use zoo::fly; - | ^^^ private function - | -note: the function `fly` is defined here - --> $DIR/issue-3993.rs:4:5 - | -LL | fn fly() {} - | ^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-47380.rs b/tests/ui/issues/issue-47380.rs deleted file mode 100644 index 61e096622252b..0000000000000 --- a/tests/ui/issues/issue-47380.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let b = "hello"; - println!("๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€"); let _a = b + ", World!"; - //~^ ERROR E0369 -} diff --git a/tests/ui/issues/issue-47380.stderr b/tests/ui/issues/issue-47380.stderr deleted file mode 100644 index 4fca0296e437a..0000000000000 --- a/tests/ui/issues/issue-47380.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47380.rs:3:35 - | -LL | println!("๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€"); let _a = b + ", World!"; - | - ^ ---------- &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | println!("๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€"); let _a = b.to_owned() + ", World!"; - | +++++++++++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-3500.rs b/tests/ui/match/match-ref-option-pattern.rs similarity index 76% rename from tests/ui/issues/issue-3500.rs rename to tests/ui/match/match-ref-option-pattern.rs index 0860d0f592600..a6de2361503a8 100644 --- a/tests/ui/issues/issue-3500.rs +++ b/tests/ui/match/match-ref-option-pattern.rs @@ -1,3 +1,4 @@ +//! regression test for issue #3500 //@ run-pass pub fn main() { diff --git a/tests/ui/issues/issue-72933-match-stack-overflow.rs b/tests/ui/match/match-stack-overflow-72933-.rs similarity index 99% rename from tests/ui/issues/issue-72933-match-stack-overflow.rs rename to tests/ui/match/match-stack-overflow-72933-.rs index 6d091a9108192..0883278be8391 100644 --- a/tests/ui/issues/issue-72933-match-stack-overflow.rs +++ b/tests/ui/match/match-stack-overflow-72933-.rs @@ -1,6 +1,7 @@ +//! regression test for issue #72933 //@ build-pass // ignore-tidy-filelength -#![crate_type="rlib"] +#![crate_type = "rlib"] fn banana(v: &str) -> u32 { match v { diff --git a/tests/ui/privacy/private-item-simple.rs b/tests/ui/privacy/private-item-simple.rs index 1f718ed9201a6..68b20991a6262 100644 --- a/tests/ui/privacy/private-item-simple.rs +++ b/tests/ui/privacy/private-item-simple.rs @@ -1,3 +1,5 @@ +//! regression test for issue #3993 + mod a { fn f() {} } @@ -5,3 +7,7 @@ mod a { fn main() { a::f(); //~ ERROR function `f` is private } + +fn foo() { + use a::f; //~ ERROR function `f` is private +} diff --git a/tests/ui/privacy/private-item-simple.stderr b/tests/ui/privacy/private-item-simple.stderr index 330d892e939d0..95165857940e3 100644 --- a/tests/ui/privacy/private-item-simple.stderr +++ b/tests/ui/privacy/private-item-simple.stderr @@ -1,15 +1,27 @@ error[E0603]: function `f` is private - --> $DIR/private-item-simple.rs:6:8 + --> $DIR/private-item-simple.rs:12:12 + | +LL | use a::f; + | ^ private function + | +note: the function `f` is defined here + --> $DIR/private-item-simple.rs:4:5 + | +LL | fn f() {} + | ^^^^^^ + +error[E0603]: function `f` is private + --> $DIR/private-item-simple.rs:8:8 | LL | a::f(); | ^ private function | note: the function `f` is defined here - --> $DIR/private-item-simple.rs:2:5 + --> $DIR/private-item-simple.rs:4:5 | LL | fn f() {} | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-47377.rs b/tests/ui/str/str-add-operator.rs similarity index 68% rename from tests/ui/issues/issue-47377.rs rename to tests/ui/str/str-add-operator.rs index 7a2e0fe6d21df..9c489f2091f8b 100644 --- a/tests/ui/issues/issue-47377.rs +++ b/tests/ui/str/str-add-operator.rs @@ -1,3 +1,4 @@ +//! regression test for issue #47377, #47380 // ignore-tidy-tab fn main() { let b = "hello"; diff --git a/tests/ui/issues/issue-47377.stderr b/tests/ui/str/str-add-operator.stderr similarity index 94% rename from tests/ui/issues/issue-47377.stderr rename to tests/ui/str/str-add-operator.stderr index 12e5c15d77fc8..2354819d7fa1e 100644 --- a/tests/ui/issues/issue-47377.stderr +++ b/tests/ui/str/str-add-operator.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47377.rs:4:14 + --> $DIR/str-add-operator.rs:5:14 | LL | let _a = b + ", World!"; | - ^ ---------- &str diff --git a/tests/ui/issues/issue-51044.rs b/tests/ui/traits/normalize-associated-type-in-where-clause.rs similarity index 55% rename from tests/ui/issues/issue-51044.rs rename to tests/ui/traits/normalize-associated-type-in-where-clause.rs index d7761b50b4c4b..25ca4a41aa85d 100644 --- a/tests/ui/issues/issue-51044.rs +++ b/tests/ui/traits/normalize-associated-type-in-where-clause.rs @@ -1,30 +1,30 @@ //@ run-pass -// regression test for issue #50825 -// Check that the feature gate normalizes associated types. +//! regression test for issue #50825, #51044 +//! Check that the feature gate normalizes associated types. #![allow(dead_code)] struct Foo(T); struct Duck; struct Quack; -trait Hello where A: Animal { +trait Hello +where + A: Animal, +{ } trait Animal { type Noise; } -trait Loud { -} +trait Loud {} -impl Loud for f32 { -} +impl Loud for f32 {} impl Animal for Duck { type Noise = Quack; } -impl Hello for Foo where f32: Loud<::Noise> { -} +impl Hello for Foo where f32: Loud<::Noise> {} fn main() {} diff --git a/tests/ui/issues/issue-2151.rs b/tests/ui/type/never-type-inference-fail.rs similarity index 69% rename from tests/ui/issues/issue-2151.rs rename to tests/ui/type/never-type-inference-fail.rs index 82cf49de8227e..76ee3c5f5d566 100644 --- a/tests/ui/issues/issue-2151.rs +++ b/tests/ui/type/never-type-inference-fail.rs @@ -1,3 +1,5 @@ +//! regression test for issue #2151 + fn main() { let x = panic!(); //~ ERROR type annotations needed x.clone(); diff --git a/tests/ui/issues/issue-2151.stderr b/tests/ui/type/never-type-inference-fail.stderr similarity index 89% rename from tests/ui/issues/issue-2151.stderr rename to tests/ui/type/never-type-inference-fail.stderr index b130f162414d0..1d2457103f1ca 100644 --- a/tests/ui/issues/issue-2151.stderr +++ b/tests/ui/type/never-type-inference-fail.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-2151.rs:2:9 + --> $DIR/never-type-inference-fail.rs:4:9 | LL | let x = panic!(); | ^ diff --git a/tests/ui/typeck/issue-10969.rs b/tests/ui/typeck/issue-10969.rs deleted file mode 100644 index 0b78fc1bb7fa2..0000000000000 --- a/tests/ui/typeck/issue-10969.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn func(i: i32) { - i(); //~ERROR expected function, found `i32` -} -fn main() { - let i = 0i32; - i(); //~ERROR expected function, found `i32` -} diff --git a/tests/ui/typeck/issue-10969.stderr b/tests/ui/typeck/issue-10969.stderr deleted file mode 100644 index f64b61aaeb05c..0000000000000 --- a/tests/ui/typeck/issue-10969.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:2:5 - | -LL | fn func(i: i32) { - | - `i` has type `i32` -LL | i(); - | ^-- - | | - | call expression requires function - -error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:6:5 - | -LL | let i = 0i32; - | - `i` has type `i32` -LL | i(); - | ^-- - | | - | call expression requires function - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/typeck/non-function-call-error.rs b/tests/ui/typeck/non-function-call-error.rs new file mode 100644 index 0000000000000..c61cf93d138a8 --- /dev/null +++ b/tests/ui/typeck/non-function-call-error.rs @@ -0,0 +1,19 @@ +//! Regression test for issue #10969, #22468 + +fn main() { + let foo = "bar"; + let x = foo("baz"); + //~^ ERROR: expected function, found `&str` + + let i = 0i32; + i(); + //~^ ERROR expected function, found `i32` +} + +fn foo(file: &str) -> bool { + true +} + +fn func(i: i32) { + i(); //~ERROR expected function, found `i32` +} diff --git a/tests/ui/typeck/non-function-call-error.stderr b/tests/ui/typeck/non-function-call-error.stderr new file mode 100644 index 0000000000000..f4797ac3d8b7b --- /dev/null +++ b/tests/ui/typeck/non-function-call-error.stderr @@ -0,0 +1,36 @@ +error[E0618]: expected function, found `&str` + --> $DIR/non-function-call-error.rs:5:13 + | +LL | let foo = "bar"; + | --- `foo` has type `&str` +LL | let x = foo("baz"); + | ^^^------- + | | + | call expression requires function +... +LL | fn foo(file: &str) -> bool { + | -------------------------- this function of the same name is available here, but it's shadowed by the local binding + +error[E0618]: expected function, found `i32` + --> $DIR/non-function-call-error.rs:9:5 + | +LL | let i = 0i32; + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error[E0618]: expected function, found `i32` + --> $DIR/non-function-call-error.rs:18:5 + | +LL | fn func(i: i32) { + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0618`.