rustc: replace TyCtxt<'tcx, 'gcx, 'tcx>
with TyCtxt<'gcx, 'tcx>
.
This commit is contained in:
parent
2441253508
commit
17cdd356da
@ -8,7 +8,7 @@ use crate::hir::{self, PatKind};
|
||||
use crate::hir::def_id::DefId;
|
||||
|
||||
struct CFGBuilder<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
owner_def_id: DefId,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
graph: CFGGraph,
|
||||
@ -30,7 +30,7 @@ struct LoopScope {
|
||||
break_index: CFGIndex, // where to go on a `break`
|
||||
}
|
||||
|
||||
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
body: &hir::Body) -> CFG {
|
||||
let mut graph = graph::Graph::new();
|
||||
let entry = graph.add_node(CFGNodeData::Entry);
|
||||
|
@ -12,7 +12,7 @@ pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
|
||||
pub type Edge<'a> = &'a cfg::CFGEdge;
|
||||
|
||||
pub struct LabelledCFG<'a, 'tcx: 'a> {
|
||||
pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'tcx, 'tcx>,
|
||||
pub cfg: &'a cfg::CFG,
|
||||
pub name: String,
|
||||
/// `labelled_edges` controls whether we emit labels on the edges
|
||||
|
@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
|
||||
pub type CFGEdge = graph::Edge<CFGEdgeData>;
|
||||
|
||||
impl CFG {
|
||||
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
body: &hir::Body) -> CFG {
|
||||
construct::construct(tcx, body)
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ macro_rules! define_dep_nodes {
|
||||
impl DepNode {
|
||||
#[allow(unreachable_code, non_snake_case)]
|
||||
#[inline(always)]
|
||||
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
dep: DepConstructor<'gcx>)
|
||||
-> DepNode
|
||||
where 'gcx: 'a + 'tcx,
|
||||
@ -307,7 +307,7 @@ macro_rules! define_dep_nodes {
|
||||
/// refers to something from the previous compilation session that
|
||||
/// has been removed.
|
||||
#[inline]
|
||||
pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_, '_>) -> Option<DefId> {
|
||||
pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_>) -> Option<DefId> {
|
||||
if self.kind.can_reconstruct_query_key() {
|
||||
let def_path_hash = DefPathHash(self.hash);
|
||||
tcx.def_path_hash_to_def_id.as_ref()?
|
||||
@ -400,7 +400,7 @@ impl DefPathHash {
|
||||
|
||||
impl DefId {
|
||||
#[inline(always)]
|
||||
pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode {
|
||||
pub fn to_dep_node(self, tcx: TyCtxt<'_, '_>, kind: DepKind) -> DepNode {
|
||||
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
|
||||
}
|
||||
}
|
||||
@ -442,23 +442,23 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
|
||||
]);
|
||||
|
||||
pub trait RecoverKey<'tcx>: Sized {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self>;
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self>;
|
||||
}
|
||||
|
||||
impl RecoverKey<'tcx> for CrateNum {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx).map(|id| id.krate)
|
||||
}
|
||||
}
|
||||
|
||||
impl RecoverKey<'tcx> for DefId {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx)
|
||||
}
|
||||
}
|
||||
|
||||
impl RecoverKey<'tcx> for DefIndex {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx).map(|id| id.index)
|
||||
}
|
||||
}
|
||||
@ -470,11 +470,11 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
|
||||
/// Fingerprint to be used in DepNode.
|
||||
/// Not all DepNodeParams support being turned into a Fingerprint (they
|
||||
/// don't need to if the corresponding DepNode is anonymous).
|
||||
fn to_fingerprint(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, _: TyCtxt<'gcx, 'tcx>) -> Fingerprint {
|
||||
panic!("Not implemented. Accidentally called on anonymous node?")
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
@ -484,7 +484,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
|
||||
{
|
||||
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
|
||||
|
||||
default fn to_fingerprint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint {
|
||||
default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint {
|
||||
let mut hcx = tcx.create_stable_hashing_context();
|
||||
let mut hasher = StableHasher::new();
|
||||
|
||||
@ -493,7 +493,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
|
||||
hasher.finish()
|
||||
}
|
||||
|
||||
default fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
@ -501,11 +501,11 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
|
||||
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId {
|
||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
|
||||
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
|
||||
tcx.def_path_hash(*self).0
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
tcx.def_path_str(*self)
|
||||
}
|
||||
}
|
||||
@ -513,11 +513,11 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId {
|
||||
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex {
|
||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
|
||||
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
|
||||
tcx.hir().definitions().def_path_hash(*self).0
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
tcx.def_path_str(DefId::local(*self))
|
||||
}
|
||||
}
|
||||
@ -525,7 +525,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex {
|
||||
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
|
||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
|
||||
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
|
||||
let def_id = DefId {
|
||||
krate: *self,
|
||||
index: CRATE_DEF_INDEX,
|
||||
@ -533,7 +533,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
|
||||
tcx.def_path_hash(def_id).0
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
tcx.crate_name(*self).as_str().to_string()
|
||||
}
|
||||
}
|
||||
@ -544,7 +544,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
|
||||
// We actually would not need to specialize the implementation of this
|
||||
// method but it's faster to combine the hashes than to instantiate a full
|
||||
// hashing context and stable-hashing state.
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
|
||||
let (def_id_0, def_id_1) = *self;
|
||||
|
||||
let def_path_hash_0 = tcx.def_path_hash(def_id_0);
|
||||
@ -553,7 +553,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
|
||||
def_path_hash_0.0.combine(def_path_hash_1.0)
|
||||
}
|
||||
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
|
||||
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
|
||||
let (def_id_0, def_id_1) = *self;
|
||||
|
||||
format!("({}, {})",
|
||||
@ -568,7 +568,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId {
|
||||
// We actually would not need to specialize the implementation of this
|
||||
// method but it's faster to combine the hashes than to instantiate a full
|
||||
// hashing context and stable-hashing state.
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
|
||||
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
|
||||
let HirId {
|
||||
owner,
|
||||
local_id,
|
||||
|
@ -558,7 +558,7 @@ impl DepGraph {
|
||||
/// a node index can be found for that node.
|
||||
pub fn try_mark_green_and_read(
|
||||
&self,
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
dep_node: &DepNode
|
||||
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
|
||||
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
|
||||
@ -570,7 +570,7 @@ impl DepGraph {
|
||||
|
||||
pub fn try_mark_green(
|
||||
&self,
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
dep_node: &DepNode
|
||||
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
|
||||
debug_assert!(!dep_node.kind.is_eval_always());
|
||||
@ -604,7 +604,7 @@ impl DepGraph {
|
||||
/// Try to mark a dep-node which existed in the previous compilation session as green.
|
||||
fn try_mark_previous_green<'tcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
data: &DepGraphData,
|
||||
prev_dep_node_index: SerializedDepNodeIndex,
|
||||
dep_node: &DepNode
|
||||
@ -791,7 +791,7 @@ impl DepGraph {
|
||||
#[inline(never)]
|
||||
fn emit_diagnostics<'tcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
data: &DepGraphData,
|
||||
dep_node_index: DepNodeIndex,
|
||||
did_allocation: bool,
|
||||
@ -842,7 +842,7 @@ impl DepGraph {
|
||||
//
|
||||
// This method will only load queries that will end up in the disk cache.
|
||||
// Other queries will not be executed.
|
||||
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) {
|
||||
let green_nodes: Vec<DepNode> = {
|
||||
let data = self.data.as_ref().unwrap();
|
||||
data.colors.values.indices().filter_map(|prev_index| {
|
||||
|
@ -33,7 +33,7 @@ impl DepGraphSafe for DefId {
|
||||
|
||||
/// The type context itself can be used to access all kinds of tracked
|
||||
/// state, but those accesses should always generate read events.
|
||||
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
/// Tuples make it easy to build up state.
|
||||
|
@ -88,7 +88,7 @@ impl Target {
|
||||
}
|
||||
|
||||
struct CheckAttrVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl CheckAttrVisitor<'tcx> {
|
||||
@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) {
|
||||
tcx.hir().visit_item_likes_in_module(
|
||||
module_def_id,
|
||||
&mut CheckAttrVisitor { tcx }.as_deep_visitor()
|
||||
|
@ -177,7 +177,7 @@ impl DefId {
|
||||
LocalDefId::from_def_id(self)
|
||||
}
|
||||
|
||||
pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_, '_>) -> String {
|
||||
pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_>) -> String {
|
||||
if self.is_local() && self.index == CRATE_DEF_INDEX {
|
||||
format!("top-level module")
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector {
|
||||
}
|
||||
|
||||
struct CaptureCollector<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
locals: &'a FxHashSet<HirId>,
|
||||
upvars: FxIndexMap<HirId, hir::Upvar>,
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ for &'b mut T {
|
||||
}
|
||||
}
|
||||
|
||||
impl StableHashingContextProvider<'lcx> for TyCtxt<'lcx, 'gcx, 'lcx> {
|
||||
impl StableHashingContextProvider<'lcx> for TyCtxt<'gcx, 'lcx> {
|
||||
fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> {
|
||||
(*self).create_stable_hashing_context()
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {
|
||||
|
||||
struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
variables: SmallVec<[CanonicalVarInfo; 8]>,
|
||||
query_state: &'cx mut OriginalQueryValues<'tcx>,
|
||||
// Note that indices is only used once `var_values` is big enough to be
|
||||
@ -290,7 +290,7 @@ struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
}
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
|
||||
fn canonicalize<V>(
|
||||
value: &V,
|
||||
infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalize_region_mode: &dyn CanonicalizeRegionMode,
|
||||
query_state: &mut OriginalQueryValues<'tcx>,
|
||||
) -> Canonicalized<'gcx, V>
|
||||
|
@ -478,7 +478,7 @@ impl<'tcx> CanonicalVarValues<'tcx> {
|
||||
/// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]`
|
||||
/// we'll return a substitution `subst` with:
|
||||
/// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`.
|
||||
pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self {
|
||||
pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Self {
|
||||
use crate::ty::subst::UnpackedKind;
|
||||
|
||||
CanonicalVarValues {
|
||||
|
@ -647,7 +647,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
||||
/// Given the region obligations and constraints scraped from the infcx,
|
||||
/// creates query region constraints.
|
||||
pub fn make_query_outlives<'tcx>(
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>)>,
|
||||
region_constraints: &RegionConstraintData<'tcx>,
|
||||
) -> Vec<QueryRegionConstraint<'tcx>> {
|
||||
|
@ -16,7 +16,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
|
||||
/// with the value given in `var_values`.
|
||||
pub fn substitute(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
var_values: &CanonicalVarValues<'tcx>,
|
||||
) -> V
|
||||
where
|
||||
@ -33,7 +33,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
|
||||
/// V, replacing each of the canonical variables.
|
||||
pub fn substitute_projected<T>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
var_values: &CanonicalVarValues<'tcx>,
|
||||
projection_fn: impl FnOnce(&V) -> &T,
|
||||
) -> T
|
||||
@ -50,7 +50,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
|
||||
/// must be values for the set of canonical variables that appear in
|
||||
/// `value`.
|
||||
pub(super) fn substitute_value<'a, 'tcx, T>(
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
var_values: &CanonicalVarValues<'tcx>,
|
||||
value: &'a T,
|
||||
) -> T
|
||||
|
@ -207,7 +207,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ struct Generalization<'tcx> {
|
||||
}
|
||||
|
||||
impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
impl TypeRelation<'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
fn tag(&self) -> &'static str { "Equate" }
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
|
||||
|
||||
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||
|
||||
|
@ -67,7 +67,7 @@ mod need_type_info;
|
||||
|
||||
pub mod nice_region_error;
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn note_and_explain_region(
|
||||
self,
|
||||
region_scope_tree: ®ion::ScopeTree,
|
||||
@ -446,7 +446,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
use ty::subst::Kind;
|
||||
|
||||
struct AbsolutePathPrinter<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
struct NonTrivialPath;
|
||||
@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
type DynExistential = !;
|
||||
type Const = !;
|
||||
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
|
||||
// where that lifetime appears. This allows us to highlight the
|
||||
// specific part of the type in the error message.
|
||||
struct FindNestedTypeVisitor<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
// The bound_region corresponding to the Refree(freeregion)
|
||||
// associated with the anonymous region we are looking for.
|
||||
bound_region: ty::BoundRegion,
|
||||
@ -209,7 +209,7 @@ impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> {
|
||||
// where that lifetime appears. This allows us to highlight the
|
||||
// specific part of the type in the error message.
|
||||
struct TyPathVisitor<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
found_it: bool,
|
||||
bound_region: ty::BoundRegion,
|
||||
current_index: ty::DebruijnIndex,
|
||||
|
@ -56,7 +56,7 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> {
|
||||
Self { infcx, error: None, regions: Some((span, sub, sup)), tables }
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
// HACK(eddyb) maybe move this in a more central location.
|
||||
#[derive(Copy, Clone)]
|
||||
struct Highlighted<'gcx, 'tcx, T> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
highlight: RegionHighlightMode,
|
||||
value: T,
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
fn tag(&self) -> &'static str { "Glb" }
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
|
||||
|
||||
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||
|
||||
|
@ -103,7 +103,7 @@ struct LexicalResolver<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
}
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.region_rels.tcx
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
|
||||
|
||||
/// Initially, the value for all variables is set to `'empty`, the
|
||||
/// empty region. The `expansion` phase will grow this larger.
|
||||
fn construct_var_data(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> {
|
||||
fn construct_var_data(&self, tcx: TyCtxt<'_, 'tcx>) -> LexicalRegionResolutions<'tcx> {
|
||||
LexicalRegionResolutions {
|
||||
error_region: tcx.lifetimes.re_static,
|
||||
values: IndexVec::from_elem_n(VarValue::Value(tcx.lifetimes.re_empty), self.num_vars())
|
||||
@ -785,7 +785,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> LexicalRegionResolutions<'tcx> {
|
||||
fn normalize<T>(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T
|
||||
fn normalize<T>(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
fn tag(&self) -> &'static str { "Lub" }
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
|
||||
|
||||
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||
|
||||
|
@ -91,7 +91,7 @@ impl SuppressRegionErrors {
|
||||
/// Indicates that the MIR borrowck will repeat these region
|
||||
/// checks, so we should ignore errors if NLL is (unconditionally)
|
||||
/// enabled.
|
||||
pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_, '_>) -> Self {
|
||||
pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_>) -> Self {
|
||||
match tcx.borrowck_mode() {
|
||||
// If we're on Migrate mode, report AST region errors
|
||||
BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false },
|
||||
@ -103,7 +103,7 @@ impl SuppressRegionErrors {
|
||||
}
|
||||
|
||||
pub struct InferCtxt<'a, 'gcx, 'tcx> {
|
||||
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'gcx, 'tcx>,
|
||||
|
||||
/// During type-checking/inference of a body, `in_progress_tables`
|
||||
/// contains a reference to the tables being built up, which are
|
||||
@ -466,11 +466,11 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
|
||||
/// Necessary because we can't write the following bound:
|
||||
/// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`.
|
||||
pub struct InferCtxtBuilder<'gcx, 'tcx> {
|
||||
global_tcx: TyCtxt<'gcx, 'gcx, 'gcx>,
|
||||
global_tcx: TyCtxt<'gcx, 'gcx>,
|
||||
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
|
||||
}
|
||||
|
||||
impl TyCtxt<'gcx, 'gcx, 'gcx> {
|
||||
impl TyCtxt<'gcx, 'gcx> {
|
||||
pub fn infer_ctxt<'tcx>(self) -> InferCtxtBuilder<'gcx, 'tcx> {
|
||||
InferCtxtBuilder {
|
||||
global_tcx: self,
|
||||
@ -1600,7 +1600,7 @@ impl<'a, 'gcx, 'tcx> ShallowResolver<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -1641,7 +1641,7 @@ impl<'gcx, 'tcx> TypeTrace<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dummy(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> TypeTrace<'tcx> {
|
||||
pub fn dummy(tcx: TyCtxt<'gcx, 'tcx>) -> TypeTrace<'tcx> {
|
||||
TypeTrace {
|
||||
cause: ObligationCause::dummy(),
|
||||
values: Types(ExpectedFound {
|
||||
|
@ -498,7 +498,7 @@ impl<D> TypeRelation<'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -827,7 +827,7 @@ impl<D> TypeRelation<'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx>
|
||||
}
|
||||
|
||||
struct ReverseMapper<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
|
||||
/// If errors have already been reported in this fn, we suppress
|
||||
/// our own errors because they are sometimes derivative.
|
||||
@ -569,7 +569,7 @@ struct ReverseMapper<'gcx, 'tcx> {
|
||||
|
||||
impl ReverseMapper<'gcx, 'tcx> {
|
||||
fn new(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
tainted_by_errors: bool,
|
||||
opaque_type_def_id: DefId,
|
||||
map: FxHashMap<Kind<'tcx>, Kind<'gcx>>,
|
||||
@ -600,7 +600,7 @@ impl ReverseMapper<'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
@ -944,7 +944,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
|
||||
/// and `opaque_hir_id` is the `HirId` of the definition of the existential type `Baz`.
|
||||
/// For the above example, this function returns `true` for `f1` and `false` for `f2`.
|
||||
pub fn may_define_existential_type(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
def_id: DefId,
|
||||
opaque_hir_id: hir::HirId,
|
||||
) -> bool {
|
||||
|
@ -29,7 +29,7 @@ impl<'tcx> FreeRegionMap<'tcx> {
|
||||
/// avoid making arbitrary choices. See
|
||||
/// `TransitiveRelation::postdom_upper_bound` for more details.
|
||||
pub fn lub_free_regions<'gcx>(&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
r_a: Region<'tcx>,
|
||||
r_b: Region<'tcx>)
|
||||
-> Region<'tcx> {
|
||||
@ -90,7 +90,7 @@ impl_stable_hash_for!(struct FreeRegionMap<'tcx> {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> {
|
||||
type Lifted = FreeRegionMap<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<FreeRegionMap<'tcx>> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<FreeRegionMap<'tcx>> {
|
||||
self.relation.maybe_map(|&fr| tcx.lift(&fr))
|
||||
.map(|relation| FreeRegionMap { relation })
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ where
|
||||
// See the comments on `process_registered_region_obligations` for the meaning
|
||||
// of these fields.
|
||||
delegate: D,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
verify_bound: VerifyBoundCx<'cx, 'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ where
|
||||
{
|
||||
pub fn new(
|
||||
delegate: D,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
|
||||
implicit_region_bound: Option<ty::Region<'tcx>>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
|
@ -13,7 +13,7 @@ use crate::util::captures::Captures;
|
||||
/// accrues them into the `region_obligations` code, but for NLL we
|
||||
/// use something else.
|
||||
pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
|
||||
implicit_region_bound: Option<ty::Region<'tcx>>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -21,7 +21,7 @@ pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
|
||||
pub fn new(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
|
||||
implicit_region_bound: Option<ty::Region<'tcx>>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
|
@ -22,7 +22,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||
/// refactor the constraint set.
|
||||
pub fn leak_check(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
overly_polymorphic: bool,
|
||||
placeholder_map: &PlaceholderMap<'tcx>,
|
||||
_snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
@ -109,7 +109,7 @@ impl<'tcx> TaintSet<'tcx> {
|
||||
|
||||
fn fixed_point(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
undo_log: &[UndoLog<'tcx>],
|
||||
verifys: &[Verify<'tcx>],
|
||||
) {
|
||||
|
@ -700,7 +700,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||
|
||||
pub fn lub_regions(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
origin: SubregionOrigin<'tcx>,
|
||||
a: Region<'tcx>,
|
||||
b: Region<'tcx>,
|
||||
@ -722,7 +722,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||
|
||||
pub fn glb_regions(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
origin: SubregionOrigin<'tcx>,
|
||||
a: Region<'tcx>,
|
||||
b: Region<'tcx>,
|
||||
@ -744,7 +744,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||
|
||||
pub fn opportunistic_resolve_var(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
rid: RegionVid,
|
||||
) -> ty::Region<'tcx> {
|
||||
let vid = self.unification_table.probe_value(rid).min_vid;
|
||||
@ -760,7 +760,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||
|
||||
fn combine_vars(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
t: CombineMapType,
|
||||
a: Region<'tcx>,
|
||||
b: Region<'tcx>,
|
||||
@ -850,7 +850,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> GenericKind<'tcx> {
|
||||
pub fn to_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
pub fn to_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
match *self {
|
||||
GenericKind::Param(ref p) => p.to_ty(tcx),
|
||||
GenericKind::Projection(ref p) => tcx.mk_projection(p.item_def_id, p.substs),
|
||||
|
@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ struct FullTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
|
||||
impl TypeRelation<'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||
fn tag(&self) -> &'static str { "Sub" }
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.infcx.tcx }
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.infcx.tcx }
|
||||
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||
|
||||
fn with_cause<F,R>(&mut self, cause: Cause, f: F) -> R
|
||||
|
@ -10,7 +10,7 @@ use std::marker::PhantomData;
|
||||
use std::cell::RefMut;
|
||||
|
||||
pub trait ToType {
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>;
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>;
|
||||
}
|
||||
|
||||
impl UnifyKey for ty::IntVid {
|
||||
@ -52,7 +52,7 @@ impl UnifyKey for ty::RegionVid {
|
||||
}
|
||||
|
||||
impl ToType for IntVarValue {
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
match *self {
|
||||
ty::IntType(i) => tcx.mk_mach_int(i),
|
||||
ty::UintType(i) => tcx.mk_mach_uint(i),
|
||||
@ -72,7 +72,7 @@ impl UnifyKey for ty::FloatVid {
|
||||
impl EqUnifyValue for FloatVarValue {}
|
||||
|
||||
impl ToType for FloatVarValue {
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
tcx.mk_mach_float(self.0)
|
||||
}
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ impl LintStore {
|
||||
/// Context for lint checking after type checking.
|
||||
pub struct LateContext<'a, 'tcx: 'a> {
|
||||
/// Type context we're checking in.
|
||||
pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'tcx, 'tcx>,
|
||||
|
||||
/// Side-tables for the body we are in.
|
||||
// FIXME: Make this lazy to avoid running the TypeckTables query?
|
||||
@ -781,7 +781,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
|
||||
/// ```
|
||||
pub fn get_def_path(&self, def_id: DefId) -> Vec<Symbol> {
|
||||
pub struct AbsolutePathPrinter<'tcx> {
|
||||
pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> {
|
||||
@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
|
||||
type DynExistential = ();
|
||||
type Const = ();
|
||||
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
@ -1372,7 +1372,7 @@ macro_rules! late_lint_pass_impl {
|
||||
late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
|
||||
|
||||
fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module_def_id: DefId,
|
||||
pass: T,
|
||||
) {
|
||||
@ -1404,7 +1404,7 @@ fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
}
|
||||
|
||||
pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module_def_id: DefId,
|
||||
builtin_lints: T,
|
||||
) {
|
||||
@ -1424,7 +1424,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
}
|
||||
|
||||
fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
pass: T
|
||||
) {
|
||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
@ -1460,7 +1460,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
}
|
||||
|
||||
fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
builtin_lints: T
|
||||
) {
|
||||
let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap();
|
||||
@ -1494,7 +1494,7 @@ fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
|
||||
/// Performs lint checking on a crate.
|
||||
pub fn check_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
builtin_lints: impl FnOnce() -> T + Send,
|
||||
) {
|
||||
join(|| {
|
||||
|
@ -761,12 +761,12 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
|
||||
return err
|
||||
}
|
||||
|
||||
pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool {
|
||||
pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool {
|
||||
let attrs = tcx.hir().attrs_by_hir_id(id);
|
||||
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
|
||||
}
|
||||
|
||||
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum)
|
||||
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum)
|
||||
-> &'tcx LintLevelMap
|
||||
{
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
@ -789,7 +789,7 @@ fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum)
|
||||
|
||||
struct LintLevelMapBuilder<'tcx> {
|
||||
levels: levels::LintLevelsBuilder<'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl LintLevelMapBuilder<'tcx> {
|
||||
|
@ -195,7 +195,7 @@ macro_rules! CloneLiftImpls {
|
||||
$(
|
||||
impl<$tcx> $crate::ty::Lift<$tcx> for $ty {
|
||||
type Lifted = Self;
|
||||
fn lift_to_tcx<'a, 'gcx>(&self, _: $crate::ty::TyCtxt<'a, 'gcx, $tcx>) -> Option<Self> {
|
||||
fn lift_to_tcx<'gcx>(&self, _: $crate::ty::TyCtxt<'gcx, $tcx>) -> Option<Self> {
|
||||
Some(Clone::clone(self))
|
||||
}
|
||||
}
|
||||
@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl {
|
||||
{
|
||||
type Lifted = $lifted;
|
||||
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> {
|
||||
$(let $field = tcx.lift(&self.$field)?;)*
|
||||
Some(Self::Lifted { $($field),* })
|
||||
}
|
||||
@ -283,7 +283,7 @@ macro_rules! EnumLiftImpl {
|
||||
{
|
||||
type Lifted = $lifted;
|
||||
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> {
|
||||
EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output())
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ pub trait CrateStore {
|
||||
|
||||
// utility functions
|
||||
fn encode_metadata<'tcx>(&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>)
|
||||
tcx: TyCtxt<'tcx, 'tcx>)
|
||||
-> EncodedMetadata;
|
||||
fn metadata_encoding_version(&self) -> &[u8];
|
||||
}
|
||||
@ -228,7 +228,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
|
||||
// In order to get this left-to-right dependency ordering, we perform a
|
||||
// topological sort of all crates putting the leaves at the right-most
|
||||
// positions.
|
||||
pub fn used_crates(tcx: TyCtxt<'_, '_, '_>, prefer: LinkagePreference)
|
||||
pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference)
|
||||
-> Vec<(CrateNum, LibSource)>
|
||||
{
|
||||
let mut libs = tcx.crates()
|
||||
|
@ -26,7 +26,7 @@ use syntax_pos;
|
||||
// explored. For example, if it's a live Node::Item that is a
|
||||
// function, then we should explore its block to check for codes that
|
||||
// may need to be marked as live.
|
||||
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
hir_id: hir::HirId) -> bool {
|
||||
match tcx.hir().find_by_hir_id(hir_id) {
|
||||
Some(Node::Item(..)) |
|
||||
@ -41,7 +41,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
|
||||
struct MarkSymbolVisitor<'a, 'tcx: 'a> {
|
||||
worklist: Vec<hir::HirId>,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
live_symbols: FxHashSet<hir::HirId>,
|
||||
repr_has_repr_c: bool,
|
||||
@ -302,7 +302,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
|
||||
fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>,
|
||||
id: hir::HirId,
|
||||
attrs: &[ast::Attribute]) -> bool {
|
||||
if attr::contains_name(attrs, sym::lang) {
|
||||
@ -353,7 +353,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
|
||||
struct LifeSeeder<'k, 'tcx: 'k> {
|
||||
worklist: Vec<hir::HirId>,
|
||||
krate: &'k hir::Crate,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
// see `MarkSymbolVisitor::struct_constructors`
|
||||
struct_constructors: FxHashMap<hir::HirId, hir::HirId>,
|
||||
}
|
||||
@ -424,7 +424,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
|
||||
}
|
||||
|
||||
fn create_and_seed_worklist<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
access_levels: &privacy::AccessLevels,
|
||||
krate: &hir::Crate,
|
||||
) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) {
|
||||
@ -451,7 +451,7 @@ fn create_and_seed_worklist<'tcx>(
|
||||
(life_seeder.worklist, life_seeder.struct_constructors)
|
||||
}
|
||||
|
||||
fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
access_levels: &privacy::AccessLevels,
|
||||
krate: &hir::Crate)
|
||||
-> FxHashSet<hir::HirId> {
|
||||
@ -472,7 +472,7 @@ fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
struct DeadVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
live_symbols: FxHashSet<hir::HirId>,
|
||||
}
|
||||
|
||||
@ -660,7 +660,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
|
||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
let krate = tcx.hir().krate();
|
||||
let live_symbols = find_live(tcx, access_levels, krate);
|
||||
|
@ -81,7 +81,7 @@ pub enum Linkage {
|
||||
Dynamic,
|
||||
}
|
||||
|
||||
pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
|
||||
let sess = &tcx.sess;
|
||||
let fmts = sess.crate_types.borrow().iter().map(|&ty| {
|
||||
let linkage = calculate_type(tcx, ty);
|
||||
@ -92,7 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
sess.dependency_formats.set(fmts);
|
||||
}
|
||||
|
||||
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: config::CrateType) -> DependencyList {
|
||||
|
||||
let sess = &tcx.sess;
|
||||
@ -242,7 +242,7 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
ret
|
||||
}
|
||||
|
||||
fn add_library(tcx: TyCtxt<'_, '_, '_>,
|
||||
fn add_library(tcx: TyCtxt<'_, '_>,
|
||||
cnum: CrateNum,
|
||||
link: LinkagePreference,
|
||||
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
|
||||
@ -267,7 +267,7 @@ fn add_library(tcx: TyCtxt<'_, '_, '_>,
|
||||
}
|
||||
}
|
||||
|
||||
fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option<DependencyList> {
|
||||
fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option<DependencyList> {
|
||||
let sess = &tcx.sess;
|
||||
let crates = cstore::used_crates(tcx, RequireStatic);
|
||||
if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) {
|
||||
@ -324,7 +324,7 @@ fn activate_injected_dep(injected: Option<CrateNum>,
|
||||
|
||||
// After the linkage for a crate has been determined we need to verify that
|
||||
// there's only going to be one allocator in the output.
|
||||
fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, list: &[Linkage]) {
|
||||
fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, list: &[Linkage]) {
|
||||
let sess = &tcx.sess;
|
||||
if list.len() == 0 {
|
||||
return
|
||||
|
@ -47,7 +47,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn entry_fn(tcx: TyCtxt<'_, '_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> {
|
||||
fn entry_fn(tcx: TyCtxt<'_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
let any_exe = tcx.sess.crate_types.borrow().iter().any(|ty| {
|
||||
@ -141,7 +141,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
|
||||
}
|
||||
|
||||
fn configure_main(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
visitor: &EntryContext<'_, '_>,
|
||||
) -> Option<(DefId, EntryFnType)> {
|
||||
if let Some((hir_id, _)) = visitor.start_fn {
|
||||
@ -179,7 +179,7 @@ fn configure_main(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_entry_point(tcx: TyCtxt<'_, '_, '_>) -> Option<(DefId, EntryFnType)> {
|
||||
pub fn find_entry_point(tcx: TyCtxt<'_, '_>) -> Option<(DefId, EntryFnType)> {
|
||||
tcx.entry_fn(LOCAL_CRATE)
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ pub enum ExportedSymbol<'tcx> {
|
||||
|
||||
impl<'tcx> ExportedSymbol<'tcx> {
|
||||
pub fn symbol_name(&self,
|
||||
tcx: TyCtxt<'_, 'tcx, '_>)
|
||||
tcx: TyCtxt<'tcx, '_>)
|
||||
-> ty::SymbolName {
|
||||
match *self {
|
||||
ExportedSymbol::NonGeneric(def_id) => {
|
||||
@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
|
||||
}
|
||||
|
||||
pub fn compare_stable(&self,
|
||||
tcx: TyCtxt<'_, 'tcx, '_>,
|
||||
tcx: TyCtxt<'tcx, '_>,
|
||||
other: &ExportedSymbol<'tcx>)
|
||||
-> cmp::Ordering {
|
||||
match *self {
|
||||
@ -92,7 +92,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_, '_>) -> String {
|
||||
pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_>) -> String {
|
||||
format!("rust_metadata_{}_{}",
|
||||
tcx.original_crate_name(LOCAL_CRATE),
|
||||
tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex())
|
||||
|
@ -202,7 +202,7 @@ enum OverloadedCallType {
|
||||
}
|
||||
|
||||
impl OverloadedCallType {
|
||||
fn from_trait_id(tcx: TyCtxt<'_, '_, '_>, trait_id: DefId) -> OverloadedCallType {
|
||||
fn from_trait_id(tcx: TyCtxt<'_, '_>, trait_id: DefId) -> OverloadedCallType {
|
||||
for &(maybe_function_trait, overloaded_call_type) in &[
|
||||
(tcx.lang_items().fn_once_trait(), FnOnceOverloadedCall),
|
||||
(tcx.lang_items().fn_mut_trait(), FnMutOverloadedCall),
|
||||
@ -219,7 +219,7 @@ impl OverloadedCallType {
|
||||
bug!("overloaded call didn't map to known function trait")
|
||||
}
|
||||
|
||||
fn from_method_id(tcx: TyCtxt<'_, '_, '_>, method_id: DefId) -> OverloadedCallType {
|
||||
fn from_method_id(tcx: TyCtxt<'_, '_>, method_id: DefId) -> OverloadedCallType {
|
||||
let method = tcx.associated_item(method_id);
|
||||
OverloadedCallType::from_trait_id(tcx, method.container.id())
|
||||
}
|
||||
@ -267,7 +267,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
|
||||
///
|
||||
/// See also `with_infer`, which is used *during* typeck.
|
||||
pub fn new(delegate: &'a mut (dyn Delegate<'tcx>+'a),
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
body_owner: DefId,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
region_scope_tree: &'a region::ScopeTree,
|
||||
@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
|
||||
self.consume_expr(&body.value);
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.mc.tcx
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ use crate::ty::{self, TyCtxt, Region};
|
||||
/// This stuff is a bit convoluted and should be refactored, but as we
|
||||
/// transition to NLL, it'll all go away anyhow.
|
||||
pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
||||
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'gcx, 'tcx>,
|
||||
|
||||
/// The context used to fetch the region maps.
|
||||
pub context: DefId,
|
||||
@ -30,7 +30,7 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
||||
|
||||
impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> {
|
||||
pub fn new(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
context: DefId,
|
||||
region_scope_tree: &'a region::ScopeTree,
|
||||
free_regions: &'a FreeRegionMap<'tcx>,
|
||||
|
@ -10,7 +10,7 @@ use syntax_pos::{Span, sym};
|
||||
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
||||
use crate::hir;
|
||||
|
||||
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) {
|
||||
tcx.hir().visit_item_likes_in_module(
|
||||
module_def_id,
|
||||
&mut ItemVisitor { tcx }.as_deep_visitor()
|
||||
@ -25,18 +25,18 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||
}
|
||||
|
||||
struct ItemVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>
|
||||
tcx: TyCtxt<'tcx, 'tcx>
|
||||
}
|
||||
|
||||
struct ExprVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
tables: &'tcx ty::TypeckTables<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
}
|
||||
|
||||
/// If the type is `Option<T>`, it will return `T`, otherwise
|
||||
/// the type itself. Works on most `Option`-like types.
|
||||
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>)
|
||||
-> Ty<'tcx> {
|
||||
let (def, substs) = match ty.sty {
|
||||
|
@ -106,7 +106,7 @@ impl LanguageItems {
|
||||
|
||||
struct LanguageItemCollector<'tcx> {
|
||||
items: LanguageItems,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
/// A mapping from the name of the lang item to its order and the form it must be of.
|
||||
item_refs: FxHashMap<&'static str, (usize, Target)>,
|
||||
}
|
||||
@ -160,7 +160,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
|
||||
}
|
||||
|
||||
impl LanguageItemCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItemCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItemCollector<'tcx> {
|
||||
let mut item_refs = FxHashMap::default();
|
||||
|
||||
$( item_refs.insert($name, ($variant as usize, $target)); )*
|
||||
@ -217,7 +217,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
|
||||
}
|
||||
|
||||
/// Traverse and collect all the lang items in all crates.
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItems {
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItems {
|
||||
// Initialize the collector.
|
||||
let mut collector = LanguageItemCollector::new(tcx);
|
||||
|
||||
@ -402,7 +402,7 @@ language_item_table! {
|
||||
Rc, "rc", rc, Target::Struct;
|
||||
}
|
||||
|
||||
impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> {
|
||||
impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> {
|
||||
/// Returns the `DefId` for a given `LangItem`.
|
||||
/// If not found, fatally abort compilation.
|
||||
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {
|
||||
|
@ -38,12 +38,12 @@ impl LibFeatures {
|
||||
}
|
||||
|
||||
pub struct LibFeatureCollector<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
lib_features: LibFeatures,
|
||||
}
|
||||
|
||||
impl LibFeatureCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatureCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatureCollector<'tcx> {
|
||||
LibFeatureCollector {
|
||||
tcx,
|
||||
lib_features: LibFeatures::new(),
|
||||
@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatures {
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatures {
|
||||
let mut collector = LibFeatureCollector::new(tcx);
|
||||
intravisit::walk_crate(&mut collector, tcx.hir().krate());
|
||||
collector.lib_features
|
||||
|
@ -150,7 +150,7 @@ enum LiveNodeKind {
|
||||
ExitNode
|
||||
}
|
||||
|
||||
fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> String {
|
||||
fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_>) -> String {
|
||||
let cm = tcx.sess.source_map();
|
||||
match lnk {
|
||||
UpvarNode(s) => {
|
||||
@ -181,7 +181,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||
fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); }
|
||||
}
|
||||
|
||||
fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) {
|
||||
tcx.hir().visit_item_likes_in_module(
|
||||
module_def_id,
|
||||
&mut IrMaps::new(tcx, module_def_id).as_deep_visitor(),
|
||||
@ -257,7 +257,7 @@ enum VarKind {
|
||||
}
|
||||
|
||||
struct IrMaps<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
body_owner: DefId,
|
||||
num_live_nodes: usize,
|
||||
num_vars: usize,
|
||||
@ -269,7 +269,7 @@ struct IrMaps<'tcx> {
|
||||
}
|
||||
|
||||
impl IrMaps<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> {
|
||||
IrMaps {
|
||||
tcx,
|
||||
body_owner,
|
||||
|
@ -288,7 +288,7 @@ impl HirNode for hir::Pat {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'gcx, 'tcx>,
|
||||
pub body_owner: DefId,
|
||||
pub upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>,
|
||||
pub region_scope_tree: &'a region::ScopeTree,
|
||||
@ -339,7 +339,7 @@ impl MutabilityCategory {
|
||||
ret
|
||||
}
|
||||
|
||||
fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>,
|
||||
fn from_local(tcx: TyCtxt<'_, '_>, tables: &ty::TypeckTables<'_>,
|
||||
id: ast::NodeId) -> MutabilityCategory {
|
||||
let ret = match tcx.hir().get(id) {
|
||||
Node::Binding(p) => match p.node {
|
||||
@ -400,7 +400,7 @@ impl MutabilityCategory {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
body_owner: DefId,
|
||||
region_scope_tree: &'a region::ScopeTree,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
@ -1514,7 +1514,7 @@ impl<'tcx> cmt_<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_, '_>) -> Cow<'static, str> {
|
||||
pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_>) -> Cow<'static, str> {
|
||||
match self.cat {
|
||||
Categorization::StaticItem => {
|
||||
"static item".into()
|
||||
|
@ -27,7 +27,7 @@ use crate::hir::intravisit;
|
||||
// Returns true if the given item must be inlined because it may be
|
||||
// monomorphized or it was marked with `#[inline]`. This will only return
|
||||
// true for functions.
|
||||
fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
item: &hir::Item,
|
||||
attrs: CodegenFnAttrs) -> bool {
|
||||
if attrs.requests_inline() {
|
||||
@ -44,7 +44,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
}
|
||||
}
|
||||
|
||||
fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
impl_item: &hir::ImplItem,
|
||||
impl_src: DefId) -> bool {
|
||||
let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id());
|
||||
@ -67,7 +67,7 @@ fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
// Information needed while computing reachability.
|
||||
struct ReachableContext<'a, 'tcx: 'a> {
|
||||
// The type context.
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
tables: &'a ty::TypeckTables<'tcx>,
|
||||
// The set of items which must be exported in the linkage sense.
|
||||
reachable_symbols: HirIdSet,
|
||||
@ -335,7 +335,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||
// trait items are used from inlinable code through method call syntax or UFCS, or their
|
||||
// trait is a lang item.
|
||||
struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
access_levels: &'a privacy::AccessLevels,
|
||||
worklist: &'a mut Vec<hir::HirId>,
|
||||
}
|
||||
@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a,
|
||||
#[derive(Clone, HashStable)]
|
||||
pub struct ReachableSet(pub Lrc<HirIdSet>);
|
||||
|
||||
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet {
|
||||
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet {
|
||||
debug_assert!(crate_num == LOCAL_CRATE);
|
||||
|
||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
|
@ -169,7 +169,7 @@ impl Scope {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn node_id(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> ast::NodeId {
|
||||
pub fn node_id(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> ast::NodeId {
|
||||
match scope_tree.root_body {
|
||||
Some(hir_id) => {
|
||||
tcx.hir().hir_to_node_id(hir::HirId {
|
||||
@ -184,7 +184,7 @@ impl Scope {
|
||||
/// Returns the span of this `Scope`. Note that in general the
|
||||
/// returned span may not correspond to the span of any `NodeId` in
|
||||
/// the AST.
|
||||
pub fn span(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> Span {
|
||||
pub fn span(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> Span {
|
||||
let node_id = self.node_id(tcx, scope_tree);
|
||||
if node_id == ast::DUMMY_NODE_ID {
|
||||
return DUMMY_SP;
|
||||
@ -359,7 +359,7 @@ pub struct Context {
|
||||
}
|
||||
|
||||
struct RegionResolutionVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
|
||||
// The number of expressions and patterns visited in the current body
|
||||
expr_and_pat_count: usize,
|
||||
@ -646,7 +646,7 @@ impl<'tcx> ScopeTree {
|
||||
|
||||
/// Assuming that the provided region was defined within this `ScopeTree`,
|
||||
/// returns the outermost `Scope` that the region outlives.
|
||||
pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
br: &ty::EarlyBoundRegion)
|
||||
-> Scope {
|
||||
let param_owner = tcx.parent(br.def_id).unwrap();
|
||||
@ -677,7 +677,7 @@ impl<'tcx> ScopeTree {
|
||||
|
||||
/// Assuming that the provided region was defined within this `ScopeTree`,
|
||||
/// returns the outermost `Scope` that the region outlives.
|
||||
pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion)
|
||||
pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, fr: &ty::FreeRegion)
|
||||
-> Scope {
|
||||
let param_owner = match fr.bound_region {
|
||||
ty::BoundRegion::BrNamed(def_id, _) => {
|
||||
@ -1327,7 +1327,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId)
|
||||
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId)
|
||||
-> &'tcx ScopeTree
|
||||
{
|
||||
let closure_base_def_id = tcx.closure_base_def_id(def_id);
|
||||
|
@ -218,7 +218,7 @@ impl_stable_hash_for!(struct crate::middle::resolve_lifetime::ResolveLifetimes {
|
||||
});
|
||||
|
||||
struct LifetimeContext<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
map: &'a mut NamedRegionMap,
|
||||
scope: ScopeRef<'a>,
|
||||
|
||||
@ -369,7 +369,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||
/// directly, but rather use `named_region_map`, `is_late_bound_map`,
|
||||
/// etc.
|
||||
fn resolve_lifetimes<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
for_krate: CrateNum,
|
||||
) -> &'tcx ResolveLifetimes {
|
||||
assert_eq!(for_krate, LOCAL_CRATE);
|
||||
@ -398,7 +398,7 @@ fn resolve_lifetimes<'tcx>(
|
||||
tcx.arena.alloc(rl)
|
||||
}
|
||||
|
||||
fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> NamedRegionMap {
|
||||
fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> NamedRegionMap {
|
||||
let krate = tcx.hir().krate();
|
||||
let mut map = NamedRegionMap {
|
||||
defs: Default::default(),
|
||||
@ -1101,7 +1101,7 @@ impl ShadowKind {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_, '_>, params: &P<[hir::GenericParam]>) {
|
||||
fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_>, params: &P<[hir::GenericParam]>) {
|
||||
let lifetime_params: Vec<_> = params
|
||||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
@ -1129,7 +1129,7 @@ fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_, '_>, params: &P<[hi
|
||||
}
|
||||
|
||||
fn signal_shadowing_problem(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
name: ast::Name,
|
||||
orig: Original,
|
||||
shadower: Shadower,
|
||||
@ -1169,7 +1169,7 @@ fn signal_shadowing_problem(
|
||||
// if one of the label shadows a lifetime or another label.
|
||||
fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) {
|
||||
struct GatherLabels<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
scope: ScopeRef<'a>,
|
||||
labels_in_fn: &'a mut Vec<ast::Ident>,
|
||||
}
|
||||
@ -1218,7 +1218,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) {
|
||||
}
|
||||
|
||||
fn check_if_label_shadows_lifetime(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
mut scope: ScopeRef<'_>,
|
||||
label: ast::Ident,
|
||||
) {
|
||||
@ -1257,7 +1257,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) {
|
||||
}
|
||||
|
||||
fn compute_object_lifetime_defaults(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
) -> HirIdMap<Vec<ObjectLifetimeDefault>> {
|
||||
let mut map = HirIdMap::default();
|
||||
for item in tcx.hir().krate().items.values() {
|
||||
@ -1315,7 +1315,7 @@ fn compute_object_lifetime_defaults(
|
||||
/// of the form `T:'a` so as to determine the `ObjectLifetimeDefault`
|
||||
/// for each type parameter.
|
||||
fn object_lifetime_defaults_for_item(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
generics: &hir::Generics,
|
||||
) -> Vec<ObjectLifetimeDefault> {
|
||||
fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::GenericBound]) {
|
||||
|
@ -106,7 +106,7 @@ impl_stable_hash_for!(struct self::Index<'tcx> {
|
||||
|
||||
// A private tree-walker for producing an Index.
|
||||
struct Annotator<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
index: &'a mut Index<'tcx>,
|
||||
parent_stab: Option<&'tcx Stability>,
|
||||
parent_depr: Option<DeprecationEntry>,
|
||||
@ -317,7 +317,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
}
|
||||
|
||||
struct MissingStabilityAnnotations<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
access_levels: &'a AccessLevels,
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Index<'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Index<'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Index<'tcx> {
|
||||
let is_staged_api =
|
||||
tcx.sess.opts.debugging_opts.force_unstable_if_unmarked ||
|
||||
tcx.features().staged_api;
|
||||
@ -466,7 +466,7 @@ impl<'tcx> Index<'tcx> {
|
||||
|
||||
/// Cross-references the feature names of unstable APIs with enabled
|
||||
/// features and possibly prints errors.
|
||||
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) {
|
||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor());
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ pub fn deprecation_in_effect(since: &str) -> bool {
|
||||
}
|
||||
|
||||
struct Checker<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
/// Result of `TyCtxt::eval_stability`.
|
||||
@ -521,7 +521,7 @@ pub enum EvalResult {
|
||||
Unmarked,
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
// See issue #38412.
|
||||
fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool {
|
||||
// Check if `def_id` is a trait method.
|
||||
@ -827,7 +827,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn lookup_deprecation(self, id: DefId) -> Option<Deprecation> {
|
||||
self.lookup_deprecation_entry(id).map(|depr| depr.attr)
|
||||
}
|
||||
@ -836,7 +836,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
/// Given the list of enabled features that were not language features (i.e., that
|
||||
/// were expected to be library features), and the list of features used from
|
||||
/// libraries, identify activated features that don't exist and error about them.
|
||||
pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
|
||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
|
||||
if tcx.stability().staged_api[&LOCAL_CRATE] {
|
||||
@ -921,7 +921,7 @@ pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
}
|
||||
|
||||
fn unnecessary_stable_feature_lint<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
span: Span,
|
||||
feature: Symbol,
|
||||
since: Symbol
|
||||
|
@ -18,13 +18,13 @@ macro_rules! weak_lang_items {
|
||||
($($name:ident, $item:ident, $sym:ident;)*) => (
|
||||
|
||||
struct Context<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
items: &'a mut lang_items::LanguageItems,
|
||||
}
|
||||
|
||||
/// Checks the crate for usage of weak lang items, returning a vector of all the
|
||||
/// language items required by this crate, but not defined yet.
|
||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
items: &mut lang_items::LanguageItems) {
|
||||
// These are never called by user code, they're generated by the compiler.
|
||||
// They will never implicitly be added to the `missing` array unless we do
|
||||
@ -60,7 +60,7 @@ pub fn link_name(attrs: &[ast::Attribute]) -> Option<Symbol> {
|
||||
/// Not all lang items are always required for each compilation, particularly in
|
||||
/// the case of panic=abort. In these situations some lang items are injected by
|
||||
/// crates and don't actually need to be defined in libstd.
|
||||
pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> bool {
|
||||
pub fn whitelisted(tcx: TyCtxt<'_, '_>, lang_item: lang_items::LangItem) -> bool {
|
||||
// If we're not compiling with unwinding, we won't actually need these
|
||||
// symbols. Other panic runtimes ensure that the relevant symbols are
|
||||
// available to link things together, but they're never exercised.
|
||||
@ -72,7 +72,7 @@ pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) ->
|
||||
false
|
||||
}
|
||||
|
||||
fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
items: &lang_items::LanguageItems) {
|
||||
// We only need to check for the presence of weak lang items if we're
|
||||
// emitting something that's not an rlib.
|
||||
@ -142,7 +142,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> {
|
||||
impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> {
|
||||
pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool {
|
||||
let lang_items = self.lang_items();
|
||||
let did = Some(item_def_id);
|
||||
|
@ -66,7 +66,7 @@ enum AllocDiscriminant {
|
||||
|
||||
pub fn specialized_encode_alloc_id<'tcx, E: Encoder>(
|
||||
encoder: &mut E,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
alloc_id: AllocId,
|
||||
) -> Result<(), E::Error> {
|
||||
let alloc: GlobalAlloc<'tcx> =
|
||||
|
@ -1241,7 +1241,7 @@ impl<'tcx> Terminator<'tcx> {
|
||||
|
||||
impl<'tcx> TerminatorKind<'tcx> {
|
||||
pub fn if_<'gcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
cond: Operand<'tcx>,
|
||||
t: BasicBlock,
|
||||
f: BasicBlock,
|
||||
@ -2324,7 +2324,7 @@ impl<'tcx> Operand<'tcx> {
|
||||
/// with given `DefId` and substs. Since this is used to synthesize
|
||||
/// MIR, assumes `user_ty` is None.
|
||||
pub fn function_handle(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: SubstsRef<'tcx>,
|
||||
span: Span,
|
||||
|
@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> MonoItem<'tcx> {
|
||||
pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> usize {
|
||||
pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx>) -> usize {
|
||||
match *self {
|
||||
MonoItem::Fn(instance) => {
|
||||
// Estimate the size of a function based on how many statements
|
||||
@ -72,7 +72,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> SymbolName {
|
||||
pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> SymbolName {
|
||||
match *self {
|
||||
MonoItem::Fn(instance) => tcx.symbol_name(instance),
|
||||
MonoItem::Static(def_id) => {
|
||||
@ -88,7 +88,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
}
|
||||
|
||||
pub fn instantiation_mode(&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>)
|
||||
tcx: TyCtxt<'tcx, 'tcx>)
|
||||
-> InstantiationMode {
|
||||
let inline_in_all_cgus =
|
||||
tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
|
||||
@ -133,7 +133,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option<Linkage> {
|
||||
pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Linkage> {
|
||||
let def_id = match *self {
|
||||
MonoItem::Fn(ref instance) => instance.def_id(),
|
||||
MonoItem::Static(def_id) => def_id,
|
||||
@ -169,7 +169,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
/// Similarly, if a vtable method has such a signature, and therefore can't
|
||||
/// be used, we can just not emit it and have a placeholder (a null pointer,
|
||||
/// which will never be accessed) in its place.
|
||||
pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> bool {
|
||||
pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool {
|
||||
debug!("is_instantiable({:?})", self);
|
||||
let (def_id, substs) = match *self {
|
||||
MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
|
||||
@ -181,7 +181,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
tcx.substitute_normalize_and_test_predicates((def_id, &substs))
|
||||
}
|
||||
|
||||
pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug: bool) -> String {
|
||||
pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String {
|
||||
return match *self {
|
||||
MonoItem::Fn(instance) => {
|
||||
to_string_internal(tcx, "fn ", instance, debug)
|
||||
@ -195,7 +195,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
prefix: &str,
|
||||
instance: Instance<'tcx>,
|
||||
debug: bool)
|
||||
@ -208,7 +208,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option<Span> {
|
||||
pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Span> {
|
||||
match *self {
|
||||
MonoItem::Fn(Instance { def, .. }) => {
|
||||
tcx.hir().as_local_hir_id(def.def_id())
|
||||
@ -334,7 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
||||
base_n::encode(hash, base_n::CASE_INSENSITIVE)
|
||||
}
|
||||
|
||||
pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
|
||||
pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx>) {
|
||||
// Estimate the size of a codegen unit as (approximately) the number of MIR
|
||||
// statements it corresponds to.
|
||||
self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum());
|
||||
@ -360,7 +360,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
||||
WorkProductId::from_cgu_name(&self.name().as_str())
|
||||
}
|
||||
|
||||
pub fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct {
|
||||
pub fn work_product(&self, tcx: TyCtxt<'_, '_>) -> WorkProduct {
|
||||
let work_product_id = self.work_product_id();
|
||||
tcx.dep_graph
|
||||
.previous_work_product(&work_product_id)
|
||||
@ -370,7 +370,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
||||
}
|
||||
|
||||
pub fn items_in_deterministic_order(&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>)
|
||||
tcx: TyCtxt<'tcx, 'tcx>)
|
||||
-> Vec<(MonoItem<'tcx>,
|
||||
(Linkage, Visibility))> {
|
||||
// The codegen tests rely on items being process in the same order as
|
||||
@ -378,7 +378,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct ItemSortKey(Option<HirId>, SymbolName);
|
||||
|
||||
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
item: MonoItem<'tcx>) -> ItemSortKey {
|
||||
ItemSortKey(match item {
|
||||
MonoItem::Fn(ref instance) => {
|
||||
@ -415,7 +415,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
||||
items
|
||||
}
|
||||
|
||||
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DepNode {
|
||||
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode {
|
||||
DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone()))
|
||||
}
|
||||
}
|
||||
@ -446,12 +446,12 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> {
|
||||
}
|
||||
|
||||
pub struct CodegenUnitNameBuilder<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
cache: FxHashMap<CrateNum, String>,
|
||||
}
|
||||
|
||||
impl CodegenUnitNameBuilder<'gcx, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self {
|
||||
pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
|
||||
CodegenUnitNameBuilder {
|
||||
tcx,
|
||||
cache: Default::default(),
|
||||
|
@ -33,7 +33,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> {
|
||||
/// not carry a `Ty` for `T`.)
|
||||
///
|
||||
/// Note that the resulting type has not been normalized.
|
||||
pub fn field_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx>
|
||||
pub fn field_ty(self, tcx: TyCtxt<'gcx, 'tcx>, f: &Field) -> Ty<'tcx>
|
||||
{
|
||||
let answer = match self.ty.sty {
|
||||
ty::Adt(adt_def, substs) => {
|
||||
@ -57,7 +57,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> {
|
||||
/// Convenience wrapper around `projection_ty_core` for
|
||||
/// `PlaceElem`, where we can just use the `Ty` that is already
|
||||
/// stored inline on field projection elems.
|
||||
pub fn projection_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn projection_ty(self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
elem: &PlaceElem<'tcx>)
|
||||
-> PlaceTy<'tcx>
|
||||
{
|
||||
@ -71,7 +71,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> {
|
||||
/// (which should be trivial when `T` = `Ty`).
|
||||
pub fn projection_ty_core<V, T>(
|
||||
self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
elem: &ProjectionElem<V, T>,
|
||||
mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>)
|
||||
-> PlaceTy<'tcx>
|
||||
@ -121,7 +121,7 @@ BraceStructTypeFoldableImpl! {
|
||||
}
|
||||
|
||||
impl<'tcx> Place<'tcx> {
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx>
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> PlaceTy<'tcx>
|
||||
where D: HasLocalDecls<'tcx>
|
||||
{
|
||||
match *self {
|
||||
@ -141,7 +141,7 @@ pub enum RvalueInitializationState {
|
||||
}
|
||||
|
||||
impl<'tcx> Rvalue<'tcx> {
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>
|
||||
where D: HasLocalDecls<'tcx>
|
||||
{
|
||||
match *self {
|
||||
@ -222,7 +222,7 @@ impl<'tcx> Rvalue<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Operand<'tcx> {
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>
|
||||
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>
|
||||
where D: HasLocalDecls<'tcx>
|
||||
{
|
||||
match self {
|
||||
@ -234,7 +234,7 @@ impl<'tcx> Operand<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> BinOp {
|
||||
pub fn ty<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn ty<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
lhs_ty: Ty<'tcx>,
|
||||
rhs_ty: Ty<'tcx>)
|
||||
-> Ty<'tcx> {
|
||||
|
@ -48,11 +48,11 @@ pub struct AutoTraitInfo<'cx> {
|
||||
}
|
||||
|
||||
pub struct AutoTraitFinder<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self {
|
||||
AutoTraitFinder { tcx }
|
||||
}
|
||||
|
||||
@ -834,11 +834,11 @@ impl AutoTraitFinder<'tcx> {
|
||||
// Replaces all ReVars in a type with ty::Region's, using the provided map
|
||||
pub struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
vid_to_region: &'a FxHashMap<ty::RegionVid, ty::Region<'tcx>>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ use crate::ty::fold::TypeFoldable;
|
||||
/// that type check should guarantee to us that all nested
|
||||
/// obligations *could be* resolved if we wanted to.
|
||||
/// Assumes that this is run after the entire crate has been successfully type-checked.
|
||||
pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx>,
|
||||
(param_env, trait_ref):
|
||||
(ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>))
|
||||
-> Vtable<'tcx, ()>
|
||||
@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
})
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
/// Monomorphizes a type from the AST by first applying the
|
||||
/// in-scope substitutions and then normalizing any associated
|
||||
/// types.
|
||||
|
@ -49,7 +49,7 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) {
|
||||
/// with a suitably-freshened `ImplHeader` with those types
|
||||
/// substituted. Otherwise, invokes `no_overlap`.
|
||||
pub fn overlapping_impls<'gcx, F1, F2, R>(
|
||||
tcx: TyCtxt<'gcx, 'gcx, 'gcx>,
|
||||
tcx: TyCtxt<'gcx, 'gcx>,
|
||||
impl1_def_id: DefId,
|
||||
impl2_def_id: DefId,
|
||||
intercrate_mode: IntercrateMode,
|
||||
@ -183,7 +183,7 @@ fn overlap_within_probe(
|
||||
Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder })
|
||||
}
|
||||
|
||||
pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::TraitRef<'tcx>)
|
||||
-> Option<Conflict>
|
||||
{
|
||||
@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::TraitRef<'tcx>)
|
||||
-> bool {
|
||||
trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental)
|
||||
@ -246,7 +246,7 @@ pub enum OrphanCheckErr<'tcx> {
|
||||
///
|
||||
/// 1. All type parameters in `Self` must be "covered" by some local type constructor.
|
||||
/// 2. Some local type must appear in `Self`.
|
||||
pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
impl_def_id: DefId)
|
||||
-> Result<(), OrphanCheckErr<'tcx>>
|
||||
{
|
||||
@ -353,7 +353,7 @@ pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
///
|
||||
/// Note that this function is never called for types that have both type
|
||||
/// parameters and inference variables.
|
||||
fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
|
||||
fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_>,
|
||||
trait_ref: ty::TraitRef<'tcx>,
|
||||
in_crate: InCrate)
|
||||
-> Result<(), OrphanCheckErr<'tcx>>
|
||||
@ -430,7 +430,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
|
||||
}
|
||||
}
|
||||
|
||||
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
|
||||
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
|
||||
-> Vec<Ty<'tcx>> {
|
||||
if ty_is_local_constructor(ty, in_crate) {
|
||||
vec![]
|
||||
@ -450,7 +450,7 @@ fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
|
||||
fn ty_is_local(tcx: TyCtxt<'_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
|
||||
ty_is_local_constructor(ty, in_crate) ||
|
||||
fundamental_ty(ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate))
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
|
||||
}
|
||||
|
||||
impl dyn TraitEngine<'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Box<Self> {
|
||||
pub fn new(tcx: TyCtxt<'_, 'tcx>) -> Box<Self> {
|
||||
if tcx.sess.opts.debugging_opts.chalk {
|
||||
Box::new(ChalkFulfillmentContext::new())
|
||||
} else {
|
||||
|
@ -1249,7 +1249,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
found: ty::PolyTraitRef<'tcx>)
|
||||
-> DiagnosticBuilder<'tcx>
|
||||
{
|
||||
fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: &ty::TraitRef<'tcx>) -> String {
|
||||
let inputs = trait_ref.substs.type_at(1);
|
||||
let sig = if let ty::Tuple(inputs) = inputs.sty {
|
||||
@ -1294,7 +1294,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn recursive_type_with_infinite_size_error(self,
|
||||
type_def_id: DefId)
|
||||
-> DiagnosticBuilder<'tcx>
|
||||
@ -1457,7 +1457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx }
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx }
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let ty::Param(ty::ParamTy {name, .. }) = ty.sty {
|
||||
|
@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> ObligationCause<'tcx> {
|
||||
pub fn span<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span {
|
||||
pub fn span<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Span {
|
||||
match self.code {
|
||||
ObligationCauseCode::CompareImplMethodObligation { .. } |
|
||||
ObligationCauseCode::MainFunctionType |
|
||||
@ -365,7 +365,7 @@ impl<'tcx> DomainGoal<'tcx> {
|
||||
impl<'tcx> GoalKind<'tcx> {
|
||||
pub fn from_poly_domain_goal<'gcx>(
|
||||
domain_goal: PolyDomainGoal<'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> GoalKind<'tcx> {
|
||||
match domain_goal.no_bound_vars() {
|
||||
Some(p) => p.into_goal(),
|
||||
@ -710,7 +710,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
region_context: DefId,
|
||||
cause: ObligationCause<'tcx>,
|
||||
elaborated_env: ty::ParamEnv<'tcx>,
|
||||
@ -795,7 +795,7 @@ fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
|
||||
// FIXME: this is gonna need to be removed ...
|
||||
/// Normalizes the parameter environment, reporting errors if they occur.
|
||||
pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
region_context: DefId,
|
||||
unnormalized_env: ty::ParamEnv<'tcx>,
|
||||
cause: ObligationCause<'tcx>)
|
||||
@ -936,7 +936,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>(
|
||||
/// environment. If this returns false, then either normalize
|
||||
/// encountered an error or one of the predicates did not hold. Used
|
||||
/// when creating vtables to check for unsatisfiable methods.
|
||||
fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
predicates: Vec<ty::Predicate<'tcx>>)
|
||||
-> bool
|
||||
{
|
||||
@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
result
|
||||
}
|
||||
|
||||
fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
key: (DefId, SubstsRef<'tcx>))
|
||||
-> bool
|
||||
{
|
||||
@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
/// that come from `trait_ref`, including its supertraits.
|
||||
#[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`.
|
||||
fn vtable_methods<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>)
|
||||
-> &'tcx [Option<(DefId, SubstsRef<'tcx>)>]
|
||||
{
|
||||
@ -1207,16 +1207,16 @@ where
|
||||
|
||||
fn lift_ex_clause_to_tcx<'gcx>(
|
||||
ex_clause: &chalk_engine::ExClause<Self>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> Option<Self::LiftedExClause>;
|
||||
|
||||
fn lift_delayed_literal_to_tcx<'gcx>(
|
||||
ex_clause: &chalk_engine::DelayedLiteral<Self>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> Option<Self::LiftedDelayedLiteral>;
|
||||
|
||||
fn lift_literal_to_tcx<'gcx>(
|
||||
ex_clause: &chalk_engine::Literal<Self>,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> Option<Self::LiftedLiteral>;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ pub enum MethodViolationCode {
|
||||
UndispatchableReceiver,
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
|
||||
/// Returns the object safety violations that affect
|
||||
/// astconv -- currently, `Self` in supertraits. This is needed
|
||||
@ -703,7 +703,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
trait_def_id: DefId) -> bool {
|
||||
tcx.object_safety_violations(trait_def_id).is_empty()
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ impl OnUnimplementedNote {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span,
|
||||
fn parse_error(tcx: TyCtxt<'_, '_>, span: Span,
|
||||
message: &str,
|
||||
label: &str,
|
||||
note: Option<&str>)
|
||||
@ -52,7 +52,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span,
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> OnUnimplementedDirective {
|
||||
fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn parse(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_def_id: DefId,
|
||||
items: &[NestedMetaItem],
|
||||
span: Span,
|
||||
@ -133,7 +133,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
|
||||
}
|
||||
|
||||
|
||||
pub fn of_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn of_item(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_def_id: DefId,
|
||||
impl_def_id: DefId)
|
||||
-> Result<Option<Self>, ErrorReported>
|
||||
@ -165,7 +165,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
|
||||
}
|
||||
|
||||
pub fn evaluate(&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::TraitRef<'tcx>,
|
||||
options: &[(Symbol, Option<String>)])
|
||||
-> OnUnimplementedNote
|
||||
@ -215,7 +215,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> OnUnimplementedFormatString {
|
||||
fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn try_parse(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_def_id: DefId,
|
||||
from: LocalInternedString,
|
||||
err_sp: Span)
|
||||
@ -228,7 +228,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString {
|
||||
|
||||
fn verify(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_def_id: DefId,
|
||||
span: Span,
|
||||
) -> Result<(), ErrorReported> {
|
||||
@ -274,7 +274,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString {
|
||||
|
||||
pub fn format(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::TraitRef<'tcx>,
|
||||
options: &FxHashMap<Symbol, String>,
|
||||
) -> String {
|
||||
|
@ -323,7 +323,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
|
||||
fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.selcx.tcx()
|
||||
}
|
||||
|
||||
@ -836,7 +836,7 @@ struct Progress<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Progress<'tcx> {
|
||||
fn error<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self {
|
||||
fn error<'gcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
|
||||
Progress {
|
||||
ty: tcx.types.err,
|
||||
obligations: vec![],
|
||||
|
@ -87,7 +87,7 @@ pub struct DropckOutlivesResult<'tcx> {
|
||||
impl<'tcx> DropckOutlivesResult<'tcx> {
|
||||
pub fn report_overflows(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
span: Span,
|
||||
ty: Ty<'tcx>,
|
||||
) {
|
||||
@ -106,7 +106,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> {
|
||||
|
||||
pub fn into_kinds_reporting_overflows(
|
||||
self,
|
||||
tcx: TyCtxt<'tcx, '_, 'tcx>,
|
||||
tcx: TyCtxt<'_, 'tcx>,
|
||||
span: Span,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Vec<Kind<'tcx>> {
|
||||
@ -190,7 +190,7 @@ impl_stable_hash_for!(struct DtorckConstraint<'tcx> {
|
||||
///
|
||||
/// Note also that `needs_drop` requires a "global" type (i.e., one
|
||||
/// with erased regions), but this function does not.
|
||||
pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
match ty.sty {
|
||||
// None of these types have a destructor and hence they do not
|
||||
// require anything in particular to outlive the dtor's
|
||||
|
@ -83,7 +83,7 @@ struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
|
||||
}
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx> {
|
||||
fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::fold::{TypeFoldable, TypeFolder};
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
/// Erase the regions in `value` and then fully normalize all the
|
||||
/// types found within. The result will also have regions erased.
|
||||
///
|
||||
@ -63,12 +63,12 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
}
|
||||
|
||||
struct NormalizeAfterErasingRegionsFolder<'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
}
|
||||
|
||||
impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx>
|
||||
type QueryResponse = ();
|
||||
|
||||
fn try_fast_path(
|
||||
_tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
_tcx: TyCtxt<'gcx, 'tcx>,
|
||||
_key: &ParamEnvAnd<'tcx, Self>,
|
||||
) -> Option<Self::QueryResponse> {
|
||||
None
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
|
||||
tcx.type_op_ascribe_user_type(canonicalized)
|
||||
|
@ -18,7 +18,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
||||
fn try_fast_path(
|
||||
_tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
_tcx: TyCtxt<'gcx, 'tcx>,
|
||||
key: &ParamEnvAnd<'tcx, Eq<'tcx>>,
|
||||
) -> Option<Self::QueryResponse> {
|
||||
if key.value.a == key.value.b {
|
||||
@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> {
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
|
||||
tcx.type_op_eq(canonicalized)
|
||||
|
@ -18,14 +18,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds<
|
||||
type QueryResponse = Vec<OutlivesBound<'tcx>>;
|
||||
|
||||
fn try_fast_path(
|
||||
_tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
_tcx: TyCtxt<'gcx, 'tcx>,
|
||||
_key: &ParamEnvAnd<'tcx, Self>,
|
||||
) -> Option<Self::QueryResponse> {
|
||||
None
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
|
||||
// FIXME this `unchecked_map` is only necessary because the
|
||||
|
@ -53,7 +53,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
|
||||
/// actually hits the tcx cache lookup etc. Return `Some(r)` with
|
||||
/// a final result or `None` to do the full path.
|
||||
fn try_fast_path(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
key: &ParamEnvAnd<'tcx, Self>,
|
||||
) -> Option<Self::QueryResponse>;
|
||||
|
||||
@ -64,7 +64,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
|
||||
/// bad, because it would create subregion relationships that are
|
||||
/// not captured in the return value.
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>>;
|
||||
|
||||
|
@ -24,7 +24,7 @@ where
|
||||
{
|
||||
type QueryResponse = T;
|
||||
|
||||
fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
|
||||
fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
|
||||
if !key.value.value.has_projections() {
|
||||
Some(key.value.value)
|
||||
} else {
|
||||
@ -33,7 +33,7 @@ where
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
|
||||
T::type_op_method(tcx, canonicalized)
|
||||
@ -48,7 +48,7 @@ where
|
||||
|
||||
pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx> + Copy {
|
||||
fn type_op_method(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>>;
|
||||
|
||||
@ -64,7 +64,7 @@ where
|
||||
'gcx: 'tcx,
|
||||
{
|
||||
fn type_op_method(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
|
||||
tcx.type_op_normalize_ty(canonicalized)
|
||||
@ -82,7 +82,7 @@ where
|
||||
'gcx: 'tcx,
|
||||
{
|
||||
fn type_op_method(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
|
||||
tcx.type_op_normalize_predicate(canonicalized)
|
||||
@ -100,7 +100,7 @@ where
|
||||
'gcx: 'tcx,
|
||||
{
|
||||
fn type_op_method(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
|
||||
tcx.type_op_normalize_poly_fn_sig(canonicalized)
|
||||
@ -118,7 +118,7 @@ where
|
||||
'gcx: 'tcx,
|
||||
{
|
||||
fn type_op_method(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
|
||||
tcx.type_op_normalize_fn_sig(canonicalized)
|
||||
|
@ -22,7 +22,7 @@ where
|
||||
type QueryResponse = DropckOutlivesResult<'tcx>;
|
||||
|
||||
fn try_fast_path(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
key: &ParamEnvAnd<'tcx, Self>,
|
||||
) -> Option<Self::QueryResponse> {
|
||||
if trivial_dropck_outlives(tcx, key.value.dropped_ty) {
|
||||
@ -33,7 +33,7 @@ where
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
|
||||
// Subtle: note that we are not invoking
|
||||
|
@ -17,7 +17,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
||||
fn try_fast_path(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
key: &ParamEnvAnd<'tcx, Self>,
|
||||
) -> Option<Self::QueryResponse> {
|
||||
// Proving Sized, very often on "obviously sized" types like
|
||||
@ -38,7 +38,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> {
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
|
||||
tcx.type_op_prove_predicate(canonicalized)
|
||||
|
@ -20,7 +20,7 @@ impl<'tcx> Subtype<'tcx> {
|
||||
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
||||
fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> {
|
||||
fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> {
|
||||
if key.value.sub == key.value.sup {
|
||||
Some(())
|
||||
} else {
|
||||
@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> {
|
||||
}
|
||||
|
||||
fn perform_query(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
|
||||
tcx.type_op_subtype(canonicalized)
|
||||
|
@ -300,7 +300,7 @@ enum SelectionCandidate<'tcx> {
|
||||
|
||||
impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> {
|
||||
type Lifted = SelectionCandidate<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
Some(match *self {
|
||||
BuiltinCandidate { has_nested } => BuiltinCandidate { has_nested },
|
||||
ImplCandidate(def_id) => ImplCandidate(def_id),
|
||||
@ -568,7 +568,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
||||
self.infcx
|
||||
}
|
||||
|
||||
pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
@ -3989,7 +3989,7 @@ impl<T: Clone> WithDepNode<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, tcx: TyCtxt<'_, '_, '_>) -> T {
|
||||
pub fn get(&self, tcx: TyCtxt<'_, '_>) -> T {
|
||||
tcx.dep_graph.read_index(self.dep_node);
|
||||
self.cached_value.clone()
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
||||
/// that impl, a less specialized impl, or the trait default,
|
||||
/// whichever applies.
|
||||
pub fn find_associated_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
item: &ty::AssocItem,
|
||||
substs: SubstsRef<'tcx>,
|
||||
@ -149,7 +149,7 @@ pub fn find_associated_item<'tcx>(
|
||||
/// Specialization is determined by the sets of types to which the impls apply;
|
||||
/// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies
|
||||
/// to.
|
||||
pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
(impl1_def_id, impl2_def_id): (DefId, DefId))
|
||||
-> bool
|
||||
{
|
||||
@ -286,7 +286,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
||||
|
||||
// Query provider for `specialization_graph_of`.
|
||||
pub(super) fn specialization_graph_provider<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
trait_id: DefId,
|
||||
) -> &'tcx specialization_graph::Graph {
|
||||
let mut sg = specialization_graph::Graph::new();
|
||||
@ -390,7 +390,7 @@ pub(super) fn specialization_graph_provider<'tcx>(
|
||||
|
||||
/// Recovers the "impl X for Y" signature from `impl_def_id` and returns it as a
|
||||
/// string.
|
||||
fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option<String> {
|
||||
fn to_pretty_impl_header(tcx: TyCtxt<'_, '_>, impl_def_id: DefId) -> Option<String> {
|
||||
use std::fmt::Write;
|
||||
|
||||
let trait_ref = if let Some(tr) = tcx.impl_trait_ref(impl_def_id) {
|
||||
|
@ -84,7 +84,7 @@ enum Inserted {
|
||||
impl<'gcx, 'tcx> Children {
|
||||
/// Insert an impl into this set of children without comparing to any existing impls.
|
||||
fn insert_blindly(&mut self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
impl_def_id: DefId) {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||
if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
|
||||
@ -100,7 +100,7 @@ impl<'gcx, 'tcx> Children {
|
||||
/// an impl with a parent. The impl must be present in the list of
|
||||
/// children already.
|
||||
fn remove_existing(&mut self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
impl_def_id: DefId) {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||
let vec: &mut Vec<DefId>;
|
||||
@ -119,7 +119,7 @@ impl<'gcx, 'tcx> Children {
|
||||
/// Attempt to insert an impl into this set of children, while comparing for
|
||||
/// specialization relationships.
|
||||
fn insert(&mut self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
impl_def_id: DefId,
|
||||
simplified_self: Option<SimplifiedType>)
|
||||
-> Result<Inserted, OverlapError>
|
||||
@ -294,7 +294,7 @@ impl<'gcx, 'tcx> Graph {
|
||||
/// conflicts with it (has overlap, but neither specializes the other),
|
||||
/// information about the area of overlap is returned in the `Err`.
|
||||
pub fn insert(&mut self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
impl_def_id: DefId)
|
||||
-> Result<Option<FutureCompatOverlapError>, OverlapError> {
|
||||
assert!(impl_def_id.is_local());
|
||||
@ -387,7 +387,7 @@ impl<'gcx, 'tcx> Graph {
|
||||
|
||||
/// Insert cached metadata mapping from a child impl back to its parent.
|
||||
pub fn record_impl_from_cstore(&mut self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
parent: DefId,
|
||||
child: DefId) {
|
||||
if self.parent.insert(child, parent).is_some() {
|
||||
@ -425,7 +425,7 @@ impl<'gcx, 'tcx> Node {
|
||||
/// Iterate over the items defined directly by the given (impl or trait) node.
|
||||
pub fn items(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> ty::AssocItemsIterator<'gcx, 'tcx> {
|
||||
tcx.associated_items(self.def_id())
|
||||
}
|
||||
@ -482,7 +482,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> {
|
||||
#[inline]
|
||||
pub fn defs(
|
||||
self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_item_name: Ident,
|
||||
trait_item_kind: ty::AssocKind,
|
||||
trait_def_id: DefId,
|
||||
@ -508,7 +508,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> {
|
||||
|
||||
/// Walk up the specialization ancestors of a given impl, starting with that
|
||||
/// impl itself.
|
||||
pub fn ancestors(tcx: TyCtxt<'_, 'tcx, '_>,
|
||||
pub fn ancestors(tcx: TyCtxt<'tcx, '_>,
|
||||
trait_def_id: DefId,
|
||||
start_from_impl: DefId)
|
||||
-> Ancestors<'tcx> {
|
||||
|
@ -446,7 +446,7 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> {
|
||||
type Lifted = traits::SelectionError<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
match *self {
|
||||
super::Unimplemented => Some(super::Unimplemented),
|
||||
super::OutputTypeParameterMismatch(a, b, ref err) => {
|
||||
@ -464,7 +464,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
|
||||
type Lifted = traits::ObligationCauseCode<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
match *self {
|
||||
super::ReturnNoExpression => Some(super::ReturnNoExpression),
|
||||
super::MiscObligation => Some(super::MiscObligation),
|
||||
@ -546,7 +546,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> {
|
||||
type Lifted = traits::DerivedObligationCause<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
tcx.lift(&self.parent_trait_ref).and_then(|trait_ref|
|
||||
tcx.lift(&*self.parent_code)
|
||||
.map(|code| traits::DerivedObligationCause {
|
||||
@ -559,7 +559,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> {
|
||||
type Lifted = traits::ObligationCause<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
tcx.lift(&self.code).map(|code| traits::ObligationCause {
|
||||
span: self.span,
|
||||
body_id: self.body_id,
|
||||
@ -571,7 +571,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> {
|
||||
// For codegen only.
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
|
||||
type Lifted = traits::Vtable<'tcx, ()>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
match self.clone() {
|
||||
traits::VtableImpl(traits::VtableImplData {
|
||||
impl_def_id,
|
||||
@ -691,7 +691,7 @@ EnumLiftImpl! {
|
||||
|
||||
impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> {
|
||||
type Lifted = traits::Environment<'tcx>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
tcx.lift(&self.clauses).map(|clauses| {
|
||||
traits::Environment {
|
||||
clauses,
|
||||
@ -702,7 +702,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> {
|
||||
|
||||
impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> {
|
||||
type Lifted = traits::InEnvironment<'tcx, G::Lifted>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
tcx.lift(&self.environment).and_then(|environment| {
|
||||
tcx.lift(&self.goal).map(|goal| {
|
||||
traits::InEnvironment {
|
||||
@ -721,7 +721,7 @@ where
|
||||
{
|
||||
type Lifted = C::LiftedExClause;
|
||||
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
<C as traits::ChalkContextLift>::lift_ex_clause_to_tcx(self, tcx)
|
||||
}
|
||||
}
|
||||
@ -733,7 +733,7 @@ where
|
||||
{
|
||||
type Lifted = C::LiftedDelayedLiteral;
|
||||
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
<C as traits::ChalkContextLift>::lift_delayed_literal_to_tcx(self, tcx)
|
||||
}
|
||||
}
|
||||
@ -745,7 +745,7 @@ where
|
||||
{
|
||||
type Lifted = C::LiftedLiteral;
|
||||
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
<C as traits::ChalkContextLift>::lift_literal_to_tcx(self, tcx)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use crate::util::nodemap::FxHashSet;
|
||||
|
||||
use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized};
|
||||
|
||||
fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
pred: &ty::Predicate<'tcx>)
|
||||
-> ty::Predicate<'tcx> {
|
||||
match *pred {
|
||||
@ -46,12 +46,12 @@ fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
struct PredicateSet<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
set: FxHashSet<ty::Predicate<'tcx>>,
|
||||
}
|
||||
|
||||
impl PredicateSet<'gcx, 'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self {
|
||||
fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
|
||||
Self { tcx: tcx, set: Default::default() }
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ pub struct Elaborator<'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn elaborate_trait_ref<'gcx, 'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>)
|
||||
-> Elaborator<'gcx, 'tcx>
|
||||
{
|
||||
@ -102,7 +102,7 @@ pub fn elaborate_trait_ref<'gcx, 'tcx>(
|
||||
}
|
||||
|
||||
pub fn elaborate_trait_refs<'gcx, 'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
|
||||
-> Elaborator<'gcx, 'tcx>
|
||||
{
|
||||
@ -111,7 +111,7 @@ pub fn elaborate_trait_refs<'gcx, 'tcx>(
|
||||
}
|
||||
|
||||
pub fn elaborate_predicates<'gcx, 'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
mut predicates: Vec<ty::Predicate<'tcx>>)
|
||||
-> Elaborator<'gcx, 'tcx>
|
||||
{
|
||||
@ -256,13 +256,13 @@ impl Iterator for Elaborator<'gcx, 'tcx> {
|
||||
|
||||
pub type Supertraits<'gcx, 'tcx> = FilterToTraits<Elaborator<'gcx, 'tcx>>;
|
||||
|
||||
pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>)
|
||||
-> Supertraits<'gcx, 'tcx> {
|
||||
elaborate_trait_ref(tcx, trait_ref).filter_to_traits()
|
||||
}
|
||||
|
||||
pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
|
||||
-> Supertraits<'gcx, 'tcx> {
|
||||
elaborate_trait_refs(tcx, bounds).filter_to_traits()
|
||||
@ -281,7 +281,7 @@ pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
/// Expansion is done via a DFS (depth-first search), and the `visited` field
|
||||
/// is used to avoid cycles.
|
||||
pub struct TraitAliasExpander<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
stack: Vec<TraitAliasExpansionInfo<'tcx>>,
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
|
||||
}
|
||||
|
||||
pub fn expand_trait_aliases<'gcx, 'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_refs: impl IntoIterator<Item = (ty::PolyTraitRef<'tcx>, Span)>
|
||||
) -> TraitAliasExpander<'gcx, 'tcx> {
|
||||
let items: Vec<_> = trait_refs
|
||||
@ -415,12 +415,12 @@ impl<'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pub struct SupertraitDefIds<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
stack: Vec<DefId>,
|
||||
visited: FxHashSet<DefId>,
|
||||
}
|
||||
|
||||
pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_def_id: DefId)
|
||||
-> SupertraitDefIds<'gcx, 'tcx>
|
||||
{
|
||||
@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn predicate_for_trait_def(self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
|
@ -20,18 +20,18 @@ use crate::mir::interpret::ConstValue;
|
||||
/// important thing about the result is Ok/Err. Also, matching never
|
||||
/// affects any type variables or unification state.
|
||||
pub struct Match<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>
|
||||
tcx: TyCtxt<'gcx, 'tcx>
|
||||
}
|
||||
|
||||
impl Match<'gcx, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Match<'gcx, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Match<'gcx, 'tcx> {
|
||||
Match { tcx }
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeRelation<'gcx, 'tcx> for Match<'gcx, 'tcx> {
|
||||
fn tag(&self) -> &'static str { "Match" }
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx }
|
||||
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx }
|
||||
fn a_is_expected(&self) -> bool { true } // irrelevant
|
||||
|
||||
fn relate_with_variance<T: Relate<'tcx>>(&mut self,
|
||||
|
@ -104,7 +104,7 @@ pub struct OverloadedDeref<'tcx> {
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> OverloadedDeref<'tcx> {
|
||||
pub fn method_call(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source: Ty<'tcx>)
|
||||
pub fn method_call(&self, tcx: TyCtxt<'gcx, 'tcx>, source: Ty<'tcx>)
|
||||
-> (DefId, SubstsRef<'tcx>) {
|
||||
let trait_def_id = match self.mutbl {
|
||||
hir::MutImmutable => tcx.lang_items().deref_trait(),
|
||||
|
@ -108,7 +108,7 @@ pub fn encode_predicates<'tcx, E, C>(encoder: &mut E,
|
||||
}
|
||||
|
||||
pub trait TyDecoder<'tcx>: Decoder {
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>;
|
||||
fn tcx(&self) -> TyCtxt<'tcx, 'tcx>;
|
||||
|
||||
fn peek_byte(&self) -> u8;
|
||||
|
||||
|
@ -6,7 +6,7 @@ use syntax_pos::symbol::{sym, Symbol};
|
||||
use crate::hir::map::blocks::FnLikeNode;
|
||||
use syntax::attr;
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
/// Whether the `def_id` counts as const fn in your current crate, considering all active
|
||||
/// feature gates
|
||||
pub fn is_const_fn(self, def_id: DefId) -> bool {
|
||||
@ -69,7 +69,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
|
||||
pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
|
||||
/// only checks whether the function has a `const` modifier
|
||||
fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id)
|
||||
.expect("Non-local call to local provider is_const_fn");
|
||||
|
||||
@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) {
|
||||
Some(stab) => {
|
||||
if cfg!(debug_assertions) && stab.promotable {
|
||||
@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
tcx.is_const_fn(def_id) &&
|
||||
tcx.lookup_stability(def_id)
|
||||
.map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)
|
||||
|
@ -1016,13 +1016,13 @@ pub struct FreeRegionInfo {
|
||||
///
|
||||
/// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
||||
pub struct TyCtxt<'gcx: 'tcx, 'tcx> {
|
||||
gcx: &'gcx GlobalCtxt<'gcx>,
|
||||
interners: &'gcx CtxtInterners<'gcx>,
|
||||
dummy: PhantomData<(&'a (), &'tcx ())>,
|
||||
dummy: PhantomData<&'tcx ()>,
|
||||
}
|
||||
|
||||
impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> {
|
||||
impl<'gcx> Deref for TyCtxt<'gcx, '_> {
|
||||
type Target = &'gcx GlobalCtxt<'gcx>;
|
||||
#[inline(always)]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@ -1119,10 +1119,10 @@ pub struct GlobalCtxt<'tcx> {
|
||||
output_filenames: Arc<OutputFilenames>,
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Gets the global `TyCtxt`.
|
||||
#[inline]
|
||||
pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> {
|
||||
pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx> {
|
||||
TyCtxt {
|
||||
gcx: self.gcx,
|
||||
interners: &self.gcx.global_interners,
|
||||
@ -1666,7 +1666,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
pub fn encode_metadata(self)
|
||||
-> EncodedMetadata
|
||||
{
|
||||
@ -1683,7 +1683,7 @@ impl<'gcx> GlobalCtxt<'gcx> {
|
||||
f: F
|
||||
) -> R
|
||||
where
|
||||
F: FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R,
|
||||
F: FnOnce(TyCtxt<'gcx, 'tcx>) -> R,
|
||||
'gcx: 'tcx,
|
||||
{
|
||||
let tcx = TyCtxt {
|
||||
@ -1725,7 +1725,7 @@ impl<'gcx> GlobalCtxt<'gcx> {
|
||||
/// e.g., `()` or `u8`, was interned in a different context.
|
||||
pub trait Lift<'tcx>: fmt::Debug {
|
||||
type Lifted: fmt::Debug + 'tcx;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted>;
|
||||
}
|
||||
|
||||
|
||||
@ -1733,7 +1733,7 @@ macro_rules! nop_lift {
|
||||
($ty:ty => $lifted:ty) => {
|
||||
impl<'a, 'tcx> Lift<'tcx> for $ty {
|
||||
type Lifted = $lifted;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
if tcx.interners.arena.in_arena(*self as *const _) {
|
||||
return Some(unsafe { mem::transmute(*self) });
|
||||
}
|
||||
@ -1752,7 +1752,7 @@ macro_rules! nop_list_lift {
|
||||
($ty:ty => $lifted:ty) => {
|
||||
impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> {
|
||||
type Lifted = &'tcx List<$lifted>;
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Self::Lifted> {
|
||||
if self.is_empty() {
|
||||
return Some(List::empty());
|
||||
}
|
||||
@ -1815,7 +1815,7 @@ pub mod tls {
|
||||
pub struct ImplicitCtxt<'a, 'gcx: 'tcx, 'tcx> {
|
||||
/// The current TyCtxt. Initially created by `enter_global` and updated
|
||||
/// by `enter_local` with a new local interner
|
||||
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'gcx, 'tcx>,
|
||||
|
||||
/// The current query job, if any. This is updated by JobOwner::start in
|
||||
/// ty::query::plumbing when executing a query
|
||||
@ -1941,7 +1941,7 @@ pub mod tls {
|
||||
/// This happens once per rustc session and TyCtxts only exists
|
||||
/// inside the `f` function.
|
||||
pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R
|
||||
where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R
|
||||
where F: FnOnce(TyCtxt<'gcx, 'gcx>) -> R
|
||||
{
|
||||
// Update GCX_PTR to indicate there's a GlobalCtxt available
|
||||
GCX_PTR.with(|lock| {
|
||||
@ -1978,7 +1978,7 @@ pub mod tls {
|
||||
/// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local.
|
||||
/// This is used in the deadlock handler.
|
||||
pub unsafe fn with_global<F, R>(f: F) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R
|
||||
{
|
||||
let gcx = GCX_PTR.with(|lock| *lock.lock());
|
||||
assert!(gcx != 0);
|
||||
@ -2030,7 +2030,7 @@ pub mod tls {
|
||||
/// This will panic if you pass it a TyCtxt which has a different global interner from
|
||||
/// the current ImplicitCtxt's tcx field.
|
||||
#[inline]
|
||||
pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'tcx1, 'gcx, 'tcx1>, f: F) -> R
|
||||
pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'gcx, 'tcx1>, f: F) -> R
|
||||
where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R
|
||||
{
|
||||
with_context(|context| {
|
||||
@ -2048,7 +2048,7 @@ pub mod tls {
|
||||
/// This will panic if you pass it a TyCtxt which has a different global interner or
|
||||
/// a different local interner from the current ImplicitCtxt's tcx field.
|
||||
#[inline]
|
||||
pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: F) -> R
|
||||
pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'gcx, 'tcx>, f: F) -> R
|
||||
where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R
|
||||
{
|
||||
with_context(|context| {
|
||||
@ -2065,7 +2065,7 @@ pub mod tls {
|
||||
/// Panics if there is no ImplicitCtxt available
|
||||
#[inline]
|
||||
pub fn with<F, R>(f: F) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R
|
||||
{
|
||||
with_context(|context| f(context.tcx))
|
||||
}
|
||||
@ -2074,7 +2074,7 @@ pub mod tls {
|
||||
/// The closure is passed None if there is no ImplicitCtxt available
|
||||
#[inline]
|
||||
pub fn with_opt<F, R>(f: F) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(Option<TyCtxt<'tcx, 'gcx, 'tcx>>) -> R
|
||||
where F: for<'gcx, 'tcx> FnOnce(Option<TyCtxt<'gcx, 'tcx>>) -> R
|
||||
{
|
||||
with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx)))
|
||||
}
|
||||
@ -2098,7 +2098,7 @@ macro_rules! sty_debug_print {
|
||||
all_infer: usize,
|
||||
}
|
||||
|
||||
pub fn go(tcx: TyCtxt<'_, '_, '_>) {
|
||||
pub fn go(tcx: TyCtxt<'_, '_>) {
|
||||
let mut total = DebugStat {
|
||||
total: 0,
|
||||
lt_infer: 0,
|
||||
@ -2151,7 +2151,7 @@ macro_rules! sty_debug_print {
|
||||
}}
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> {
|
||||
impl<'tcx> TyCtxt<'tcx, 'tcx> {
|
||||
pub fn print_debug_stats(self) {
|
||||
sty_debug_print!(
|
||||
self,
|
||||
@ -2290,7 +2290,7 @@ macro_rules! intern_method {
|
||||
$alloc_method:expr,
|
||||
$alloc_to_key:expr,
|
||||
$keep_in_local_tcx:expr) -> $ty:ty) => {
|
||||
impl<'a, 'gcx, $lt_tcx> TyCtxt<'a, 'gcx, $lt_tcx> {
|
||||
impl<'gcx, $lt_tcx> TyCtxt<'gcx, $lt_tcx> {
|
||||
pub fn $method(self, v: $alloc) -> &$lt_tcx $ty {
|
||||
let key = ($alloc_to_key)(&v);
|
||||
|
||||
@ -2400,7 +2400,7 @@ intern_method! {
|
||||
) -> List<CanonicalVarInfo>
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Given a `fn` type, returns an equivalent `unsafe fn` type;
|
||||
/// that is, a `fn` type that is equivalent in every way for being
|
||||
/// unsafe.
|
||||
|
@ -8,13 +8,13 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||
};
|
||||
}
|
||||
|
||||
fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
// N.B., use `super_fold_with` here. If we used `fold_with`, it
|
||||
// could invoke the `erase_regions_ty` query recursively.
|
||||
ty.super_fold_with(&mut RegionEraserVisitor { tcx })
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Returns an equivalent value with all free regions removed (note
|
||||
/// that late-bound regions remain, because they are important for
|
||||
/// subtyping, but they are anonymized and normalized as well)..
|
||||
@ -33,11 +33,11 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
struct RegionEraserVisitor<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
}
|
||||
|
||||
impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
|
||||
pub fn sort_string(&self, tcx: TyCtxt<'lcx, 'gcx, 'lcx>) -> Cow<'static, str> {
|
||||
pub fn sort_string(&self, tcx: TyCtxt<'gcx, 'lcx>) -> Cow<'static, str> {
|
||||
match self.sty {
|
||||
ty::Bool | ty::Char | ty::Int(_) |
|
||||
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => self.to_string().into(),
|
||||
@ -249,7 +249,7 @@ impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn note_and_explain_type_err(self,
|
||||
db: &mut DiagnosticBuilder<'_>,
|
||||
err: &TypeError<'tcx>,
|
||||
|
@ -55,7 +55,7 @@ pub enum SimplifiedTypeGen<D>
|
||||
/// then we can't say much about whether two types would unify. Put another way,
|
||||
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
|
||||
/// are to be considered bound.
|
||||
pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
ty: Ty<'_>,
|
||||
can_simplify_params: bool)
|
||||
-> Option<SimplifiedType>
|
||||
|
@ -156,7 +156,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
|
||||
/// identity fold, it should invoke `foo.fold_with(self)` to fold each
|
||||
/// sub-item.
|
||||
pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>;
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>;
|
||||
|
||||
fn fold_binder<T>(&mut self, t: &Binder<T>) -> Binder<T>
|
||||
where T : TypeFoldable<'tcx>
|
||||
@ -203,7 +203,7 @@ pub struct BottomUpFolder<'gcx, 'tcx, F, G, H>
|
||||
G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>,
|
||||
H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>,
|
||||
{
|
||||
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'gcx, 'tcx>,
|
||||
pub ty_op: F,
|
||||
pub lt_op: G,
|
||||
pub ct_op: H,
|
||||
@ -214,7 +214,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx,
|
||||
G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>,
|
||||
H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>,
|
||||
{
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx }
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx }
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
let t = ty.super_fold_with(self);
|
||||
@ -235,7 +235,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx,
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Region folder
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Collects the free and escaping regions in `value` into `region_set`. Returns
|
||||
/// whether any late-bound regions were skipped
|
||||
pub fn collect_regions<T>(self,
|
||||
@ -362,7 +362,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
/// visited by `fld_r`.
|
||||
|
||||
pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
skipped_regions: &'a mut bool,
|
||||
|
||||
/// Stores the index of a binder *just outside* the stuff we have
|
||||
@ -382,7 +382,7 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> {
|
||||
#[inline]
|
||||
pub fn new(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
skipped_regions: &'a mut bool,
|
||||
fold_region_fn: &'a mut dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>,
|
||||
) -> RegionFolder<'a, 'gcx, 'tcx> {
|
||||
@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx }
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx }
|
||||
|
||||
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T> {
|
||||
self.current_index.shift_in(1);
|
||||
@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> {
|
||||
|
||||
/// Replaces the escaping bound vars (late bound regions or bound types) in a type.
|
||||
struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
|
||||
/// As with `RegionFolder`, represents the index of a binder *just outside*
|
||||
/// the ones we have visited.
|
||||
@ -440,7 +440,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
|
||||
impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> {
|
||||
fn new<F, G, H>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
fld_r: &'a mut F,
|
||||
fld_t: &'a mut G,
|
||||
fld_c: &'a mut H,
|
||||
@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx }
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx }
|
||||
|
||||
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T> {
|
||||
self.current_index.shift_in(1);
|
||||
@ -542,7 +542,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx>
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Replaces all regions bound by the given `Binder` with the
|
||||
/// results returned by the closure; the closure is expected to
|
||||
/// return a free region (relative to this binder), and hence the
|
||||
@ -723,14 +723,14 @@ enum Direction {
|
||||
}
|
||||
|
||||
struct Shifter<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
current_index: ty::DebruijnIndex,
|
||||
amount: u32,
|
||||
direction: Direction,
|
||||
}
|
||||
|
||||
impl Shifter<'gcx, 'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self {
|
||||
pub fn new(tcx: TyCtxt<'gcx, 'tcx>, amount: u32, direction: Direction) -> Self {
|
||||
Shifter {
|
||||
tcx,
|
||||
current_index: ty::INNERMOST,
|
||||
@ -741,7 +741,7 @@ impl Shifter<'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx }
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx }
|
||||
|
||||
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T> {
|
||||
self.current_index.shift_in(1);
|
||||
@ -818,7 +818,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn shift_region<'gcx, 'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
region: ty::Region<'tcx>,
|
||||
amount: u32
|
||||
) -> ty::Region<'tcx> {
|
||||
@ -833,7 +833,7 @@ pub fn shift_region<'gcx, 'tcx>(
|
||||
}
|
||||
|
||||
pub fn shift_vars<'gcx, 'tcx, T>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
value: &T,
|
||||
amount: u32
|
||||
) -> T where T: TypeFoldable<'tcx> {
|
||||
@ -844,7 +844,7 @@ pub fn shift_vars<'gcx, 'tcx, T>(
|
||||
}
|
||||
|
||||
pub fn shift_out_vars<'gcx, 'tcx, T>(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
value: &T,
|
||||
amount: u32
|
||||
) -> T where T: TypeFoldable<'tcx> {
|
||||
|
@ -32,7 +32,7 @@ impl<'gcx, 'tcx> DefIdForest {
|
||||
/// Creates a forest consisting of a single tree representing the entire
|
||||
/// crate.
|
||||
#[inline]
|
||||
pub fn full(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest {
|
||||
pub fn full(tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest {
|
||||
let crate_id = tcx.hir().local_def_id(CRATE_NODE_ID);
|
||||
DefIdForest::from_id(crate_id)
|
||||
}
|
||||
@ -53,14 +53,14 @@ impl<'gcx, 'tcx> DefIdForest {
|
||||
|
||||
/// Tests whether the forest contains a given DefId.
|
||||
pub fn contains(&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
id: DefId) -> bool
|
||||
{
|
||||
self.root_ids.iter().any(|root_id| tcx.is_descendant_of(id, *root_id))
|
||||
}
|
||||
|
||||
/// Calculate the intersection of a collection of forests.
|
||||
pub fn intersection<I>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn intersection<I>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
iter: I) -> DefIdForest
|
||||
where I: IntoIterator<Item=DefIdForest>
|
||||
{
|
||||
@ -97,7 +97,7 @@ impl<'gcx, 'tcx> DefIdForest {
|
||||
}
|
||||
|
||||
/// Calculate the union of a collection of forests.
|
||||
pub fn union<I>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn union<I>(tcx: TyCtxt<'gcx, 'tcx>,
|
||||
iter: I) -> DefIdForest
|
||||
where I: IntoIterator<Item=DefIdForest>
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ mod def_id_forest;
|
||||
// This code should only compile in modules where the uninhabitedness of Foo is
|
||||
// visible.
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Checks whether a type is visibly uninhabited from a particular module.
|
||||
/// # Example
|
||||
/// ```rust
|
||||
@ -110,7 +110,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
/// Calculate the forest of DefIds from which this adt is visibly uninhabited.
|
||||
fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
substs: SubstsRef<'tcx>) -> DefIdForest
|
||||
{
|
||||
// Non-exhaustive ADTs from other crates are always considered inhabited.
|
||||
@ -128,7 +128,7 @@ impl<'gcx, 'tcx> VariantDef {
|
||||
/// Calculate the forest of DefIds from which this variant is visibly uninhabited.
|
||||
pub fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
adt_kind: AdtKind) -> DefIdForest
|
||||
{
|
||||
@ -154,7 +154,7 @@ impl<'gcx, 'tcx> FieldDef {
|
||||
/// Calculate the forest of DefIds from which this field is visibly uninhabited.
|
||||
fn uninhabited_from(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
is_enum: bool,
|
||||
) -> DefIdForest {
|
||||
@ -182,7 +182,7 @@ impl<'gcx, 'tcx> FieldDef {
|
||||
|
||||
impl<'gcx, 'tcx> TyS<'tcx> {
|
||||
/// Calculate the forest of DefIds from which this type is visibly uninhabited.
|
||||
fn uninhabited_from(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest
|
||||
fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest
|
||||
{
|
||||
match self.sty {
|
||||
Adt(def, substs) => def.uninhabited_from(tcx, substs),
|
||||
|
@ -44,7 +44,7 @@ pub enum InstanceDef<'tcx> {
|
||||
|
||||
impl<'tcx> Instance<'tcx> {
|
||||
pub fn ty(&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>)
|
||||
tcx: TyCtxt<'tcx, 'tcx>)
|
||||
-> Ty<'tcx>
|
||||
{
|
||||
let ty = tcx.type_of(self.def.def_id());
|
||||
@ -55,7 +55,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
)
|
||||
}
|
||||
|
||||
fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> PolyFnSig<'tcx> {
|
||||
fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx>) -> PolyFnSig<'tcx> {
|
||||
let ty = self.ty(tcx);
|
||||
match ty.sty {
|
||||
ty::FnDef(..) |
|
||||
@ -105,7 +105,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> {
|
||||
pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> {
|
||||
let mut fn_sig = self.fn_sig_noadjust(tcx);
|
||||
if let InstanceDef::VtableShim(..) = self.def {
|
||||
// Modify fn(self, ...) to fn(self: *mut Self, ...)
|
||||
@ -136,13 +136,13 @@ impl<'tcx> InstanceDef<'tcx> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> {
|
||||
pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::Attributes<'tcx> {
|
||||
tcx.get_attrs(self.def_id())
|
||||
}
|
||||
|
||||
pub fn is_inline(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>
|
||||
tcx: TyCtxt<'tcx, 'tcx>
|
||||
) -> bool {
|
||||
use crate::hir::map::DefPathData;
|
||||
let def_id = match *self {
|
||||
@ -158,7 +158,7 @@ impl<'tcx> InstanceDef<'tcx> {
|
||||
|
||||
pub fn requires_local(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>
|
||||
tcx: TyCtxt<'tcx, 'tcx>
|
||||
) -> bool {
|
||||
if self.is_inline(tcx) {
|
||||
return true
|
||||
@ -218,7 +218,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
Instance { def: InstanceDef::Item(def_id), substs: substs }
|
||||
}
|
||||
|
||||
pub fn mono(tcx: TyCtxt<'b, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> {
|
||||
pub fn mono(tcx: TyCtxt<'tcx, 'b>, def_id: DefId) -> Instance<'tcx> {
|
||||
Instance::new(def_id, tcx.global_tcx().empty_substs_for_def_id(def_id))
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
/// Presuming that coherence and type-check have succeeded, if this method is invoked
|
||||
/// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return
|
||||
/// `Some`.
|
||||
pub fn resolve(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn resolve(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: SubstsRef<'tcx>) -> Option<Instance<'tcx>> {
|
||||
@ -297,7 +297,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
result
|
||||
}
|
||||
|
||||
pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: SubstsRef<'tcx>) -> Option<Instance<'tcx>> {
|
||||
@ -317,7 +317,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
}
|
||||
|
||||
pub fn resolve_closure(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: ty::ClosureSubsts<'tcx>,
|
||||
requested_kind: ty::ClosureKind)
|
||||
@ -332,7 +332,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
}
|
||||
|
||||
pub fn resolve_drop_in_place(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>)
|
||||
-> ty::Instance<'tcx>
|
||||
{
|
||||
@ -342,7 +342,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
}
|
||||
|
||||
pub fn fn_once_adapter_instance(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
closure_did: DefId,
|
||||
substs: ty::ClosureSubsts<'tcx>)
|
||||
-> Instance<'tcx>
|
||||
@ -377,7 +377,7 @@ impl<'b, 'tcx> Instance<'tcx> {
|
||||
}
|
||||
|
||||
fn resolve_associated_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
trait_item: &ty::AssocItem,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
trait_id: DefId,
|
||||
|
@ -31,9 +31,9 @@ use rustc_target::abi::call::{
|
||||
|
||||
|
||||
pub trait IntegerExt {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>;
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx>;
|
||||
fn from_attr<C: HasDataLayout>(cx: &C, ity: attr::IntType) -> Integer;
|
||||
fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
repr: &ReprOptions,
|
||||
min: i128,
|
||||
@ -42,7 +42,7 @@ pub trait IntegerExt {
|
||||
}
|
||||
|
||||
impl IntegerExt for Integer {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx> {
|
||||
match (*self, signed) {
|
||||
(I8, false) => tcx.types.u8,
|
||||
(I16, false) => tcx.types.u16,
|
||||
@ -77,7 +77,7 @@ impl IntegerExt for Integer {
|
||||
/// signed discriminant range and #[repr] attribute.
|
||||
/// N.B.: u128 values above i128::MAX will be treated as signed, but
|
||||
/// that shouldn't affect anything, other than maybe debuginfo.
|
||||
fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
repr: &ReprOptions,
|
||||
min: i128,
|
||||
@ -126,11 +126,11 @@ impl IntegerExt for Integer {
|
||||
}
|
||||
|
||||
pub trait PrimitiveExt {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>;
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx>;
|
||||
}
|
||||
|
||||
impl PrimitiveExt for Primitive {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> {
|
||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> {
|
||||
match *self {
|
||||
Int(i, signed) => i.to_ty(tcx, signed),
|
||||
Float(FloatTy::F32) => tcx.types.f32,
|
||||
@ -171,7 +171,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
||||
-> Result<&'tcx LayoutDetails, LayoutError<'tcx>>
|
||||
{
|
||||
@ -226,7 +226,7 @@ enum StructKind {
|
||||
Prefixed(Size, Align),
|
||||
}
|
||||
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> {
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> {
|
||||
fn scalar_pair(&self, a: Scalar, b: Scalar) -> LayoutDetails {
|
||||
let dl = self.data_layout();
|
||||
let b_align = b.value.align(dl);
|
||||
@ -1221,7 +1221,7 @@ enum SavedLocalEligibility {
|
||||
// Also included in the layout are the upvars and the discriminant.
|
||||
// These are included as fields on the "outer" layout; they are not part
|
||||
// of any variant.
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> {
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> {
|
||||
/// Compute the eligibility and assignment of each local.
|
||||
fn generator_saved_local_eligibility(&self, info: &GeneratorLayout<'tcx>)
|
||||
-> (BitSet<GeneratorSavedLocal>, IndexVec<GeneratorSavedLocal, SavedLocalEligibility>) {
|
||||
@ -1605,7 +1605,7 @@ pub enum SizeSkeleton<'tcx> {
|
||||
|
||||
impl<'tcx> SizeSkeleton<'tcx> {
|
||||
pub fn compute(ty: Ty<'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>)
|
||||
-> Result<SizeSkeleton<'tcx>, LayoutError<'tcx>> {
|
||||
debug_assert!(!ty.has_infer_types());
|
||||
@ -1727,21 +1727,21 @@ impl<'tcx> SizeSkeleton<'tcx> {
|
||||
}
|
||||
|
||||
pub trait HasTyCtxt<'tcx>: HasDataLayout {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx>;
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>;
|
||||
}
|
||||
|
||||
pub trait HasParamEnv<'tcx> {
|
||||
fn param_env(&self) -> ty::ParamEnv<'tcx>;
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> {
|
||||
fn data_layout(&self) -> &TargetDataLayout {
|
||||
&self.data_layout
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> {
|
||||
impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
|
||||
self.global_tcx()
|
||||
}
|
||||
}
|
||||
@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> {
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> {
|
||||
self.tcx.tcx()
|
||||
}
|
||||
}
|
||||
@ -1796,7 +1796,7 @@ impl<T, E> MaybeResult<T> for Result<T, E> {
|
||||
|
||||
pub type TyLayout<'tcx> = ::rustc_target::abi::TyLayout<'tcx, Ty<'tcx>>;
|
||||
|
||||
impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> {
|
||||
impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> {
|
||||
type Ty = Ty<'tcx>;
|
||||
type TyLayout = Result<TyLayout<'tcx>, LayoutError<'tcx>>;
|
||||
|
||||
@ -1855,7 +1855,7 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx, 'tcx>> {
|
||||
}
|
||||
|
||||
// Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users.
|
||||
impl TyCtxt<'_, 'tcx, '_> {
|
||||
impl TyCtxt<'tcx, '_> {
|
||||
/// Computes the layout of a type. Note that this implicitly
|
||||
/// executes in "reveal all" mode.
|
||||
#[inline]
|
||||
@ -2189,7 +2189,7 @@ struct Niche {
|
||||
impl Niche {
|
||||
fn reserve<'tcx>(
|
||||
&self,
|
||||
cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>>,
|
||||
cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>>,
|
||||
count: u128,
|
||||
) -> Option<(u128, Scalar)> {
|
||||
if count > self.available {
|
||||
@ -2205,7 +2205,7 @@ impl Niche {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> {
|
||||
impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> {
|
||||
/// Find the offset of a niche leaf field, starting from
|
||||
/// the given type and recursing through aggregates.
|
||||
// FIXME(eddyb) traverse already optimized enums.
|
||||
|
@ -213,7 +213,7 @@ impl AssocItem {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String {
|
||||
pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> String {
|
||||
match self.kind {
|
||||
ty::AssocKind::Method => {
|
||||
// We skip the binder here because the binder would deanonymize all
|
||||
@ -259,14 +259,14 @@ pub trait DefIdTree: Copy {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> DefIdTree for TyCtxt<'gcx, 'tcx> {
|
||||
fn parent(self, id: DefId) -> Option<DefId> {
|
||||
self.def_key(id).parent.map(|index| DefId { index: index, ..id })
|
||||
}
|
||||
}
|
||||
|
||||
impl Visibility {
|
||||
pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_, '_>) -> Self {
|
||||
pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_>) -> Self {
|
||||
match visibility.node {
|
||||
hir::VisibilityKind::Public => Visibility::Public,
|
||||
hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)),
|
||||
@ -934,7 +934,7 @@ impl<'gcx, 'tcx> Generics {
|
||||
own_counts
|
||||
}
|
||||
|
||||
pub fn requires_monomorphization(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool {
|
||||
pub fn requires_monomorphization(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool {
|
||||
if self.own_requires_monomorphization() {
|
||||
return true;
|
||||
}
|
||||
@ -959,7 +959,7 @@ impl<'gcx, 'tcx> Generics {
|
||||
|
||||
pub fn region_param(&'tcx self,
|
||||
param: &EarlyBoundRegion,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>)
|
||||
tcx: TyCtxt<'gcx, 'tcx>)
|
||||
-> &'tcx GenericParamDef
|
||||
{
|
||||
if let Some(index) = param.index.checked_sub(self.parent_count as u32) {
|
||||
@ -977,7 +977,7 @@ impl<'gcx, 'tcx> Generics {
|
||||
/// Returns the `GenericParamDef` associated with this `ParamTy`.
|
||||
pub fn type_param(&'tcx self,
|
||||
param: &ParamTy,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>)
|
||||
tcx: TyCtxt<'gcx, 'tcx>)
|
||||
-> &'tcx GenericParamDef {
|
||||
if let Some(index) = param.index.checked_sub(self.parent_count as u32) {
|
||||
let param = &self.params[index as usize];
|
||||
@ -994,7 +994,7 @@ impl<'gcx, 'tcx> Generics {
|
||||
/// Returns the `ConstParameterDef` associated with this `ParamConst`.
|
||||
pub fn const_param(&'tcx self,
|
||||
param: &ParamConst,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>)
|
||||
tcx: TyCtxt<'gcx, 'tcx>)
|
||||
-> &GenericParamDef {
|
||||
if let Some(index) = param.index.checked_sub(self.parent_count as u32) {
|
||||
let param = &self.params[index as usize];
|
||||
@ -1020,21 +1020,21 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
|
||||
|
||||
impl<'gcx, 'tcx> GenericPredicates<'tcx> {
|
||||
pub fn instantiate(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>)
|
||||
pub fn instantiate(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>)
|
||||
-> InstantiatedPredicates<'tcx> {
|
||||
let mut instantiated = InstantiatedPredicates::empty();
|
||||
self.instantiate_into(tcx, &mut instantiated, substs);
|
||||
instantiated
|
||||
}
|
||||
|
||||
pub fn instantiate_own(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>)
|
||||
pub fn instantiate_own(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>)
|
||||
-> InstantiatedPredicates<'tcx> {
|
||||
InstantiatedPredicates {
|
||||
predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
fn instantiate_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn instantiate_into(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
instantiated: &mut InstantiatedPredicates<'tcx>,
|
||||
substs: SubstsRef<'tcx>) {
|
||||
if let Some(def_id) = self.parent {
|
||||
@ -1045,14 +1045,14 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>)
|
||||
pub fn instantiate_identity(&self, tcx: TyCtxt<'gcx, 'tcx>)
|
||||
-> InstantiatedPredicates<'tcx> {
|
||||
let mut instantiated = InstantiatedPredicates::empty();
|
||||
self.instantiate_identity_into(tcx, &mut instantiated);
|
||||
instantiated
|
||||
}
|
||||
|
||||
fn instantiate_identity_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
fn instantiate_identity_into(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
instantiated: &mut InstantiatedPredicates<'tcx>) {
|
||||
if let Some(def_id) = self.parent {
|
||||
tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated);
|
||||
@ -1060,7 +1060,7 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> {
|
||||
instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p))
|
||||
}
|
||||
|
||||
pub fn instantiate_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn instantiate_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
poly_trait_ref: &ty::PolyTraitRef<'tcx>)
|
||||
-> InstantiatedPredicates<'tcx>
|
||||
{
|
||||
@ -1134,7 +1134,7 @@ impl<'gcx, 'tcx> Predicate<'tcx> {
|
||||
/// poly-trait-ref holds. This is slightly different from a normal
|
||||
/// substitution in terms of what happens with bound regions. See
|
||||
/// lengthy comment below for details.
|
||||
pub fn subst_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
pub fn subst_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>,
|
||||
trait_ref: &ty::PolyTraitRef<'tcx>)
|
||||
-> ty::Predicate<'tcx>
|
||||
{
|
||||
@ -1294,7 +1294,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> {
|
||||
pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_>) -> PolyTraitRef<'tcx> {
|
||||
// Note: unlike with `TraitRef::to_poly_trait_ref()`,
|
||||
// `self.0.trait_ref` is permitted to have escaping regions.
|
||||
// This is because here `self` has a `Binder` and so does our
|
||||
@ -1856,7 +1856,7 @@ impl<'gcx, 'tcx> VariantDef {
|
||||
/// If someone speeds up attribute loading to not be a performance concern, they can
|
||||
/// remove this hack and use the constructor `DefId` everywhere.
|
||||
pub fn new(
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
ident: Ident,
|
||||
variant_did: Option<DefId>,
|
||||
ctor_def_id: Option<DefId>,
|
||||
@ -2069,7 +2069,7 @@ impl_stable_hash_for!(struct ReprOptions {
|
||||
});
|
||||
|
||||
impl ReprOptions {
|
||||
pub fn new(tcx: TyCtxt<'_, '_, '_>, did: DefId) -> ReprOptions {
|
||||
pub fn new(tcx: TyCtxt<'_, '_>, did: DefId) -> ReprOptions {
|
||||
let mut flags = ReprFlags::empty();
|
||||
let mut size = None;
|
||||
let mut max_align = 0;
|
||||
@ -2146,7 +2146,7 @@ impl ReprOptions {
|
||||
impl<'gcx, 'tcx> AdtDef {
|
||||
/// Creates a new `AdtDef`.
|
||||
fn new(
|
||||
tcx: TyCtxt<'_, '_, '_>,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
did: DefId,
|
||||
kind: AdtKind,
|
||||
variants: IndexVec<VariantIdx, VariantDef>,
|
||||
@ -2286,7 +2286,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
}
|
||||
|
||||
/// Returns `true` if this type has a destructor.
|
||||
pub fn has_dtor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool {
|
||||
pub fn has_dtor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool {
|
||||
self.destructor(tcx).is_some()
|
||||
}
|
||||
|
||||
@ -2297,7 +2297,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> {
|
||||
pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> {
|
||||
tcx.predicates_of(self.did)
|
||||
}
|
||||
|
||||
@ -2351,7 +2351,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
#[inline]
|
||||
pub fn eval_explicit_discr(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
expr_did: DefId,
|
||||
) -> Option<Discr<'tcx>> {
|
||||
let param_env = ParamEnv::empty();
|
||||
@ -2398,7 +2398,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
#[inline]
|
||||
pub fn discriminants(
|
||||
&'tcx self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
) -> impl Iterator<Item = (VariantIdx, Discr<'tcx>)> + Captures<'gcx> {
|
||||
let repr_type = self.repr.discr_type();
|
||||
let initial = repr_type.initial_discriminant(tcx.global_tcx());
|
||||
@ -2428,7 +2428,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
/// assuming there are no constant-evaluation errors there.
|
||||
#[inline]
|
||||
pub fn discriminant_for_variant(&self,
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
variant_index: VariantIdx)
|
||||
-> Discr<'tcx> {
|
||||
let (val, offset) = self.discriminant_def_for_variant(variant_index);
|
||||
@ -2465,7 +2465,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
(expr_did, variant_index.as_u32() - explicit_index)
|
||||
}
|
||||
|
||||
pub fn destructor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Destructor> {
|
||||
pub fn destructor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<Destructor> {
|
||||
tcx.adt_destructor(self.did)
|
||||
}
|
||||
|
||||
@ -2479,12 +2479,12 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
///
|
||||
/// Due to normalization being eager, this applies even if
|
||||
/// the associated type is behind a pointer (e.g., issue #31299).
|
||||
pub fn sized_constraint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] {
|
||||
pub fn sized_constraint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] {
|
||||
tcx.adt_sized_constraint(self.did).0
|
||||
}
|
||||
|
||||
fn sized_constraint_for_ty(&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>)
|
||||
-> Vec<Ty<'tcx>> {
|
||||
let result = match ty.sty {
|
||||
@ -2564,7 +2564,7 @@ impl<'gcx, 'tcx> AdtDef {
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> FieldDef {
|
||||
pub fn ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
pub fn ty(&self, tcx: TyCtxt<'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
tcx.type_of(self.did).subst(tcx, subst)
|
||||
}
|
||||
}
|
||||
@ -2590,7 +2590,7 @@ impl<'tcx> ClosureKind {
|
||||
// This is the initial value used when doing upvar inference.
|
||||
pub const LATTICE_BOTTOM: ClosureKind = ClosureKind::Fn;
|
||||
|
||||
pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DefId {
|
||||
pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DefId {
|
||||
match *self {
|
||||
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem),
|
||||
ClosureKind::FnMut => {
|
||||
@ -2618,7 +2618,7 @@ impl<'tcx> ClosureKind {
|
||||
|
||||
/// Returns the representative scalar type for this closure kind.
|
||||
/// See `TyS::to_opt_closure_kind` for more details.
|
||||
pub fn to_ty(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Ty<'tcx> {
|
||||
pub fn to_ty(self, tcx: TyCtxt<'_, 'tcx>) -> Ty<'tcx> {
|
||||
match self {
|
||||
ty::ClosureKind::Fn => tcx.types.i8,
|
||||
ty::ClosureKind::FnMut => tcx.types.i16,
|
||||
@ -2755,7 +2755,7 @@ pub enum ImplOverlapKind {
|
||||
Issue33140
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> {
|
||||
self.typeck_tables_of(self.hir().body_owner_def_id(body))
|
||||
}
|
||||
@ -3116,7 +3116,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
pub struct AssocItemsIterator<'gcx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'gcx, 'tcx>,
|
||||
def_ids: &'gcx [DefId],
|
||||
next_index: usize,
|
||||
}
|
||||
@ -3131,7 +3131,7 @@ impl Iterator for AssocItemsIterator<'_, '_> {
|
||||
}
|
||||
}
|
||||
|
||||
fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem {
|
||||
fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AssocItem {
|
||||
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let parent_id = tcx.hir().get_parent_item(id);
|
||||
let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id);
|
||||
@ -3176,7 +3176,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]);
|
||||
/// such.
|
||||
/// - a Error, if a type contained itself. The representability
|
||||
/// check should catch this case.
|
||||
fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> AdtSizedConstraint<'tcx> {
|
||||
let def = tcx.adt_def(def_id);
|
||||
@ -3192,7 +3192,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
AdtSizedConstraint(result)
|
||||
}
|
||||
|
||||
fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> &'tcx [DefId] {
|
||||
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
@ -3217,14 +3217,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
}
|
||||
}
|
||||
|
||||
fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span {
|
||||
fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Span {
|
||||
tcx.hir().span_if_local(def_id).unwrap()
|
||||
}
|
||||
|
||||
/// If the given `DefId` describes an item belonging to a trait,
|
||||
/// returns the `DefId` of the trait that the trait item belongs to;
|
||||
/// otherwise, returns `None`.
|
||||
fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option<DefId> {
|
||||
fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option<DefId> {
|
||||
tcx.opt_associated_item(def_id)
|
||||
.and_then(|associated_item| {
|
||||
match associated_item.container {
|
||||
@ -3235,7 +3235,7 @@ fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option<D
|
||||
}
|
||||
|
||||
/// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition.
|
||||
pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<DefId> {
|
||||
pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option<DefId> {
|
||||
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
|
||||
if let Node::Item(item) = tcx.hir().get_by_hir_id(hir_id) {
|
||||
if let hir::ItemKind::Existential(ref exist_ty) = item.node {
|
||||
@ -3247,7 +3247,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<DefI
|
||||
}
|
||||
|
||||
/// See `ParamEnv` struct definition for details.
|
||||
fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> ParamEnv<'tcx>
|
||||
{
|
||||
@ -3285,26 +3285,26 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause)
|
||||
}
|
||||
|
||||
fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
crate_num: CrateNum) -> CrateDisambiguator {
|
||||
assert_eq!(crate_num, LOCAL_CRATE);
|
||||
tcx.sess.local_crate_disambiguator()
|
||||
}
|
||||
|
||||
fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
crate_num: CrateNum) -> Symbol {
|
||||
assert_eq!(crate_num, LOCAL_CRATE);
|
||||
tcx.crate_name.clone()
|
||||
}
|
||||
|
||||
fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
crate_num: CrateNum)
|
||||
-> Svh {
|
||||
assert_eq!(crate_num, LOCAL_CRATE);
|
||||
tcx.hir().crate_hash
|
||||
}
|
||||
|
||||
fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
instance_def: InstanceDef<'tcx>)
|
||||
-> usize {
|
||||
match instance_def {
|
||||
@ -3321,7 +3321,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
|
||||
///
|
||||
/// See [`ImplOverlapKind::Issue33140`] for more details.
|
||||
fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
|
||||
fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> Option<Ty<'tcx>>
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ pub enum Component<'tcx> {
|
||||
EscapingProjection(Vec<Component<'tcx>>),
|
||||
}
|
||||
|
||||
impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> {
|
||||
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
|
||||
/// Push onto `out` all the things that must outlive `'a` for the condition
|
||||
/// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**.
|
||||
pub fn push_outlives_components(&self, ty0: Ty<'tcx>,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user