Skip to content

Commit ccfa5d6

Browse files
csmoecsmoe
authored andcommitted
replace &'tcx Substs with SubstsRef
1 parent ea43c3c commit ccfa5d6

File tree

55 files changed

+213
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+213
-211
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::traits::query::{
6767
};
6868
use crate::ty::{TyCtxt, FnSig, Instance, InstanceDef,
6969
ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty};
70-
use crate::ty::subst::Substs;
70+
use crate::ty::subst::SubstsRef;
7171

7272
// erase!() just makes tokens go away. It's used to specify which macro argument
7373
// is repeated (i.e., which sub-expression of the macro we are in) but don't need
@@ -661,7 +661,7 @@ define_dep_nodes!( <'tcx>
661661
[] TypeOpNormalizePolyFnSig(CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>),
662662
[] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>),
663663

664-
[] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) },
664+
[] SubstituteNormalizeAndTestPredicates { key: (DefId, SubstsRef<'tcx>) },
665665
[] MethodAutoderefSteps(CanonicalTyGoal<'tcx>),
666666

667667
[input] TargetFeaturesWhitelist,

src/librustc/infer/combine.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::ty::{IntType, UintType};
3434
use crate::ty::{self, Ty, TyCtxt};
3535
use crate::ty::error::TypeError;
3636
use crate::ty::relate::{self, Relate, RelateResult, TypeRelation};
37-
use crate::ty::subst::Substs;
37+
use crate::ty::subst::SubstsRef;
3838
use crate::traits::{Obligation, PredicateObligations};
3939

4040
use syntax::ast;
@@ -373,9 +373,9 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, '
373373

374374
fn relate_item_substs(&mut self,
375375
item_def_id: DefId,
376-
a_subst: &'tcx Substs<'tcx>,
377-
b_subst: &'tcx Substs<'tcx>)
378-
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
376+
a_subst: SubstsRef<'tcx>,
377+
b_subst: SubstsRef<'tcx>)
378+
-> RelateResult<'tcx, SubstsRef<'tcx>>
379379
{
380380
if self.ambient_variance == ty::Variance::Invariant {
381381
// Avoid fetching the variance if we are in an invariant

src/librustc/infer/equate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::hir::def_id::DefId;
55

66
use crate::ty::{self, Ty, TyCtxt};
77
use crate::ty::TyVar;
8-
use crate::ty::subst::Substs;
8+
use crate::ty::subst::SubstsRef;
99
use crate::ty::relate::{self, Relate, RelateResult, TypeRelation};
1010

1111
/// Ensures `a` is made equal to `b`. Returns `a` on success.
@@ -33,9 +33,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
3333

3434
fn relate_item_substs(&mut self,
3535
_item_def_id: DefId,
36-
a_subst: &'tcx Substs<'tcx>,
37-
b_subst: &'tcx Substs<'tcx>)
38-
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
36+
a_subst: SubstsRef<'tcx>,
37+
b_subst: SubstsRef<'tcx>)
38+
-> RelateResult<'tcx, SubstsRef<'tcx>>
3939
{
4040
// N.B., once we are equating types, we don't care about
4141
// variance, so don't try to lookup the variance here. This

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::infer::{SubregionOrigin, TypeTrace};
77
use crate::traits::{ObligationCause, ObligationCauseCode};
88
use crate::ty;
99
use crate::ty::error::ExpectedFound;
10-
use crate::ty::subst::Substs;
10+
use crate::ty::subst::SubstsRef;
1111
use crate::util::ppaux::RegionHighlightMode;
1212

1313
impl NiceRegionError<'me, 'gcx, 'tcx> {
@@ -175,8 +175,8 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
175175
sub_placeholder: Option<ty::Region<'tcx>>,
176176
sup_placeholder: Option<ty::Region<'tcx>>,
177177
trait_def_id: DefId,
178-
expected_substs: &'tcx Substs<'tcx>,
179-
actual_substs: &'tcx Substs<'tcx>,
178+
expected_substs: SubstsRef<'tcx>,
179+
actual_substs: SubstsRef<'tcx>,
180180
) -> DiagnosticBuilder<'me> {
181181
debug!(
182182
"try_report_placeholders_trait(\

src/librustc/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine};
1818
use crate::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
1919
use crate::ty::fold::TypeFoldable;
2020
use crate::ty::relate::RelateResult;
21-
use crate::ty::subst::{Kind, Substs};
21+
use crate::ty::subst::{Kind, Substs, SubstsRef};
2222
use crate::ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners};
2323
use crate::ty::{FloatVid, IntVid, TyVid};
2424
use crate::util::nodemap::FxHashMap;
@@ -1088,7 +1088,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10881088

10891089
/// Given a set of generics defined on a type or impl, returns a substitution mapping each
10901090
/// type/region parameter to a fresh inference variable.
1091-
pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> &'tcx Substs<'tcx> {
1091+
pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> SubstsRef<'tcx> {
10921092
Substs::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param))
10931093
}
10941094

src/librustc/infer/opaque_types/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::traits::{self, PredicateObligation};
99
use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind};
1010
use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder};
1111
use crate::ty::outlives::Component;
12-
use crate::ty::subst::{Kind, Substs, UnpackedKind};
12+
use crate::ty::subst::{Kind, Substs, SubstsRef, UnpackedKind};
1313
use crate::util::nodemap::DefIdMap;
1414

