Skip to content

don't use a span_note for ignored impls #97645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2022
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
6 changes: 1 addition & 5 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,7 @@ impl<'tcx> DeadVisitor<'tcx> {
traits_str,
is_are
);
let multispan = ign_traits
.iter()
.map(|(_, impl_id)| self.tcx.def_span(*impl_id))
.collect::<Vec<_>>();
err.span_note(multispan, &msg);
err.note(&msg);
}
err.emit();
});
Expand Down
7 changes: 1 addition & 6 deletions src/test/ui/derive-uninhabited-enum-38885.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ LL | Void(Void),
| ^^^^^^^^^^
|
= note: `-W dead-code` implied by `-W unused`
note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
--> $DIR/derive-uninhabited-enum-38885.rs:10:10
|
LL | #[derive(Debug)]
| ^^^^^
= note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

warning: 1 warning emitted

21 changes: 3 additions & 18 deletions src/test/ui/derives/clone-debug-dead-code.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,23 @@ error: field is never read: `f`
LL | struct B { f: () }
| ^^^^^
|
note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
--> $DIR/clone-debug-dead-code.rs:9:10
|
LL | #[derive(Clone)]
| ^^^^^
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis

error: field is never read: `f`
--> $DIR/clone-debug-dead-code.rs:14:12
|
LL | struct C { f: () }
| ^^^^^
|
note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
--> $DIR/clone-debug-dead-code.rs:13:10
|
LL | #[derive(Debug)]
| ^^^^^
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

error: field is never read: `f`
--> $DIR/clone-debug-dead-code.rs:18:12
|
LL | struct D { f: () }
| ^^^^^
|
note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
--> $DIR/clone-debug-dead-code.rs:17:10
|
LL | #[derive(Debug,Clone)]
| ^^^^^ ^^^^^
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis

error: field is never read: `f`
--> $DIR/clone-debug-dead-code.rs:21:12
Expand Down
7 changes: 1 addition & 6 deletions src/test/ui/lint/dead-code/unused-variant.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ note: the lint level is defined here
|
LL | #![deny(dead_code)]
| ^^^^^^^^^
note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
--> $DIR/unused-variant.rs:3:10
|
LL | #[derive(Clone)]
| ^^^^^
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis

error: aborting due to previous error