Skip to content

Commit ccad964

Browse files
committed
Preserve the ErrorGuaranteed in LifetimeName::Error
1 parent 22d5e6f commit ccad964

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20692069
}
20702070
LifetimeRes::Infer => hir::LifetimeName::Infer,
20712071
LifetimeRes::Static => hir::LifetimeName::Static,
2072-
LifetimeRes::Error(_guar) => hir::LifetimeName::Error,
2072+
LifetimeRes::Error(guar) => hir::LifetimeName::Error(guar),
20732073
res => panic!(
20742074
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
20752075
res, ident, ident.span

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub enum LifetimeName {
9595

9696
/// Indicates an error during lowering (usually `'_` in wrong place)
9797
/// that was already reported.
98-
Error,
98+
Error(ErrorGuaranteed),
9999

100100
/// User wrote an anonymous lifetime, either `'_` or nothing.
101101
/// The semantics of this lifetime should be inferred by typechecking code.
@@ -114,7 +114,7 @@ impl LifetimeName {
114114
// -- but this is because, as far as the code in the compiler is
115115
// concerned -- `Fresh` variants act equivalently to "some fresh name".
116116
// They correspond to early-bound regions on an impl, in other words.
117-
LifetimeName::Error | LifetimeName::Param(..) | LifetimeName::Static => false,
117+
LifetimeName::Error(_) | LifetimeName::Param(..) | LifetimeName::Static => false,
118118
}
119119
}
120120
}

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
566566
LifetimeName::Param(def_id) => {
567567
self.resolve_lifetime_ref(def_id, lt);
568568
}
569-
LifetimeName::Error => {}
569+
LifetimeName::Error(_) => {}
570570
LifetimeName::ImplicitObjectLifetimeDefault
571571
| LifetimeName::Infer
572572
| LifetimeName::Static => {
@@ -678,7 +678,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
678678
// If the user wrote an explicit name, use that.
679679
self.visit_lifetime(lifetime);
680680
}
681-
LifetimeName::Error => {}
681+
LifetimeName::Error(_) => {}
682682
}
683683
}
684684
hir::TyKind::Ref(lifetime_ref, ref mt) => {
@@ -819,7 +819,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
819819
self.resolve_lifetime_ref(param_def_id, lifetime_ref)
820820
}
821821
// If we've already reported an error, just ignore `lifetime_ref`.
822-
hir::LifetimeName::Error => {}
822+
hir::LifetimeName::Error(_) => {}
823823
// Those will be resolved by typechecking.
824824
hir::LifetimeName::ImplicitObjectLifetimeDefault | hir::LifetimeName::Infer => {}
825825
}

0 commit comments

Comments
 (0)