Auto merge of #147863 - matthiaskrgr:rollup-l4alyf0, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#138679 (Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop)
 - rust-lang/rust#146490 (Rehome 26 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [rust-lang/rust#5 of Batch rust-lang/rust#2])
 - rust-lang/rust#147438 (Rename "non-inline module" to "file module" in proc macro diagnostics)
 - rust-lang/rust#147724 (Fix ICE in pattern matching with generic const array length errors)
 - rust-lang/rust#147813 (Warn on unused_attributes in uitests )
 - rust-lang/rust#147816 (Do not error out for `download-rustc` if LTO is configured)
 - rust-lang/rust#147845 (Add regression test for 134355)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-10-19 00:17:12 +00:00
commit 377a931045
125 changed files with 1334 additions and 412 deletions

View file

@ -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

View file

@ -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();
}

View file

@ -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)

View file

@ -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<FxIndexSet<DefId>>,
) {
), ErrorGuaranteed> {
arena_cache
desc { "finding live symbols in crate" }
}

View file

@ -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 {

View file

@ -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) -> <MarkSymbolVisitor<'tcx> 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>,
) -> <MarkSymbolVisitor<'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<ErrorGuaranteed>;
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<FxIndexSet<DefId>>) {
) -> Result<(LocalDefIdSet, LocalDefIdMap<FxIndexSet<DefId>>), 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);

View file

@ -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");

View file

@ -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.

View file

@ -1,6 +0,0 @@
//@ known-bug: rust-lang/rust#125323
fn main() {
for _ in 0..0 {
[(); loop {}];
}
}

View file

@ -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

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/72076
trait X {
type S;
fn f() -> Self::S {} //~ ERROR mismatched types

View file

@ -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 `()`

View file

@ -5,6 +5,7 @@
#[rustc_dummy(bar)]
mod foo {
#![feature(globs)]
//~^ WARN crate-level attribute should be in the root module
}
fn main() {}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"}

View file

@ -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

View file

@ -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 {
() => {};
}

View file

@ -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`.

View file

@ -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

View file

@ -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 {
}

View file

@ -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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
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 <https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute>
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 <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
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 <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
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 <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
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 <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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]
| ^^^^^^^^^^^^^

View file

@ -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]

View file

@ -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`.

View file

@ -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) {}
| - ^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/70724
fn a() -> i32 {
3
}

View file

@ -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

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/72002
//@ check-pass
struct Indexable;

View file

@ -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

View file

@ -21,7 +21,7 @@ LL | #[cfg_attr(all())]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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 <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
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`.

View file

@ -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

View file

@ -118,7 +118,7 @@ LL | #[cfg_attr(true, link_section)]
= note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
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`.

View file

@ -1,8 +1,10 @@
//@ known-bug: #139815
//@ compile-flags: --crate-type=lib
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
fn is_123<const N: usize>(
x: [u32; {
//~^ ERROR overly complex generic constant
N + 1;
5
}],

View file

@ -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

View file

@ -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();
}

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,4 @@
//@ ignore-auxiliary (used by `./main.rs`)
#![crate_type = "lib"]
macro_rules! underscore {
() => (

View file

@ -5,4 +5,6 @@
pub fn public() {
#[deprecated] 0
//~^ ERROR mismatched types
//~| WARN attribute cannot be used on expressions
//~| WARN previously accepted
}

View file

@ -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`.

View file

@ -1,6 +1,7 @@
//@ aux-build:two_macros.rs
#[macro_use()]
//~^ WARN unused attribute
extern crate two_macros;
pub fn main() {

View file

@ -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

View file

@ -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]

View file

@ -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 <https://github.com/rust-lang/rust/issues/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() { }
| ^^^^^^^^^^^^^^^^^^

View file

@ -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() { }

View file

@ -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

View file

@ -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 });
}

View file

@ -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`.

View file

@ -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() {

View file

@ -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¡{}")
| ^^

View file

@ -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<I, F>(iterable: I, functor: F)
where
for<'t> &'t I: IntoIterator,
for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator,
for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
{
}
fn main() {
trigger_error(vec![], |x: &u32| x) //~ ERROR E0277
}

View file

@ -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<I, F>(iterable: I, functor: F)
| ------------- required by a bound in this function
...
LL | for<'t> <Map<<&'t I as IntoIterator>::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`.

View file

@ -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
_ => {}
}

View file

@ -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`.

View file

@ -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)]

View file

@ -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

View file

@ -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() {}

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -6,6 +6,8 @@
#![forbid(warnings)]
#![allow(unused)]
//~^ WARN allow(unused) incompatible with previous forbid
//~| WARN previously accepted
#[allow(unused)]
mod bar {

View file

@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/81670>
= note: `#[warn(forbidden_lint_groups)]` (part of `#[warn(future_incompatible)]`) on by default

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -31,6 +31,19 @@ LL | let _ = foo!(warn_in_expr);
= note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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

View file

@ -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() {}

View file

@ -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 <https://github.com/rust-lang/rust/issues/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:

View file

@ -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() {}

View file

@ -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

View file

@ -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<Rc<Apple>> for Apple {
fn eq(&self, _rc: &Rc<Apple>) -> bool {
unreachable!()
}
}
fn main() {
let _ = Pin::new(Apple) == Rc::pin(Apple);
//~^ ERROR type mismatch resolving
}

View file

@ -0,0 +1,13 @@
error[E0271]: type mismatch resolving `<Rc<Apple> as Deref>::Target == Rc<Apple>`
--> $DIR/pin-deref-target-partial-eq-67039.rs:26:29
|
LL | let _ = Pin::new(Apple) == Rc::pin(Apple);
| ^^ expected `Rc<Apple>`, found `Apple`
|
= note: expected struct `Rc<Apple>`
found struct `Apple`
= note: required for `Pin<Apple>` to implement `PartialEq<Pin<Rc<Apple>>>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0271`.

View file

@ -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();
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -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
}

View file

@ -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;

View file

@ -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,
}

View file

@ -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

View file

@ -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() {}

View file

@ -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;
| ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -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),
},
]

View file

@ -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() {}

View file

@ -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`.

View file

@ -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

View file

@ -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)]
| ^^^^

View file

@ -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 {

View file

@ -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 {
| ^^^^^^^^^^^^^^^^^^^^

Some files were not shown because too many files have changed in this diff Show more