Rollup merge of #61824 - rust-lang:single_derive, r=eddyb
in which we decline to lint single-use lifetimes in `derive`d impls Resolves #53738. r? @eddyb
This commit is contained in:
commit
eb188f1317
2 changed files with 18 additions and 0 deletions
|
|
@ -1586,6 +1586,17 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
continue;
|
||||
}
|
||||
|
||||
if let Some(parent_def_id) = self.tcx.parent(def_id) {
|
||||
if let Some(parent_hir_id) = self.tcx.hir()
|
||||
.as_local_hir_id(parent_def_id) {
|
||||
// lifetimes in `derive` expansions don't count (Issue #53738)
|
||||
if self.tcx.hir().attrs_by_hir_id(parent_hir_id).iter()
|
||||
.any(|attr| attr.check_name(sym::automatically_derived)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut err = self.tcx.struct_span_lint_hir(
|
||||
lint::builtin::SINGLE_USE_LIFETIMES,
|
||||
id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue