Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ impl<'a> TraitDef<'a> {
.filter(|a| {
a.has_any_name(&[
sym::allow,
sym::expect,
sym::warn,
sym::deny,
sym::forbid,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// FIXME: Bring back duplication of the `#[expect]` attribute when deriving.
//
// Make sure we produce the unfulfilled expectation lint if neither the struct or the
// derived code fulfilled it.

//@ check-pass

#[expect(unexpected_cfgs)]
//~^ WARN this lint expectation is unfulfilled
//~^^ WARN this lint expectation is unfulfilled
//FIXME ~^^ WARN this lint expectation is unfulfilled
#[derive(Debug)]
pub struct MyStruct {
pub t_ref: i64,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
warning: this lint expectation is unfulfilled
--> $DIR/derive-expect-issue-150553-3.rs:6:10
--> $DIR/derive-expect-issue-150553-3.rs:8:10
|
LL | #[expect(unexpected_cfgs)]
| ^^^^^^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default

warning: this lint expectation is unfulfilled
--> $DIR/derive-expect-issue-150553-3.rs:6:10
|
LL | #[expect(unexpected_cfgs)]
| ^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: 2 warnings emitted
warning: 1 warning emitted

15 changes: 15 additions & 0 deletions tests/ui/lint/rfc-2383-lint-reason/derive-expect-issue-150553-4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This test makes sure that expended items with derives don't interfear with lint expectations.
//
// See <https://github.com/rust-lang/rust/issues/153036> for some context.

//@ check-pass

#[derive(Clone, Debug)]
#[expect(unused)]
pub struct LoggingArgs {
#[cfg(false)]
x: i32,
y: i32,
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// FIXME: Bring back duplication of the `#[expect]` attribute when deriving.
//
// Make sure we properly copy the `#[expect]` attr to the derived code and that no
// unfulfilled expectations are trigerred.
//
// See <https://github.com/rust-lang/rust/issues/150553> for rational.

//@ check-pass
//@ check-fail

#![deny(redundant_lifetimes)]

Expand All @@ -12,6 +14,7 @@ use std::fmt::Debug;
#[derive(Debug)]
#[expect(redundant_lifetimes)]
pub struct RefWrapper<'a, T>
//~^ ERROR redundant_lifetimes
where
'a: 'static,
T: Debug,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: unnecessary lifetime parameter `'a`
--> $DIR/derive-expect-issue-150553.rs:16:23
|
LL | pub struct RefWrapper<'a, T>
| ^^
|
= note: you can use the `'static` lifetime directly, in place of `'a`
note: the lint level is defined here
--> $DIR/derive-expect-issue-150553.rs:10:9
|
LL | #![deny(redundant_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

Loading