mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
replace &'tcx Substs with SubstsRef
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
};
|
||||
use crate::ty::{TyCtxt, FnSig, Instance, InstanceDef,
|
||||
ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
|
||||
// erase!() just makes tokens go away. It's used to specify which macro argument
|
||||
// is repeated (i.e., which sub-expression of the macro we are in) but don't need
|
||||
@@ -661,7 +661,7 @@ pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode {
|
||||
[] TypeOpNormalizePolyFnSig(CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>),
|
||||
[] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>),
|
||||
|
||||
[] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) },
|
||||
[] SubstituteNormalizeAndTestPredicates { key: (DefId, SubstsRef<'tcx>) },
|
||||
[] MethodAutoderefSteps(CanonicalTyGoal<'tcx>),
|
||||
|
||||
[input] TargetFeaturesWhitelist,
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::error::TypeError;
|
||||
use crate::ty::relate::{self, Relate, RelateResult, TypeRelation};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::traits::{Obligation, PredicateObligations};
|
||||
|
||||
use syntax::ast;
|
||||
@@ -373,9 +373,9 @@ fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>)
|
||||
|
||||
fn relate_item_substs(&mut self,
|
||||
item_def_id: DefId,
|
||||
a_subst: &'tcx Substs<'tcx>,
|
||||
b_subst: &'tcx Substs<'tcx>)
|
||||
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
|
||||
a_subst: SubstsRef<'tcx>,
|
||||
b_subst: SubstsRef<'tcx>)
|
||||
-> RelateResult<'tcx, SubstsRef<'tcx>>
|
||||
{
|
||||
if self.ambient_variance == ty::Variance::Invariant {
|
||||
// Avoid fetching the variance if we are in an invariant
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::TyVar;
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::ty::relate::{self, Relate, RelateResult, TypeRelation};
|
||||
|
||||
/// Ensures `a` is made equal to `b`. Returns `a` on success.
|
||||
@@ -33,9 +33,9 @@ fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||
|
||||
fn relate_item_substs(&mut self,
|
||||
_item_def_id: DefId,
|
||||
a_subst: &'tcx Substs<'tcx>,
|
||||
b_subst: &'tcx Substs<'tcx>)
|
||||
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
|
||||
a_subst: SubstsRef<'tcx>,
|
||||
b_subst: SubstsRef<'tcx>)
|
||||
-> RelateResult<'tcx, SubstsRef<'tcx>>
|
||||
{
|
||||
// N.B., once we are equating types, we don't care about
|
||||
// variance, so don't try to lookup the variance here. This
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
use crate::ty;
|
||||
use crate::ty::error::ExpectedFound;
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::util::ppaux::RegionHighlightMode;
|
||||
|
||||
impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
@@ -175,8 +175,8 @@ fn try_report_placeholders_trait(
|
||||
sub_placeholder: Option<ty::Region<'tcx>>,
|
||||
sup_placeholder: Option<ty::Region<'tcx>>,
|
||||
trait_def_id: DefId,
|
||||
expected_substs: &'tcx Substs<'tcx>,
|
||||
actual_substs: &'tcx Substs<'tcx>,
|
||||
expected_substs: SubstsRef<'tcx>,
|
||||
actual_substs: SubstsRef<'tcx>,
|
||||
) -> DiagnosticBuilder<'me> {
|
||||
debug!(
|
||||
"try_report_placeholders_trait(\
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use crate::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
|
||||
use crate::ty::fold::TypeFoldable;
|
||||
use crate::ty::relate::RelateResult;
|
||||
use crate::ty::subst::{Kind, Substs};
|
||||
use crate::ty::subst::{Kind, Substs, SubstsRef};
|
||||
use crate::ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners};
|
||||
use crate::ty::{FloatVid, IntVid, TyVid};
|
||||
use crate::util::nodemap::FxHashMap;
|
||||
@@ -1088,7 +1088,7 @@ pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> Kind<'tcx>
|
||||
|
||||
/// Given a set of generics defined on a type or impl, returns a substitution mapping each
|
||||
/// type/region parameter to a fresh inference variable.
|
||||
pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> &'tcx Substs<'tcx> {
|
||||
pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> SubstsRef<'tcx> {
|
||||
Substs::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param))
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind};
|
||||
use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder};
|
||||
use crate::ty::outlives::Component;
|
||||
use crate::ty::subst::{Kind, Substs, UnpackedKind};
|
||||
use crate::ty::subst::{Kind, Substs, SubstsRef, UnpackedKind};
|
||||
use crate::util::nodemap::DefIdMap;
|
||||
|
||||
pub type OpaqueTypeMap<'tcx> = DefIdMap<OpaqueTypeDecl<'tcx>>;
|
||||
@@ -30,7 +30,7 @@ pub struct OpaqueTypeDecl<'tcx> {
|
||||
/// fn foo<'a, 'b, T>() -> Foo<'a, T>
|
||||
///
|
||||
/// then `substs` would be `['a, T]`.
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
|
||||
/// The type variable that represents the value of the abstract type
|
||||
/// that we require. In other words, after we compile this function,
|
||||
@@ -740,7 +740,7 @@ fn fold_opaque_ty(
|
||||
&mut self,
|
||||
ty: Ty<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
let infcx = self.infcx;
|
||||
let tcx = infcx.tcx;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use crate::ty;
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
|
||||
/// The SymbolExportLevel of a symbols specifies from which kinds of crates
|
||||
/// the symbol will be exported. `C` symbols will be exported from any
|
||||
@@ -33,7 +33,7 @@ pub fn is_below_threshold(self, threshold: SymbolExportLevel) -> bool {
|
||||
#[derive(Eq, PartialEq, Debug, Copy, Clone, RustcEncodable, RustcDecodable)]
|
||||
pub enum ExportedSymbol<'tcx> {
|
||||
NonGeneric(DefId),
|
||||
Generic(DefId, &'tcx Substs<'tcx>),
|
||||
Generic(DefId, SubstsRef<'tcx>),
|
||||
NoDefId(ty::SymbolName),
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
use syntax::symbol::InternedString;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||
use crate::ty::subst::{Subst, Substs};
|
||||
use crate::ty::subst::{Subst, SubstsRef};
|
||||
use crate::ty::layout::VariantIdx;
|
||||
use crate::ty::{
|
||||
self, AdtDef, CanonicalUserTypeAnnotations, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt,
|
||||
@@ -2151,7 +2151,7 @@ impl<'tcx> Operand<'tcx> {
|
||||
pub fn function_handle<'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
span: Span,
|
||||
) -> Self {
|
||||
let ty = tcx.type_of(def_id).subst(tcx, substs);
|
||||
@@ -2247,7 +2247,7 @@ pub enum AggregateKind<'tcx> {
|
||||
Adt(
|
||||
&'tcx AdtDef,
|
||||
VariantIdx,
|
||||
&'tcx Substs<'tcx>,
|
||||
SubstsRef<'tcx>,
|
||||
Option<UserTypeAnnotationIndex>,
|
||||
Option<usize>,
|
||||
),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
use crate::mir::*;
|
||||
use crate::ty::subst::{Subst, Substs};
|
||||
use crate::ty::subst::{Subst, SubstsRef};
|
||||
use crate::ty::{self, AdtDef, Ty, TyCtxt};
|
||||
use crate::ty::layout::VariantIdx;
|
||||
use crate::hir;
|
||||
@@ -17,7 +17,7 @@ pub enum PlaceTy<'tcx> {
|
||||
|
||||
/// Downcast to a particular variant of an enum.
|
||||
Downcast { adt_def: &'tcx AdtDef,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
variant_index: VariantIdx },
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Region, Ty};
|
||||
use crate::mir::*;
|
||||
use syntax_pos::Span;
|
||||
@@ -238,7 +238,7 @@ fn visit_const(&mut self,
|
||||
}
|
||||
|
||||
fn visit_substs(&mut self,
|
||||
substs: & $($mutability)? &'tcx Substs<'tcx>,
|
||||
substs: & $($mutability)? SubstsRef<'tcx>,
|
||||
_: Location) {
|
||||
self.super_substs(substs);
|
||||
}
|
||||
@@ -889,7 +889,7 @@ fn super_region(&mut self, _region: & $($mutability)? ty::Region<'tcx>) {
|
||||
fn super_const(&mut self, _const: & $($mutability)? &'tcx ty::LazyConst<'tcx>) {
|
||||
}
|
||||
|
||||
fn super_substs(&mut self, _substs: & $($mutability)? &'tcx Substs<'tcx>) {
|
||||
fn super_substs(&mut self, _substs: & $($mutability)? SubstsRef<'tcx>) {
|
||||
}
|
||||
|
||||
fn super_generator_substs(&mut self,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use syntax::ast;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::{Substs, SubstsRef};
|
||||
use crate::ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate};
|
||||
use crate::ty::error::{ExpectedFound, TypeError};
|
||||
use crate::ty::fold::{TypeFolder, TypeFoldable, TypeVisitor};
|
||||
@@ -565,7 +565,7 @@ pub enum Vtable<'tcx, N> {
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||
pub struct VtableImplData<'tcx, N> {
|
||||
pub impl_def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
pub nested: Vec<N>
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ pub struct VtableFnPointerData<'tcx, N> {
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||
pub struct VtableTraitAliasData<'tcx, N> {
|
||||
pub alias_def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
pub nested: Vec<N>,
|
||||
}
|
||||
|
||||
@@ -963,7 +963,7 @@ fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
key: (DefId, &'tcx Substs<'tcx>))
|
||||
key: (DefId, SubstsRef<'tcx>))
|
||||
-> bool
|
||||
{
|
||||
debug!("substitute_normalize_and_test_predicates(key={:?})",
|
||||
@@ -983,7 +983,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
|
||||
fn vtable_methods<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>)
|
||||
-> Lrc<Vec<Option<(DefId, &'tcx Substs<'tcx>)>>>
|
||||
-> Lrc<Vec<Option<(DefId, SubstsRef<'tcx>)>>>
|
||||
{
|
||||
debug!("vtable_methods({:?})", trait_ref);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
use crate::mir::interpret::GlobalId;
|
||||
use crate::ty::fast_reject;
|
||||
use crate::ty::relate::TypeRelation;
|
||||
use crate::ty::subst::{Subst, Substs};
|
||||
use crate::ty::subst::{Subst, Substs, SubstsRef};
|
||||
use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable};
|
||||
|
||||
use crate::hir;
|
||||
@@ -2944,7 +2944,7 @@ fn confirm_impl_candidate(
|
||||
fn vtable_impl(
|
||||
&mut self,
|
||||
impl_def_id: DefId,
|
||||
mut substs: Normalized<'tcx, &'tcx Substs<'tcx>>,
|
||||
mut substs: Normalized<'tcx, SubstsRef<'tcx>>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
recursion_depth: usize,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@@ -3538,7 +3538,7 @@ fn rematch_impl(
|
||||
impl_def_id: DefId,
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
) -> Normalized<'tcx, &'tcx Substs<'tcx>> {
|
||||
) -> Normalized<'tcx, SubstsRef<'tcx>> {
|
||||
match self.match_impl(impl_def_id, obligation, snapshot) {
|
||||
Ok(substs) => substs,
|
||||
Err(()) => {
|
||||
@@ -3556,7 +3556,7 @@ fn match_impl(
|
||||
impl_def_id: DefId,
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
) -> Result<Normalized<'tcx, &'tcx Substs<'tcx>>, ()> {
|
||||
) -> Result<Normalized<'tcx, SubstsRef<'tcx>>, ()> {
|
||||
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
|
||||
|
||||
// Before we create the substitutions and everything, first
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use syntax_pos::DUMMY_SP;
|
||||
use crate::traits::select::IntercrateAmbiguityCause;
|
||||
use crate::ty::{self, TyCtxt, TypeFoldable};
|
||||
use crate::ty::subst::{Subst, Substs};
|
||||
use crate::ty::subst::{Subst, Substs, SubstsRef};
|
||||
|
||||
use super::{SelectionContext, FulfillmentContext};
|
||||
use super::util::impl_trait_ref_and_oblig;
|
||||
@@ -73,9 +73,9 @@ pub struct OverlapError {
|
||||
pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
source_impl: DefId,
|
||||
source_substs: &'tcx Substs<'tcx>,
|
||||
source_substs: SubstsRef<'tcx>,
|
||||
target_node: specialization_graph::Node)
|
||||
-> &'tcx Substs<'tcx> {
|
||||
-> SubstsRef<'tcx> {
|
||||
debug!("translate_substs({:?}, {:?}, {:?}, {:?})",
|
||||
param_env, source_impl, source_substs, target_node);
|
||||
let source_trait_ref = infcx.tcx
|
||||
@@ -114,9 +114,9 @@ pub fn find_associated_item<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
item: &ty::AssociatedItem,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
impl_data: &super::VtableImplData<'tcx, ()>,
|
||||
) -> (DefId, &'tcx Substs<'tcx>) {
|
||||
) -> (DefId, SubstsRef<'tcx>) {
|
||||
debug!("find_associated_item({:?}, {:?}, {:?}, {:?})",
|
||||
param_env, item, substs, impl_data);
|
||||
assert!(!substs.needs_infer());
|
||||
@@ -214,7 +214,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
source_trait_ref: ty::TraitRef<'tcx>,
|
||||
target_impl: DefId)
|
||||
-> Result<&'tcx Substs<'tcx>, ()> {
|
||||
-> Result<SubstsRef<'tcx>, ()> {
|
||||
debug!("fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)",
|
||||
param_env, source_trait_ref, target_impl);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::hir;
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
|
||||
|
||||
/// Represents coercing a value to a different type of value.
|
||||
@@ -98,7 +98,7 @@ pub struct OverloadedDeref<'tcx> {
|
||||
|
||||
impl<'a, 'gcx, 'tcx> OverloadedDeref<'tcx> {
|
||||
pub fn method_call(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source: Ty<'tcx>)
|
||||
-> (DefId, &'tcx Substs<'tcx>) {
|
||||
-> (DefId, SubstsRef<'tcx>) {
|
||||
let trait_def_id = match self.mutbl {
|
||||
hir::MutImmutable => tcx.lang_items().deref_trait(),
|
||||
hir::MutMutable => tcx.lang_items().deref_mut_trait()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
use std::hash::Hash;
|
||||
use std::intrinsics;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::mir::interpret::Allocation;
|
||||
|
||||
/// The shorthand encoding uses an enum's variant index `usize`
|
||||
@@ -185,7 +185,7 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx Substs<'tcx>, D::Error>
|
||||
pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<SubstsRef<'tcx>, D::Error>
|
||||
where D: TyDecoder<'a, 'tcx>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
@@ -281,7 +281,7 @@ mod __ty_decoder_impl {
|
||||
use $crate::infer::canonical::CanonicalVarInfos;
|
||||
use $crate::ty;
|
||||
use $crate::ty::codec::*;
|
||||
use $crate::ty::subst::Substs;
|
||||
use $crate::ty::subst::SubstsRef;
|
||||
use $crate::hir::def_id::{CrateNum};
|
||||
use crate::rustc_serialize::{Decoder, SpecializedDecoder};
|
||||
use std::borrow::Cow;
|
||||
@@ -344,9 +344,9 @@ fn specialized_decode(&mut self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($typaram),*> SpecializedDecoder<&'tcx Substs<'tcx>>
|
||||
impl<$($typaram),*> SpecializedDecoder<SubstsRef<'tcx>>
|
||||
for $DecoderName<$($typaram),*> {
|
||||
fn specialized_decode(&mut self) -> Result<&'tcx Substs<'tcx>, Self::Error> {
|
||||
fn specialized_decode(&mut self) -> Result<SubstsRef<'tcx>, Self::Error> {
|
||||
decode_substs(self)
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -22,7 +22,7 @@
|
||||
use crate::middle::stability;
|
||||
use crate::mir::{self, Mir, interpret, ProjectionKind};
|
||||
use crate::mir::interpret::Allocation;
|
||||
use crate::ty::subst::{Kind, Substs, Subst};
|
||||
use crate::ty::subst::{Kind, Substs, Subst, SubstsRef};
|
||||
use crate::ty::ReprOptions;
|
||||
use crate::traits;
|
||||
use crate::traits::{Clause, Clauses, GoalKind, Goal, Goals};
|
||||
@@ -325,7 +325,7 @@ pub struct ResolvedOpaqueTy<'tcx> {
|
||||
/// Generic parameters on the opaque type as passed by this function.
|
||||
/// For `existential type Foo<A, B>; fn foo<T, U>() -> Foo<T, U> { .. }` this is `[T, U]`, not
|
||||
/// `[A, B]`
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable, Debug)]
|
||||
@@ -352,7 +352,7 @@ pub struct TypeckTables<'tcx> {
|
||||
/// of this node. This only applies to nodes that refer to entities
|
||||
/// parameterized by type parameters, such as generic fns, types, or
|
||||
/// other items.
|
||||
node_substs: ItemLocalMap<&'tcx Substs<'tcx>>,
|
||||
node_substs: ItemLocalMap<SubstsRef<'tcx>>,
|
||||
|
||||
/// This will either store the canonicalized types provided by the user
|
||||
/// or the substitutions that the user explicitly gave (if any) attached
|
||||
@@ -548,19 +548,19 @@ pub fn node_type_opt(&self, id: hir::HirId) -> Option<Ty<'tcx>> {
|
||||
self.node_types.get(&id.local_id).cloned()
|
||||
}
|
||||
|
||||
pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, &'tcx Substs<'tcx>> {
|
||||
pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, SubstsRef<'tcx>> {
|
||||
LocalTableInContextMut {
|
||||
local_id_root: self.local_id_root,
|
||||
data: &mut self.node_substs
|
||||
}
|
||||
}
|
||||
|
||||
pub fn node_substs(&self, id: hir::HirId) -> &'tcx Substs<'tcx> {
|
||||
pub fn node_substs(&self, id: hir::HirId) -> SubstsRef<'tcx> {
|
||||
validate_hir_id_for_typeck_tables(self.local_id_root, id, false);
|
||||
self.node_substs.get(&id.local_id).cloned().unwrap_or_else(|| Substs::empty())
|
||||
}
|
||||
|
||||
pub fn node_substs_opt(&self, id: hir::HirId) -> Option<&'tcx Substs<'tcx>> {
|
||||
pub fn node_substs_opt(&self, id: hir::HirId) -> Option<SubstsRef<'tcx>> {
|
||||
validate_hir_id_for_typeck_tables(self.local_id_root, id, false);
|
||||
self.node_substs.get(&id.local_id).cloned()
|
||||
}
|
||||
@@ -1733,7 +1733,7 @@ pub fn enter_local<'tcx, F, R>(
|
||||
/// A trait implemented for all X<'a> types which can be safely and
|
||||
/// efficiently converted to X<'tcx> as long as they are part of the
|
||||
/// provided TyCtxt<'tcx>.
|
||||
/// This can be done, for example, for Ty<'tcx> or &'tcx Substs<'tcx>
|
||||
/// This can be done, for example, for Ty<'tcx> or SubstsRef<'tcx>
|
||||
/// by looking them up in their respective interners.
|
||||
///
|
||||
/// However, this is still not the best implementation as it does
|
||||
@@ -2507,7 +2507,7 @@ pub fn mk_static_str(self) -> Ty<'tcx> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
|
||||
pub fn mk_adt(self, def: &'tcx AdtDef, substs: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
// take a copy of substs so that we own the vectors inside
|
||||
self.mk_ty(Adt(def, substs))
|
||||
}
|
||||
@@ -2613,7 +2613,7 @@ pub fn mk_bool(self) -> Ty<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn mk_fn_def(self, def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
|
||||
substs: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ty(FnDef(def_id, substs))
|
||||
}
|
||||
|
||||
@@ -2634,7 +2634,7 @@ pub fn mk_dynamic(
|
||||
#[inline]
|
||||
pub fn mk_projection(self,
|
||||
item_def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> Ty<'tcx> {
|
||||
self.mk_ty(Projection(ProjectionTy {
|
||||
item_def_id,
|
||||
@@ -2704,7 +2704,7 @@ pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> Kind<'tcx> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_opaque(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
|
||||
pub fn mk_opaque(self, def_id: DefId, substs: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ty(Opaque(def_id, substs))
|
||||
}
|
||||
|
||||
@@ -2817,7 +2817,7 @@ pub fn mk_substs<I: InternAs<[Kind<'tcx>],
|
||||
pub fn mk_substs_trait(self,
|
||||
self_ty: Ty<'tcx>,
|
||||
rest: &[Kind<'tcx>])
|
||||
-> &'tcx Substs<'tcx>
|
||||
-> SubstsRef<'tcx>
|
||||
{
|
||||
self.mk_substs(iter::once(self_ty.into()).chain(rest.iter().cloned()))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::ty::context::TyCtxt;
|
||||
use crate::ty::{AdtDef, VariantDef, FieldDef, Ty, TyS};
|
||||
use crate::ty::{self, DefId, Substs};
|
||||
use crate::ty::{self, DefId, SubstsRef};
|
||||
use crate::ty::{AdtKind, Visibility};
|
||||
use crate::ty::TyKind::*;
|
||||
|
||||
@@ -108,7 +108,7 @@ fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest {
|
||||
pub fn is_enum_variant_uninhabited_from(self,
|
||||
module: DefId,
|
||||
variant: &'tcx VariantDef,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> bool
|
||||
{
|
||||
self.variant_inhabitedness_forest(variant, substs).contains(self, module)
|
||||
@@ -116,13 +116,13 @@ pub fn is_enum_variant_uninhabited_from(self,
|
||||
|
||||
pub fn is_variant_uninhabited_from_all_modules(self,
|
||||
variant: &'tcx VariantDef,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> bool
|
||||
{
|
||||
!self.variant_inhabitedness_forest(variant, substs).is_empty()
|
||||
}
|
||||
|
||||
fn variant_inhabitedness_forest(self, variant: &'tcx VariantDef, substs: &'tcx Substs<'tcx>)
|
||||
fn variant_inhabitedness_forest(self, variant: &'tcx VariantDef, substs: SubstsRef<'tcx>)
|
||||
-> DefIdForest {
|
||||
// Determine the ADT kind:
|
||||
let adt_def_id = self.adt_def_id_of_variant(variant);
|
||||
@@ -138,7 +138,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
|
||||
fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
substs: &'tcx Substs<'tcx>) -> DefIdForest
|
||||
substs: SubstsRef<'tcx>) -> DefIdForest
|
||||
{
|
||||
DefIdForest::intersection(tcx, self.variants.iter().map(|v| {
|
||||
v.uninhabited_from(tcx, substs, self.adt_kind())
|
||||
@@ -151,7 +151,7 @@ impl<'a, 'gcx, 'tcx> VariantDef {
|
||||
fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
adt_kind: AdtKind) -> DefIdForest
|
||||
{
|
||||
let is_enum = match adt_kind {
|
||||
@@ -172,7 +172,7 @@ impl<'a, 'gcx, 'tcx> FieldDef {
|
||||
fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
is_enum: bool,
|
||||
) -> DefIdForest {
|
||||
let data_uninhabitedness = move || {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::hir::Unsafety;
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, Substs, TyCtxt};
|
||||
use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, SubstsRef, TyCtxt};
|
||||
use crate::traits;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use crate::util::ppaux;
|
||||
@@ -11,7 +11,7 @@
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub struct Instance<'tcx> {
|
||||
pub def: InstanceDef<'tcx>,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
|
||||
@@ -203,7 +203,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> Instance<'tcx> {
|
||||
pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>)
|
||||
pub fn new(def_id: DefId, substs: SubstsRef<'tcx>)
|
||||
-> Instance<'tcx> {
|
||||
assert!(!substs.has_escaping_bound_vars(),
|
||||
"substs of instance {:?} not normalized for codegen: {:?}",
|
||||
@@ -241,7 +241,7 @@ pub fn def_id(&self) -> DefId {
|
||||
pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>) -> Option<Instance<'tcx>> {
|
||||
substs: SubstsRef<'tcx>) -> Option<Instance<'tcx>> {
|
||||
debug!("resolve(def_id={:?}, substs={:?})", def_id, substs);
|
||||
let result = if let Some(trait_def_id) = tcx.trait_of_item(def_id) {
|
||||
debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env);
|
||||
@@ -293,7 +293,7 @@ pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub fn resolve_for_vtable(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>) -> Option<Instance<'tcx>> {
|
||||
substs: SubstsRef<'tcx>) -> Option<Instance<'tcx>> {
|
||||
debug!("resolve(def_id={:?}, substs={:?})", def_id, substs);
|
||||
let fn_sig = tcx.fn_sig(def_id);
|
||||
let is_vtable_shim =
|
||||
@@ -338,7 +338,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
||||
trait_item: &ty::AssociatedItem,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
trait_id: DefId,
|
||||
rcvr_substs: &'tcx Substs<'tcx>,
|
||||
rcvr_substs: SubstsRef<'tcx>,
|
||||
) -> Option<Instance<'tcx>> {
|
||||
let def_id = trait_item.def_id;
|
||||
debug!("resolve_associated_item(trait_item={:?}, \
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use crate::traits::{self, Reveal};
|
||||
use crate::ty;
|
||||
use crate::ty::layout::VariantIdx;
|
||||
use crate::ty::subst::{Subst, Substs};
|
||||
use crate::ty::subst::{Subst, Substs, SubstsRef};
|
||||
use crate::ty::util::{IntTypeExt, Discr};
|
||||
use crate::ty::walk::TypeWalker;
|
||||
use crate::util::captures::Captures;
|
||||
@@ -1067,7 +1067,7 @@ pub enum Predicate<'tcx> {
|
||||
Subtype(PolySubtypePredicate<'tcx>),
|
||||
|
||||
/// Constant initializer must evaluate successfully.
|
||||
ConstEvaluatable(DefId, &'tcx Substs<'tcx>),
|
||||
ConstEvaluatable(DefId, SubstsRef<'tcx>),
|
||||
}
|
||||
|
||||
/// The crate outlives map is computed during typeck and contains the
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal,
|
||||
};
|
||||
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::ty::query::queries;
|
||||
use crate::ty::query::Query;
|
||||
use crate::ty::query::QueryCache;
|
||||
@@ -914,7 +914,7 @@ fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_predicates<'tcx> {
|
||||
fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, &'tcx Substs<'tcx>)) -> Cow<'static, str> {
|
||||
fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, SubstsRef<'tcx>)) -> Cow<'static, str> {
|
||||
format!("testing substituted normalized predicates:`{}`", tcx.item_path_str(key.0)).into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use crate::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, DefIndex};
|
||||
use crate::traits;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
use crate::mir;
|
||||
|
||||
@@ -109,7 +109,7 @@ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
|
||||
impl<'tcx> Key for (DefId, SubstsRef<'tcx>) {
|
||||
fn query_crate(&self) -> CrateNum {
|
||||
self.0.krate
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
use crate::traits::Clauses;
|
||||
use crate::ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt, AdtSizedConstraint};
|
||||
use crate::ty::steal::Steal;
|
||||
use crate::ty::subst::Substs;
|
||||
use crate::ty::util::NeedsDrop;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
|
||||
use crate::util::common::{ErrorReported};
|
||||
use crate::util::profiling::ProfileCategory::*;
|
||||
@@ -393,7 +393,7 @@
|
||||
|
||||
Other {
|
||||
[] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>)
|
||||
-> Lrc<Vec<Option<(DefId, &'tcx Substs<'tcx>)>>>,
|
||||
-> Lrc<Vec<Option<(DefId, SubstsRef<'tcx>)>>>,
|
||||
},
|
||||
|
||||
Codegen {
|
||||
@@ -493,9 +493,9 @@
|
||||
|
||||
Codegen {
|
||||
[] fn upstream_monomorphizations: UpstreamMonomorphizations(CrateNum)
|
||||
-> Lrc<DefIdMap<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>>,
|
||||
-> Lrc<DefIdMap<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>>,
|
||||
[] fn upstream_monomorphizations_for: UpstreamMonomorphizationsFor(DefId)
|
||||
-> Option<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>,
|
||||
-> Option<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>,
|
||||
},
|
||||
|
||||
Other {
|
||||
@@ -714,7 +714,7 @@
|
||||
>,
|
||||
|
||||
[] fn substitute_normalize_and_test_predicates:
|
||||
substitute_normalize_and_test_predicates_node((DefId, &'tcx Substs<'tcx>)) -> bool,
|
||||
substitute_normalize_and_test_predicates_node((DefId, SubstsRef<'tcx>)) -> bool,
|
||||
|
||||
[] fn method_autoderef_steps: MethodAutoderefSteps(
|
||||
CanonicalTyGoal<'tcx>
|
||||
@@ -906,7 +906,7 @@ fn vtable_methods_node<'tcx>(trait_ref: ty::PolyTraitRef<'tcx>) -> DepConstructo
|
||||
DepConstructor::VtableMethods{ trait_ref }
|
||||
}
|
||||
|
||||
fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, &'tcx Substs<'tcx>))
|
||||
fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, SubstsRef<'tcx>))
|
||||
-> DepConstructor<'tcx> {
|
||||
DepConstructor::SubstituteNormalizeAndTestPredicates { key }
|
||||
}
|
||||
|
||||
+11
-11
@@ -5,7 +5,7 @@
|
||||
//! subtyping, type equality, etc.
|
||||
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::ty::subst::{Kind, UnpackedKind, Substs};
|
||||
use crate::ty::subst::{Kind, UnpackedKind, SubstsRef};
|
||||
use crate::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||
use crate::ty::error::{ExpectedFound, TypeError};
|
||||
use crate::mir::interpret::GlobalId;
|
||||
@@ -50,9 +50,9 @@ fn relate<T: Relate<'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T> {
|
||||
/// accordingly.
|
||||
fn relate_item_substs(&mut self,
|
||||
item_def_id: DefId,
|
||||
a_subst: &'tcx Substs<'tcx>,
|
||||
b_subst: &'tcx Substs<'tcx>)
|
||||
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
|
||||
a_subst: SubstsRef<'tcx>,
|
||||
b_subst: SubstsRef<'tcx>)
|
||||
-> RelateResult<'tcx, SubstsRef<'tcx>>
|
||||
{
|
||||
debug!("relate_item_substs(item_def_id={:?}, a_subst={:?}, b_subst={:?})",
|
||||
item_def_id,
|
||||
@@ -123,9 +123,9 @@ fn relate<'a, 'gcx, R>(relation: &mut R,
|
||||
|
||||
pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R,
|
||||
variances: Option<&Vec<ty::Variance>>,
|
||||
a_subst: &'tcx Substs<'tcx>,
|
||||
b_subst: &'tcx Substs<'tcx>)
|
||||
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
|
||||
a_subst: SubstsRef<'tcx>,
|
||||
b_subst: SubstsRef<'tcx>)
|
||||
-> RelateResult<'tcx, SubstsRef<'tcx>>
|
||||
where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a
|
||||
{
|
||||
let tcx = relation.tcx();
|
||||
@@ -624,11 +624,11 @@ fn relate<'a, 'gcx, R>(relation: &mut R,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Relate<'tcx> for &'tcx Substs<'tcx> {
|
||||
impl<'tcx> Relate<'tcx> for SubstsRef<'tcx> {
|
||||
fn relate<'a, 'gcx, R>(relation: &mut R,
|
||||
a: &&'tcx Substs<'tcx>,
|
||||
b: &&'tcx Substs<'tcx>)
|
||||
-> RelateResult<'tcx, &'tcx Substs<'tcx>>
|
||||
a: &SubstsRef<'tcx>,
|
||||
b: &SubstsRef<'tcx>)
|
||||
-> RelateResult<'tcx, SubstsRef<'tcx>>
|
||||
where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a
|
||||
{
|
||||
relate_substs(relation, None, a, b)
|
||||
|
||||
+12
-12
@@ -7,7 +7,7 @@
|
||||
use crate::middle::region;
|
||||
use polonius_engine::Atom;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use crate::ty::subst::{Substs, Subst, Kind, UnpackedKind};
|
||||
use crate::ty::subst::{Substs, Subst, SubstsRef, Kind, UnpackedKind};
|
||||
use crate::ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable};
|
||||
use crate::ty::{List, TyS, ParamEnvAnd, ParamEnv};
|
||||
use crate::util::captures::Captures;
|
||||
@@ -105,7 +105,7 @@ pub enum TyKind<'tcx> {
|
||||
/// That is, even after substitution it is possible that there are type
|
||||
/// variables. This happens when the `Adt` corresponds to an ADT
|
||||
/// definition and not a concrete use of it.
|
||||
Adt(&'tcx AdtDef, &'tcx Substs<'tcx>),
|
||||
Adt(&'tcx AdtDef, SubstsRef<'tcx>),
|
||||
|
||||
/// An unsized FFI type that is opaque to Rust. Written as `extern type T`.
|
||||
Foreign(DefId),
|
||||
@@ -136,7 +136,7 @@ pub enum TyKind<'tcx> {
|
||||
/// fn foo() -> i32 { 1 }
|
||||
/// let bar = foo; // bar: fn() -> i32 {foo}
|
||||
/// ```
|
||||
FnDef(DefId, &'tcx Substs<'tcx>),
|
||||
FnDef(DefId, SubstsRef<'tcx>),
|
||||
|
||||
/// A pointer to a function. Written as `fn() -> i32`.
|
||||
///
|
||||
@@ -184,7 +184,7 @@ pub enum TyKind<'tcx> {
|
||||
/// * or the `existential type` declaration
|
||||
/// The substitutions are for the generics of the function in question.
|
||||
/// After typeck, the concrete type can be found in the `types` map.
|
||||
Opaque(DefId, &'tcx Substs<'tcx>),
|
||||
Opaque(DefId, SubstsRef<'tcx>),
|
||||
|
||||
/// A type parameter; for example, `T` in `fn f<T>(x: T) {}
|
||||
Param(ParamTy),
|
||||
@@ -309,7 +309,7 @@ pub struct ClosureSubsts<'tcx> {
|
||||
///
|
||||
/// These are separated out because codegen wants to pass them around
|
||||
/// when monomorphizing.
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
/// Struct returned by `split()`. Note that these are subslices of the
|
||||
@@ -387,7 +387,7 @@ pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::Poly
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub struct GeneratorSubsts<'tcx> {
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
struct SplitGeneratorSubsts<'tcx> {
|
||||
@@ -672,11 +672,11 @@ pub fn iter<'a>(&'a self)
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub struct TraitRef<'tcx> {
|
||||
pub def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> TraitRef<'tcx> {
|
||||
pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> {
|
||||
pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> TraitRef<'tcx> {
|
||||
TraitRef { def_id: def_id, substs: substs }
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub struct ExistentialTraitRef<'tcx> {
|
||||
pub def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> {
|
||||
@@ -915,7 +915,7 @@ pub fn split<U,V,F>(self, f: F) -> (Binder<U>, Binder<V>)
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub struct ProjectionTy<'tcx> {
|
||||
/// The parameters of the associated item.
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
|
||||
/// The `DefId` of the `TraitItem` for the associated type `N`.
|
||||
///
|
||||
@@ -1297,7 +1297,7 @@ fn from(var: BoundVar) -> Self {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub struct ExistentialProjection<'tcx> {
|
||||
pub item_def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
@@ -2060,7 +2060,7 @@ pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> bool {
|
||||
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the
|
||||
/// code is monomorphic enough for that.
|
||||
pub enum LazyConst<'tcx> {
|
||||
Unevaluated(DefId, &'tcx Substs<'tcx>),
|
||||
Unevaluated(DefId, SubstsRef<'tcx>),
|
||||
Evaluated(Const<'tcx>),
|
||||
}
|
||||
|
||||
|
||||
@@ -159,10 +159,12 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Kind<'tcx>, D::Error> {
|
||||
/// A substitution mapping generic parameters to new values.
|
||||
pub type Substs<'tcx> = List<Kind<'tcx>>;
|
||||
|
||||
pub type SubstsRef<'tcx> = &'tcx Substs<'tcx>;
|
||||
|
||||
impl<'a, 'gcx, 'tcx> Substs<'tcx> {
|
||||
/// Creates a `Substs` that maps each generic parameter to itself.
|
||||
pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId)
|
||||
-> &'tcx Substs<'tcx> {
|
||||
-> SubstsRef<'tcx> {
|
||||
Substs::for_item(tcx, def_id, |param, _| {
|
||||
tcx.mk_param_from_def(param)
|
||||
})
|
||||
@@ -175,7 +177,7 @@ pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId)
|
||||
pub fn bound_vars_for_item(
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
def_id: DefId
|
||||
) -> &'tcx Substs<'tcx> {
|
||||
) -> SubstsRef<'tcx> {
|
||||
Substs::for_item(tcx, def_id, |param, _| {
|
||||
match param.kind {
|
||||
ty::GenericParamDefKind::Type { .. } => {
|
||||
@@ -205,7 +207,7 @@ pub fn bound_vars_for_item(
|
||||
pub fn for_item<F>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
mut mk_kind: F)
|
||||
-> &'tcx Substs<'tcx>
|
||||
-> SubstsRef<'tcx>
|
||||
where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>
|
||||
{
|
||||
let defs = tcx.generics_of(def_id);
|
||||
@@ -219,7 +221,7 @@ pub fn extend_to<F>(&self,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
mut mk_kind: F)
|
||||
-> &'tcx Substs<'tcx>
|
||||
-> SubstsRef<'tcx>
|
||||
where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>
|
||||
{
|
||||
Substs::for_item(tcx, def_id, |param, substs| {
|
||||
@@ -312,18 +314,18 @@ pub fn type_for_def(&self, def: &ty::GenericParamDef) -> Kind<'tcx> {
|
||||
pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
source_ancestor: DefId,
|
||||
target_substs: &Substs<'tcx>)
|
||||
-> &'tcx Substs<'tcx> {
|
||||
-> SubstsRef<'tcx> {
|
||||
let defs = tcx.generics_of(source_ancestor);
|
||||
tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned())
|
||||
}
|
||||
|
||||
pub fn truncate_to(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, generics: &ty::Generics)
|
||||
-> &'tcx Substs<'tcx> {
|
||||
-> SubstsRef<'tcx> {
|
||||
tcx.mk_substs(self.iter().take(generics.count()).cloned())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for &'tcx Substs<'tcx> {
|
||||
impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
let params: SmallVec<[_; 8]> = self.iter().map(|k| k.fold_with(folder)).collect();
|
||||
|
||||
@@ -341,7 +343,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Substs<'tcx> {}
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Public trait `Subst`
|
||||
@@ -563,7 +565,7 @@ fn shift_region_through_binders(&self, region: ty::Region<'tcx>) -> ty::Region<'
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub struct UserSubsts<'tcx> {
|
||||
/// The substitutions for the item as given by the user.
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
|
||||
/// The self type, in the case of a `<T>::Item` path (when applied
|
||||
/// to an inherent impl). See `UserSelfTy` below.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
use crate::ich::NodeIdHashingMode;
|
||||
use crate::traits::{self, ObligationCause};
|
||||
use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
|
||||
use crate::ty::subst::{Subst, Substs, UnpackedKind};
|
||||
use crate::ty::subst::{Subst, Substs, SubstsRef, UnpackedKind};
|
||||
use crate::ty::query::TyCtxtAt;
|
||||
use crate::ty::TyKind::*;
|
||||
use crate::ty::layout::{Integer, IntegerExt};
|
||||
@@ -588,7 +588,7 @@ pub fn closure_env_ty(self,
|
||||
|
||||
/// Given the `DefId` of some item that has no type parameters, make
|
||||
/// a suitable "empty substs" for it.
|
||||
pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> &'tcx Substs<'tcx> {
|
||||
pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> SubstsRef<'tcx> {
|
||||
Substs::for_item(self, item_def_id, |param, _| {
|
||||
match param.kind {
|
||||
GenericParamDefKind::Lifetime => self.types.re_erased.into(),
|
||||
@@ -633,7 +633,7 @@ pub fn is_static(&self, def_id: DefId) -> Option<hir::Mutability> {
|
||||
pub fn try_expand_impl_trait_type(
|
||||
self,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Result<Ty<'tcx>, Ty<'tcx>> {
|
||||
use crate::ty::fold::TypeFolder;
|
||||
|
||||
@@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> OpaqueTypeExpander<'a, 'gcx, 'tcx> {
|
||||
fn expand_opaque_ty(
|
||||
&mut self,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Option<Ty<'tcx>> {
|
||||
if self.found_recursion {
|
||||
None
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
use rustc::session::config;
|
||||
use rustc::ty::{TyCtxt, SymbolName};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::util::nodemap::{FxHashMap, DefIdMap};
|
||||
use rustc_allocator::ALLOCATOR_METHODS;
|
||||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
@@ -282,7 +282,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn upstream_monomorphizations_provider<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
cnum: CrateNum)
|
||||
-> Lrc<DefIdMap<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>>
|
||||
-> Lrc<DefIdMap<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>>
|
||||
{
|
||||
debug_assert!(cnum == LOCAL_CRATE);
|
||||
|
||||
@@ -334,7 +334,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>(
|
||||
fn upstream_monomorphizations_for_provider<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> Option<Lrc<FxHashMap<&'tcx Substs<'tcx>, CrateNum>>>
|
||||
-> Option<Lrc<FxHashMap<SubstsRef<'tcx>, CrateNum>>>
|
||||
{
|
||||
debug_assert!(!def_id.is_local());
|
||||
tcx.upstream_monomorphizations(LOCAL_CRATE)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use crate::traits::*;
|
||||
use rustc::ty;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::hir::def_id::DefId;
|
||||
|
||||
pub fn resolve_and_get_fn<'tcx, Cx: CodegenMethods<'tcx>>(
|
||||
cx: &Cx,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Cx::Value {
|
||||
cx.get_fn(
|
||||
ty::Instance::resolve(
|
||||
@@ -23,7 +23,7 @@ pub fn resolve_and_get_fn_for_vtable<'tcx,
|
||||
>(
|
||||
cx: &Cx,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Cx::Value {
|
||||
cx.get_fn(
|
||||
ty::Instance::resolve_for_vtable(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
|
||||
use rustc::ty::layout::{TyLayout, HasTyCtxt};
|
||||
use rustc::mir::{self, Mir};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::session::config::DebugInfo;
|
||||
use rustc_mir::monomorphize::Instance;
|
||||
use rustc_target::abi::call::{FnType, PassMode};
|
||||
@@ -85,7 +85,7 @@ pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> {
|
||||
scopes: IndexVec<mir::SourceScope, debuginfo::MirDebugScope<Bx::DIScope>>,
|
||||
|
||||
/// If this function is being monomorphized, this contains the type substitutions used.
|
||||
param_substs: &'tcx Substs<'tcx>,
|
||||
param_substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
use rustc::ich::NodeIdHashingMode;
|
||||
use rustc::ty::item_path::{self, ItemPathBuffer, RootMode};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc::util::common::record_time;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
@@ -134,7 +134,7 @@ fn get_symbol_hash<'a, 'tcx>(
|
||||
|
||||
// values for generic type parameters,
|
||||
// if any.
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> u64 {
|
||||
debug!(
|
||||
"get_symbol_hash(def_id={:?}, parameters={:?})",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use rustc::hir::Node;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
|
||||
use rustc::ty::layout::{self, IntegerExt, LayoutOf, VariantIdx};
|
||||
use rustc::{lint, util};
|
||||
@@ -445,7 +445,7 @@ enum FfiResult<'tcx> {
|
||||
/// FIXME: This duplicates code in codegen.
|
||||
fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def: &'tcx ty::AdtDef,
|
||||
substs: &Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> bool {
|
||||
if def.variants.len() == 2 {
|
||||
let data_idx;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
use rustc::mir::{SourceInfo, Statement, Terminator};
|
||||
use rustc::mir::UserTypeProjection;
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid};
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
|
||||
pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'gcx, 'tcx>,
|
||||
@@ -50,7 +50,7 @@ fn visit_basic_block_data(&mut self, bb: BasicBlock, data: &BasicBlockData<'tcx>
|
||||
|
||||
/// We sometimes have `substs` within an rvalue, or within a
|
||||
/// call. Make them live at the location where they appear.
|
||||
fn visit_substs(&mut self, substs: &&'tcx Substs<'tcx>, location: Location) {
|
||||
fn visit_substs(&mut self, substs: &SubstsRef<'tcx>, location: Location) {
|
||||
self.add_regular_live_constraint(*substs, location);
|
||||
self.super_substs(substs);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::InferCtxt;
|
||||
use rustc::mir::Mir;
|
||||
use rustc::ty::subst::{Substs, UnpackedKind};
|
||||
use rustc::ty::subst::{SubstsRef, UnpackedKind};
|
||||
use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt};
|
||||
use rustc::util::ppaux::RegionHighlightMode;
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
@@ -541,7 +541,7 @@ fn give_name_if_we_can_match_hir_ty(
|
||||
/// types+hir to search through).
|
||||
fn match_adt_and_segment<'hir>(
|
||||
&self,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
needle_fr: RegionVid,
|
||||
last_segment: &'hir hir::PathSegment,
|
||||
counter: &mut usize,
|
||||
@@ -587,7 +587,7 @@ fn match_adt_and_segment<'hir>(
|
||||
/// `search_stack` the types+hir to search through.
|
||||
fn try_match_adt_and_generic_args<'hir>(
|
||||
&self,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
needle_fr: RegionVid,
|
||||
args: &'hir hir::GenericArgs,
|
||||
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty)>,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable};
|
||||
use rustc::mir::{Location, Mir};
|
||||
use rustc::mir::visit::{MutVisitor, TyContext};
|
||||
@@ -55,7 +55,7 @@ fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) {
|
||||
debug!("visit_ty: ty={:?}", ty);
|
||||
}
|
||||
|
||||
fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, location: Location) {
|
||||
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
|
||||
debug!("visit_substs(substs={:?}, location={:?})", substs, location);
|
||||
|
||||
*substs = self.renumber_regions(&{ *substs });
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
use rustc::traits::query::{Fallible, NoSolution};
|
||||
use rustc::traits::{ObligationCause, PredicateObligations};
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::subst::{Subst, Substs, UnpackedKind, UserSubsts};
|
||||
use rustc::ty::subst::{Subst, SubstsRef, UnpackedKind, UserSubsts};
|
||||
use rustc::ty::{
|
||||
self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserType,
|
||||
CanonicalUserTypeAnnotation, UserTypeAnnotationIndex,
|
||||
@@ -2261,7 +2261,7 @@ fn prove_closure_bounds(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
location: Location,
|
||||
) -> ty::InstantiatedPredicates<'tcx> {
|
||||
if let Some(closure_region_requirements) = tcx.mir_borrowck(def_id).closure_requirements {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use rustc::hir::{self, BodyOwnerKind, HirId};
|
||||
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty, TyCtxt};
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||
@@ -94,12 +94,12 @@ pub enum DefiningTy<'tcx> {
|
||||
|
||||
/// The MIR is a fn item with the given `DefId` and substs. The signature
|
||||
/// of the function can be bound then with the `fn_sig` query.
|
||||
FnDef(DefId, &'tcx Substs<'tcx>),
|
||||
FnDef(DefId, SubstsRef<'tcx>),
|
||||
|
||||
/// The MIR represents some form of constant. The signature then
|
||||
/// is that it has no inputs and a single return value, which is
|
||||
/// the value of the constant.
|
||||
Const(DefId, &'tcx Substs<'tcx>),
|
||||
Const(DefId, SubstsRef<'tcx>),
|
||||
}
|
||||
|
||||
impl<'tcx> DefiningTy<'tcx> {
|
||||
@@ -222,7 +222,7 @@ pub fn new(
|
||||
/// `V[1]: V[2]`.
|
||||
pub fn closure_mapping(
|
||||
tcx: TyCtxt<'_, '_, 'tcx>,
|
||||
closure_substs: &'tcx Substs<'tcx>,
|
||||
closure_substs: SubstsRef<'tcx>,
|
||||
expected_num_vars: usize,
|
||||
closure_base_def_id: DefId,
|
||||
) -> IndexVec<RegionVid, ty::Region<'tcx>> {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
use rustc::mir::*;
|
||||
use rustc::mir::visit::{MutVisitor, TyContext};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::util::nodemap::NodeMap;
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||
@@ -212,7 +212,7 @@ fn visit_const(&mut self, constant: &mut &'tcx ty::LazyConst<'tcx>, _: Location)
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, _: Location) {
|
||||
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) {
|
||||
if let Some(lifted) = self.tcx.lift(substs) {
|
||||
*substs = lifted;
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
use rustc::ty::{self, AdtKind, Ty};
|
||||
use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability};
|
||||
use rustc::ty::cast::CastKind as TyCastKind;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::LocalDefId;
|
||||
use rustc::mir::BorrowKind;
|
||||
@@ -834,7 +835,7 @@ fn method_callee<'a, 'gcx, 'tcx>(
|
||||
cx: &mut Cx<'a, 'gcx, 'tcx>,
|
||||
expr: &hir::Expr,
|
||||
span: Span,
|
||||
overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>,
|
||||
overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>,
|
||||
) -> Expr<'tcx> {
|
||||
let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id);
|
||||
let (def_id, substs, user_ty) = match overloaded_callee {
|
||||
@@ -1133,7 +1134,7 @@ fn overloaded_place<'a, 'gcx, 'tcx>(
|
||||
cx: &mut Cx<'a, 'gcx, 'tcx>,
|
||||
expr: &'tcx hir::Expr,
|
||||
place_ty: Ty<'tcx>,
|
||||
overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>,
|
||||
overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>,
|
||||
args: Vec<ExprRef<'tcx>>,
|
||||
) -> ExprKind<'tcx> {
|
||||
// For an overloaded *x or x[y] expression of type T, the method
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::canonical::Canonical;
|
||||
use rustc::middle::region;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType};
|
||||
use rustc::ty::layout::VariantIdx;
|
||||
use rustc::hir;
|
||||
@@ -261,7 +261,7 @@ pub enum ExprKind<'tcx> {
|
||||
Adt {
|
||||
adt_def: &'tcx AdtDef,
|
||||
variant_index: VariantIdx,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
|
||||
/// Optional user-given substs: for something like `let x =
|
||||
/// Bar::<T> { ... }`.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
use rustc::middle::region;
|
||||
use rustc::session::Session;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::lint;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc::util::common::ErrorReported;
|
||||
@@ -64,7 +64,7 @@ struct MatchVisitor<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
identity_substs: &'tcx Substs<'tcx>,
|
||||
identity_substs: SubstsRef<'tcx>,
|
||||
region_scope_tree: &'a region::ScopeTree,
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend};
|
||||
use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift, UserType};
|
||||
use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations};
|
||||
use rustc::ty::subst::{Substs, Kind};
|
||||
use rustc::ty::subst::{SubstsRef, Kind};
|
||||
use rustc::ty::layout::VariantIdx;
|
||||
use rustc::hir::{self, PatKind, RangeEnd};
|
||||
use rustc::hir::def::{Def, CtorKind};
|
||||
@@ -135,7 +135,7 @@ pub enum PatternKind<'tcx> {
|
||||
/// multiple variants.
|
||||
Variant {
|
||||
adt_def: &'tcx AdtDef,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
variant_index: VariantIdx,
|
||||
subpatterns: Vec<FieldPattern<'tcx>>,
|
||||
},
|
||||
@@ -330,13 +330,13 @@ pub struct PatternContext<'a, 'tcx: 'a> {
|
||||
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub param_env: ty::ParamEnv<'tcx>,
|
||||
pub tables: &'a ty::TypeckTables<'tcx>,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
pub errors: Vec<PatternError>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Pattern<'tcx> {
|
||||
pub fn from_hir(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>,
|
||||
param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
pat: &'tcx hir::Pat) -> Self {
|
||||
let mut pcx = PatternContext::new(tcx, param_env_and_substs, tables);
|
||||
@@ -352,7 +352,7 @@ pub fn from_hir(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
|
||||
impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>,
|
||||
param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>,
|
||||
tables: &'a ty::TypeckTables<'tcx>) -> Self {
|
||||
PatternContext {
|
||||
tcx,
|
||||
@@ -1093,7 +1093,7 @@ fn super_fold_with<F: PatternFolder<$lt_tcx>>(&self, _: &mut F) -> Self {
|
||||
CloneImpls!{ <'tcx>
|
||||
Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>,
|
||||
Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef,
|
||||
&'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>,
|
||||
SubstsRef<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>,
|
||||
UserTypeProjection<'tcx>, PatternTypeProjection<'tcx>
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
use rustc::ty::layout::{
|
||||
self, Size, Align, HasDataLayout, LayoutOf, TyLayout
|
||||
};
|
||||
use rustc::ty::subst::{Subst, Substs};
|
||||
use rustc::ty::subst::{Subst, SubstsRef};
|
||||
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc::ty::query::TyCtxtAt;
|
||||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
@@ -244,7 +244,7 @@ pub(super) fn subst_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
|
||||
pub(super) fn resolve(
|
||||
&self,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>
|
||||
substs: SubstsRef<'tcx>
|
||||
) -> EvalResult<'tcx, ty::Instance<'tcx>> {
|
||||
trace!("resolve: {:?}, {:#?}", def_id, substs);
|
||||
trace!("param_env: {:#?}", self.param_env);
|
||||
@@ -306,7 +306,7 @@ pub(super) fn monomorphize<T: TypeFoldable<'tcx> + Subst<'tcx>>(
|
||||
fn monomorphize_with_substs<T: TypeFoldable<'tcx> + Subst<'tcx>>(
|
||||
&self,
|
||||
t: T,
|
||||
substs: &'tcx Substs<'tcx>
|
||||
substs: SubstsRef<'tcx>
|
||||
) -> T {
|
||||
// miri doesn't care about lifetimes, and will choke on some crazy ones
|
||||
// let's simply get rid of them
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::mir::interpret::{AllocId, ConstValue};
|
||||
use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind};
|
||||
use rustc::ty::adjustment::CustomCoerceUnsized;
|
||||
use rustc::session::config::EntryFnType;
|
||||
@@ -500,7 +500,7 @@ struct MirNeighborCollector<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
mir: &'a mir::Mir<'tcx>,
|
||||
output: &'a mut Vec<MonoItem<'tcx>>,
|
||||
param_substs: &'tcx Substs<'tcx>,
|
||||
param_substs: SubstsRef<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
||||
@@ -748,7 +748,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance:
|
||||
|
||||
fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> bool {
|
||||
debug_assert!(!def_id.is_local());
|
||||
|
||||
@@ -1218,7 +1218,7 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn collect_lazy_const<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
constant: &ty::LazyConst<'tcx>,
|
||||
param_substs: &'tcx Substs<'tcx>,
|
||||
param_substs: SubstsRef<'tcx>,
|
||||
output: &mut Vec<MonoItem<'tcx>>,
|
||||
) {
|
||||
let (def_id, substs) = match *constant {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! N.B., we do _not_ erase regions of statements that are relevant for
|
||||
//! "types-as-contracts"-validation, namely, `AcquireValid` and `ReleaseValid`.
|
||||
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::mir::*;
|
||||
use rustc::mir::visit::{MutVisitor, TyContext};
|
||||
@@ -36,7 +36,7 @@ fn visit_const(&mut self, constant: &mut &'tcx ty::LazyConst<'tcx>, _: Location)
|
||||
*constant = self.tcx.erase_regions(constant);
|
||||
}
|
||||
|
||||
fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, _: Location) {
|
||||
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) {
|
||||
*substs = self.tcx.erase_regions(substs);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
use rustc::mir::visit::{PlaceContext, Visitor, MutVisitor};
|
||||
use rustc::ty::{self, TyCtxt, AdtDef, Ty};
|
||||
use rustc::ty::layout::VariantIdx;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use rustc_data_structures::bit_set::BitSet;
|
||||
@@ -154,7 +154,7 @@ struct SuspensionPoint {
|
||||
struct TransformVisitor<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
state_adt_ref: &'tcx AdtDef,
|
||||
state_substs: &'tcx Substs<'tcx>,
|
||||
state_substs: SubstsRef<'tcx>,
|
||||
|
||||
// The index of the generator state in the generator struct
|
||||
state_field: usize,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
use rustc::mir::*;
|
||||
use rustc::mir::visit::*;
|
||||
use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
|
||||
use rustc::ty::subst::{Subst,Substs};
|
||||
use rustc::ty::subst::{Subst, SubstsRef};
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::iter;
|
||||
@@ -32,7 +32,7 @@
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct CallSite<'tcx> {
|
||||
callee: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
bb: BasicBlock,
|
||||
location: SourceInfo,
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use rustc::traits::Reveal;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::layout::VariantIdx;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::util::IntTypeExt;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use crate::util::patch::MirPatch;
|
||||
@@ -189,7 +189,7 @@ fn move_paths_for_fields(&self,
|
||||
base_place: &Place<'tcx>,
|
||||
variant_path: D::Path,
|
||||
variant: &'tcx ty::VariantDef,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> Vec<(Place<'tcx>, Option<D::Path>)>
|
||||
{
|
||||
variant.fields.iter().enumerate().map(|(i, f)| {
|
||||
@@ -328,7 +328,7 @@ fn open_drop_for_tuple<'a>(&mut self, tys: &[Ty<'tcx>])
|
||||
self.drop_ladder(fields, succ, unwind).0
|
||||
}
|
||||
|
||||
fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>)
|
||||
fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
|
||||
-> BasicBlock
|
||||
{
|
||||
debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs);
|
||||
@@ -346,7 +346,7 @@ fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<
|
||||
self.drop_subpath(&interior, interior_path, succ, unwind_succ)
|
||||
}
|
||||
|
||||
fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>)
|
||||
fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
|
||||
-> BasicBlock {
|
||||
debug!("open_drop_for_adt({:?}, {:?}, {:?})", self, adt, substs);
|
||||
if adt.variants.len() == 0 {
|
||||
@@ -376,7 +376,7 @@ fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<
|
||||
}
|
||||
|
||||
fn open_drop_for_adt_contents(&mut self, adt: &'tcx ty::AdtDef,
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
substs: SubstsRef<'tcx>)
|
||||
-> (BasicBlock, Unwind) {
|
||||
let (succ, unwind) = self.drop_ladder_bottom();
|
||||
if !adt.is_enum() {
|
||||
@@ -393,7 +393,7 @@ fn open_drop_for_adt_contents(&mut self, adt: &'tcx ty::AdtDef,
|
||||
}
|
||||
|
||||
fn open_drop_for_multivariant(&mut self, adt: &'tcx ty::AdtDef,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
succ: BasicBlock,
|
||||
unwind: Unwind)
|
||||
-> (BasicBlock, Unwind) {
|
||||
@@ -867,7 +867,7 @@ fn elaborated_drop_block<'a>(&mut self) -> BasicBlock {
|
||||
fn box_free_block<'a>(
|
||||
&mut self,
|
||||
adt: &'tcx ty::AdtDef,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
target: BasicBlock,
|
||||
unwind: Unwind,
|
||||
) -> BasicBlock {
|
||||
@@ -878,7 +878,7 @@ fn box_free_block<'a>(
|
||||
fn unelaborated_free_block<'a>(
|
||||
&mut self,
|
||||
adt: &'tcx ty::AdtDef,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
target: BasicBlock,
|
||||
unwind: Unwind
|
||||
) -> BasicBlock {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::util::nodemap::{ItemLocalSet, HirIdSet};
|
||||
use rustc::hir;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@@ -94,7 +94,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> {
|
||||
in_static: bool,
|
||||
mut_rvalue_borrows: HirIdSet,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
identity_substs: &'tcx Substs<'tcx>,
|
||||
identity_substs: SubstsRef<'tcx>,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
result: ItemLocalSet,
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable};
|
||||
use rustc::ty::{GenericParamDef, GenericParamDefKind};
|
||||
use rustc::ty::subst::{Kind, Subst, Substs};
|
||||
use rustc::ty::subst::{Kind, Subst, Substs, SubstsRef};
|
||||
use rustc::ty::wf::object_region_bounds;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_target::spec::abi;
|
||||
@@ -177,7 +177,7 @@ pub fn ast_path_substs_for_ty(&self,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
item_segment: &hir::PathSegment)
|
||||
-> &'tcx Substs<'tcx>
|
||||
-> SubstsRef<'tcx>
|
||||
{
|
||||
let (substs, assoc_bindings, _) = item_segment.with_generic_args(|generic_args| {
|
||||
self.create_substs_for_ast_path(
|
||||
@@ -436,7 +436,7 @@ pub fn create_substs_for_generic_args<'a, 'b>(
|
||||
args_for_def_id: impl Fn(DefId) -> (Option<&'b GenericArgs>, bool),
|
||||
provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> Kind<'tcx>,
|
||||
inferred_kind: impl Fn(Option<&[Kind<'tcx>]>, &GenericParamDef, bool) -> Kind<'tcx>,
|
||||
) -> &'tcx Substs<'tcx> {
|
||||
) -> SubstsRef<'tcx> {
|
||||
// Collect the segments of the path; we need to substitute arguments
|
||||
// for parameters throughout the entire path (wherever there are
|
||||
// generic parameters).
|
||||
@@ -548,7 +548,7 @@ fn create_substs_for_ast_path(&self,
|
||||
generic_args: &hir::GenericArgs,
|
||||
infer_types: bool,
|
||||
self_ty: Option<Ty<'tcx>>)
|
||||
-> (&'tcx Substs<'tcx>, Vec<ConvertedBinding<'tcx>>, Option<Vec<Span>>)
|
||||
-> (SubstsRef<'tcx>, Vec<ConvertedBinding<'tcx>>, Option<Vec<Span>>)
|
||||
{
|
||||
// If the type is parameterized by this region, then replace this
|
||||
// region with the current anon region binding (in other words,
|
||||
@@ -760,7 +760,7 @@ fn create_substs_for_ast_trait_ref(
|
||||
trait_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_segment: &hir::PathSegment,
|
||||
) -> (&'tcx Substs<'tcx>, Vec<ConvertedBinding<'tcx>>, Option<Vec<Span>>) {
|
||||
) -> (SubstsRef<'tcx>, Vec<ConvertedBinding<'tcx>>, Option<Vec<Span>>) {
|
||||
debug!("create_substs_for_ast_trait_ref(trait_segment={:?})",
|
||||
trait_segment);
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
use rustc::session::Session;
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, Ty, TypeFoldable, TypeAndMut};
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::adjustment::AllowTwoPhase;
|
||||
use rustc::ty::cast::{CastKind, CastTy};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::middle::lang_items;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
@@ -69,7 +69,7 @@ enum PointerKind<'tcx> {
|
||||
/// The unsize info of this projection
|
||||
OfProjection(&'tcx ty::ProjectionTy<'tcx>),
|
||||
/// The unsize info of this opaque ty
|
||||
OfOpaque(DefId, &'tcx Substs<'tcx>),
|
||||
OfOpaque(DefId, SubstsRef<'tcx>),
|
||||
/// The unsize info of this parameter
|
||||
OfParam(&'tcx ty::ParamTy),
|
||||
}
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
use crate::check::{FnCtxt, PlaceOp, callee, Needs};
|
||||
use crate::hir::GenericArg;
|
||||
use crate::hir::def_id::DefId;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Subst, SubstsRef};
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, Ty, GenericParamDefKind};
|
||||
use rustc::ty::subst::Subst;
|
||||
use rustc::ty::adjustment::{Adjustment, Adjust, OverloadedDeref};
|
||||
use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
@@ -209,7 +208,7 @@ fn adjust_self_ty(&mut self,
|
||||
fn fresh_receiver_substs(&mut self,
|
||||
self_ty: Ty<'tcx>,
|
||||
pick: &probe::Pick<'tcx>)
|
||||
-> &'tcx Substs<'tcx> {
|
||||
-> SubstsRef<'tcx> {
|
||||
match pick.kind {
|
||||
probe::InherentImplPick => {
|
||||
let impl_def_id = pick.item.container.id();
|
||||
@@ -300,8 +299,8 @@ fn instantiate_method_substs(
|
||||
&mut self,
|
||||
pick: &probe::Pick<'tcx>,
|
||||
seg: &hir::PathSegment,
|
||||
parent_substs: &Substs<'tcx>,
|
||||
) -> &'tcx Substs<'tcx> {
|
||||
parent_substs: SubstsRef<'tcx>,
|
||||
) -> SubstsRef<'tcx> {
|
||||
// Determine the values for the generic parameters of the method.
|
||||
// If they were not explicitly supplied, just construct fresh
|
||||
// variables.
|
||||
@@ -369,7 +368,7 @@ fn unify_receivers(&mut self, self_ty: Ty<'tcx>, method_self_ty: Ty<'tcx>) {
|
||||
// until we unify the `Self` type.
|
||||
fn instantiate_method_sig(&mut self,
|
||||
pick: &probe::Pick<'tcx>,
|
||||
all_substs: &'tcx Substs<'tcx>)
|
||||
all_substs: SubstsRef<'tcx>)
|
||||
-> (ty::FnSig<'tcx>, ty::InstantiatedPredicates<'tcx>) {
|
||||
debug!("instantiate_method_sig(pick={:?}, all_substs={:?})",
|
||||
pick,
|
||||
@@ -404,7 +403,7 @@ fn instantiate_method_sig(&mut self,
|
||||
|
||||
fn add_obligations(&mut self,
|
||||
fty: Ty<'tcx>,
|
||||
all_substs: &Substs<'tcx>,
|
||||
all_substs: SubstsRef<'tcx>,
|
||||
method_predicates: &ty::InstantiatedPredicates<'tcx>) {
|
||||
debug!("add_obligations: fty={:?} all_substs={:?} method_predicates={:?}",
|
||||
fty,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::traits;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Substs, SubstsRef};
|
||||
use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable};
|
||||
use rustc::ty::GenericParamDefKind;
|
||||
use rustc::ty::subst::Subst;
|
||||
@@ -38,7 +38,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||
pub struct MethodCallee<'tcx> {
|
||||
/// Impl method ID, for inherent methods, or trait method ID, otherwise.
|
||||
pub def_id: DefId,
|
||||
pub substs: &'tcx Substs<'tcx>,
|
||||
pub substs: SubstsRef<'tcx>,
|
||||
|
||||
/// Instantiated method signature, i.e., it has been
|
||||
/// substituted, normalized, and has had late-bound
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
use rustc::hir;
|
||||
use rustc::lint;
|
||||
use rustc::session::config::nightly_options;
|
||||
use rustc::ty::subst::{Subst, Substs};
|
||||
use rustc::ty::subst::{Subst, Substs, SubstsRef};
|
||||
use rustc::traits::{self, ObligationCause};
|
||||
use rustc::traits::query::{CanonicalTyGoal};
|
||||
use rustc::traits::query::method_autoderef::{CandidateStep, MethodAutoderefStepsResult};
|
||||
@@ -125,7 +125,7 @@ struct Candidate<'tcx> {
|
||||
|
||||
#[derive(Debug)]
|
||||
enum CandidateKind<'tcx> {
|
||||
InherentImplCandidate(&'tcx Substs<'tcx>,
|
||||
InherentImplCandidate(SubstsRef<'tcx>,
|
||||
// Normalize obligations
|
||||
Vec<traits::PredicateObligation<'tcx>>),
|
||||
ObjectCandidate,
|
||||
@@ -1537,11 +1537,11 @@ fn xform_method_sig(&self,
|
||||
}
|
||||
|
||||
/// Gets the type of an impl and generate substitutions with placeholders.
|
||||
fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, &'tcx Substs<'tcx>) {
|
||||
fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, SubstsRef<'tcx>) {
|
||||
(self.tcx.type_of(impl_def_id), self.fresh_item_substs(impl_def_id))
|
||||
}
|
||||
|
||||
fn fresh_item_substs(&self, def_id: DefId) -> &'tcx Substs<'tcx> {
|
||||
fn fresh_item_substs(&self, def_id: DefId) -> SubstsRef<'tcx> {
|
||||
Substs::for_item(self.tcx, def_id, |param, _| {
|
||||
match param.kind {
|
||||
GenericParamDefKind::Lifetime => self.tcx.types.re_erased.into(),
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::subst::{UnpackedKind, Subst, Substs, UserSelfTy, UserSubsts};
|
||||
use rustc::ty::subst::{UnpackedKind, Subst, Substs, SubstsRef, UserSelfTy, UserSubsts};
|
||||
use rustc::ty::util::{Representability, IntTypeExt, Discr};
|
||||
use rustc::ty::layout::VariantIdx;
|
||||
use syntax_pos::{self, BytePos, Span, MultiSpan};
|
||||
@@ -1318,7 +1318,7 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn check_opaque<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
span: Span,
|
||||
) {
|
||||
if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id, substs) {
|
||||
@@ -2200,7 +2200,7 @@ pub fn write_method_call(&self,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_substs(&self, node_id: hir::HirId, substs: &'tcx Substs<'tcx>) {
|
||||
pub fn write_substs(&self, node_id: hir::HirId, substs: SubstsRef<'tcx>) {
|
||||
if !substs.is_noop() {
|
||||
debug!("write_substs({:?}, {:?}) in fcx {}",
|
||||
node_id,
|
||||
@@ -2222,7 +2222,7 @@ pub fn write_user_type_annotation_from_substs(
|
||||
&self,
|
||||
hir_id: hir::HirId,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
user_self_ty: Option<UserSelfTy<'tcx>>,
|
||||
) {
|
||||
debug!(
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
use rustc::session::CompileIncomplete;
|
||||
use rustc::session::config::{EntryFnType, nightly_options};
|
||||
use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::util;
|
||||
@@ -116,7 +116,7 @@
|
||||
use std::iter;
|
||||
|
||||
pub struct TypeAndSubsts<'tcx> {
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user