Skip to content

Commit b2e129e

Browse files
committed
Preserve ErrorGuaranteed in ParamName
1 parent ccad964 commit b2e129e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,10 +2147,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21472147
GenericParamKind::Lifetime => {
21482148
// AST resolution emitted an error on those parameters, so we lower them using
21492149
// `ParamName::Error`.
2150-
let param_name = if let Some(LifetimeRes::Error(_guar)) =
2150+
let param_name = if let Some(LifetimeRes::Error(guar)) =
21512151
self.resolver.get_lifetime_res(param.id)
21522152
{
2153-
ParamName::Error
2153+
ParamName::Error(guar)
21542154
} else {
21552155
let ident = self.lower_ident(param.ident);
21562156
ParamName::Plain(ident)

compiler/rustc_hir/src/hir.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ pub enum ParamName {
6363
/// Indicates an illegal name was given and an error has been
6464
/// reported (so we should squelch other derived errors). Occurs
6565
/// when, e.g., `'_` is used in the wrong place.
66-
Error,
66+
Error(ErrorGuaranteed),
6767
}
6868

6969
impl ParamName {
7070
pub fn ident(&self) -> Ident {
7171
match *self {
7272
ParamName::Plain(ident) => ident,
73-
ParamName::Fresh | ParamName::Error => Ident::with_dummy_span(kw::UnderscoreLifetime),
73+
ParamName::Fresh | ParamName::Error(_) => {
74+
Ident::with_dummy_span(kw::UnderscoreLifetime)
75+
}
7476
}
7577
}
7678
}

compiler/rustc_hir/src/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(
904904
try_visit!(visitor.visit_id(param.hir_id));
905905
match param.name {
906906
ParamName::Plain(ident) => try_visit!(visitor.visit_ident(ident)),
907-
ParamName::Error | ParamName::Fresh => {}
907+
ParamName::Error(_) | ParamName::Fresh => {}
908908
}
909909
match param.kind {
910910
GenericParamKind::Lifetime { .. } => {}

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ fn check_variances_for_type_defn<'tcx>(
18951895
}
18961896

18971897
match hir_param.name {
1898-
hir::ParamName::Error => {}
1898+
hir::ParamName::Error(_guar) => {}
18991899
_ => {
19001900
let has_explicit_bounds = explicitly_bounded_params.contains(&parameter);
19011901
report_bivariance(tcx, hir_param, has_explicit_bounds, item.kind);

0 commit comments

Comments
 (0)