diff options
| author | bors <bors@rust-lang.org> | 2023-02-09 20:23:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-09 20:23:00 +0000 |
| commit | 8996ea93b6e554148c4286e62b613f12a3ee505c (patch) | |
| tree | 1e54719a1d3b2d503d76ad2c7f4bc77d6c51ff45 /compiler/rustc_resolve | |
| parent | 8cca42a47f5d574c8f7302c98c3f918cdc772fbb (diff) | |
| parent | b080a1a4fc68bc6150a281f21012b79b9f1ee57f (diff) | |
| download | rust-8996ea93b6e554148c4286e62b613f12a3ee505c.tar.gz rust-8996ea93b6e554148c4286e62b613f12a3ee505c.zip | |
Auto merge of #107853 - Dylan-DPC:rollup-macf1qo, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #107648 (unused-lifetimes: don't warn about lifetimes originating from expanded code) - #107655 (rustdoc: use the same URL escape rules for fragments as for examples) - #107659 (test: snapshot for derive suggestion in diff files) - #107786 (Implement some tweaks in the new solver) - #107803 (Do not bring trait alias supertraits into scope) - #107815 (Disqualify `auto trait` built-in impl in new solver if explicit `impl` exists) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index cee0a7f3c20..a9dbb3ca131 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2244,19 +2244,23 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { } None => { debug!(?param.ident, ?param.ident.span); - let deletion_span = deletion_span(); - self.r.lint_buffer.buffer_lint_with_diagnostic( - lint::builtin::UNUSED_LIFETIMES, - param.id, - param.ident.span, - &format!("lifetime parameter `{}` never used", param.ident), - lint::BuiltinLintDiagnostics::SingleUseLifetime { - param_span: param.ident.span, - use_span: None, - deletion_span, - }, - ); + // the give lifetime originates from expanded code so we won't be able to remove it #104432 + let lifetime_only_in_expanded_code = + deletion_span.map(|sp| sp.in_derive_expansion()).unwrap_or(true); + if !lifetime_only_in_expanded_code { + self.r.lint_buffer.buffer_lint_with_diagnostic( + lint::builtin::UNUSED_LIFETIMES, + param.id, + param.ident.span, + &format!("lifetime parameter `{}` never used", param.ident), + lint::BuiltinLintDiagnostics::SingleUseLifetime { + param_span: param.ident.span, + use_span: None, + deletion_span, + }, + ); + } } } } |
