Skip to content

Commit 604bc87

Browse files
committed
implement nits
1 parent 236689d commit 604bc87

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22102210
.attrs
22112211
.iter()
22122212
.filter(|attr| self.sess.check_name(attr, sym::rustc_synthetic))
2213-
.map(|_| hir::SyntheticTyParamKind::Rustc)
2213+
.map(|_| hir::SyntheticTyParamKind::FromAttr)
22142214
.next(),
22152215
};
22162216

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl Generics<'hir> {
509509
pub enum SyntheticTyParamKind {
510510
ImplTrait,
511511
// Created by the `#[rustc_synthetic]` attribute.
512-
Rustc,
512+
FromAttr,
513513
}
514514

515515
/// A where-clause in a definition.

compiler/rustc_passes/src/hir_id_validator.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
170170
..
171171
} = param.kind
172172
{
173-
// Do nothing because bodging is fun.
173+
// Synthetic impl trait parameters are owned by the node of the desugared type.
174+
// This means it is correct for them to have a different owner.
174175
} else {
175176
intravisit::walk_generic_param(self, param);
176177
}

compiler/rustc_typeck/src/astconv/generics.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -548,14 +548,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
548548
generics: &ty::Generics,
549549
) -> bool {
550550
let explicit = !seg.infer_args;
551-
let impl_trait = generics.params.iter().any(|param| match param.kind {
552-
ty::GenericParamDefKind::Type {
553-
synthetic:
554-
Some(hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::Rustc),
555-
..
556-
} => true,
557-
_ => false,
558-
});
551+
let impl_trait =
552+
generics.params.iter().any(|param| match param.kind {
553+
ty::GenericParamDefKind::Type {
554+
synthetic:
555+
Some(
556+
hir::SyntheticTyParamKind::ImplTrait
557+
| hir::SyntheticTyParamKind::FromAttr,
558+
),
559+
..
560+
} => true,
561+
_ => false,
562+
});
559563

560564
if explicit && impl_trait {
561565
let spans = seg

0 commit comments

Comments
 (0)