1515
pub type OpaqueTypeMap<'tcx> = DefIdMap<OpaqueTypeDecl<'tcx>>;
@@ -30,7 +30,7 @@ pub struct OpaqueTypeDecl<'tcx> {
3030
/// fn foo<'a, 'b, T>() -> Foo<'a, T>
3131
///
3232
/// then `substs` would be `['a, T]`.
33-
pub substs: &'tcx Substs<'tcx>,
33+
pub substs: SubstsRef<'tcx>,
3434

3535
/// The type variable that represents the value of the abstract type
3636
/// that we require. In other words, after we compile this function,
@@ -740,7 +740,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
740740
&mut self,
741741
ty: Ty<'tcx>,
742742
def_id: DefId,
743-
substs: &'tcx Substs<'tcx>,
743+
substs: SubstsRef<'tcx>,
744744
) -> Ty<'tcx> {
745745
let infcx = self.infcx;
746746
let tcx = infcx.tcx;

src/librustc/middle/exported_symbols.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable,
55
use std::cmp;
66
use std::mem;
77
use crate::ty;
8-
use crate::ty::subst::Substs;
8+
use crate::ty::subst::SubstsRef;
99

1010
/// The SymbolExportLevel of a symbols specifies from which kinds of crates
1111
/// the symbol will be exported. `C` symbols will be exported from any
@@ -33,7 +33,7 @@ impl SymbolExportLevel {
3333
#[derive(Eq, PartialEq, Debug, Copy, Clone, RustcEncodable, RustcDecodable)]
3434
pub enum ExportedSymbol<'tcx> {
3535
NonGeneric(DefId),
36-
Generic(DefId, &'tcx Substs<'tcx>),
36+
Generic(DefId, SubstsRef<'tcx>),
3737
NoDefId(ty::SymbolName),
3838
}
3939

src/librustc/mir/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syntax::ast::{self, Name};
2727
use syntax::symbol::InternedString;
2828
use syntax_pos::{Span, DUMMY_SP};
2929
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
30-
use crate::ty::subst::{Subst, Substs};
30+
use crate::ty::subst::{Subst, SubstsRef};
3131
use crate::ty::layout::VariantIdx;
3232
use crate::ty::{
3333
self, AdtDef, CanonicalUserTypeAnnotations, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt,
@@ -2151,7 +2151,7 @@ impl<'tcx> Operand<'tcx> {
21512151
pub fn function_handle<'a>(
21522152
tcx: TyCtxt<'a, 'tcx, 'tcx>,
21532153
def_id: DefId,
2154-
substs: &'tcx Substs<'tcx>,
2154+
substs: SubstsRef<'tcx>,
21552155
span: Span,
21562156
) -> Self {
21572157
let ty = tcx.type_of(def_id).subst(tcx, substs);
@@ -2247,7 +2247,7 @@ pub enum AggregateKind<'tcx> {
22472247
Adt(
22482248
&'tcx AdtDef,
22492249
VariantIdx,
2250-
&'tcx Substs<'tcx>,
2250+
SubstsRef<'tcx>,
22512251
Option<UserTypeAnnotationIndex>,
22522252
Option<usize>,
22532253
),

src/librustc/mir/tcx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
use crate::mir::*;
7-
use crate::ty::subst::{Subst, Substs};
7+
use crate::ty::subst::{Subst, SubstsRef};
88
use crate::ty::{self, AdtDef, Ty, TyCtxt};
99
use crate::ty::layout::VariantIdx;
1010
use crate::hir;
@@ -17,7 +17,7 @@ pub enum PlaceTy<'tcx> {
1717

1818
/// Downcast to a particular variant of an enum.
1919
Downcast { adt_def: &'tcx AdtDef,
20-
substs: &'tcx Substs<'tcx>,
20+
substs: SubstsRef<'tcx>,
2121
variant_index: VariantIdx },
2222
}
2323

src/librustc/mir/visit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::hir::def_id::DefId;
2-
use crate::ty::subst::Substs;
2+
use crate::ty::subst::SubstsRef;
33
use crate::ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Region, Ty};
44
use crate::mir::*;
55
use syntax_pos::Span;
@@ -238,7 +238,7 @@ macro_rules! make_mir_visitor {
238238
}
239239

240240
fn visit_substs(&mut self,
241-
substs: & $($mutability)? &'tcx Substs<'tcx>,
241+
substs: & $($mutability)? SubstsRef<'tcx>,
242242
_: Location) {
243243
self.super_substs(substs);
244244
}
@@ -889,7 +889,7 @@ macro_rules! make_mir_visitor {
889889
fn super_const(&mut self, _const: & $($mutability)? &'tcx ty::LazyConst<'tcx>) {
890890
}
891891

892-
fn super_substs(&mut self, _substs: & $($mutability)? &'tcx Substs<'tcx>) {
892+
fn super_substs(&mut self, _substs: & $($mutability)? SubstsRef<'tcx>) {
893893
}
894894

895895
fn super_generator_substs(&mut self,

0 commit comments

Comments
 (0)