diff options
| author | bors <bors@rust-lang.org> | 2022-06-05 09:30:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-05 09:30:53 +0000 |
| commit | 4322a785cc99ea5fc81dd7f5fc8ba7f7a64b08ef (patch) | |
| tree | 4a4a195907d0e90c345e280060c116038fa572a3 /compiler/rustc_trait_selection | |
| parent | a2da4af33c5e6a22fff0a223f99d53cba4a5aa52 (diff) | |
| parent | cae3c78664a2ed901e5e962707960e45e7cea33d (diff) | |
Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin
Replace `&Vec<_>`s with `&[_]`s It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`. I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index d0f20022bfb..fd0732f51d5 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -146,11 +146,13 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> { /// that are live across the yield of this generator fn get_generator_interior_types( &self, - ) -> ty::Binder<'tcx, &Vec<GeneratorInteriorTypeCause<'tcx>>> { + ) -> ty::Binder<'tcx, &[GeneratorInteriorTypeCause<'tcx>]> { match self { - GeneratorData::Local(typeck_result) => typeck_result.generator_interior_types.as_ref(), + GeneratorData::Local(typeck_result) => { + typeck_result.generator_interior_types.as_deref() + } GeneratorData::Foreign(generator_diagnostic_data) => { - generator_diagnostic_data.generator_interior_types.as_ref() + generator_diagnostic_data.generator_interior_types.as_deref() } } } diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 641b915f373..17e0fae9853 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -773,7 +773,7 @@ pub struct PlaceholderReplacer<'me, 'tcx> { mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>, mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>, mapped_consts: BTreeMap<ty::PlaceholderConst<'tcx>, ty::BoundVar>, - universe_indices: &'me Vec<Option<ty::UniverseIndex>>, + universe_indices: &'me [Option<ty::UniverseIndex>], current_index: ty::DebruijnIndex, } @@ -783,7 +783,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> { mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>, mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>, mapped_consts: BTreeMap<ty::PlaceholderConst<'tcx>, ty::BoundVar>, - universe_indices: &'me Vec<Option<ty::UniverseIndex>>, + universe_indices: &'me [Option<ty::UniverseIndex>], value: T, ) -> T { let mut replacer = PlaceholderReplacer { |
