diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-10-05 02:01:32 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-10-07 10:19:04 +0200 |
| commit | 604bc876e03a4169a1fb42408d778c65ab39cec2 (patch) | |
| tree | 7b40a8a99f4860d7a5582996b7b14b88272c2f37 | |
| parent | 236689d6eb241e92bea7449c07ba55783926391f (diff) | |
| download | rust-604bc876e03a4169a1fb42408d778c65ab39cec2.tar.gz rust-604bc876e03a4169a1fb42408d778c65ab39cec2.zip | |
implement nits
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/hir_id_validator.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/astconv/generics.rs | 20 |
4 files changed, 16 insertions, 11 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 6e60191892f..a70309b64c1 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -2210,7 +2210,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { .attrs .iter() .filter(|attr| self.sess.check_name(attr, sym::rustc_synthetic)) - .map(|_| hir::SyntheticTyParamKind::Rustc) + .map(|_| hir::SyntheticTyParamKind::FromAttr) .next(), }; diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 52d24a2eb48..befdfdbd7cf 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -509,7 +509,7 @@ impl Generics<'hir> { pub enum SyntheticTyParamKind { ImplTrait, // Created by the `#[rustc_synthetic]` attribute. - Rustc, + FromAttr, } /// A where-clause in a definition. diff --git a/compiler/rustc_passes/src/hir_id_validator.rs b/compiler/rustc_passes/src/hir_id_validator.rs index 7d4bafc1089..6d1a5fcc10b 100644 --- a/compiler/rustc_passes/src/hir_id_validator.rs +++ b/compiler/rustc_passes/src/hir_id_validator.rs @@ -170,7 +170,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { .. } = param.kind { - // Do nothing because bodging is fun. + // Synthetic impl trait parameters are owned by the node of the desugared type. + // This means it is correct for them to have a different owner. } else { intravisit::walk_generic_param(self, param); } diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index a877dfcfcb7..3bfb2d3f1b0 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -548,14 +548,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { generics: &ty::Generics, ) -> bool { let explicit = !seg.infer_args; - let impl_trait = generics.params.iter().any(|param| match param.kind { - ty::GenericParamDefKind::Type { - synthetic: - Some(hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::Rustc), - .. - } => true, - _ => false, - }); + let impl_trait = + generics.params.iter().any(|param| match param.kind { + ty::GenericParamDefKind::Type { + synthetic: + Some( + hir::SyntheticTyParamKind::ImplTrait + | hir::SyntheticTyParamKind::FromAttr, + ), + .. + } => true, + _ => false, + }); if explicit && impl_trait { let spans = seg |
