diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl index e3aae9739a23..6c23320a1b11 100644 --- a/compiler/rustc_expand/messages.ftl +++ b/compiler/rustc_expand/messages.ftl @@ -49,6 +49,9 @@ expand_feature_removed = .note = removed in {$removed_rustc_version}{$pull_note} .reason = {$reason} +expand_file_modules_in_proc_macro_input_are_unstable = + file modules in proc macro input are unstable + expand_glob_delegation_outside_impls = glob delegation is only supported in impls @@ -158,9 +161,6 @@ expand_mve_unrecognized_expr = expand_mve_unrecognized_var = variable `{$key}` is not recognized in meta-variable expression -expand_non_inline_modules_in_proc_macro_input_are_unstable = - non-inline modules in proc macro input are unstable - expand_or_patterns_back_compat = the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro .suggestion = use pat_param to preserve semantics diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 8031e11afc75..276490bc0c9d 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -1050,7 +1050,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.sess, sym::proc_macro_hygiene, item.span, - fluent_generated::expand_non_inline_modules_in_proc_macro_input_are_unstable, + fluent_generated::expand_file_modules_in_proc_macro_input_are_unstable, ) .emit(); } diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 6167b0d63a9a..d9bcd5e3481f 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -152,7 +152,10 @@ declare_lint_pass!(NonShorthandFieldPatterns => [NON_SHORTHAND_FIELD_PATTERNS]); impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns { fn check_pat(&mut self, cx: &LateContext<'_>, pat: &hir::Pat<'_>) { - if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind { + // The result shouldn't be tainted, otherwise it will cause ICE. + if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind + && cx.typeck_results().tainted_by_errors.is_none() + { let variant = cx .typeck_results() .pat_ty(pat) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 151ec4c75618..588ff68ba572 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1202,10 +1202,10 @@ rustc_queries! { /// Return the live symbols in the crate for dead code check. /// /// The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone). - query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx ( + query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx Result<( LocalDefIdSet, LocalDefIdMap>, - ) { + ), ErrorGuaranteed> { arena_cache desc { "finding live symbols in crate" } } diff --git a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs index 82c769eb3d58..c3028b9b5c4e 100644 --- a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs +++ b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs @@ -43,13 +43,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ) { let tcx = self.tcx; let (min_length, exact_size) = if let Some(place_resolved) = place.try_to_place(self) { - match place_resolved.ty(&self.local_decls, tcx).ty.kind() { - ty::Array(_, length) => ( - length - .try_to_target_usize(tcx) - .expect("expected len of array pat to be definite"), - true, - ), + let place_ty = place_resolved.ty(&self.local_decls, tcx).ty; + match place_ty.kind() { + ty::Array(_, length) => { + if let Some(length) = length.try_to_target_usize(tcx) { + (length, true) + } else { + // This can happen when the array length is a generic const + // expression that couldn't be evaluated (e.g., due to an error). + // Since there's already a compilation error, we use a fallback + // to avoid an ICE. + tcx.dcx().span_delayed_bug( + tcx.def_span(self.def_id), + "array length in pattern couldn't be evaluated", + ); + ((prefix.len() + suffix.len()).try_into().unwrap(), false) + } + } _ => ((prefix.len() + suffix.len()).try_into().unwrap(), false), } } else { diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 49dd21f537cf..877b5ad93bfc 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -4,11 +4,12 @@ // is dead. use std::mem; +use std::ops::ControlFlow; use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; use rustc_abi::FieldIdx; use rustc_data_structures::fx::FxIndexSet; -use rustc_errors::MultiSpan; +use rustc_errors::{ErrorGuaranteed, MultiSpan}; use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; use rustc_hir::intravisit::{self, Visitor}; @@ -178,12 +179,12 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { .iter() .any(|adj| matches!(adj.kind, ty::adjustment::Adjust::Deref(_))) { - self.visit_expr(expr); + let _ = self.visit_expr(expr); } else if let hir::ExprKind::Field(base, ..) = expr.kind { // Ignore write to field self.handle_assign(base); } else { - self.visit_expr(expr); + let _ = self.visit_expr(expr); } } @@ -318,7 +319,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { } } - fn mark_live_symbols(&mut self) { + fn mark_live_symbols(&mut self) -> as Visitor<'tcx>>::Result { while let Some(work) = self.worklist.pop() { let (mut id, comes_from_allow_expect) = work; @@ -366,8 +367,10 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { continue; } - self.visit_node(self.tcx.hir_node_by_def_id(id)); + self.visit_node(self.tcx.hir_node_by_def_id(id))?; } + + ControlFlow::Continue(()) } /// Automatically generated items marked with `rustc_trivial_field_reads` @@ -391,11 +394,14 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { false } - fn visit_node(&mut self, node: Node<'tcx>) { + fn visit_node( + &mut self, + node: Node<'tcx>, + ) -> as Visitor<'tcx>>::Result { if let Node::ImplItem(impl_item) = node && self.should_ignore_impl_item(impl_item) { - return; + return ControlFlow::Continue(()); } let unconditionally_treated_fields_as_live = @@ -403,7 +409,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { let had_repr_simd = self.repr_has_repr_simd; self.repr_unconditionally_treats_fields_as_live = false; self.repr_has_repr_simd = false; - match node { + let walk_result = match node { Node::Item(item) => match item.kind { hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => { let def = self.tcx.adt_def(item.owner_id); @@ -413,7 +419,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { intravisit::walk_item(self, item) } - hir::ItemKind::ForeignMod { .. } => {} + hir::ItemKind::ForeignMod { .. } => ControlFlow::Continue(()), hir::ItemKind::Trait(.., trait_item_refs) => { // mark assoc ty live if the trait is live for trait_item in trait_item_refs { @@ -431,7 +437,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { if let Some(trait_id) = self.tcx.trait_of_assoc(trait_item_id) { self.check_def_id(trait_id); } - intravisit::walk_trait_item(self, trait_item); + intravisit::walk_trait_item(self, trait_item) } Node::ImplItem(impl_item) => { let item = self.tcx.local_parent(impl_item.owner_id.def_id); @@ -452,16 +458,16 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { _ => {} } } - intravisit::walk_impl_item(self, impl_item); - } - Node::ForeignItem(foreign_item) => { - intravisit::walk_foreign_item(self, foreign_item); + intravisit::walk_impl_item(self, impl_item) } + Node::ForeignItem(foreign_item) => intravisit::walk_foreign_item(self, foreign_item), Node::OpaqueTy(opaq) => intravisit::walk_opaque_ty(self, opaq), - _ => {} - } + _ => ControlFlow::Continue(()), + }; self.repr_has_repr_simd = had_repr_simd; self.repr_unconditionally_treats_fields_as_live = unconditionally_treated_fields_as_live; + + walk_result } fn mark_as_used_if_union(&mut self, adt: ty::AdtDef<'tcx>, fields: &[hir::ExprField<'_>]) { @@ -511,15 +517,25 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { } impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { - fn visit_nested_body(&mut self, body: hir::BodyId) { - let old_maybe_typeck_results = - self.maybe_typeck_results.replace(self.tcx.typeck_body(body)); + type Result = ControlFlow; + + fn visit_nested_body(&mut self, body: hir::BodyId) -> Self::Result { + let typeck_results = self.tcx.typeck_body(body); + + // The result shouldn't be tainted, otherwise it will cause ICE. + if let Some(guar) = typeck_results.tainted_by_errors { + return ControlFlow::Break(guar); + } + + let old_maybe_typeck_results = self.maybe_typeck_results.replace(typeck_results); let body = self.tcx.hir_body(body); - self.visit_body(body); + let result = self.visit_body(body); self.maybe_typeck_results = old_maybe_typeck_results; + + result } - fn visit_variant_data(&mut self, def: &'tcx hir::VariantData<'tcx>) { + fn visit_variant_data(&mut self, def: &'tcx hir::VariantData<'tcx>) -> Self::Result { let tcx = self.tcx; let unconditionally_treat_fields_as_live = self.repr_unconditionally_treats_fields_as_live; let has_repr_simd = self.repr_has_repr_simd; @@ -536,10 +552,10 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { }); self.live_symbols.extend(live_fields); - intravisit::walk_struct_def(self, def); + intravisit::walk_struct_def(self, def) } - fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { + fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Self::Result { match expr.kind { hir::ExprKind::Path(ref qpath @ QPath::TypeRelative(..)) => { let res = self.typeck_results().qpath_res(qpath, expr.hir_id); @@ -575,20 +591,22 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { _ => (), } - intravisit::walk_expr(self, expr); + intravisit::walk_expr(self, expr) } - fn visit_arm(&mut self, arm: &'tcx hir::Arm<'tcx>) { + fn visit_arm(&mut self, arm: &'tcx hir::Arm<'tcx>) -> Self::Result { // Inside the body, ignore constructions of variants // necessary for the pattern to match. Those construction sites // can't be reached unless the variant is constructed elsewhere. let len = self.ignore_variant_stack.len(); self.ignore_variant_stack.extend(arm.pat.necessary_variants()); - intravisit::walk_arm(self, arm); + let result = intravisit::walk_arm(self, arm); self.ignore_variant_stack.truncate(len); + + result } - fn visit_pat(&mut self, pat: &'tcx hir::Pat<'tcx>) { + fn visit_pat(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Self::Result { self.in_pat = true; match pat.kind { PatKind::Struct(ref path, fields, _) => { @@ -602,11 +620,13 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { _ => (), } - intravisit::walk_pat(self, pat); + let result = intravisit::walk_pat(self, pat); self.in_pat = false; + + result } - fn visit_pat_expr(&mut self, expr: &'tcx rustc_hir::PatExpr<'tcx>) { + fn visit_pat_expr(&mut self, expr: &'tcx rustc_hir::PatExpr<'tcx>) -> Self::Result { match &expr.kind { rustc_hir::PatExprKind::Path(qpath) => { // mark the type of variant live when meeting E::V in expr @@ -619,37 +639,41 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { } _ => {} } - intravisit::walk_pat_expr(self, expr); + intravisit::walk_pat_expr(self, expr) } - fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) { + fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) -> Self::Result { self.handle_res(path.res); - intravisit::walk_path(self, path); + intravisit::walk_path(self, path) } - fn visit_anon_const(&mut self, c: &'tcx hir::AnonConst) { + fn visit_anon_const(&mut self, c: &'tcx hir::AnonConst) -> Self::Result { // When inline const blocks are used in pattern position, paths // referenced by it should be considered as used. let in_pat = mem::replace(&mut self.in_pat, false); self.live_symbols.insert(c.def_id); - intravisit::walk_anon_const(self, c); + let result = intravisit::walk_anon_const(self, c); self.in_pat = in_pat; + + result } - fn visit_inline_const(&mut self, c: &'tcx hir::ConstBlock) { + fn visit_inline_const(&mut self, c: &'tcx hir::ConstBlock) -> Self::Result { // When inline const blocks are used in pattern position, paths // referenced by it should be considered as used. let in_pat = mem::replace(&mut self.in_pat, false); self.live_symbols.insert(c.def_id); - intravisit::walk_inline_const(self, c); + let result = intravisit::walk_inline_const(self, c); self.in_pat = in_pat; + + result } - fn visit_trait_ref(&mut self, t: &'tcx hir::TraitRef<'tcx>) { + fn visit_trait_ref(&mut self, t: &'tcx hir::TraitRef<'tcx>) -> Self::Result { if let Some(trait_def_id) = t.path.res.opt_def_id() && let Some(segment) = t.path.segments.last() && let Some(args) = segment.args @@ -671,7 +695,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { } } - intravisit::walk_trait_ref(self, t); + intravisit::walk_trait_ref(self, t) } } @@ -818,7 +842,7 @@ fn create_and_seed_worklist( fn live_symbols_and_ignored_derived_traits( tcx: TyCtxt<'_>, (): (), -) -> (LocalDefIdSet, LocalDefIdMap>) { +) -> Result<(LocalDefIdSet, LocalDefIdMap>), ErrorGuaranteed> { let (worklist, mut unsolved_items) = create_and_seed_worklist(tcx); let mut symbol_visitor = MarkSymbolVisitor { worklist, @@ -832,7 +856,9 @@ fn live_symbols_and_ignored_derived_traits( ignore_variant_stack: vec![], ignored_derived_traits: Default::default(), }; - symbol_visitor.mark_live_symbols(); + if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { + return Err(guar); + } // We have marked the primary seeds as live. We now need to process unsolved items from traits // and trait impls: add them to the work list if the trait or the implemented type is live. @@ -846,14 +872,16 @@ fn live_symbols_and_ignored_derived_traits( symbol_visitor .worklist .extend(items_to_check.drain(..).map(|id| (id, ComesFromAllowExpect::No))); - symbol_visitor.mark_live_symbols(); + if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { + return Err(guar); + } items_to_check.extend(unsolved_items.extract_if(.., |&mut local_def_id| { symbol_visitor.check_impl_or_impl_item_live(local_def_id) })); } - (symbol_visitor.live_symbols, symbol_visitor.ignored_derived_traits) + Ok((symbol_visitor.live_symbols, symbol_visitor.ignored_derived_traits)) } struct DeadItem { @@ -1133,7 +1161,12 @@ impl<'tcx> DeadVisitor<'tcx> { } fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { - let (live_symbols, ignored_derived_traits) = tcx.live_symbols_and_ignored_derived_traits(()); + let Ok((live_symbols, ignored_derived_traits)) = + tcx.live_symbols_and_ignored_derived_traits(()).as_ref() + else { + return; + }; + let mut visitor = DeadVisitor { tcx, live_symbols, ignored_derived_traits }; let module_items = tcx.hir_module_items(module); diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index 5a2c6e169869..cb48c7d9aada 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -321,7 +321,6 @@ pub fn check_incompatible_options_for_ci_rustc( debuginfo_level_rustc, llvm_tools, llvm_bitcode_linker, - lto, stack_protector, strip, jemalloc, @@ -354,6 +353,7 @@ pub fn check_incompatible_options_for_ci_rustc( save_toolstates: _, codegen_backends: _, lld: _, + lto: _, deny_warnings: _, backtrace_on_ice: _, verify_llvm_ir: _, @@ -393,7 +393,6 @@ pub fn check_incompatible_options_for_ci_rustc( err!(current_rust_config.jemalloc, jemalloc, "rust"); err!(current_rust_config.default_linker, default_linker, "rust"); err!(current_rust_config.stack_protector, stack_protector, "rust"); - err!(current_rust_config.lto, lto, "rust"); err!(current_rust_config.std_features, std_features, "rust"); warn!(current_rust_config.channel, channel, "rust"); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e9dea95cafbd..ff275df9b31c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1838,8 +1838,9 @@ impl<'test> TestCx<'test> { // Add `-A unused` before `config` flags and in-test (`props`) flags, so that they can // overwrite this. + // Don't allow `unused_attributes` since these are usually actual mistakes, rather than just unused code. if let AllowUnused::Yes = allow_unused { - rustc.args(&["-A", "unused"]); + rustc.args(&["-A", "unused", "-W", "unused_attributes"]); } // Allow tests to use internal features. diff --git a/tests/crashes/125323.rs b/tests/crashes/125323.rs deleted file mode 100644 index 180b7bbad097..000000000000 --- a/tests/crashes/125323.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ known-bug: rust-lang/rust#125323 -fn main() { - for _ in 0..0 { - [(); loop {}]; - } -} diff --git a/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs b/tests/ui/associated-types/ambiguous-associated-type-error-78622.rs similarity index 100% rename from tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs rename to tests/ui/associated-types/ambiguous-associated-type-error-78622.rs diff --git a/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr b/tests/ui/associated-types/ambiguous-associated-type-error-78622.stderr similarity index 100% rename from tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr rename to tests/ui/associated-types/ambiguous-associated-type-error-78622.stderr diff --git a/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs b/tests/ui/associated-types/mismatched-types-in-associated-type-87490.rs similarity index 100% rename from tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs rename to tests/ui/associated-types/mismatched-types-in-associated-type-87490.rs diff --git a/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr b/tests/ui/associated-types/mismatched-types-in-associated-type-87490.stderr similarity index 87% rename from tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr rename to tests/ui/associated-types/mismatched-types-in-associated-type-87490.stderr index bbd73347d027..0a2dbcdc27b7 100644 --- a/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr +++ b/tests/ui/associated-types/mismatched-types-in-associated-type-87490.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mismatched-types-in-trait-implementation-87490.rs:10:5 + --> $DIR/mismatched-types-in-associated-type-87490.rs:10:5 | LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { | ------------------------------ expected `usize` because of return type diff --git a/tests/ui/issues/issue-72076.rs b/tests/ui/associated-types/missing-default-associated-type-72076.rs similarity index 64% rename from tests/ui/issues/issue-72076.rs rename to tests/ui/associated-types/missing-default-associated-type-72076.rs index 1659044a64fe..c25bdff16fd2 100644 --- a/tests/ui/issues/issue-72076.rs +++ b/tests/ui/associated-types/missing-default-associated-type-72076.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/72076 trait X { type S; fn f() -> Self::S {} //~ ERROR mismatched types diff --git a/tests/ui/issues/issue-72076.stderr b/tests/ui/associated-types/missing-default-associated-type-72076.stderr similarity index 90% rename from tests/ui/issues/issue-72076.stderr rename to tests/ui/associated-types/missing-default-associated-type-72076.stderr index a08704c90732..c91dbb6d5c85 100644 --- a/tests/ui/issues/issue-72076.stderr +++ b/tests/ui/associated-types/missing-default-associated-type-72076.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-72076.rs:3:23 + --> $DIR/missing-default-associated-type-72076.rs:4:23 | LL | fn f() -> Self::S {} | ^^ expected associated type, found `()` diff --git a/tests/ui/attributes/attr-mix-new.rs b/tests/ui/attributes/attr-mix-new.rs index bd249a0c198a..c4f080eb8c30 100644 --- a/tests/ui/attributes/attr-mix-new.rs +++ b/tests/ui/attributes/attr-mix-new.rs @@ -5,6 +5,7 @@ #[rustc_dummy(bar)] mod foo { #![feature(globs)] + //~^ WARN crate-level attribute should be in the root module } fn main() {} diff --git a/tests/ui/attributes/attr-mix-new.stderr b/tests/ui/attributes/attr-mix-new.stderr new file mode 100644 index 000000000000..c1bb8a550bcc --- /dev/null +++ b/tests/ui/attributes/attr-mix-new.stderr @@ -0,0 +1,10 @@ +warning: crate-level attribute should be in the root module + --> $DIR/attr-mix-new.rs:7:3 + | +LL | #![feature(globs)] + | ^^^^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-W unused-attributes` + +warning: 1 warning emitted + diff --git a/tests/ui/attributes/crate-type-macro-empty.rs b/tests/ui/attributes/crate-type-macro-empty.rs index 217ff598f7a4..cfc71e6b938f 100644 --- a/tests/ui/attributes/crate-type-macro-empty.rs +++ b/tests/ui/attributes/crate-type-macro-empty.rs @@ -1,6 +1,7 @@ // Tests for the issue in #137589 #[crate_type = foo!()] //~^ ERROR cannot find macro `foo` in this scope +//~| WARN crate-level attribute should be an inner attribute macro_rules! foo {} //~ ERROR macros must contain at least one rule diff --git a/tests/ui/attributes/crate-type-macro-empty.stderr b/tests/ui/attributes/crate-type-macro-empty.stderr index 130fa454ca19..0c2c4cf2a9b2 100644 --- a/tests/ui/attributes/crate-type-macro-empty.stderr +++ b/tests/ui/attributes/crate-type-macro-empty.stderr @@ -1,5 +1,5 @@ error: macros must contain at least one rule - --> $DIR/crate-type-macro-empty.rs:5:1 + --> $DIR/crate-type-macro-empty.rs:6:1 | LL | macro_rules! foo {} | ^^^^^^^^^^^^^^^^^^^ @@ -11,10 +11,22 @@ LL | #[crate_type = foo!()] | ^^^ consider moving the definition of `foo` before this call | note: a macro with the same name exists, but it appears later - --> $DIR/crate-type-macro-empty.rs:5:14 + --> $DIR/crate-type-macro-empty.rs:6:14 | LL | macro_rules! foo {} | ^^^ -error: aborting due to 2 previous errors +warning: crate-level attribute should be an inner attribute + --> $DIR/crate-type-macro-empty.rs:2:1 + | +LL | #[crate_type = foo!()] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-W unused-attributes` +help: add a `!` + | +LL | #![crate_type = foo!()] + | + + +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/attributes/crate-type-macro-not-found.rs b/tests/ui/attributes/crate-type-macro-not-found.rs index 824468c0e85b..b9f05fa7caa1 100644 --- a/tests/ui/attributes/crate-type-macro-not-found.rs +++ b/tests/ui/attributes/crate-type-macro-not-found.rs @@ -1,5 +1,6 @@ // Tests for the issue in #137589 #[crate_type = foo!()] //~ ERROR cannot find macro `foo` in this scope +//~| WARN crate-level attribute should be an inner attribute macro_rules! foo { ($x:expr) => {"rlib"} diff --git a/tests/ui/attributes/crate-type-macro-not-found.stderr b/tests/ui/attributes/crate-type-macro-not-found.stderr index a4967e4f12e9..7b8c6a808349 100644 --- a/tests/ui/attributes/crate-type-macro-not-found.stderr +++ b/tests/ui/attributes/crate-type-macro-not-found.stderr @@ -5,10 +5,22 @@ LL | #[crate_type = foo!()] | ^^^ consider moving the definition of `foo` before this call | note: a macro with the same name exists, but it appears later - --> $DIR/crate-type-macro-not-found.rs:4:14 + --> $DIR/crate-type-macro-not-found.rs:5:14 | LL | macro_rules! foo { | ^^^ -error: aborting due to 1 previous error +warning: crate-level attribute should be an inner attribute + --> $DIR/crate-type-macro-not-found.rs:2:1 + | +LL | #[crate_type = foo!()] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-W unused-attributes` +help: add a `!` + | +LL | #![crate_type = foo!()] + | + + +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/attributes/inline/attr-usage-inline.rs b/tests/ui/attributes/inline/attr-usage-inline.rs index 8217b9834ff2..54f2f8020c4a 100644 --- a/tests/ui/attributes/inline/attr-usage-inline.rs +++ b/tests/ui/attributes/inline/attr-usage-inline.rs @@ -9,16 +9,22 @@ struct S; struct I { #[inline] + //~^ WARN attribute cannot be used on + //~| WARN previously accepted i: u8, } #[macro_export] #[inline] +//~^ WARN attribute cannot be used on +//~| WARN previously accepted macro_rules! m_e { () => {}; } #[inline] //~ ERROR: attribute should be applied to function or closure +//~^ WARN attribute cannot be used on +//~| WARN previously accepted macro_rules! m { () => {}; } diff --git a/tests/ui/attributes/inline/attr-usage-inline.stderr b/tests/ui/attributes/inline/attr-usage-inline.stderr index 9fca17d90ca1..0a0af1a27b38 100644 --- a/tests/ui/attributes/inline/attr-usage-inline.stderr +++ b/tests/ui/attributes/inline/attr-usage-inline.stderr @@ -7,11 +7,39 @@ LL | #[inline] = help: `#[inline]` can only be applied to functions error[E0518]: attribute should be applied to function or closure - --> $DIR/attr-usage-inline.rs:21:1 + --> $DIR/attr-usage-inline.rs:25:1 | LL | #[inline] | ^^^^^^^^^ not a function or closure -error: aborting due to 2 previous errors +warning: `#[inline]` attribute cannot be used on struct fields + --> $DIR/attr-usage-inline.rs:11:5 + | +LL | #[inline] + | ^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions + = note: requested on the command line with `-W unused-attributes` + +warning: `#[inline]` attribute cannot be used on macro defs + --> $DIR/attr-usage-inline.rs:18:1 + | +LL | #[inline] + | ^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions + +warning: `#[inline]` attribute cannot be used on macro defs + --> $DIR/attr-usage-inline.rs:25:1 + | +LL | #[inline] + | ^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[inline]` can only be applied to functions + +error: aborting due to 2 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0518`. diff --git a/tests/ui/attributes/link-dl.rs b/tests/ui/attributes/link-dl.rs index 0785c83cb442..b3b22c6bbc58 100644 --- a/tests/ui/attributes/link-dl.rs +++ b/tests/ui/attributes/link-dl.rs @@ -9,7 +9,7 @@ //@ revisions: default_fcw allowed //@[allowed] check-pass -#[cfg_attr(allowed, allow(ill_formed_attribute_input))] +#![cfg_attr(allowed, allow(ill_formed_attribute_input))] #[link="dl"] //[default_fcw]~^ ERROR valid forms for the attribute are diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 820484aa015d..26ee89dd7b3b 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -73,6 +73,7 @@ //~| ERROR attribute cannot be used on #[crate_name] //~^ ERROR malformed +//~| WARN crate-level attribute should be an inner attribute #[doc] //~^ ERROR valid forms for the attribute are //~| WARN this was previously accepted by the compiler @@ -82,8 +83,12 @@ //~^ ERROR malformed #[link] //~^ ERROR malformed +//~| WARN attribute should be applied to an `extern` block with non-Rust ABI +//~| WARN previously accepted #[link_name] //~^ ERROR malformed +//~| WARN cannot be used on functions +//~| WARN previously accepted #[link_section] //~^ ERROR malformed #[coverage] @@ -95,6 +100,8 @@ //~| WARN this was previously accepted by the compiler #[no_implicit_prelude = 23] //~^ ERROR malformed +//~| WARN cannot be used on functions +//~| WARN previously accepted #[proc_macro = 18] //~^ ERROR malformed //~| ERROR the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type @@ -188,6 +195,8 @@ extern "C" { //~^ ERROR malformed `debugger_visualizer` attribute input #[automatically_derived = 18] //~^ ERROR malformed +//~| WARN cannot be used on modules +//~| WARN previously accepted mod yooo { } diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index f0d2c100f030..c29bd0245bf0 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:101:1 + --> $DIR/malformed-attrs.rs:108:1 | LL | #[cfg] | ^^^^^^ @@ -10,7 +10,7 @@ LL | #[cfg] = note: for more information, visit error[E0539]: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:103:1 + --> $DIR/malformed-attrs.rs:110:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | #[cfg_attr] = note: for more information, visit error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:209:1 + --> $DIR/malformed-attrs.rs:218:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate @@ -41,7 +41,7 @@ LL | #![windows_subsystem = "windows"] | +++++++++++ error: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:105:1 + --> $DIR/malformed-attrs.rs:112:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` @@ -49,13 +49,13 @@ LL | #[instruction_set] = note: for more information, visit error: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:107:1 + --> $DIR/malformed-attrs.rs:114:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` error: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:131:1 + --> $DIR/malformed-attrs.rs:138:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^^^^ @@ -70,13 +70,13 @@ LL + #[must_not_suspend] | error: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:133:1 + --> $DIR/malformed-attrs.rs:140:1 | LL | #[cfi_encoding] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:177:1 + --> $DIR/malformed-attrs.rs:184:1 | LL | #[allow] | ^^^^^^^^ @@ -92,7 +92,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:179:1 + --> $DIR/malformed-attrs.rs:186:1 | LL | #[expect] | ^^^^^^^^^ @@ -108,7 +108,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:188:1 | LL | #[warn] | ^^^^^^^ @@ -124,7 +124,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:190:1 | LL | #[deny] | ^^^^^^^ @@ -140,7 +140,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:192:1 | LL | #[forbid] | ^^^^^^^^^ @@ -156,13 +156,13 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:201:1 + --> $DIR/malformed-attrs.rs:210:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]` error: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:205:1 + --> $DIR/malformed-attrs.rs:214:1 | LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` @@ -170,25 +170,25 @@ LL | #[no_link()] = note: for more information, visit error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:115:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:122:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:223:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -208,7 +208,7 @@ LL | #[doc] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:76:1 + --> $DIR/malformed-attrs.rs:77:1 | LL | #[doc] | ^^^^^^ @@ -432,7 +432,7 @@ LL | #[crate_name] | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:79:1 + --> $DIR/malformed-attrs.rs:80:1 | LL | #[target_feature] | ^^^^^^^^^^^^^^^^^ @@ -441,7 +441,7 @@ LL | #[target_feature] | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]` error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:81:1 + --> $DIR/malformed-attrs.rs:82:1 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^^^---^ @@ -450,7 +450,7 @@ LL | #[export_stable = 1] | help: must be of the form: `#[export_stable]` error[E0539]: malformed `link` attribute input - --> $DIR/malformed-attrs.rs:83:1 + --> $DIR/malformed-attrs.rs:84:1 | LL | #[link] | ^^^^^^^ expected this to be a list @@ -469,7 +469,7 @@ LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", = and 1 other candidate error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:85:1 + --> $DIR/malformed-attrs.rs:88:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -477,7 +477,7 @@ LL | #[link_name] = note: for more information, visit error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:87:1 + --> $DIR/malformed-attrs.rs:92:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` @@ -485,7 +485,7 @@ LL | #[link_section] = note: for more information, visit error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:89:1 + --> $DIR/malformed-attrs.rs:94:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -498,7 +498,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `sanitize` attribute input - --> $DIR/malformed-attrs.rs:91:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[sanitize] | ^^^^^^^^^^^ expected this to be a list @@ -516,7 +516,7 @@ LL | #[sanitize(kcfi = "on|off")] = and 5 other candidates error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:96:1 + --> $DIR/malformed-attrs.rs:101:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -525,7 +525,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -534,7 +534,7 @@ LL | #[proc_macro = 18] | help: must be of the form: `#[proc_macro]` error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:110:5 + --> $DIR/malformed-attrs.rs:117:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^----^ @@ -543,7 +543,7 @@ LL | #[coroutine = 63] || {} | help: must be of the form: `#[coroutine]` error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:115:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -552,7 +552,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:118:1 + --> $DIR/malformed-attrs.rs:125:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -570,7 +570,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:122:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -584,7 +584,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:127:1 + --> $DIR/malformed-attrs.rs:134:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -593,7 +593,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:129:1 + --> $DIR/malformed-attrs.rs:136:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -602,7 +602,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:154:1 + --> $DIR/malformed-attrs.rs:161:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -611,7 +611,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:156:1 + --> $DIR/malformed-attrs.rs:163:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -620,7 +620,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:164:5 + --> $DIR/malformed-attrs.rs:171:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -629,7 +629,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:166:5 + --> $DIR/malformed-attrs.rs:173:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -640,7 +640,7 @@ LL | #[link_ordinal] = note: for more information, visit error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:170:5 + --> $DIR/malformed-attrs.rs:177:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -649,7 +649,7 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:172:5 + --> $DIR/malformed-attrs.rs:179:5 | LL | #[linkage] | ^^^^^^^^^^ expected this to be of the form `linkage = "..."` @@ -667,7 +667,7 @@ LL | #[linkage = "external"] = and 5 other candidates error[E0539]: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:194:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -678,7 +678,7 @@ LL | #[debugger_visualizer] = note: for more information, visit error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:196:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -687,7 +687,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:195:1 + --> $DIR/malformed-attrs.rs:204:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -696,19 +696,19 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` - --> $DIR/malformed-attrs.rs:207:1 + --> $DIR/malformed-attrs.rs:216:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^^^^^ error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]` - --> $DIR/malformed-attrs.rs:212:1 + --> $DIR/malformed-attrs.rs:221:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^^^^^^ error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:223:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -717,7 +717,7 @@ LL | #[allow_internal_unsafe = 1] | help: must be of the form: `#[allow_internal_unsafe]` error[E0565]: malformed `type_const` attribute input - --> $DIR/malformed-attrs.rs:142:5 + --> $DIR/malformed-attrs.rs:149:5 | LL | #[type_const = 1] | ^^^^^^^^^^^^^---^ @@ -737,6 +737,21 @@ LL | | #[coroutine = 63] || {} LL | | } | |_- not a `const fn` +warning: attribute should be applied to an `extern` block with non-Rust ABI + --> $DIR/malformed-attrs.rs:84:1 + | +LL | #[link] + | ^^^^^^^ +... +LL | / fn test() { +LL | | #[coroutine = 63] || {} +... | +LL | | } + | |_- not an `extern` block + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: requested on the command line with `-W unused-attributes` + error: `#[repr(align(...))]` is not supported on functions --> $DIR/malformed-attrs.rs:47:1 | @@ -750,7 +765,7 @@ LL | #[repr] | ^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:148:1 + --> $DIR/malformed-attrs.rs:155:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -758,7 +773,7 @@ LL | #[diagnostic::do_not_recommend()] = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:137:1 + --> $DIR/malformed-attrs.rs:144:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -766,7 +781,7 @@ LL | #[diagnostic::on_unimplemented] = help: at least one of the `message`, `note` and `label` options are expected warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:139:1 + --> $DIR/malformed-attrs.rs:146:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -782,8 +797,32 @@ LL | #[inline = 5] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57571 +warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` + --> $DIR/malformed-attrs.rs:74:1 + | +LL | #[crate_name] + | ^^^^^^^^^^^^^ + | +note: This attribute does not have an `!`, which means it is applied to this function + --> $DIR/malformed-attrs.rs:116:1 + | +LL | / fn test() { +LL | | #[coroutine = 63] || {} +... | +LL | | } + | |_^ + +warning: `#[link_name]` attribute cannot be used on functions + --> $DIR/malformed-attrs.rs:88:1 + | +LL | #[link_name] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[link_name]` can be applied to foreign functions and foreign statics + error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -791,8 +830,26 @@ LL | #[ignore()] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57571 +warning: `#[no_implicit_prelude]` attribute cannot be used on functions + --> $DIR/malformed-attrs.rs:101:1 + | +LL | #[no_implicit_prelude = 23] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_implicit_prelude]` can be applied to crates and modules + +warning: `#[automatically_derived]` attribute cannot be used on modules + --> $DIR/malformed-attrs.rs:196:1 + | +LL | #[automatically_derived = 18] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[automatically_derived]` can only be applied to trait impl blocks + error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:221:1 + --> $DIR/malformed-attrs.rs:230:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -801,7 +858,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:110:23 + --> $DIR/malformed-attrs.rs:117:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -809,9 +866,9 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:110:23: 110:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:117:23: 117:25}` -error: aborting due to 76 previous errors; 3 warnings emitted +error: aborting due to 76 previous errors; 8 warnings emitted Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805. For more information about an error, try `rustc --explain E0308`. @@ -829,7 +886,7 @@ LL | #[doc] Future breakage diagnostic: error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:76:1 + --> $DIR/malformed-attrs.rs:77:1 | LL | #[doc] | ^^^^^^ @@ -852,7 +909,7 @@ LL | #[inline = 5] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -863,7 +920,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:221:1 + --> $DIR/malformed-attrs.rs:230:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/malformed-no-std.rs b/tests/ui/attributes/malformed-no-std.rs index 528ecb549b0e..2e618a13d41f 100644 --- a/tests/ui/attributes/malformed-no-std.rs +++ b/tests/ui/attributes/malformed-no-std.rs @@ -4,14 +4,18 @@ //~^ ERROR malformed `no_std` attribute input #![no_std("bar")] //~^ ERROR malformed `no_std` attribute input +//~| WARN unused attribute #![no_std(foo = "bar")] //~^ ERROR malformed `no_std` attribute input +//~| WARN unused attribute #![no_core = "foo"] //~^ ERROR malformed `no_core` attribute input #![no_core("bar")] //~^ ERROR malformed `no_core` attribute input +//~| WARN unused attribute #![no_core(foo = "bar")] //~^ ERROR malformed `no_core` attribute input +//~| WARN unused attribute #[deny(unused_attributes)] #[no_std] diff --git a/tests/ui/attributes/malformed-no-std.stderr b/tests/ui/attributes/malformed-no-std.stderr index 322d5f03e41c..89d7ee410d70 100644 --- a/tests/ui/attributes/malformed-no-std.stderr +++ b/tests/ui/attributes/malformed-no-std.stderr @@ -17,7 +17,7 @@ LL | #![no_std("bar")] | help: must be of the form: `#![no_std]` error[E0565]: malformed `no_std` attribute input - --> $DIR/malformed-no-std.rs:7:1 + --> $DIR/malformed-no-std.rs:8:1 | LL | #![no_std(foo = "bar")] | ^^^^^^^^^-------------^ @@ -26,7 +26,7 @@ LL | #![no_std(foo = "bar")] | help: must be of the form: `#![no_std]` error[E0565]: malformed `no_core` attribute input - --> $DIR/malformed-no-std.rs:9:1 + --> $DIR/malformed-no-std.rs:11:1 | LL | #![no_core = "foo"] | ^^^^^^^^^^^-------^ @@ -35,7 +35,7 @@ LL | #![no_core = "foo"] | help: must be of the form: `#![no_core]` error[E0565]: malformed `no_core` attribute input - --> $DIR/malformed-no-std.rs:11:1 + --> $DIR/malformed-no-std.rs:13:1 | LL | #![no_core("bar")] | ^^^^^^^^^^-------^ @@ -44,7 +44,7 @@ LL | #![no_core("bar")] | help: must be of the form: `#![no_core]` error[E0565]: malformed `no_core` attribute input - --> $DIR/malformed-no-std.rs:13:1 + --> $DIR/malformed-no-std.rs:16:1 | LL | #![no_core(foo = "bar")] | ^^^^^^^^^^-------------^ @@ -53,34 +53,83 @@ LL | #![no_core(foo = "bar")] | help: must be of the form: `#![no_core]` error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/malformed-no-std.rs:17:1 + --> $DIR/malformed-no-std.rs:21:1 | LL | #[no_std] | ^^^^^^^^^ | note: This attribute does not have an `!`, which means it is applied to this extern crate - --> $DIR/malformed-no-std.rs:22:1 + --> $DIR/malformed-no-std.rs:26:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/malformed-no-std.rs:16:8 + --> $DIR/malformed-no-std.rs:20:8 | LL | #[deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_core]` - --> $DIR/malformed-no-std.rs:19:1 + --> $DIR/malformed-no-std.rs:23:1 | LL | #[no_core] | ^^^^^^^^^^ | note: This attribute does not have an `!`, which means it is applied to this extern crate - --> $DIR/malformed-no-std.rs:22:1 + --> $DIR/malformed-no-std.rs:26:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +warning: unused attribute + --> $DIR/malformed-no-std.rs:5:1 + | +LL | #![no_std("bar")] + | ^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/malformed-no-std.rs:3:1 + | +LL | #![no_std = "foo"] + | ^^^^^^^^^^^^^^^^^^ + = note: requested on the command line with `-W unused-attributes` + +warning: unused attribute + --> $DIR/malformed-no-std.rs:8:1 + | +LL | #![no_std(foo = "bar")] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/malformed-no-std.rs:5:1 + | +LL | #![no_std("bar")] + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/malformed-no-std.rs:13:1 + | +LL | #![no_core("bar")] + | ^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/malformed-no-std.rs:11:1 + | +LL | #![no_core = "foo"] + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/malformed-no-std.rs:16:1 + | +LL | #![no_core(foo = "bar")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/malformed-no-std.rs:13:1 + | +LL | #![no_core("bar")] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors; 4 warnings emitted For more information about this error, try `rustc --explain E0565`. diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed b/tests/ui/binding/invalid-assignment-in-while-77218.fixed similarity index 100% rename from tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed rename to tests/ui/binding/invalid-assignment-in-while-77218.fixed diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs b/tests/ui/binding/invalid-assignment-in-while-77218.rs similarity index 100% rename from tests/ui/binding/invalid-assignment-in-while-loop-77218.rs rename to tests/ui/binding/invalid-assignment-in-while-77218.rs diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr b/tests/ui/binding/invalid-assignment-in-while-77218.stderr similarity index 88% rename from tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr rename to tests/ui/binding/invalid-assignment-in-while-77218.stderr index e6baf349d28a..0545a0130997 100644 --- a/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr +++ b/tests/ui/binding/invalid-assignment-in-while-77218.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/invalid-assignment-in-while-loop-77218.rs:5:19 + --> $DIR/invalid-assignment-in-while-77218.rs:5:19 | LL | while Some(0) = value.get(0) {} | - ^ diff --git a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs b/tests/ui/binop/binary-operation-error-on-function-70724.rs similarity index 77% rename from tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs rename to tests/ui/binop/binary-operation-error-on-function-70724.rs index c2683157f797..0bbf13761488 100644 --- a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs +++ b/tests/ui/binop/binary-operation-error-on-function-70724.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/70724 fn a() -> i32 { 3 } diff --git a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/tests/ui/binop/binary-operation-error-on-function-70724.stderr similarity index 87% rename from tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr rename to tests/ui/binop/binary-operation-error-on-function-70724.stderr index 736002c9335a..11b0e4ba19c5 100644 --- a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/tests/ui/binop/binary-operation-error-on-function-70724.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `fn() -> i32 {a}` - --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + --> $DIR/binary-operation-error-on-function-70724.rs:7:5 | LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | assert_eq!(a, 0); = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + --> $DIR/binary-operation-error-on-function-70724.rs:7:5 | LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^ expected fn item, found integer @@ -20,7 +20,7 @@ LL | assert_eq!(a, 0); = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug` - --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + --> $DIR/binary-operation-error-on-function-70724.rs:7:5 | LL | fn a() -> i32 { | - consider calling this function diff --git a/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs b/tests/ui/borrowck/pointer-reassignment-after-deref-78192.rs similarity index 100% rename from tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs rename to tests/ui/borrowck/pointer-reassignment-after-deref-78192.rs diff --git a/tests/ui/issues/issue-72002.rs b/tests/ui/coercion/index-coercion-over-indexmut-72002.rs similarity index 90% rename from tests/ui/issues/issue-72002.rs rename to tests/ui/coercion/index-coercion-over-indexmut-72002.rs index ce3463069b88..826cc99fe2ad 100644 --- a/tests/ui/issues/issue-72002.rs +++ b/tests/ui/coercion/index-coercion-over-indexmut-72002.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/72002 //@ check-pass struct Indexable; diff --git a/tests/ui/conditional-compilation/cfg-attr-parse.rs b/tests/ui/conditional-compilation/cfg-attr-parse.rs index 8ca31c118369..b8aaad2685ef 100644 --- a/tests/ui/conditional-compilation/cfg-attr-parse.rs +++ b/tests/ui/conditional-compilation/cfg-attr-parse.rs @@ -9,7 +9,8 @@ struct NoConfigurationPredicate; struct A0C0; // Zero attributes, one trailing comma -#[cfg_attr(all(),)] // Ok +#[cfg_attr(all(),)] +//~^ WARN `#[cfg_attr]` does not expand to any attributes struct A0C1; // Zero attributes, two trailing commas diff --git a/tests/ui/conditional-compilation/cfg-attr-parse.stderr b/tests/ui/conditional-compilation/cfg-attr-parse.stderr index b08915e93421..4d4769b05cda 100644 --- a/tests/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-parse.stderr @@ -21,7 +21,7 @@ LL | #[cfg_attr(all())] = note: for more information, visit error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:16:18 + --> $DIR/cfg-attr-parse.rs:17:18 | LL | #[cfg_attr(all(),,)] | -----------------^-- @@ -32,7 +32,7 @@ LL | #[cfg_attr(all(),,)] = note: for more information, visit error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:28:28 + --> $DIR/cfg-attr-parse.rs:29:28 | LL | #[cfg_attr(all(), must_use,,)] | ---------------------------^-- @@ -43,7 +43,7 @@ LL | #[cfg_attr(all(), must_use,,)] = note: for more information, visit error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:40:40 + --> $DIR/cfg-attr-parse.rs:41:40 | LL | #[cfg_attr(all(), must_use, deprecated,,)] | ---------------------------------------^-- @@ -54,7 +54,7 @@ LL | #[cfg_attr(all(), must_use, deprecated,,)] = note: for more information, visit error: wrong `cfg_attr` delimiters - --> $DIR/cfg-attr-parse.rs:44:11 + --> $DIR/cfg-attr-parse.rs:45:11 | LL | #[cfg_attr[all(),,]] | ^^^^^^^^^ @@ -66,7 +66,7 @@ LL + #[cfg_attr(all(),,)] | error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:44:18 + --> $DIR/cfg-attr-parse.rs:45:18 | LL | #[cfg_attr[all(),,]] | -----------------^-- @@ -77,7 +77,7 @@ LL | #[cfg_attr[all(),,]] = note: for more information, visit error: wrong `cfg_attr` delimiters - --> $DIR/cfg-attr-parse.rs:50:11 + --> $DIR/cfg-attr-parse.rs:51:11 | LL | #[cfg_attr{all(),,}] | ^^^^^^^^^ @@ -89,7 +89,7 @@ LL + #[cfg_attr(all(),,)] | error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:50:18 + --> $DIR/cfg-attr-parse.rs:51:18 | LL | #[cfg_attr{all(),,}] | -----------------^-- @@ -99,6 +99,14 @@ LL | #[cfg_attr{all(),,}] | = note: for more information, visit -error: aborting due to 9 previous errors +warning: `#[cfg_attr]` does not expand to any attributes + --> $DIR/cfg-attr-parse.rs:12:1 + | +LL | #[cfg_attr(all(),)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-W unused-attributes` + +error: aborting due to 9 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs index c08762db8aa9..a0f86e3e771f 100644 --- a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs @@ -42,6 +42,8 @@ struct S11; struct S12; #[cfg_attr(true, link_section)] //~ ERROR malformed `link_section` attribute input +//~^ WARN attribute cannot be used on +//~| WARN previously accepted struct S13; #[cfg_attr(true, inline())] //~ ERROR malformed `inline` attribute input diff --git a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr index 99117af70dc7..2b7a7da3e33d 100644 --- a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr @@ -118,7 +118,7 @@ LL | #[cfg_attr(true, link_section)] = note: for more information, visit error[E0805]: malformed `inline` attribute input - --> $DIR/cfg_attr-attr-syntax-validation.rs:47:18 + --> $DIR/cfg_attr-attr-syntax-validation.rs:49:18 | LL | #[cfg_attr(true, inline())] | ^^^^^^-- @@ -138,7 +138,17 @@ LL - #[cfg_attr(true, inline())] LL + #[cfg_attr(true, #[inline])] | -error: aborting due to 13 previous errors +warning: `#[link_section]` attribute cannot be used on structs + --> $DIR/cfg_attr-attr-syntax-validation.rs:44:18 + | +LL | #[cfg_attr(true, link_section)] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[link_section]` can be applied to functions and statics + = note: requested on the command line with `-W unused-attributes` + +error: aborting due to 13 previous errors; 1 warning emitted Some errors have detailed explanations: E0537, E0539, E0805. For more information about an error, try `rustc --explain E0537`. diff --git a/tests/crashes/139815.rs b/tests/ui/const-generics/generic-const-array-pattern-ice-139815.rs similarity index 61% rename from tests/crashes/139815.rs rename to tests/ui/const-generics/generic-const-array-pattern-ice-139815.rs index 9094acdc94b2..52f4b246d069 100644 --- a/tests/crashes/139815.rs +++ b/tests/ui/const-generics/generic-const-array-pattern-ice-139815.rs @@ -1,8 +1,10 @@ -//@ known-bug: #139815 - +//@ compile-flags: --crate-type=lib +#![allow(incomplete_features)] #![feature(generic_const_exprs)] + fn is_123( x: [u32; { + //~^ ERROR overly complex generic constant N + 1; 5 }], diff --git a/tests/ui/const-generics/generic-const-array-pattern-ice-139815.stderr b/tests/ui/const-generics/generic-const-array-pattern-ice-139815.stderr new file mode 100644 index 000000000000..9da973ef3a04 --- /dev/null +++ b/tests/ui/const-generics/generic-const-array-pattern-ice-139815.stderr @@ -0,0 +1,16 @@ +error: overly complex generic constant + --> $DIR/generic-const-array-pattern-ice-139815.rs:6:14 + | +LL | x: [u32; { + | ______________^ +LL | | +LL | | N + 1; +LL | | 5 +LL | | }], + | |_____^ blocks are not supported in generic constants + | + = help: consider moving this anonymous constant into a `const` function + = note: this operation may be supported in the future + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs b/tests/ui/const-generics/invalid-attributes-on-const-params-78957.rs similarity index 100% rename from tests/ui/attributes/invalid-attributes-on-const-params-78957.rs rename to tests/ui/const-generics/invalid-attributes-on-const-params-78957.rs diff --git a/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr b/tests/ui/const-generics/invalid-attributes-on-const-params-78957.stderr similarity index 100% rename from tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr rename to tests/ui/const-generics/invalid-attributes-on-const-params-78957.stderr diff --git a/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.rs b/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.rs new file mode 100644 index 000000000000..465b54e69d1b --- /dev/null +++ b/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.rs @@ -0,0 +1,14 @@ +// The test confirms ICE-125323 is fixed. +// +// This warning tests there is no warning about dead code +// when there is a constant evaluation error. +#![warn(unused)] +fn should_not_be_dead() {} + +fn main() { + for _ in 0..0 { + [(); loop {}]; //~ ERROR constant evaluation is taking a long time + } + + should_not_be_dead(); +} diff --git a/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.stderr b/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.stderr new file mode 100644 index 000000000000..32a18469ab9e --- /dev/null +++ b/tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.stderr @@ -0,0 +1,17 @@ +error: constant evaluation is taking a long time + --> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14 + | +LL | [(); loop {}]; + | ^^^^^^^ + | + = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. + If your compilation actually takes a long time, you can safely allow the lint. +help: the constant being evaluated + --> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14 + | +LL | [(); loop {}]; + | ^^^^^^^ + = note: `#[deny(long_running_const_eval)]` on by default + +error: aborting due to 1 previous error + diff --git a/tests/ui/cross/cross-file-errors/main.stderr b/tests/ui/cross/cross-file-errors/main.stderr index c7dea801acfb..db7b3a84fc8b 100644 --- a/tests/ui/cross/cross-file-errors/main.stderr +++ b/tests/ui/cross/cross-file-errors/main.stderr @@ -1,5 +1,5 @@ error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/underscore.rs:6:9 + --> $DIR/underscore.rs:5:9 | LL | _ | ^ `_` not allowed here diff --git a/tests/ui/cross/cross-file-errors/underscore.rs b/tests/ui/cross/cross-file-errors/underscore.rs index 73eb36cec24c..9bad2268b98e 100644 --- a/tests/ui/cross/cross-file-errors/underscore.rs +++ b/tests/ui/cross/cross-file-errors/underscore.rs @@ -1,5 +1,4 @@ //@ ignore-auxiliary (used by `./main.rs`) -#![crate_type = "lib"] macro_rules! underscore { () => ( diff --git a/tests/ui/deprecation/deprecated-expr-precedence.rs b/tests/ui/deprecation/deprecated-expr-precedence.rs index 9636b46df201..08a741e11c0d 100644 --- a/tests/ui/deprecation/deprecated-expr-precedence.rs +++ b/tests/ui/deprecation/deprecated-expr-precedence.rs @@ -5,4 +5,6 @@ pub fn public() { #[deprecated] 0 //~^ ERROR mismatched types + //~| WARN attribute cannot be used on expressions + //~| WARN previously accepted } diff --git a/tests/ui/deprecation/deprecated-expr-precedence.stderr b/tests/ui/deprecation/deprecated-expr-precedence.stderr index 3275f2e790ae..c3124cf86ef4 100644 --- a/tests/ui/deprecation/deprecated-expr-precedence.stderr +++ b/tests/ui/deprecation/deprecated-expr-precedence.stderr @@ -1,3 +1,13 @@ +warning: `#[deprecated]` attribute cannot be used on expressions + --> $DIR/deprecated-expr-precedence.rs:6:5 + | +LL | #[deprecated] 0 + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, unions, and use statements + = note: requested on the command line with `-W unused-attributes` + error[E0308]: mismatched types --> $DIR/deprecated-expr-precedence.rs:6:19 | @@ -6,6 +16,6 @@ LL | pub fn public() { LL | #[deprecated] 0 | ^ expected `()`, found integer -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/empty/empty-macro-use.rs b/tests/ui/empty/empty-macro-use.rs index 8f5ea7df3bd1..fadc653be74e 100644 --- a/tests/ui/empty/empty-macro-use.rs +++ b/tests/ui/empty/empty-macro-use.rs @@ -1,6 +1,7 @@ //@ aux-build:two_macros.rs #[macro_use()] +//~^ WARN unused attribute extern crate two_macros; pub fn main() { diff --git a/tests/ui/empty/empty-macro-use.stderr b/tests/ui/empty/empty-macro-use.stderr index cdf3ff83cc38..0b23dd4e1721 100644 --- a/tests/ui/empty/empty-macro-use.stderr +++ b/tests/ui/empty/empty-macro-use.stderr @@ -1,5 +1,5 @@ error: cannot find macro `macro_two` in this scope - --> $DIR/empty-macro-use.rs:7:5 + --> $DIR/empty-macro-use.rs:8:5 | LL | macro_two!(); | ^^^^^^^^^ @@ -9,5 +9,14 @@ help: consider importing this macro LL + use two_macros::macro_two; | -error: aborting due to 1 previous error +warning: unused attribute + --> $DIR/empty-macro-use.rs:3:12 + | +LL | #[macro_use()] + | ^^ help: remove these parentheses + | + = note: using `macro_use` with an empty list is equivalent to not using a list at all + = note: requested on the command line with `-W unused-attributes` + +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index 4bea4487f16a..0b0dd80f0115 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs @@ -16,15 +16,23 @@ //~| NOTE: the `#[rustc_main]` attribute is used internally to specify test entry point function #![repr()] //~^ ERROR: `repr` attribute cannot be used at crate level +//~| WARN unused attribute +//~| NOTE empty list has no effect #![path = "3800"] //~^ ERROR: attribute cannot be used on #![automatically_derived] //~^ ERROR: attribute cannot be used on #![no_mangle] +//~^ WARN may not be used in combination with `#[export_name]` +//~| NOTE is ignored +//~| NOTE requested on the command line +//~| WARN cannot be used on crates +//~| WARN previously accepted #![no_link] //~^ ERROR: attribute should be applied to an `extern crate` item #![export_name = "2200"] //~^ ERROR: attribute cannot be used on +//~| NOTE takes precedence #![inline] //~^ ERROR: attribute cannot be used on #[inline] diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index 8091b0b28e62..013e52923811 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -25,7 +25,7 @@ LL | #![rustc_main] = help: `#[rustc_main]` can only be applied to functions error: `#[path]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1 | LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | #![path = "3800"] = help: `#[path]` can only be applied to modules error: `#[automatically_derived]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:23:1 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | #![automatically_derived] = help: `#[automatically_derived]` can only be applied to trait impl blocks error: `#[export_name]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:26:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:33:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | #![export_name = "2200"] = help: `#[export_name]` can be applied to functions and statics error: `#[inline]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:1 | LL | #![inline] | ^^^^^^^^^^ @@ -57,7 +57,7 @@ LL | #![inline] = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:38:1 | LL | #[inline] | ^^^^^^^^^ @@ -65,7 +65,7 @@ LL | #[inline] = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:35:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:17 | LL | mod inner { #![inline] } | ^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | mod inner { #![inline] } = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:44:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5 | LL | #[inline] struct S; | ^^^^^^^^^ @@ -81,7 +81,7 @@ LL | #[inline] struct S; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:47:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:55:5 | LL | #[inline] type T = S; | ^^^^^^^^^ @@ -89,7 +89,7 @@ LL | #[inline] type T = S; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:58:5 | LL | #[inline] impl S { } | ^^^^^^^^^ @@ -97,7 +97,7 @@ LL | #[inline] impl S { } = help: `#[inline]` can only be applied to functions error: `#[export_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:80:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:88:1 | LL | #[export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -105,7 +105,7 @@ LL | #[export_name = "2200"] = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:83:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:17 | LL | mod inner { #![export_name="2200"] } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -113,7 +113,7 @@ LL | mod inner { #![export_name="2200"] } = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:88:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5 | LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | #[export_name = "2200"] struct S; = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:99:5 | LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | #[export_name = "2200"] type T = S; = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:94:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:5 | LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -137,7 +137,7 @@ LL | #[export_name = "2200"] impl S { } = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:98:9 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:9 | LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | #[export_name = "2200"] fn foo(); = help: `#[export_name]` can be applied to functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:62:1 | LL | #[no_link] | ^^^^^^^^^^ @@ -159,7 +159,7 @@ LL | | } | |_- not an `extern crate` item error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:105:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:113:8 | LL | #[repr(C)] | ^ @@ -172,7 +172,7 @@ LL | | } | |_- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:129:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:8 | LL | #[repr(Rust)] | ^^^^ @@ -185,11 +185,28 @@ LL | | } | |_- not a struct, enum, or union error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:24:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:31:1 | LL | #![no_link] | ^^^^^^^^^^^ not an `extern crate` item +warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:25:1 + | +LL | #![no_mangle] + | ^^^^^^^^^^^^^ `#[no_mangle]` is ignored + | +note: `#[export_name]` takes precedence + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:33:1 + | +LL | #![export_name = "2200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: requested on the command line with `-W unused-attributes` +help: remove the `#[no_mangle]` attribute + | +LL - #![no_mangle] + | + error: `repr` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 | @@ -206,85 +223,85 @@ LL + #[repr()] | error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:67:17 | LL | mod inner { #![no_link] } | ------------^^^^^^^^^^^-- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:63:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:71:5 | LL | #[no_link] fn f() { } | ^^^^^^^^^^ ---------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:67:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:5 | LL | #[no_link] struct S; | ^^^^^^^^^^ --------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:71:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:79:5 | LL | #[no_link]type T = S; | ^^^^^^^^^^----------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:83:5 | LL | #[no_link] impl S { } | ^^^^^^^^^^ ---------- not an `extern crate` item error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:117:25 | LL | mod inner { #![repr(C)] } | --------------------^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:113:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:121:12 | LL | #[repr(C)] fn f() { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:12 | LL | #[repr(C)] type T = S; | ^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:123:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:131:12 | LL | #[repr(C)] impl S { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:25 | LL | mod inner { #![repr(Rust)] } | --------------------^^^^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12 | LL | #[repr(Rust)] fn f() { } | ^^^^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12 | LL | #[repr(Rust)] type T = S; | ^^^^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12 | LL | #[repr(Rust)] impl S { } | ^^^^ ---------- not a struct, enum, or union error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:38:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ @@ -293,13 +310,30 @@ LL | #[inline = "2100"] fn f() { } = note: for more information, see issue #57571 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default -error: aborting due to 37 previous errors +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 + | +LL | #![repr()] + | ^^^^^^^^^^ help: remove this attribute + | + = note: using `repr` with an empty list has no effect + +warning: `#[no_mangle]` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:25:1 + | +LL | #![no_mangle] + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +error: aborting due to 37 previous errors; 3 warnings emitted Some errors have detailed explanations: E0517, E0658. For more information about an error, try `rustc --explain E0517`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:38:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs index 0438152ff35f..67959a318297 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs @@ -14,12 +14,20 @@ mod macro_escape { #[macro_use = "2700"] struct S; //~^ ERROR valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` + //~| WARN cannot be used on + //~| WARN previously accepted #[macro_use] fn f() { } + //~^ WARN cannot be used on + //~| WARN previously accepted #[macro_use] type T = S; + //~^ WARN cannot be used on + //~| WARN previously accepted #[macro_use] impl S { } + //~^ WARN cannot be used on + //~| WARN previously accepted } fn main() { } diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr index 4da717668379..5be17e96fb15 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr @@ -22,5 +22,42 @@ error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and ` LL | #[macro_use = "2700"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +warning: `#[macro_use]` attribute cannot be used on structs + --> $DIR/issue-43106-gating-of-macro_use.rs:15:5 + | +LL | #[macro_use = "2700"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[macro_use]` can be applied to crates, extern crates, and modules + = note: requested on the command line with `-W unused-attributes` + +warning: `#[macro_use]` attribute cannot be used on functions + --> $DIR/issue-43106-gating-of-macro_use.rs:20:5 + | +LL | #[macro_use] fn f() { } + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[macro_use]` can be applied to crates, extern crates, and modules + +warning: `#[macro_use]` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-macro_use.rs:24:5 + | +LL | #[macro_use] type T = S; + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[macro_use]` can be applied to crates, extern crates, and modules + +warning: `#[macro_use]` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-macro_use.rs:28:5 + | +LL | #[macro_use] impl S { } + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[macro_use]` can be applied to crates, extern crates, and modules + +error: aborting due to 4 previous errors; 4 warnings emitted diff --git a/tests/ui/ffi/extern-static-mut-slice-54410.rs b/tests/ui/ffi/extern-static-mut-slice-54410.rs new file mode 100644 index 000000000000..0c967229bde2 --- /dev/null +++ b/tests/ui/ffi/extern-static-mut-slice-54410.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/54410 +extern "C" { + pub static mut symbol: [i8]; + //~^ ERROR the size for values of type `[i8]` cannot be known at compilation time +} + +fn main() { + println!("{:p}", unsafe { &symbol }); +} diff --git a/tests/ui/ffi/extern-static-mut-slice-54410.stderr b/tests/ui/ffi/extern-static-mut-slice-54410.stderr new file mode 100644 index 000000000000..73368366dc5c --- /dev/null +++ b/tests/ui/ffi/extern-static-mut-slice-54410.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `[i8]` cannot be known at compilation time + --> $DIR/extern-static-mut-slice-54410.rs:3:5 + | +LL | pub static mut symbol: [i8]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i8]` + = note: statics and constants must have a statically known size + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-70381.rs b/tests/ui/fmt/unicode-format-string-missing-parameter-70381.rs similarity index 76% rename from tests/ui/issues/issue-70381.rs rename to tests/ui/fmt/unicode-format-string-missing-parameter-70381.rs index 3df8277b8737..fad2fd884a80 100644 --- a/tests/ui/issues/issue-70381.rs +++ b/tests/ui/fmt/unicode-format-string-missing-parameter-70381.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/70381 // Test that multi-byte unicode characters with missing parameters do not ICE. fn main() { diff --git a/tests/ui/issues/issue-70381.stderr b/tests/ui/fmt/unicode-format-string-missing-parameter-70381.stderr similarity index 72% rename from tests/ui/issues/issue-70381.stderr rename to tests/ui/fmt/unicode-format-string-missing-parameter-70381.stderr index 298a1cf9e0d5..cfcff0e5582c 100644 --- a/tests/ui/issues/issue-70381.stderr +++ b/tests/ui/fmt/unicode-format-string-missing-parameter-70381.stderr @@ -1,5 +1,5 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/issue-70381.rs:4:16 + --> $DIR/unicode-format-string-missing-parameter-70381.rs:5:16 | LL | println!("\r¡{}") | ^^ diff --git a/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.rs b/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.rs new file mode 100644 index 000000000000..d1a4e09243ec --- /dev/null +++ b/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/60218 +// Regression test for #60218 +// +// This was reported to cause ICEs. + +use std::iter::Map; + +pub trait Foo {} + +pub fn trigger_error(iterable: I, functor: F) +where + for<'t> &'t I: IntoIterator, +for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator, +for<'t> ::IntoIter, F> as Iterator>::Item: Foo, +{ +} + +fn main() { + trigger_error(vec![], |x: &u32| x) //~ ERROR E0277 +} diff --git a/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.stderr b/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.stderr new file mode 100644 index 000000000000..4c403bcbd601 --- /dev/null +++ b/tests/ui/higher-ranked-trait-bounds/higher-trait-bounds-ice-60218.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `&u32: Foo` is not satisfied + --> $DIR/higher-trait-bounds-ice-60218.rs:19:19 + | +LL | trigger_error(vec![], |x: &u32| x) + | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` + | | + | required by a bound introduced by this call + | +help: this trait has no implementations, consider adding one + --> $DIR/higher-trait-bounds-ice-60218.rs:8:1 + | +LL | pub trait Foo {} + | ^^^^^^^^^^^^^ +note: required by a bound in `trigger_error` + --> $DIR/higher-trait-bounds-ice-60218.rs:14:72 + | +LL | pub fn trigger_error(iterable: I, functor: F) + | ------------- required by a bound in this function +... +LL | for<'t> ::IntoIter, F> as Iterator>::Item: Foo, + | ^^^ required by this bound in `trigger_error` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs b/tests/ui/instrument-coverage/msvc-link-dead-code-inline-always-85461.rs similarity index 100% rename from tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs rename to tests/ui/instrument-coverage/msvc-link-dead-code-inline-always-85461.rs diff --git a/tests/ui/internal/internal-unstable.rs b/tests/ui/internal/internal-unstable.rs index 381c1337148c..5564852e9888 100644 --- a/tests/ui/internal/internal-unstable.rs +++ b/tests/ui/internal/internal-unstable.rs @@ -8,6 +8,8 @@ extern crate internal_unstable; struct Baz { #[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names + //~^ WARN cannot be used on + //~| WARN previously accepted baz: u8, } @@ -57,6 +59,8 @@ fn main() { match true { #[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names + //~^ WARN cannot be used on + //~| WARN previously accepted _ => {} } diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr index bbf589d3f926..192ecdfd0891 100644 --- a/tests/ui/internal/internal-unstable.stderr +++ b/tests/ui/internal/internal-unstable.stderr @@ -5,13 +5,13 @@ LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `allow_internal_unstable` expects a list of feature names - --> $DIR/internal-unstable.rs:59:9 + --> $DIR/internal-unstable.rs:61:9 | LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: use of unstable library feature `function` - --> $DIR/internal-unstable.rs:48:25 + --> $DIR/internal-unstable.rs:50:25 | LL | pass_through_allow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | pass_through_allow!(internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `function` - --> $DIR/internal-unstable.rs:50:27 + --> $DIR/internal-unstable.rs:52:27 | LL | pass_through_noallow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | pass_through_noallow!(internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `function` - --> $DIR/internal-unstable.rs:54:22 + --> $DIR/internal-unstable.rs:56:22 | LL | println!("{:?}", internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | println!("{:?}", internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `function` - --> $DIR/internal-unstable.rs:56:10 + --> $DIR/internal-unstable.rs:58:10 | LL | bar!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | bar!(internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `function` - --> $DIR/internal-unstable.rs:18:9 + --> $DIR/internal-unstable.rs:20:9 | LL | internal_unstable::unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,6 +59,25 @@ LL | bar!(internal_unstable::unstable()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 7 previous errors +warning: `#[allow_internal_unstable]` attribute cannot be used on struct fields + --> $DIR/internal-unstable.rs:10:5 + | +LL | #[allow_internal_unstable] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[allow_internal_unstable]` can be applied to functions and macro defs + = note: requested on the command line with `-W unused-attributes` + +warning: `#[allow_internal_unstable]` attribute cannot be used on match arms + --> $DIR/internal-unstable.rs:61:9 + | +LL | #[allow_internal_unstable] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[allow_internal_unstable]` can be applied to functions and macro defs + +error: aborting due to 7 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-72278.rs b/tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.rs similarity index 73% rename from tests/ui/issues/issue-72278.rs rename to tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.rs index 2a9cd9423915..81e4d3e7043b 100644 --- a/tests/ui/issues/issue-72278.rs +++ b/tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/72278 +// and https://github.com/rust-lang/rust/issues/42868 //@ run-pass #![allow(unused)] diff --git a/tests/ui/issues/issue-72278.stderr b/tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.stderr similarity index 90% rename from tests/ui/issues/issue-72278.stderr rename to tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.stderr index 91efada3d8d1..cffdf0df83cc 100644 --- a/tests/ui/issues/issue-72278.stderr +++ b/tests/ui/lifetimes/late-bound-lifetime-arguments-warning-72278.stderr @@ -1,5 +1,5 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/issue-72278.rs:14:14 + --> $DIR/late-bound-lifetime-arguments-warning-72278.rs:16:14 | LL | fn func<'a, U>(&'a self) -> U { | -- the late bound lifetime parameter is introduced here diff --git a/tests/ui/lint/empty-lint-attributes.rs b/tests/ui/lint/empty-lint-attributes.rs index 0193345e5c8c..4f550eae0636 100644 --- a/tests/ui/lint/empty-lint-attributes.rs +++ b/tests/ui/lint/empty-lint-attributes.rs @@ -3,13 +3,13 @@ // Empty (and reason-only) lint attributes are legal—although we may want to // lint them in the future (Issue #55112). -#![allow()] -#![warn(reason = "observationalism")] +#![allow()] //~ WARN unused attribute +#![warn(reason = "observationalism")] //~ WARN unused attribute -#[forbid()] +#[forbid()] //~ WARN unused attribute fn devoir() {} -#[deny(reason = "ultion")] +#[deny(reason = "ultion")] //~ WARN unused attribute fn waldgrave() {} fn main() {} diff --git a/tests/ui/lint/empty-lint-attributes.stderr b/tests/ui/lint/empty-lint-attributes.stderr new file mode 100644 index 000000000000..5bf8ae1e9ee7 --- /dev/null +++ b/tests/ui/lint/empty-lint-attributes.stderr @@ -0,0 +1,35 @@ +warning: unused attribute + --> $DIR/empty-lint-attributes.rs:9:1 + | +LL | #[forbid()] + | ^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `forbid` with an empty list has no effect + = note: requested on the command line with `-W unused-attributes` + +warning: unused attribute + --> $DIR/empty-lint-attributes.rs:12:1 + | +LL | #[deny(reason = "ultion")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `deny` without any lints has no effect + +warning: unused attribute + --> $DIR/empty-lint-attributes.rs:6:1 + | +LL | #![allow()] + | ^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `allow` with an empty list has no effect + +warning: unused attribute + --> $DIR/empty-lint-attributes.rs:7:1 + | +LL | #![warn(reason = "observationalism")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `warn` without any lints has no effect + +warning: 4 warnings emitted + diff --git a/tests/ui/lint/fn_must_use.rs b/tests/ui/lint/fn_must_use.rs index be18ffedabb1..b0f7a12cec70 100644 --- a/tests/ui/lint/fn_must_use.rs +++ b/tests/ui/lint/fn_must_use.rs @@ -39,6 +39,8 @@ impl Replaceable for MyStruct { // method won't work; the attribute should be on the method signature in // the trait's definition. #[must_use] + //~^ WARN attribute cannot be used on trait methods in impl blocks + //~| WARN previously accepted fn replace(&mut self, substitute: usize) -> usize { let previously = self.n; self.n = substitute; diff --git a/tests/ui/lint/fn_must_use.stderr b/tests/ui/lint/fn_must_use.stderr index e88c1a9b8a9b..0e8da873e7c3 100644 --- a/tests/ui/lint/fn_must_use.stderr +++ b/tests/ui/lint/fn_must_use.stderr @@ -1,5 +1,15 @@ +warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks + --> $DIR/fn_must_use.rs:41:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions + = note: requested on the command line with `-W unused-attributes` + warning: unused return value of `need_to_use_this_value` that must be used - --> $DIR/fn_must_use.rs:55:5 + --> $DIR/fn_must_use.rs:57:5 | LL | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +26,7 @@ LL | let _ = need_to_use_this_value(); | +++++++ warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used - --> $DIR/fn_must_use.rs:60:5 + --> $DIR/fn_must_use.rs:62:5 | LL | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +37,7 @@ LL | let _ = m.need_to_use_this_method_value(); | +++++++ warning: unused return value of `EvenNature::is_even` that must be used - --> $DIR/fn_must_use.rs:61:5 + --> $DIR/fn_must_use.rs:63:5 | LL | m.is_even(); // trait method! | ^^^^^^^^^^^ @@ -39,7 +49,7 @@ LL | let _ = m.is_even(); // trait method! | +++++++ warning: unused return value of `MyStruct::need_to_use_this_associated_function_value` that must be used - --> $DIR/fn_must_use.rs:64:5 + --> $DIR/fn_must_use.rs:66:5 | LL | MyStruct::need_to_use_this_associated_function_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +60,7 @@ LL | let _ = MyStruct::need_to_use_this_associated_function_value(); | +++++++ warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:70:5 + --> $DIR/fn_must_use.rs:72:5 | LL | 2.eq(&3); | ^^^^^^^^ @@ -61,7 +71,7 @@ LL | let _ = 2.eq(&3); | +++++++ warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:71:5 + --> $DIR/fn_must_use.rs:73:5 | LL | m.eq(&n); | ^^^^^^^^ @@ -72,7 +82,7 @@ LL | let _ = m.eq(&n); | +++++++ warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:74:5 + --> $DIR/fn_must_use.rs:76:5 | LL | 2 == 3; | ^^^^^^ the comparison produces a value @@ -83,7 +93,7 @@ LL | let _ = 2 == 3; | +++++++ warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:75:5 + --> $DIR/fn_must_use.rs:77:5 | LL | m == n; | ^^^^^^ the comparison produces a value @@ -93,5 +103,5 @@ help: use `let _ = ...` to ignore the resulting value LL | let _ = m == n; | +++++++ -warning: 8 warnings emitted +warning: 9 warnings emitted diff --git a/tests/ui/lint/forbid-error-capped.rs b/tests/ui/lint/forbid-error-capped.rs index f5059793eddf..e458ddf90746 100644 --- a/tests/ui/lint/forbid-error-capped.rs +++ b/tests/ui/lint/forbid-error-capped.rs @@ -6,6 +6,8 @@ #![forbid(warnings)] #![allow(unused)] +//~^ WARN allow(unused) incompatible with previous forbid +//~| WARN previously accepted #[allow(unused)] mod bar { diff --git a/tests/ui/lint/forbid-error-capped.stderr b/tests/ui/lint/forbid-error-capped.stderr new file mode 100644 index 000000000000..479e7b9412d5 --- /dev/null +++ b/tests/ui/lint/forbid-error-capped.stderr @@ -0,0 +1,27 @@ +warning: allow(unused) incompatible with previous forbid + --> $DIR/forbid-error-capped.rs:8:10 + | +LL | #![forbid(warnings)] + | -------- `forbid` level set here +LL | #![allow(unused)] + | ^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 + = note: `#[warn(forbidden_lint_groups)]` (part of `#[warn(future_incompatible)]`) on by default + +warning: 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +warning: allow(unused) incompatible with previous forbid + --> $DIR/forbid-error-capped.rs:8:10 + | +LL | #![forbid(warnings)] + | -------- `forbid` level set here +LL | #![allow(unused)] + | ^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 + = note: `#[warn(forbidden_lint_groups)]` (part of `#[warn(future_incompatible)]`) on by default + diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs index 549f031cbf6a..c93c94ae84a9 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs @@ -23,7 +23,7 @@ pub fn check_expect_on_item() { pub fn check_expect_on_macro() { // This should be fulfilled by the macro - #[expect(unused_variables)] + #[expect(unused_variables)] //~ WARN unused attribute trigger_unused_variables_macro!(); // FIXME: Lint attributes currently don't work directly on macros, and diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr index b09270d94ba3..f0ee27a99151 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr @@ -1,3 +1,16 @@ +warning: unused attribute `expect` + --> $DIR/expect_lint_from_macro.rs:26:5 + | +LL | #[expect(unused_variables)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the built-in attribute `expect` will be ignored, since it's applied to the macro invocation `trigger_unused_variables_macro` + --> $DIR/expect_lint_from_macro.rs:27:5 + | +LL | trigger_unused_variables_macro!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: requested on the command line with `-W unused-attributes` + warning: unused variable: `x` --> $DIR/expect_lint_from_macro.rs:7:13 | @@ -41,5 +54,5 @@ LL | trigger_unused_variables_macro!(); | --------------------------------- in this macro invocation = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 2 warnings emitted +warning: 3 warnings emitted diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs index 33efdb3f08d3..28c2a2c33abe 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs @@ -48,4 +48,5 @@ fn main() { // This `#[allow]` does not work, since the attribute gets dropped // when we expand the macro let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work); + //~^ WARN unused attribute } diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr index ea72ef84b9da..0f3a5d7ba547 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr @@ -31,6 +31,19 @@ LL | let _ = foo!(warn_in_expr); = note: for more information, see issue #79813 = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) +warning: unused attribute `allow` + --> $DIR/semicolon-in-expressions-from-macros.rs:50:13 + | +LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo` + --> $DIR/semicolon-in-expressions-from-macros.rs:50:60 + | +LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work); + | ^^^ + = note: requested on the command line with `-W unused-attributes` + warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | @@ -44,7 +57,7 @@ LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_ = note: for more information, see issue #79813 = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 3 warnings emitted +warning: 4 warnings emitted Future incompatibility report: Future breakage diagnostic: warning: trailing semicolon in macro used in expression position diff --git a/tests/ui/malformed/malformed-regressions.rs b/tests/ui/malformed/malformed-regressions.rs index 407920c4e4ec..c0f8c0d15bb8 100644 --- a/tests/ui/malformed/malformed-regressions.rs +++ b/tests/ui/malformed/malformed-regressions.rs @@ -5,6 +5,8 @@ #[inline = ""] //~ ERROR valid forms for the attribute are //~^ WARN this was previously accepted #[link] //~ ERROR malformed +//~^ WARN attribute should be applied to an `extern` block with non-Rust ABI +//~| WARN previously accepted #[link = ""] //~ ERROR malformed fn main() {} diff --git a/tests/ui/malformed/malformed-regressions.stderr b/tests/ui/malformed/malformed-regressions.stderr index 850bcb6cbc2d..181207984877 100644 --- a/tests/ui/malformed/malformed-regressions.stderr +++ b/tests/ui/malformed/malformed-regressions.stderr @@ -29,7 +29,7 @@ LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", = and 1 other candidate error[E0539]: malformed `link` attribute input - --> $DIR/malformed-regressions.rs:8:1 + --> $DIR/malformed-regressions.rs:10:1 | LL | #[link = ""] | ^^^^^^^^^^^^ expected this to be a list @@ -51,6 +51,18 @@ LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", | = and 1 other candidate +warning: attribute should be applied to an `extern` block with non-Rust ABI + --> $DIR/malformed-regressions.rs:7:1 + | +LL | #[link] + | ^^^^^^^ +... +LL | fn main() {} + | ------------ not an `extern` block + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: requested on the command line with `-W unused-attributes` + error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` --> $DIR/malformed-regressions.rs:3:1 | @@ -69,7 +81,7 @@ LL | #[inline = ""] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57571 -error: aborting due to 5 previous errors +error: aborting due to 5 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0539`. Future incompatibility report: Future breakage diagnostic: diff --git a/tests/ui/mir/mir-cfg-unpretty-check-81918.rs b/tests/ui/mir/mir-cfg-unpretty-no-panic-81918.rs similarity index 100% rename from tests/ui/mir/mir-cfg-unpretty-check-81918.rs rename to tests/ui/mir/mir-cfg-unpretty-no-panic-81918.rs diff --git a/tests/ui/parser/inner-attr.rs b/tests/ui/parser/inner-attr.rs index 1b405e20e038..e66227c3d2b9 100644 --- a/tests/ui/parser/inner-attr.rs +++ b/tests/ui/parser/inner-attr.rs @@ -1,4 +1,4 @@ -#[feature(lang_items)] +#[feature(lang_items)] //~ WARN crate-level attribute should be an inner attribute #![recursion_limit="100"] //~ ERROR an inner attribute is not permitted following an outer attribute fn main() {} diff --git a/tests/ui/parser/inner-attr.stderr b/tests/ui/parser/inner-attr.stderr index 18a82ea4c385..3fb2d60ee5b6 100644 --- a/tests/ui/parser/inner-attr.stderr +++ b/tests/ui/parser/inner-attr.stderr @@ -11,5 +11,17 @@ LL | fn main() {} | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -error: aborting due to 1 previous error +warning: crate-level attribute should be an inner attribute + --> $DIR/inner-attr.rs:1:1 + | +LL | #[feature(lang_items)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-W unused-attributes` +help: add a `!` + | +LL | #![feature(lang_items)] + | + + +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/pin/pin-deref-target-partial-eq-67039.rs b/tests/ui/pin/pin-deref-target-partial-eq-67039.rs new file mode 100644 index 000000000000..541960012bd3 --- /dev/null +++ b/tests/ui/pin/pin-deref-target-partial-eq-67039.rs @@ -0,0 +1,28 @@ +// https://github.com/rust-lang/rust/issues/67039 +// Pin's PartialEq implementation allowed to access the pointer allowing for +// unsoundness by using Rc::get_mut to move value within Rc. +// See https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73 for more details. + +use std::ops::Deref; +use std::pin::Pin; +use std::rc::Rc; + +struct Apple; + +impl Deref for Apple { + type Target = Apple; + fn deref(&self) -> &Apple { + &Apple + } +} + +impl PartialEq> for Apple { + fn eq(&self, _rc: &Rc) -> bool { + unreachable!() + } +} + +fn main() { + let _ = Pin::new(Apple) == Rc::pin(Apple); + //~^ ERROR type mismatch resolving +} diff --git a/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr b/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr new file mode 100644 index 000000000000..541656dd7437 --- /dev/null +++ b/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr @@ -0,0 +1,13 @@ +error[E0271]: type mismatch resolving ` as Deref>::Target == Rc` + --> $DIR/pin-deref-target-partial-eq-67039.rs:26:29 + | +LL | let _ = Pin::new(Apple) == Rc::pin(Apple); + | ^^ expected `Rc`, found `Apple` + | + = note: expected struct `Rc` + found struct `Apple` + = note: required for `Pin` to implement `PartialEq>>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed b/tests/ui/privacy/inaccessible-private-fields-76077.fixed similarity index 100% rename from tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed rename to tests/ui/privacy/inaccessible-private-fields-76077.fixed diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs b/tests/ui/privacy/inaccessible-private-fields-76077.rs similarity index 100% rename from tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs rename to tests/ui/privacy/inaccessible-private-fields-76077.rs diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr b/tests/ui/privacy/inaccessible-private-fields-76077.stderr similarity index 83% rename from tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr rename to tests/ui/privacy/inaccessible-private-fields-76077.stderr index 070fa1a53a54..7b9f49592076 100644 --- a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr +++ b/tests/ui/privacy/inaccessible-private-fields-76077.stderr @@ -1,5 +1,5 @@ error: pattern requires `..` due to inaccessible fields - --> $DIR/inaccessible-fields-pattern-matching-76077.rs:14:9 + --> $DIR/inaccessible-private-fields-76077.rs:14:9 | LL | let foo::Foo {} = foo::Foo::default(); | ^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | let foo::Foo { .. } = foo::Foo::default(); | ++ error: pattern requires `..` due to inaccessible fields - --> $DIR/inaccessible-fields-pattern-matching-76077.rs:17:9 + --> $DIR/inaccessible-private-fields-76077.rs:17:9 | LL | let foo::Bar { visible } = foo::Bar::default(); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/attributes-on-modules-fail.rs b/tests/ui/proc-macro/attributes-on-modules-fail.rs index 80300b47c5fc..59da87a1dde1 100644 --- a/tests/ui/proc-macro/attributes-on-modules-fail.rs +++ b/tests/ui/proc-macro/attributes-on-modules-fail.rs @@ -17,11 +17,11 @@ type A = X; //~ ERROR cannot find type `X` in this scope mod n {} #[empty_attr] -mod module; //~ ERROR non-inline modules in proc macro input are unstable +mod module; //~ ERROR file modules in proc macro input are unstable #[empty_attr] mod outer { - mod inner; //~ ERROR non-inline modules in proc macro input are unstable + mod inner; //~ ERROR file modules in proc macro input are unstable mod inner_inline {} // OK } @@ -30,16 +30,16 @@ mod outer { struct S { field: [u8; { #[path = "outer/inner.rs"] - mod inner; //~ ERROR non-inline modules in proc macro input are unstable + mod inner; //~ ERROR file modules in proc macro input are unstable mod inner_inline {} // OK 0 - }] + }], } #[identity_attr] fn f() { #[path = "outer/inner.rs"] - mod inner; //~ ERROR non-inline modules in proc macro input are unstable + mod inner; //~ ERROR file modules in proc macro input are unstable mod inner_inline {} // OK } diff --git a/tests/ui/proc-macro/attributes-on-modules-fail.stderr b/tests/ui/proc-macro/attributes-on-modules-fail.stderr index e69ab7872386..26b20a3ee6cb 100644 --- a/tests/ui/proc-macro/attributes-on-modules-fail.stderr +++ b/tests/ui/proc-macro/attributes-on-modules-fail.stderr @@ -6,7 +6,7 @@ LL | #[derive(Copy)] LL | mod n {} | -------- not a `struct`, `enum` or `union` -error[E0658]: non-inline modules in proc macro input are unstable +error[E0658]: file modules in proc macro input are unstable --> $DIR/attributes-on-modules-fail.rs:20:1 | LL | mod module; @@ -16,7 +16,7 @@ LL | mod module; = help: add `#![feature(proc_macro_hygiene)]` 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[E0658]: non-inline modules in proc macro input are unstable +error[E0658]: file modules in proc macro input are unstable --> $DIR/attributes-on-modules-fail.rs:24:5 | LL | mod inner; @@ -26,7 +26,7 @@ LL | mod inner; = help: add `#![feature(proc_macro_hygiene)]` 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[E0658]: non-inline modules in proc macro input are unstable +error[E0658]: file modules in proc macro input are unstable --> $DIR/attributes-on-modules-fail.rs:33:9 | LL | mod inner; @@ -36,7 +36,7 @@ LL | mod inner; = help: add `#![feature(proc_macro_hygiene)]` 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[E0658]: non-inline modules in proc macro input are unstable +error[E0658]: file modules in proc macro input are unstable --> $DIR/attributes-on-modules-fail.rs:42:5 | LL | mod inner; diff --git a/tests/ui/proc-macro/cfg-eval.rs b/tests/ui/proc-macro/cfg-eval.rs index ddf370805960..9e9e46912588 100644 --- a/tests/ui/proc-macro/cfg-eval.rs +++ b/tests/ui/proc-macro/cfg-eval.rs @@ -19,7 +19,7 @@ struct S1 { field_false: u8, #[cfg(all(/*true*/))] #[cfg_attr(FALSE, unknown_attr)] - #[cfg_attr(all(/*true*/), allow())] + #[cfg_attr(all(/*true*/), allow())] //~ WARN unused attribute field_true: u8, } diff --git a/tests/ui/proc-macro/cfg-eval.stderr b/tests/ui/proc-macro/cfg-eval.stderr new file mode 100644 index 000000000000..1429dbde7bfc --- /dev/null +++ b/tests/ui/proc-macro/cfg-eval.stderr @@ -0,0 +1,11 @@ +warning: unused attribute + --> $DIR/cfg-eval.rs:22:5 + | +LL | #[cfg_attr(all(/*true*/), allow())] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `allow` with an empty list has no effect + = note: requested on the command line with `-W unused-attributes` + +warning: 1 warning emitted + diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.rs b/tests/ui/proc-macro/inner-attr-file-mod.rs similarity index 86% rename from tests/ui/proc-macro/inner-attr-non-inline-mod.rs rename to tests/ui/proc-macro/inner-attr-file-mod.rs index 2dcdbf3c4022..e592331c2c6d 100644 --- a/tests/ui/proc-macro/inner-attr-non-inline-mod.rs +++ b/tests/ui/proc-macro/inner-attr-file-mod.rs @@ -9,7 +9,7 @@ extern crate test_macros; #[deny(unused_attributes)] mod module_with_attrs; -//~^ ERROR non-inline modules in proc macro input are unstable +//~^ ERROR file modules in proc macro input are unstable //~| ERROR custom inner attributes are unstable fn main() {} diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr b/tests/ui/proc-macro/inner-attr-file-mod.stderr similarity index 91% rename from tests/ui/proc-macro/inner-attr-non-inline-mod.stderr rename to tests/ui/proc-macro/inner-attr-file-mod.stderr index c0a9385f4c68..92262284a00c 100644 --- a/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr +++ b/tests/ui/proc-macro/inner-attr-file-mod.stderr @@ -18,8 +18,8 @@ LL | #![print_attr] = help: add `#![feature(custom_inner_attributes)]` 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[E0658]: non-inline modules in proc macro input are unstable - --> $DIR/inner-attr-non-inline-mod.rs:11:1 +error[E0658]: file modules in proc macro input are unstable + --> $DIR/inner-attr-file-mod.rs:11:1 | LL | mod module_with_attrs; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | mod module_with_attrs; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: custom inner attributes are unstable - --> $DIR/inner-attr-non-inline-mod.rs:11:1 + --> $DIR/inner-attr-file-mod.rs:11:1 | LL | mod module_with_attrs; | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout b/tests/ui/proc-macro/inner-attr-file-mod.stdout similarity index 59% rename from tests/ui/proc-macro/inner-attr-non-inline-mod.stdout rename to tests/ui/proc-macro/inner-attr-file-mod.stdout index 219794a8eb8c..6f893875657b 100644 --- a/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout +++ b/tests/ui/proc-macro/inner-attr-file-mod.stdout @@ -4,35 +4,35 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "deny", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "unused_attributes", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, ], - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, ], - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Ident { ident: "mod", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Ident { ident: "module_with_attrs", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Group { delimiter: Brace, @@ -40,38 +40,38 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "rustfmt", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Punct { ch: ':', spacing: Joint, - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, Ident { ident: "skip", - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, ], - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, ], - span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0), + span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0), }, ] diff --git a/tests/ui/repr/attr-usage-repr.rs b/tests/ui/repr/attr-usage-repr.rs index ca63ac564fc5..10256a7619e5 100644 --- a/tests/ui/repr/attr-usage-repr.rs +++ b/tests/ui/repr/attr-usage-repr.rs @@ -46,9 +46,11 @@ enum EInt { } #[repr()] //~ ERROR attribute should be applied to a struct, enum, or union [E0517] +//~^ WARN unused attribute type SirThisIsAType = i32; #[repr()] +//~^ WARN unused attribute struct EmptyReprArgumentList(i32); fn main() {} diff --git a/tests/ui/repr/attr-usage-repr.stderr b/tests/ui/repr/attr-usage-repr.stderr index a62992c597a2..33aa3c2f9f21 100644 --- a/tests/ui/repr/attr-usage-repr.stderr +++ b/tests/ui/repr/attr-usage-repr.stderr @@ -41,9 +41,27 @@ error[E0517]: attribute should be applied to a struct, enum, or union | LL | #[repr()] | ^^^^^^^^^ +LL | LL | type SirThisIsAType = i32; | -------------------------- not a struct, enum, or union -error: aborting due to 5 previous errors +warning: unused attribute + --> $DIR/attr-usage-repr.rs:48:1 + | +LL | #[repr()] + | ^^^^^^^^^ help: remove this attribute + | + = note: using `repr` with an empty list has no effect + = note: requested on the command line with `-W unused-attributes` + +warning: unused attribute + --> $DIR/attr-usage-repr.rs:52:1 + | +LL | #[repr()] + | ^^^^^^^^^ help: remove this attribute + | + = note: using `repr` with an empty list has no effect + +error: aborting due to 5 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/issues/auxiliary/issue-73112.rs b/tests/ui/repr/auxiliary/aux-73112.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-73112.rs rename to tests/ui/repr/auxiliary/aux-73112.rs diff --git a/tests/ui/issues/issue-74082.rs b/tests/ui/repr/invalid-repr-on-structs-74082.rs similarity index 79% rename from tests/ui/issues/issue-74082.rs rename to tests/ui/repr/invalid-repr-on-structs-74082.rs index e3e400c79d65..8b9807fad8ce 100644 --- a/tests/ui/issues/issue-74082.rs +++ b/tests/ui/repr/invalid-repr-on-structs-74082.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/74082 #![allow(dead_code)] #[repr(i128)] //~ ERROR: attribute should be applied to an enum diff --git a/tests/ui/issues/issue-74082.stderr b/tests/ui/repr/invalid-repr-on-structs-74082.stderr similarity index 80% rename from tests/ui/issues/issue-74082.stderr rename to tests/ui/repr/invalid-repr-on-structs-74082.stderr index 12f5a3b27bb3..e11beb811fbf 100644 --- a/tests/ui/issues/issue-74082.stderr +++ b/tests/ui/repr/invalid-repr-on-structs-74082.stderr @@ -1,5 +1,5 @@ error[E0517]: attribute should be applied to an enum - --> $DIR/issue-74082.rs:3:8 + --> $DIR/invalid-repr-on-structs-74082.rs:4:8 | LL | #[repr(i128)] | ^^^^ @@ -7,7 +7,7 @@ LL | struct Foo; | ----------- not an enum error[E0517]: attribute should be applied to an enum - --> $DIR/issue-74082.rs:6:8 + --> $DIR/invalid-repr-on-structs-74082.rs:7:8 | LL | #[repr(u128)] | ^^^^ diff --git a/tests/ui/issues/issue-73112.rs b/tests/ui/repr/packed-struct-contains-aligned-type-73112.rs similarity index 58% rename from tests/ui/issues/issue-73112.rs rename to tests/ui/repr/packed-struct-contains-aligned-type-73112.rs index 89075b756249..baeb75beb0aa 100644 --- a/tests/ui/issues/issue-73112.rs +++ b/tests/ui/repr/packed-struct-contains-aligned-type-73112.rs @@ -1,9 +1,10 @@ -//@ aux-build:issue-73112.rs +// https://github.com/rust-lang/rust/issues/73112 +//@ aux-build:aux-73112.rs -extern crate issue_73112; +extern crate aux_73112; fn main() { - use issue_73112::PageTable; + use aux_73112::PageTable; #[repr(C, packed)] struct SomeStruct { diff --git a/tests/ui/issues/issue-73112.stderr b/tests/ui/repr/packed-struct-contains-aligned-type-73112.stderr similarity index 78% rename from tests/ui/issues/issue-73112.stderr rename to tests/ui/repr/packed-struct-contains-aligned-type-73112.stderr index c2c15ca10ce2..237c357db22b 100644 --- a/tests/ui/issues/issue-73112.stderr +++ b/tests/ui/repr/packed-struct-contains-aligned-type-73112.stderr @@ -1,11 +1,11 @@ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type - --> $DIR/issue-73112.rs:9:5 + --> $DIR/packed-struct-contains-aligned-type-73112.rs:10:5 | LL | struct SomeStruct { | ^^^^^^^^^^^^^^^^^ | note: `PageTable` has a `#[repr(align)]` attribute - --> $DIR/auxiliary/issue-73112.rs:8:1 + --> $DIR/auxiliary/aux-73112.rs:8:1 | LL | pub struct PageTable { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-71406.rs b/tests/ui/resolve/function-module-ambiguity-error-71406.rs similarity index 74% rename from tests/ui/issues/issue-71406.rs rename to tests/ui/resolve/function-module-ambiguity-error-71406.rs index 6266112c3a86..a7964de9ba5e 100644 --- a/tests/ui/issues/issue-71406.rs +++ b/tests/ui/resolve/function-module-ambiguity-error-71406.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/71406 use std::sync::mpsc; fn main() { diff --git a/tests/ui/issues/issue-71406.stderr b/tests/ui/resolve/function-module-ambiguity-error-71406.stderr similarity index 85% rename from tests/ui/issues/issue-71406.stderr rename to tests/ui/resolve/function-module-ambiguity-error-71406.stderr index cd7921f550e5..c25bafa0a5dd 100644 --- a/tests/ui/issues/issue-71406.stderr +++ b/tests/ui/resolve/function-module-ambiguity-error-71406.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc` - --> $DIR/issue-71406.rs:4:26 + --> $DIR/function-module-ambiguity-error-71406.rs:5:26 | LL | let (tx, rx) = mpsc::channel::new(1); | ^^^^^^^ expected type, found function `channel` in `mpsc` diff --git a/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.rs b/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.rs index f003e40fa55f..053af255e041 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.rs @@ -2,6 +2,8 @@ // See https://github.com/rust-lang/rust/issues/95151 #[track_caller] +//~^ WARN attribute cannot be used on macro defs +//~| WARN previously accepted macro_rules! _foo { () => {}; } diff --git a/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.stderr b/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.stderr new file mode 100644 index 000000000000..0a0e49177551 --- /dev/null +++ b/tests/ui/rfcs/rfc-2091-track-caller/macro-declaration.stderr @@ -0,0 +1,12 @@ +warning: `#[track_caller]` attribute cannot be used on macro defs + --> $DIR/macro-declaration.rs:4:1 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[track_caller]` can only be applied to functions + = note: requested on the command line with `-W unused-attributes` + +warning: 1 warning emitted + diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs index 151659e35c0d..bb6e7705a29d 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs @@ -39,10 +39,14 @@ pub fn foo( //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Baz //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} struct SelfStruct {} @@ -59,10 +63,14 @@ impl SelfStruct { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} fn issue_64682_associated_fn( @@ -74,10 +82,14 @@ impl SelfStruct { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} } @@ -95,10 +107,14 @@ impl RefStruct { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} } trait RefTrait { @@ -114,10 +130,14 @@ trait RefTrait { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} fn issue_64682_associated_fn( @@ -129,10 +149,14 @@ trait RefTrait { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} } @@ -149,10 +173,14 @@ impl RefTrait for RefStruct { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Qux //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted ) {} } @@ -166,9 +194,13 @@ fn main() { //~^ ERROR documentation comments cannot be applied to function #[must_use] //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted /// Baz //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32 //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~| WARN attribute cannot be used on + //~| WARN previously accepted | {}; } diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr index 7573e39d8eb0..cc08307a18d0 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr @@ -17,31 +17,25 @@ LL | #[test] a: u32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:56:11 + --> $DIR/param-attrs-builtin-attrs.rs:60:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:71:11 + --> $DIR/param-attrs-builtin-attrs.rs:79:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:92:11 + --> $DIR/param-attrs-builtin-attrs.rs:104:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:111:11 - | -LL | #[test] a: i32, - | ^^^^ not a non-macro attribute - -error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:126:11 + --> $DIR/param-attrs-builtin-attrs.rs:127:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute @@ -53,7 +47,13 @@ LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:163:11 + --> $DIR/param-attrs-builtin-attrs.rs:170:11 + | +LL | #[test] a: i32, + | ^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:191:11 | LL | #[test] a: u32, | ^^^^ not a non-macro attribute @@ -137,195 +137,159 @@ LL | #[must_use] | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:42:5 + --> $DIR/param-attrs-builtin-attrs.rs:44:5 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:44:5 + --> $DIR/param-attrs-builtin-attrs.rs:46:5 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:51:9 + --> $DIR/param-attrs-builtin-attrs.rs:55:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:54:9 - | -LL | /// Bar - | ^^^^^^^ doc comments are not allowed here - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:58:9 | -LL | /// Baz +LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:60:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:62:9 | -LL | /// Qux +LL | /// Baz | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters --> $DIR/param-attrs-builtin-attrs.rs:64:9 | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ +LL | #[must_use] + | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:69:9 + --> $DIR/param-attrs-builtin-attrs.rs:68:9 | -LL | /// Foo - | ^^^^^^^ doc comments are not allowed here - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:73:9 - | -LL | /// Baz +LL | /// Qux | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:75:9 + --> $DIR/param-attrs-builtin-attrs.rs:70:9 | -LL | #[must_use] - | ^^^^^^^^^^^ +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:77:9 | -LL | /// Qux +LL | /// Foo + | ^^^^^^^ doc comments are not allowed here + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:81:9 + | +LL | /// Baz | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:79:9 + --> $DIR/param-attrs-builtin-attrs.rs:83:9 | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ +LL | #[must_use] + | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:87:9 | -LL | /// Foo - | ^^^^^^^ doc comments are not allowed here - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:90:9 - | -LL | /// Bar - | ^^^^^^^ doc comments are not allowed here - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:94:9 - | -LL | /// Baz - | ^^^^^^^ doc comments are not allowed here - -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:96:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:98:9 - | LL | /// Qux | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:100:9 + --> $DIR/param-attrs-builtin-attrs.rs:89:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:99:9 + | +LL | /// Foo + | ^^^^^^^ doc comments are not allowed here + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:102:9 + | +LL | /// Bar + | ^^^^^^^ doc comments are not allowed here + error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:106:9 | +LL | /// Baz + | ^^^^^^^ doc comments are not allowed here + +error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/param-attrs-builtin-attrs.rs:108:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:112:9 + | +LL | /// Qux + | ^^^^^^^ doc comments are not allowed here + +error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/param-attrs-builtin-attrs.rs:114:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:122:9 + | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:109:9 + --> $DIR/param-attrs-builtin-attrs.rs:125:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:113:9 + --> $DIR/param-attrs-builtin-attrs.rs:129:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:115:9 + --> $DIR/param-attrs-builtin-attrs.rs:131:9 | LL | #[must_use] | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:117:9 + --> $DIR/param-attrs-builtin-attrs.rs:135:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:119:9 + --> $DIR/param-attrs-builtin-attrs.rs:137:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:124:9 - | -LL | /// Foo - | ^^^^^^^ doc comments are not allowed here - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:128:9 - | -LL | /// Baz - | ^^^^^^^ doc comments are not allowed here - -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:130:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:132:9 - | -LL | /// Qux - | ^^^^^^^ doc comments are not allowed here - -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:134:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - -error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:141:9 - | -LL | /// Foo - | ^^^^^^^ doc comments are not allowed here - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:144:9 | -LL | /// Bar +LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters @@ -341,46 +305,227 @@ LL | #[must_use] | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:152:9 + --> $DIR/param-attrs-builtin-attrs.rs:154:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:154:9 + --> $DIR/param-attrs-builtin-attrs.rs:156:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:161:9 + --> $DIR/param-attrs-builtin-attrs.rs:165:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:165:9 + --> $DIR/param-attrs-builtin-attrs.rs:168:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:167:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:169:9 + --> $DIR/param-attrs-builtin-attrs.rs:172:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:171:9 + --> $DIR/param-attrs-builtin-attrs.rs:174:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:178:9 + | +LL | /// Qux + | ^^^^^^^ doc comments are not allowed here + +error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/param-attrs-builtin-attrs.rs:180:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:189:9 + | +LL | /// Foo + | ^^^^^^^ doc comments are not allowed here + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:193:9 + | +LL | /// Bar + | ^^^^^^^ doc comments are not allowed here + +error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/param-attrs-builtin-attrs.rs:195:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + +error: documentation comments cannot be applied to function parameters + --> $DIR/param-attrs-builtin-attrs.rs:199:9 + | +LL | /// Baz + | ^^^^^^^ doc comments are not allowed here + +error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/param-attrs-builtin-attrs.rs:201:9 | LL | #[no_mangle] b: i32 | ^^^^^^^^^^^^ -error: aborting due to 64 previous errors +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:40:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + = note: requested on the command line with `-W unused-attributes` + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:46:5 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:64:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:70:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:83:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:89:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:108:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:114:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:131:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:137:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:150:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:156:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:174:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:180:9 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +warning: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:195:9 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +warning: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:201:9 + | +LL | #[no_mangle] b: i32 + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[no_mangle]` can be applied to functions and statics + +error: aborting due to 64 previous errors; 16 warnings emitted diff --git a/tests/ui/track-diagnostics/track-caller-for-once-87707.rs b/tests/ui/sync/track-caller-for-once-87707.rs similarity index 100% rename from tests/ui/track-diagnostics/track-caller-for-once-87707.rs rename to tests/ui/sync/track-caller-for-once-87707.rs diff --git a/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr b/tests/ui/sync/track-caller-for-once-87707.run.stderr similarity index 100% rename from tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr rename to tests/ui/sync/track-caller-for-once-87707.run.stderr diff --git a/tests/ui/issues/issue-70673.rs b/tests/ui/thread-local/thread-local-static-reference-70673.rs similarity index 100% rename from tests/ui/issues/issue-70673.rs rename to tests/ui/thread-local/thread-local-static-reference-70673.rs diff --git a/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs b/tests/ui/trait-bounds/invalid-bound-modifier-87199.rs similarity index 100% rename from tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs rename to tests/ui/trait-bounds/invalid-bound-modifier-87199.rs diff --git a/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr b/tests/ui/trait-bounds/invalid-bound-modifier-87199.stderr similarity index 80% rename from tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr rename to tests/ui/trait-bounds/invalid-bound-modifier-87199.stderr index 16223676c067..692f2d469e65 100644 --- a/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr +++ b/tests/ui/trait-bounds/invalid-bound-modifier-87199.stderr @@ -1,23 +1,23 @@ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:9:11 + --> $DIR/invalid-bound-modifier-87199.rs:9:11 | LL | fn arg(_: T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:15 + --> $DIR/invalid-bound-modifier-87199.rs:11:15 | LL | fn ref_arg(_: &T) {} | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 + --> $DIR/invalid-bound-modifier-87199.rs:13:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ error: bound modifier `?` can only be applied to `Sized` - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 + --> $DIR/invalid-bound-modifier-87199.rs:13:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ @@ -25,14 +25,14 @@ LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:20:15 + --> $DIR/invalid-bound-modifier-87199.rs:20:15 | LL | ref_arg::<[i32]>(&[5]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` note: required by an implicit `Sized` bound in `ref_arg` - --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:12 + --> $DIR/invalid-bound-modifier-87199.rs:11:12 | LL | fn ref_arg(_: &T) {} | ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg` diff --git a/tests/ui/issues/issue-69455.rs b/tests/ui/trait-bounds/projection-predicate-not-satisfied-69455.rs similarity index 100% rename from tests/ui/issues/issue-69455.rs rename to tests/ui/trait-bounds/projection-predicate-not-satisfied-69455.rs diff --git a/tests/ui/issues/issue-69455.stderr b/tests/ui/trait-bounds/projection-predicate-not-satisfied-69455.stderr similarity index 88% rename from tests/ui/issues/issue-69455.stderr rename to tests/ui/trait-bounds/projection-predicate-not-satisfied-69455.stderr index d3e307fba2ce..48b3ba7061be 100644 --- a/tests/ui/issues/issue-69455.stderr +++ b/tests/ui/trait-bounds/projection-predicate-not-satisfied-69455.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations needed - --> $DIR/issue-69455.rs:29:41 + --> $DIR/projection-predicate-not-satisfied-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); | ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum` @@ -13,7 +13,7 @@ LL | println!("{}", 23u64.test(xs.iter().sum::())); | +++++ error[E0283]: type annotations needed - --> $DIR/issue-69455.rs:29:41 + --> $DIR/projection-predicate-not-satisfied-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); | ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum` @@ -21,7 +21,7 @@ LL | println!("{}", 23u64.test(xs.iter().sum())); | required by a bound introduced by this call | note: multiple `impl`s satisfying `u64: Test<_>` found - --> $DIR/issue-69455.rs:11:1 + --> $DIR/projection-predicate-not-satisfied-69455.rs:11:1 | LL | impl Test for u64 { | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-73229.rs b/tests/ui/traits/callback-trait-implementation-73229.rs similarity index 90% rename from tests/ui/issues/issue-73229.rs rename to tests/ui/traits/callback-trait-implementation-73229.rs index 6d5eec2365e5..56bcf7acdcdf 100644 --- a/tests/ui/issues/issue-73229.rs +++ b/tests/ui/traits/callback-trait-implementation-73229.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/73229 //@ check-pass fn any() -> T { diff --git a/tests/ui/generics/duplicate-generic-parameter-error-86756.rs b/tests/ui/traits/duplicate-generic-parameter-error-86756.rs similarity index 100% rename from tests/ui/generics/duplicate-generic-parameter-error-86756.rs rename to tests/ui/traits/duplicate-generic-parameter-error-86756.rs diff --git a/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr b/tests/ui/traits/duplicate-generic-parameter-error-86756.stderr similarity index 100% rename from tests/ui/generics/duplicate-generic-parameter-error-86756.stderr rename to tests/ui/traits/duplicate-generic-parameter-error-86756.stderr diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs b/tests/ui/traits/trait-implementation-ambiguity-69602.rs similarity index 88% rename from tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs rename to tests/ui/traits/trait-implementation-ambiguity-69602.rs index 2c5257ce063c..74198b97fd80 100644 --- a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs +++ b/tests/ui/traits/trait-implementation-ambiguity-69602.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/69602 trait TraitA { const VALUE: usize; } diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/tests/ui/traits/trait-implementation-ambiguity-69602.stderr similarity index 81% rename from tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr rename to tests/ui/traits/trait-implementation-ambiguity-69602.stderr index fa1d7dffbd49..c771740bec41 100644 --- a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr +++ b/tests/ui/traits/trait-implementation-ambiguity-69602.stderr @@ -1,11 +1,11 @@ error[E0437]: type `M` is not a member of trait `TraitB` - --> $DIR/issue-69602-type-err-during-codegen-ice.rs:17:5 + --> $DIR/trait-implementation-ambiguity-69602.rs:18:5 | LL | type M = A; | ^^^^^^^^^^^^^ not a member of trait `TraitB` error[E0046]: not all trait items implemented, missing: `MyA` - --> $DIR/issue-69602-type-err-during-codegen-ice.rs:16:1 + --> $DIR/trait-implementation-ambiguity-69602.rs:17:1 | LL | type MyA: TraitA; | ---------------- `MyA` from trait diff --git a/tests/ui/typeck/return-unsized-coercion.rs b/tests/ui/typeck/return-unsized-coercion.rs new file mode 100644 index 000000000000..17706ea8dd28 --- /dev/null +++ b/tests/ui/typeck/return-unsized-coercion.rs @@ -0,0 +1,8 @@ +// Regression test for issue + +fn digit() -> str { + //~^ ERROR the size for values of type `str` cannot be known at compilation time + return { i32::MIN }; +} + +fn main() {} diff --git a/tests/ui/typeck/return-unsized-coercion.stderr b/tests/ui/typeck/return-unsized-coercion.stderr new file mode 100644 index 000000000000..9736d2659263 --- /dev/null +++ b/tests/ui/typeck/return-unsized-coercion.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/return-unsized-coercion.rs:3:15 + | +LL | fn digit() -> str { + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: the return type of a function must have a statically known size + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-69683.rs b/tests/ui/typeck/type-inference-for-associated-types-69683.rs similarity index 91% rename from tests/ui/issues/issue-69683.rs rename to tests/ui/typeck/type-inference-for-associated-types-69683.rs index 7a76e9ef205f..f18adcae23b0 100644 --- a/tests/ui/issues/issue-69683.rs +++ b/tests/ui/typeck/type-inference-for-associated-types-69683.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/69683 pub trait Element { type Array; } diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/typeck/type-inference-for-associated-types-69683.stderr similarity index 82% rename from tests/ui/issues/issue-69683.stderr rename to tests/ui/typeck/type-inference-for-associated-types-69683.stderr index b8e9e89e56eb..5d49d442c55d 100644 --- a/tests/ui/issues/issue-69683.stderr +++ b/tests/ui/typeck/type-inference-for-associated-types-69683.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations needed - --> $DIR/issue-69683.rs:30:10 + --> $DIR/type-inference-for-associated-types-69683.rs:31:10 | LL | 0u16.foo(b); | ^^^ @@ -12,13 +12,13 @@ LL + >::foo(0u16, b); | error[E0283]: type annotations needed - --> $DIR/issue-69683.rs:30:10 + --> $DIR/type-inference-for-associated-types-69683.rs:31:10 | LL | 0u16.foo(b); | ^^^ | note: multiple `impl`s satisfying `u8: Element<_>` found - --> $DIR/issue-69683.rs:5:1 + --> $DIR/type-inference-for-associated-types-69683.rs:6:1 | LL | impl Element<()> for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | impl Element<()> for T { LL | impl, S> Element<[S; 3]> for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `Foo::foo` - --> $DIR/issue-69683.rs:15:9 + --> $DIR/type-inference-for-associated-types-69683.rs:16:9 | LL | u8: Element, | ^^^^^^^^^^ required by this bound in `Foo::foo` diff --git a/tests/ui/issues/issue-70746.rs b/tests/ui/unboxed-closures/callback-trait-prediction-70746.rs similarity index 91% rename from tests/ui/issues/issue-70746.rs rename to tests/ui/unboxed-closures/callback-trait-prediction-70746.rs index e7b485503979..c0f0eb541e84 100644 --- a/tests/ui/issues/issue-70746.rs +++ b/tests/ui/unboxed-closures/callback-trait-prediction-70746.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/70746 //@ check-pass pub trait Trait1 { diff --git a/tests/ui/thir-print/break-outside-loop-error-83048.rs b/tests/ui/unpretty/thir-tree-break-outside-loop-83048.rs similarity index 100% rename from tests/ui/thir-print/break-outside-loop-error-83048.rs rename to tests/ui/unpretty/thir-tree-break-outside-loop-83048.rs diff --git a/tests/ui/thir-print/break-outside-loop-error-83048.stderr b/tests/ui/unpretty/thir-tree-break-outside-loop-83048.stderr similarity index 82% rename from tests/ui/thir-print/break-outside-loop-error-83048.stderr rename to tests/ui/unpretty/thir-tree-break-outside-loop-83048.stderr index 65a08e62e3df..72ae6ae2725c 100644 --- a/tests/ui/thir-print/break-outside-loop-error-83048.stderr +++ b/tests/ui/unpretty/thir-tree-break-outside-loop-83048.stderr @@ -1,5 +1,5 @@ error[E0268]: `break` outside of a loop or labeled block - --> $DIR/break-outside-loop-error-83048.rs:5:5 + --> $DIR/thir-tree-break-outside-loop-83048.rs:5:5 | LL | break; | ^^^^^ cannot `break` outside of a loop or labeled block