Unify all uses of 'gcx and 'tcx.

This commit is contained in:
Eduard-Mihai Burtescu 2019-06-14 00:48:52 +03:00
parent 0e4a56b4b0
commit f3f9d6dfd9
341 changed files with 3109 additions and 3327 deletions

View file

@ -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: TyCtxt<'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>, body: &hir::Body) -> CFG {
pub fn construct<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry);

View file

@ -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>,
pub tcx: TyCtxt<'tcx>,
pub cfg: &'a cfg::CFG,
pub name: String,
/// `labelled_edges` controls whether we emit labels on the edges

View file

@ -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>, body: &hir::Body) -> CFG {
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
construct::construct(tcx, body)
}

View file

@ -204,10 +204,10 @@ macro_rules! define_dep_nodes {
impl DepNode {
#[allow(unreachable_code, non_snake_case)]
#[inline(always)]
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
dep: DepConstructor<'gcx>)
pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx>,
dep: DepConstructor<'tcx>)
-> DepNode
where 'gcx: 'a + 'tcx,
where 'tcx: 'a,
'tcx: 'a
{
match dep {
@ -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,50 +442,50 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
]);
pub trait RecoverKey<'tcx>: Sized {
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self>;
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
}
impl RecoverKey<'tcx> for CrateNum {
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'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>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
dep_node.extract_def_id(tcx)
}
}
impl RecoverKey<'tcx> for DefIndex {
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
dep_node.extract_def_id(tcx).map(|id| id.index)
}
}
trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
trait DepNodeParams<'tcx>: fmt::Debug {
const CAN_RECONSTRUCT_QUERY_KEY: bool;
/// This method turns the parameters of a DepNodeConstructor into an opaque
/// 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<'gcx, 'tcx>) -> Fingerprint {
fn to_fingerprint(&self, _: TyCtxt<'tcx>) -> Fingerprint {
panic!("Not implemented. Accidentally called on anonymous node?")
}
fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String {
format!("{:?}", self)
}
}
impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
impl<'tcx, T> DepNodeParams<'tcx> for T
where
T: HashStable<StableHashingContext<'tcx>> + fmt::Debug,
{
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint {
default fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
let mut hcx = tcx.create_stable_hashing_context();
let mut hasher = StableHasher::new();
@ -494,39 +494,39 @@ where
hasher.finish()
}
default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
default fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String {
format!("{:?}", *self)
}
}
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId {
impl<'tcx> DepNodeParams<'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<'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
tcx.def_path_str(*self)
}
}
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex {
impl<'tcx> DepNodeParams<'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<'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
tcx.def_path_str(DefId::local(*self))
}
}
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
impl<'tcx> DepNodeParams<'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,
@ -534,18 +534,18 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
tcx.def_path_hash(def_id).0
}
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
tcx.crate_name(*self).as_str().to_string()
}
}
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
impl<'tcx> DepNodeParams<'tcx> for (DefId, DefId) {
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
// 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);
@ -554,7 +554,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<'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
let (def_id_0, def_id_1) = *self;
format!("({}, {})",
@ -563,13 +563,13 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
}
}
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId {
impl<'tcx> DepNodeParams<'tcx> for HirId {
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
// 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,

View file

@ -557,7 +557,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)| {
@ -569,7 +569,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());
@ -603,7 +603,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: TyCtxt<'tcx>,
data: &DepGraphData,
prev_dep_node_index: SerializedDepNodeIndex,
dep_node: &DepNode,
@ -790,7 +790,7 @@ impl DepGraph {
#[inline(never)]
fn emit_diagnostics<'tcx>(
&self,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
data: &DepGraphData,
dep_node_index: DepNodeIndex,
did_allocation: bool,
@ -841,7 +841,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>) {
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) {
let green_nodes: Vec<DepNode> = {
let data = self.data.as_ref().unwrap();
data.colors.values.indices().filter_map(|prev_index| {

View file

@ -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<'gcx, 'tcx> {}
impl<'tcx> DepGraphSafe for TyCtxt<'tcx> {}
/// Tuples make it easy to build up state.
impl<A, B> DepGraphSafe for (A, B)

View file

@ -88,7 +88,7 @@ impl Target {
}
struct CheckAttrVisitor<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'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>, module_def_id: DefId) {
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,
&mut CheckAttrVisitor { tcx }.as_deep_visitor()

View file

@ -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 {

View file

@ -413,8 +413,8 @@ impl<'a> LoweringContext<'a> {
/// needed from arbitrary locations in the crate,
/// e.g., the number of lifetime generic parameters
/// declared for every type and trait definition.
struct MiscCollector<'lcx, 'interner: 'lcx> {
lctx: &'lcx mut LoweringContext<'interner>,
struct MiscCollector<'tcx, 'interner: 'tcx> {
lctx: &'tcx mut LoweringContext<'interner>,
hir_id_owner: Option<NodeId>,
}
@ -458,8 +458,8 @@ impl<'a> LoweringContext<'a> {
}
}
impl<'lcx, 'interner> Visitor<'lcx> for MiscCollector<'lcx, 'interner> {
fn visit_pat(&mut self, p: &'lcx Pat) {
impl<'tcx, 'interner> Visitor<'tcx> for MiscCollector<'tcx, 'interner> {
fn visit_pat(&mut self, p: &'tcx Pat) {
match p.node {
// Doesn't generate a HIR node
PatKind::Paren(..) => {},
@ -473,7 +473,7 @@ impl<'a> LoweringContext<'a> {
visit::walk_pat(self, p)
}
fn visit_item(&mut self, item: &'lcx Item) {
fn visit_item(&mut self, item: &'tcx Item) {
let hir_id = self.lctx.allocate_hir_id_counter(item.id);
match item.node {
@ -505,7 +505,7 @@ impl<'a> LoweringContext<'a> {
});
}
fn visit_trait_item(&mut self, item: &'lcx TraitItem) {
fn visit_trait_item(&mut self, item: &'tcx TraitItem) {
self.lctx.allocate_hir_id_counter(item.id);
match item.node {
@ -521,21 +521,21 @@ impl<'a> LoweringContext<'a> {
}
}
fn visit_impl_item(&mut self, item: &'lcx ImplItem) {
fn visit_impl_item(&mut self, item: &'tcx ImplItem) {
self.lctx.allocate_hir_id_counter(item.id);
self.with_hir_id_owner(Some(item.id), |this| {
visit::walk_impl_item(this, item);
});
}
fn visit_foreign_item(&mut self, i: &'lcx ForeignItem) {
fn visit_foreign_item(&mut self, i: &'tcx ForeignItem) {
// Ignore patterns in foreign items
self.with_hir_id_owner(None, |this| {
visit::walk_foreign_item(this, i)
});
}
fn visit_ty(&mut self, t: &'lcx Ty) {
fn visit_ty(&mut self, t: &'tcx Ty) {
match t.node {
// Mirrors the case in visit::walk_ty
TyKind::BareFn(ref f) => {
@ -559,11 +559,11 @@ impl<'a> LoweringContext<'a> {
}
}
struct ItemLowerer<'lcx, 'interner: 'lcx> {
lctx: &'lcx mut LoweringContext<'interner>,
struct ItemLowerer<'tcx, 'interner: 'tcx> {
lctx: &'tcx mut LoweringContext<'interner>,
}
impl<'lcx, 'interner> ItemLowerer<'lcx, 'interner> {
impl<'tcx, 'interner> ItemLowerer<'tcx, 'interner> {
fn with_trait_impl_ref<F>(&mut self, trait_impl_ref: &Option<TraitRef>, f: F)
where
F: FnOnce(&mut Self),
@ -579,8 +579,8 @@ impl<'a> LoweringContext<'a> {
}
}
impl<'lcx, 'interner> Visitor<'lcx> for ItemLowerer<'lcx, 'interner> {
fn visit_mod(&mut self, m: &'lcx Mod, _s: Span, _attrs: &[Attribute], n: NodeId) {
impl<'tcx, 'interner> Visitor<'tcx> for ItemLowerer<'tcx, 'interner> {
fn visit_mod(&mut self, m: &'tcx Mod, _s: Span, _attrs: &[Attribute], n: NodeId) {
self.lctx.modules.insert(n, hir::ModuleItems {
items: BTreeSet::new(),
trait_items: BTreeSet::new(),
@ -593,7 +593,7 @@ impl<'a> LoweringContext<'a> {
self.lctx.current_module = old;
}
fn visit_item(&mut self, item: &'lcx Item) {
fn visit_item(&mut self, item: &'tcx Item) {
let mut item_hir_id = None;
self.lctx.with_hir_id_owner(item.id, |lctx| {
if let Some(hir_item) = lctx.lower_item(item) {
@ -624,7 +624,7 @@ impl<'a> LoweringContext<'a> {
}
}
fn visit_trait_item(&mut self, item: &'lcx TraitItem) {
fn visit_trait_item(&mut self, item: &'tcx TraitItem) {
self.lctx.with_hir_id_owner(item.id, |lctx| {
let hir_item = lctx.lower_trait_item(item);
let id = hir::TraitItemId { hir_id: hir_item.hir_id };
@ -635,7 +635,7 @@ impl<'a> LoweringContext<'a> {
visit::walk_trait_item(self, item);
}
fn visit_impl_item(&mut self, item: &'lcx ImplItem) {
fn visit_impl_item(&mut self, item: &'tcx ImplItem) {
self.lctx.with_hir_id_owner(item.id, |lctx| {
let hir_item = lctx.lower_impl_item(item);
let id = hir::ImplItemId { hir_id: hir_item.hir_id };

View file

@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector {
}
struct CaptureCollector<'a, 'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
locals: &'a FxHashSet<HirId>,
upvars: FxIndexMap<HirId, hir::Upvar>,
}

View file

@ -61,12 +61,12 @@ pub enum NodeIdHashingMode {
/// We could also just store a plain reference to the hir::Crate but we want
/// to avoid that the crate is used to get untracked access to all of the HIR.
#[derive(Clone, Copy)]
struct BodyResolver<'gcx>(&'gcx hir::Crate);
struct BodyResolver<'tcx>(&'tcx hir::Crate);
impl<'gcx> BodyResolver<'gcx> {
impl<'tcx> BodyResolver<'tcx> {
// Return a reference to the hir::Body with the given BodyId.
// DOES NOT DO ANY TRACKING, use carefully.
fn body(self, id: hir::BodyId) -> &'gcx hir::Body {
fn body(self, id: hir::BodyId) -> &'tcx hir::Body {
self.0.body(id)
}
}
@ -205,8 +205,8 @@ for &'b mut T {
}
}
impl StableHashingContextProvider<'lcx> for TyCtxt<'gcx, 'lcx> {
fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> {
impl StableHashingContextProvider<'tcx> for TyCtxt<'tcx> {
fn get_stable_hashing_context(&self) -> StableHashingContext<'tcx> {
(*self).create_stable_hashing_context()
}
}

View file

@ -508,9 +508,9 @@ fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar,
impl<'gcx> HashStable<StableHashingContext<'gcx>> for feature_gate::Features {
impl<'tcx> HashStable<StableHashingContext<'tcx>> for feature_gate::Features {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hcx: &mut StableHashingContext<'tcx>,
hasher: &mut StableHasher<W>) {
// Unfortunately we cannot exhaustively list fields here, since the
// struct is macro generated.

View file

@ -11,8 +11,8 @@ use crate::middle::region;
use crate::ty;
use crate::mir;
impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>>
for &'gcx ty::List<T>
impl<'a, 'tcx, T> HashStable<StableHashingContext<'a>>
for &'tcx ty::List<T>
where T: HashStable<StableHashingContext<'a>> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
@ -40,7 +40,7 @@ for &'gcx ty::List<T>
}
}
impl<'a, 'gcx, T> ToStableHashKey<StableHashingContext<'a>> for &'gcx ty::List<T>
impl<'a, 'tcx, T> ToStableHashKey<StableHashingContext<'a>> for &'tcx ty::List<T>
where T: HashStable<StableHashingContext<'a>>
{
type KeyType = Fingerprint;
@ -54,7 +54,7 @@ impl<'a, 'gcx, T> ToStableHashKey<StableHashingContext<'a>> for &'gcx ty::List<T
}
}
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::subst::Kind<'gcx> {
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::Kind<'tcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
@ -117,19 +117,19 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
}
}
impl<'gcx, 'tcx> HashStable<StableHashingContext<'gcx>> for ty::ConstVid<'tcx> {
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::ConstVid<'tcx> {
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
self.index.hash_stable(hcx, hasher);
}
}
impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::BoundVar {
impl<'tcx> HashStable<StableHashingContext<'tcx>> for ty::BoundVar {
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hcx: &mut StableHashingContext<'tcx>,
hasher: &mut StableHasher<W>) {
self.index().hash_stable(hcx, hasher);
}

View file

@ -30,24 +30,24 @@ use super::*;
use crate::ty::Const;
use crate::ty::relate::{Relate, TypeRelation};
pub struct At<'a, 'gcx: 'tcx, 'tcx: 'a> {
pub infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct At<'a, 'tcx: 'a> {
pub infcx: &'a InferCtxt<'a, 'tcx>,
pub cause: &'a ObligationCause<'tcx>,
pub param_env: ty::ParamEnv<'tcx>,
}
pub struct Trace<'a, 'gcx: 'tcx, 'tcx: 'a> {
at: At<'a, 'gcx, 'tcx>,
pub struct Trace<'a, 'tcx: 'a> {
at: At<'a, 'tcx>,
a_is_expected: bool,
trace: TypeTrace<'tcx>,
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
#[inline]
pub fn at(&'a self,
cause: &'a ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>)
-> At<'a, 'gcx, 'tcx>
-> At<'a, 'tcx>
{
At { infcx: self, cause, param_env }
}
@ -61,7 +61,7 @@ pub trait ToTrace<'tcx>: Relate<'tcx> + Copy {
-> TypeTrace<'tcx>;
}
impl<'a, 'gcx, 'tcx> At<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> At<'a, 'tcx> {
/// Hacky routine for equating two impl headers in coherence.
pub fn eq_impl_headers(self,
expected: &ty::ImplHeader<'tcx>,
@ -189,7 +189,7 @@ impl<'a, 'gcx, 'tcx> At<'a, 'gcx, 'tcx> {
pub fn trace<T>(self,
expected: T,
actual: T)
-> Trace<'a, 'gcx, 'tcx>
-> Trace<'a, 'tcx>
where T: ToTrace<'tcx>
{
self.trace_exp(true, expected, actual)
@ -202,7 +202,7 @@ impl<'a, 'gcx, 'tcx> At<'a, 'gcx, 'tcx> {
a_is_expected: bool,
a: T,
b: T)
-> Trace<'a, 'gcx, 'tcx>
-> Trace<'a, 'tcx>
where T: ToTrace<'tcx>
{
let trace = ToTrace::to_trace(self.cause, a_is_expected, a, b);
@ -210,7 +210,7 @@ impl<'a, 'gcx, 'tcx> At<'a, 'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> Trace<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> Trace<'a, 'tcx> {
/// Makes `a <: b` where `a` may or may not be expected (if
/// `a_is_expected` is true, then `a` is expected).
/// Makes `expected <: actual`.

View file

@ -21,7 +21,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use smallvec::SmallVec;
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// Canonicalizes a query value `V`. When we canonicalize a query,
/// we not only canonicalize unbound inference variables, but we
/// *also* replace all free regions whatsoever. So for example a
@ -41,9 +41,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
&self,
value: &V,
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'gcx, V>
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'gcx>,
V: TypeFoldable<'tcx> + Lift<'tcx>,
{
self.tcx
.sess
@ -85,9 +85,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// out the [chapter in the rustc guide][c].
///
/// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
pub fn canonicalize_response<V>(&self, value: &V) -> Canonicalized<'gcx, V>
pub fn canonicalize_response<V>(&self, value: &V) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'gcx>,
V: TypeFoldable<'tcx> + Lift<'tcx>,
{
let mut query_state = OriginalQueryValues::default();
Canonicalizer::canonicalize(
@ -99,9 +99,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
)
}
pub fn canonicalize_user_type_annotation<V>(&self, value: &V) -> Canonicalized<'gcx, V>
pub fn canonicalize_user_type_annotation<V>(&self, value: &V) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'gcx>,
V: TypeFoldable<'tcx> + Lift<'tcx>,
{
let mut query_state = OriginalQueryValues::default();
Canonicalizer::canonicalize(
@ -130,9 +130,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
&self,
value: &V,
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'gcx, V>
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'gcx>,
V: TypeFoldable<'tcx> + Lift<'tcx>,
{
self.tcx
.sess
@ -160,7 +160,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
trait CanonicalizeRegionMode {
fn canonicalize_free_region(
&self,
canonicalizer: &mut Canonicalizer<'_, '_, 'tcx>,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
) -> ty::Region<'tcx>;
@ -172,7 +172,7 @@ struct CanonicalizeQueryResponse;
impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
fn canonicalize_free_region(
&self,
canonicalizer: &mut Canonicalizer<'_, '_, 'tcx>,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
) -> ty::Region<'tcx> {
match r {
@ -221,7 +221,7 @@ struct CanonicalizeUserTypeAnnotation;
impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
fn canonicalize_free_region(
&self,
canonicalizer: &mut Canonicalizer<'_, '_, 'tcx>,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
) -> ty::Region<'tcx> {
match r {
@ -244,7 +244,7 @@ struct CanonicalizeAllFreeRegions;
impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions {
fn canonicalize_free_region(
&self,
canonicalizer: &mut Canonicalizer<'_, '_, 'tcx>,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
) -> ty::Region<'tcx> {
canonicalizer.canonical_var_for_region_in_root_universe(r)
@ -260,7 +260,7 @@ struct CanonicalizeFreeRegionsOtherThanStatic;
impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {
fn canonicalize_free_region(
&self,
canonicalizer: &mut Canonicalizer<'_, '_, 'tcx>,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
) -> ty::Region<'tcx> {
if let ty::ReStatic = r {
@ -275,9 +275,9 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {
}
}
struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>,
tcx: TyCtxt<'gcx, 'tcx>,
struct Canonicalizer<'cx, 'tcx: 'cx> {
infcx: Option<&'cx InferCtxt<'cx, 'tcx>>,
tcx: TyCtxt<'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
@ -289,8 +289,8 @@ struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
binder_index: ty::DebruijnIndex,
}
impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx
}
@ -495,18 +495,18 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
}
}
impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
/// The main `canonicalize` method, shared impl of
/// `canonicalize_query` and `canonicalize_response`.
fn canonicalize<V>(
value: &V,
infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>,
tcx: TyCtxt<'gcx, 'tcx>,
infcx: Option<&InferCtxt<'_, 'tcx>>,
tcx: TyCtxt<'tcx>,
canonicalize_region_mode: &dyn CanonicalizeRegionMode,
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'gcx, V>
) -> Canonicalized<'tcx, V>
where
V: TypeFoldable<'tcx> + Lift<'gcx>,
V: TypeFoldable<'tcx> + Lift<'tcx>,
{
let needs_canonical_flags = if canonicalize_region_mode.any() {
TypeFlags::KEEP_IN_LOCAL_TCX |

View file

@ -44,15 +44,15 @@ mod substitute;
/// variables have been rewritten to "canonical vars". These are
/// numbered starting from 0 in order of first appearance.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcDecodable, RustcEncodable, HashStable)]
pub struct Canonical<'gcx, V> {
pub struct Canonical<'tcx, V> {
pub max_universe: ty::UniverseIndex,
pub variables: CanonicalVarInfos<'gcx>,
pub variables: CanonicalVarInfos<'tcx>,
pub value: V,
}
pub type CanonicalVarInfos<'gcx> = &'gcx List<CanonicalVarInfo>;
pub type CanonicalVarInfos<'tcx> = &'tcx List<CanonicalVarInfo>;
impl<'gcx> UseSpecializedDecodable for CanonicalVarInfos<'gcx> {}
impl<'tcx> UseSpecializedDecodable for CanonicalVarInfos<'tcx> {}
/// A set of values corresponding to the canonical variables from some
/// `Canonical`. You can give these values to
@ -194,10 +194,10 @@ pub struct QueryResponse<'tcx, R> {
pub value: R,
}
pub type Canonicalized<'gcx, V> = Canonical<'gcx, <V as Lift<'gcx>>::Lifted>;
pub type Canonicalized<'tcx, V> = Canonical<'tcx, <V as Lift<'tcx>>::Lifted>;
pub type CanonicalizedQueryResponse<'gcx, T> =
&'gcx Canonical<'gcx, QueryResponse<'gcx, <T as Lift<'gcx>>::Lifted>>;
pub type CanonicalizedQueryResponse<'tcx, T> =
&'tcx Canonical<'tcx, QueryResponse<'tcx, <T as Lift<'tcx>>::Lifted>>;
/// Indicates whether or not we were able to prove the query to be
/// true.
@ -254,7 +254,7 @@ impl<'tcx, R> Canonical<'tcx, QueryResponse<'tcx, R>> {
}
}
impl<'gcx, V> Canonical<'gcx, V> {
impl<'tcx, V> Canonical<'tcx, V> {
/// Allows you to map the `value` of a canonical while keeping the
/// same set of bound variables.
///
@ -278,7 +278,7 @@ impl<'gcx, V> Canonical<'gcx, V> {
/// let ty: Ty<'tcx> = ...;
/// let b: Canonical<'tcx, (T, Ty<'tcx>)> = a.unchecked_map(|v| (v, ty));
/// ```
pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<'gcx, W> {
pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<'tcx, W> {
let Canonical {
max_universe,
variables,
@ -294,7 +294,7 @@ impl<'gcx, V> Canonical<'gcx, V> {
pub type QueryRegionConstraint<'tcx> = ty::Binder<ty::OutlivesPredicate<Kind<'tcx>, Region<'tcx>>>;
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// Creates a substitution S for the canonical value with fresh
/// inference variables and applies it to the canonical value.
/// Returns both the instantiated result *and* the substitution S.
@ -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>) -> Self {
pub fn make_identity(&self, tcx: TyCtxt<'tcx>) -> Self {
use crate::ty::subst::UnpackedKind;
CanonicalVarValues {

View file

@ -29,7 +29,7 @@ use crate::ty::subst::{Kind, UnpackedKind};
use crate::ty::{self, BoundVar, InferConst, Lift, Ty, TyCtxt};
use crate::util::captures::Captures;
impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
impl<'tcx> InferCtxtBuilder<'tcx> {
/// The "main method" for a canonicalized trait query. Given the
/// canonical key `canonical_key`, this method will create a new
/// inference context, instantiate the key, and run your operation
@ -42,20 +42,20 @@ impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
///
/// (It might be mildly nicer to implement this on `TyCtxt`, and
/// not `InferCtxtBuilder`, but that is a bit tricky right now.
/// In part because we would need a `for<'gcx: 'tcx>` sort of
/// In part because we would need a `for<'tcx>` sort of
/// bound for the closure and in part because it is convenient to
/// have `'tcx` be free on this function so that we can talk about
/// `K: TypeFoldable<'tcx>`.)
pub fn enter_canonical_trait_query<K, R>(
&'tcx mut self,
&mut self,
canonical_key: &Canonical<'tcx, K>,
operation: impl FnOnce(&InferCtxt<'_, 'gcx, 'tcx>, &mut dyn TraitEngine<'tcx>, K)
operation: impl FnOnce(&InferCtxt<'_, 'tcx>, &mut dyn TraitEngine<'tcx>, K)
-> Fallible<R>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, R>>
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
where
K: TypeFoldable<'tcx>,
R: Debug + Lift<'gcx> + TypeFoldable<'tcx>,
Canonical<'gcx, <QueryResponse<'gcx, R> as Lift<'gcx>>::Lifted>: ArenaAllocatable,
R: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
Canonical<'tcx, <QueryResponse<'tcx, R> as Lift<'tcx>>::Lifted>: ArenaAllocatable,
{
self.enter_with_canonical(
DUMMY_SP,
@ -73,7 +73,7 @@ impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
}
}
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// This method is meant to be invoked as the final step of a canonical query
/// implementation. It is given:
///
@ -98,10 +98,10 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
fulfill_cx: &mut dyn TraitEngine<'tcx>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, T>>
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
where
T: Debug + Lift<'gcx> + TypeFoldable<'tcx>,
Canonical<'gcx, <QueryResponse<'gcx, T> as Lift<'gcx>>::Lifted>: ArenaAllocatable,
T: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
Canonical<'tcx, <QueryResponse<'tcx, T> as Lift<'tcx>>::Lifted>: ArenaAllocatable,
{
let query_response = self.make_query_response(inference_vars, answer, fulfill_cx)?;
let canonical_result = self.canonicalize_response(&query_response);
@ -127,9 +127,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T
) -> Canonical<'gcx, QueryResponse<'gcx, <T as Lift<'gcx>>::Lifted>>
) -> Canonical<'tcx, QueryResponse<'tcx, <T as Lift<'tcx>>::Lifted>>
where
T: Debug + Lift<'gcx> + TypeFoldable<'tcx>,
T: Debug + Lift<'tcx> + TypeFoldable<'tcx>,
{
self.canonicalize_response(&QueryResponse {
var_values: inference_vars,
@ -148,7 +148,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
fulfill_cx: &mut dyn TraitEngine<'tcx>,
) -> Result<QueryResponse<'tcx, T>, NoSolution>
where
T: Debug + TypeFoldable<'tcx> + Lift<'gcx>,
T: Debug + TypeFoldable<'tcx> + Lift<'tcx>,
{
let tcx = self.tcx;
@ -567,7 +567,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
param_env: ty::ParamEnv<'tcx>,
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
result_subst: &'a CanonicalVarValues<'tcx>,
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'gcx> {
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'tcx> {
unsubstituted_region_constraints
.iter()
.map(move |constraint| {
@ -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: TyCtxt<'tcx>,
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>)>,
region_constraints: &RegionConstraintData<'tcx>,
) -> Vec<QueryRegionConstraint<'tcx>> {

View file

@ -14,7 +14,7 @@ use crate::ty::{self, TyCtxt};
impl<'tcx, V> Canonical<'tcx, V> {
/// Instantiate the wrapped value, replacing each canonical value
/// with the value given in `var_values`.
pub fn substitute(&self, tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V
pub fn substitute(&self, tcx: TyCtxt<'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V
where
V: TypeFoldable<'tcx>,
{
@ -29,7 +29,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
/// V, replacing each of the canonical variables.
pub fn substitute_projected<T>(
&self,
tcx: TyCtxt<'_, 'tcx>,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> &T,
) -> T
@ -46,7 +46,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: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
value: &'a T,
) -> T

View file

@ -44,8 +44,8 @@ use syntax::ast;
use syntax_pos::{Span, DUMMY_SP};
#[derive(Clone)]
pub struct CombineFields<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
pub infcx: &'infcx InferCtxt<'infcx, 'gcx, 'tcx>,
pub struct CombineFields<'infcx, 'tcx: 'infcx> {
pub infcx: &'infcx InferCtxt<'infcx, 'tcx>,
pub trace: TypeTrace<'tcx>,
pub cause: Option<ty::relate::Cause>,
pub param_env: ty::ParamEnv<'tcx>,
@ -57,7 +57,7 @@ pub enum RelationDir {
SubtypeOf, SupertypeOf, EqTo
}
impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
pub fn super_combine_tys<R>(
&self,
relation: &mut R,
@ -65,7 +65,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
b: Ty<'tcx>,
) -> RelateResult<'tcx, Ty<'tcx>>
where
R: TypeRelation<'gcx, 'tcx>,
R: TypeRelation<'tcx>,
{
let a_is_expected = relation.a_is_expected();
@ -125,7 +125,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
b: &'tcx ty::Const<'tcx>,
) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>>
where
R: TypeRelation<'gcx, 'tcx>,
R: TypeRelation<'tcx>,
{
let a_is_expected = relation.a_is_expected();
@ -208,24 +208,24 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
}
}
impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
pub fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> Equate<'a, 'infcx, 'gcx, 'tcx> {
pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> Equate<'a, 'infcx, 'tcx> {
Equate::new(self, a_is_expected)
}
pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> Sub<'a, 'infcx, 'gcx, 'tcx> {
pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> Sub<'a, 'infcx, 'tcx> {
Sub::new(self, a_is_expected)
}
pub fn lub<'a>(&'a mut self, a_is_expected: bool) -> Lub<'a, 'infcx, 'gcx, 'tcx> {
pub fn lub<'a>(&'a mut self, a_is_expected: bool) -> Lub<'a, 'infcx, 'tcx> {
Lub::new(self, a_is_expected)
}
pub fn glb<'a>(&'a mut self, a_is_expected: bool) -> Glb<'a, 'infcx, 'gcx, 'tcx> {
pub fn glb<'a>(&'a mut self, a_is_expected: bool) -> Glb<'a, 'infcx, 'tcx> {
Glb::new(self, a_is_expected)
}
@ -355,8 +355,8 @@ impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
}
}
struct Generalizer<'cx, 'gcx: 'cx+'tcx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
struct Generalizer<'cx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'tcx>,
/// The span, used when creating new type variables and things.
span: Span,
@ -415,8 +415,8 @@ struct Generalization<'tcx> {
needs_wf: bool,
}
impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -11,23 +11,23 @@ use crate::mir::interpret::ConstValue;
use crate::infer::unify_key::replace_if_possible;
/// Ensures `a` is made equal to `b`. Returns `a` on success.
pub struct Equate<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>,
pub struct Equate<'combine, 'infcx: 'combine, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'tcx>,
a_is_expected: bool,
}
impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
-> Equate<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> Equate<'combine, 'infcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool)
-> Equate<'combine, 'infcx, 'tcx>
{
Equate { fields: fields, a_is_expected: a_is_expected }
}
}
impl TypeRelation<'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> {
impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
fn tag(&self) -> &'static str { "Equate" }
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
fn tcx(&self) -> TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.a_is_expected }

View file

@ -67,7 +67,7 @@ mod need_type_info;
pub mod nice_region_error;
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn note_and_explain_region(
self,
region_scope_tree: &region::ScopeTree,
@ -282,7 +282,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn report_region_errors(
&self,
region_scope_tree: &region::ScopeTree,
@ -445,13 +445,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
use ty::print::Printer;
use ty::subst::Kind;
struct AbsolutePathPrinter<'gcx, 'tcx> {
tcx: TyCtxt<'gcx, 'tcx>,
struct AbsolutePathPrinter<'tcx> {
tcx: TyCtxt<'tcx>,
}
struct NonTrivialPath;
impl<'gcx, 'tcx> Printer<'gcx, 'tcx> for AbsolutePathPrinter<'gcx, 'tcx> {
impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
type Error = NonTrivialPath;
type Path = Vec<String>;
@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
type DynExistential = !;
type Const = !;
fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> {
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
self.tcx
}
@ -1546,7 +1546,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
fn report_inference_failure(
&self,
var_origin: RegionVariableOrigin,

View file

@ -9,16 +9,16 @@ use syntax::source_map::CompilerDesugaringKind;
use syntax_pos::Span;
use errors::DiagnosticBuilder;
struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
struct FindLocalByTypeVisitor<'a, 'tcx> {
infcx: &'a InferCtxt<'a, 'tcx>,
target_ty: Ty<'tcx>,
hir_map: &'a hir::map::Map<'gcx>,
found_local_pattern: Option<&'gcx Pat>,
found_arg_pattern: Option<&'gcx Pat>,
hir_map: &'a hir::map::Map<'tcx>,
found_local_pattern: Option<&'tcx Pat>,
found_arg_pattern: Option<&'tcx Pat>,
found_ty: Option<Ty<'tcx>>,
}
impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
fn node_matches_type(&mut self, hir_id: HirId) -> Option<Ty<'tcx>> {
let ty_opt = self.infcx.in_progress_tables.and_then(|tables| {
tables.borrow().node_type_opt(hir_id)
@ -47,12 +47,12 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> {
impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::OnlyBodies(&self.hir_map)
}
fn visit_local(&mut self, local: &'gcx Local) {
fn visit_local(&mut self, local: &'tcx Local) {
if let (None, Some(ty)) = (self.found_local_pattern, self.node_matches_type(local.hir_id)) {
self.found_local_pattern = Some(&*local.pat);
self.found_ty = Some(ty);
@ -60,7 +60,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
intravisit::walk_local(self, local);
}
fn visit_body(&mut self, body: &'gcx Body) {
fn visit_body(&mut self, body: &'tcx Body) {
for argument in &body.arguments {
if let (None, Some(ty)) = (
self.found_arg_pattern,
@ -75,7 +75,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn extract_type_name(
&self,
ty: Ty<'tcx>,
@ -103,7 +103,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
body_id: Option<hir::BodyId>,
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx> {
) -> DiagnosticBuilder<'tcx> {
let ty = self.resolve_vars_if_possible(&ty);
let name = self.extract_type_name(&ty, None);
@ -230,7 +230,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
&self,
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx> {
) -> DiagnosticBuilder<'tcx> {
let ty = self.resolve_vars_if_possible(&ty);
let name = self.extract_type_name(&ty, None);

View file

@ -5,7 +5,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::error_reporting::nice_region_error::util::AnonymousArgInfo;
use crate::util::common::ErrorReported;
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when both the concerned regions are anonymous.
///
/// Consider a case where we have

View file

@ -5,7 +5,7 @@ use crate::middle::resolve_lifetime as rl;
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// This function calls the `visit_ty` method for the parameters
/// corresponding to the anonymous regions. The `nested_visitor.found_type`
/// contains the anonymous type.
@ -60,9 +60,9 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
// to the anonymous region.
fn find_component_for_bound_region(
&self,
arg: &'gcx hir::Ty,
arg: &'tcx hir::Ty,
br: &ty::BoundRegion,
) -> Option<(&'gcx hir::Ty)> {
) -> Option<(&'tcx hir::Ty)> {
let mut nested_visitor = FindNestedTypeVisitor {
tcx: self.tcx(),
bound_region: *br,
@ -81,23 +81,23 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
// walk the types like &mut Vec<&u8> and &u8 looking for the HIR
// 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<'gcx, 'tcx>,
struct FindNestedTypeVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
// The bound_region corresponding to the Refree(freeregion)
// associated with the anonymous region we are looking for.
bound_region: ty::BoundRegion,
// The type where the anonymous lifetime appears
// for e.g., Vec<`&u8`> and <`&u8`>
found_type: Option<&'gcx hir::Ty>,
found_type: Option<&'tcx hir::Ty>,
current_index: ty::DebruijnIndex,
}
impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> {
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_ty(&mut self, arg: &'gcx hir::Ty) {
fn visit_ty(&mut self, arg: &'tcx hir::Ty) {
match arg.node {
hir::TyKind::BareFn(_) => {
self.current_index.shift_in(1);
@ -208,15 +208,15 @@ impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> {
// and would walk the types like Vec<Ref> in the above example and Ref looking for the HIR
// 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<'gcx, 'tcx>,
struct TyPathVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
found_it: bool,
bound_region: ty::BoundRegion,
current_index: ty::DebruijnIndex,
}
impl Visitor<'gcx> for TyPathVisitor<'gcx, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> {
impl Visitor<'tcx> for TyPathVisitor<'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
@ -267,7 +267,7 @@ impl Visitor<'gcx> for TyPathVisitor<'gcx, 'tcx> {
}
}
fn visit_ty(&mut self, arg: &'gcx hir::Ty) {
fn visit_ty(&mut self, arg: &'tcx hir::Ty) {
// ignore nested types
//
// If you have a type like `Foo<'a, &Ty>` we

View file

@ -14,7 +14,7 @@ mod outlives_closure;
mod static_impl_trait;
mod util;
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
pub fn try_report_nice_region_error(&self, error: &RegionResolutionError<'tcx>) -> bool {
match *error {
ConcreteFailure(..) | SubSupConflict(..) => {}
@ -30,16 +30,16 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
}
}
pub struct NiceRegionError<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
pub struct NiceRegionError<'cx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'tcx>,
error: Option<RegionResolutionError<'tcx>>,
regions: Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)>,
tables: Option<&'cx ty::TypeckTables<'tcx>>,
}
impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {
pub fn new(
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
infcx: &'cx InferCtxt<'cx, 'tcx>,
error: RegionResolutionError<'tcx>,
tables: Option<&'cx ty::TypeckTables<'tcx>>,
) -> Self {
@ -47,7 +47,7 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> {
}
pub fn new_from_span(
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
infcx: &'cx InferCtxt<'cx, 'tcx>,
span: Span,
sub: ty::Region<'tcx>,
sup: ty::Region<'tcx>,
@ -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<'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -5,7 +5,7 @@ use crate::hir::{FunctionRetTy, TyKind};
use crate::ty;
use errors::{Applicability, DiagnosticBuilder};
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
/// an anonymous region, emit an descriptive diagnostic error.
pub(super) fn try_report_named_anon_conflict(&self) -> Option<DiagnosticBuilder<'a>> {

View file

@ -9,7 +9,7 @@ use crate::hir::Node;
use crate::util::common::ErrorReported;
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when binding escapes a closure.
///
/// Consider a case where we have

View file

@ -13,7 +13,7 @@ use crate::ty::print::{Print, RegionHighlightMode, FmtPrinter};
use std::fmt::{self, Write};
impl NiceRegionError<'me, 'gcx, 'tcx> {
impl NiceRegionError<'me, 'tcx> {
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
/// an anonymous region, emit a descriptive diagnostic error.
pub(super) fn try_report_placeholder_conflict(&self) -> Option<DiagnosticBuilder<'me>> {
@ -321,14 +321,14 @@ 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<'gcx, 'tcx>,
struct Highlighted<'tcx, T> {
tcx: TyCtxt<'tcx>,
highlight: RegionHighlightMode,
value: T,
}
impl<'gcx, 'tcx, T> Highlighted<'gcx, 'tcx, T> {
fn map<U>(self, f: impl FnOnce(T) -> U) -> Highlighted<'gcx, 'tcx, U> {
impl<'tcx, T> Highlighted<'tcx, T> {
fn map<U>(self, f: impl FnOnce(T) -> U) -> Highlighted<'tcx, U> {
Highlighted {
tcx: self.tcx,
highlight: self.highlight,
@ -337,12 +337,11 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
}
}
impl<'gcx, 'tcx, T> fmt::Display for Highlighted<'gcx, 'tcx, T>
impl<'tcx, T> fmt::Display for Highlighted<'tcx, T>
where
T: for<'a, 'b, 'c> Print<
'gcx,
'tcx,
FmtPrinter<'a, 'gcx, 'tcx, &'b mut fmt::Formatter<'c>>,
FmtPrinter<'a, 'tcx, &'b mut fmt::Formatter<'c>>,
Error = fmt::Error,
>,
{

View file

@ -6,7 +6,7 @@ use crate::ty::{BoundRegion, FreeRegion, RegionKind};
use crate::util::common::ErrorReported;
use errors::Applicability;
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when the return type is a static impl Trait.
pub(super) fn try_report_static_impl_trait(&self) -> Option<ErrorReported> {
if let Some(ref error) = self.error {

View file

@ -24,7 +24,7 @@ pub(super) struct AnonymousArgInfo<'tcx> {
pub is_first: bool,
}
impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
// This method walks the Type of the function body arguments using
// `fold_regions()` function and returns the
// &hir::Arg of the function argument corresponding to the anonymous

View file

@ -4,7 +4,7 @@ use crate::ty::{self, Region};
use crate::ty::error::TypeError;
use errors::DiagnosticBuilder;
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub(super) fn note_region_origin(&self,
err: &mut DiagnosticBuilder<'_>,
origin: &SubregionOrigin<'tcx>) {

View file

@ -41,17 +41,17 @@ use std::collections::hash_map::Entry;
use super::InferCtxt;
use super::unify_key::ToType;
pub struct TypeFreshener<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct TypeFreshener<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
ty_freshen_count: u32,
const_freshen_count: u32,
ty_freshen_map: FxHashMap<ty::InferTy, Ty<'tcx>>,
const_freshen_map: FxHashMap<ty::InferConst<'tcx>, &'tcx ty::Const<'tcx>>,
}
impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>)
-> TypeFreshener<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>)
-> TypeFreshener<'a, 'tcx> {
TypeFreshener {
infcx,
ty_freshen_count: 0,
@ -113,8 +113,8 @@ 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<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -22,7 +22,7 @@ fn const_vars_since_snapshot<'tcx>(
}).collect())
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// This rather funky routine is used while processing expected
/// types. What happens here is that we want to propagate a
/// coercion through the return type of a fn to its
@ -133,8 +133,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}
pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct InferenceFudger<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
type_vars: (Range<TyVid>, Vec<TypeVariableOrigin>),
int_vars: Range<IntVid>,
float_vars: Range<FloatVid>,
@ -142,8 +142,8 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
const_vars: (Range<ConstVid<'tcx>>, Vec<ConstVariableOrigin>),
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for InferenceFudger<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -8,23 +8,23 @@ use crate::ty::{self, Ty, TyCtxt};
use crate::ty::relate::{Relate, RelateResult, TypeRelation};
/// "Greatest lower bound" (common subtype)
pub struct Glb<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>,
pub struct Glb<'combine, 'infcx: 'combine, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'tcx>,
a_is_expected: bool,
}
impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
-> Glb<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> Glb<'combine, 'infcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool)
-> Glb<'combine, 'infcx, 'tcx>
{
Glb { fields: fields, a_is_expected: a_is_expected }
}
}
impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> {
impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
fn tag(&self) -> &'static str { "Glb" }
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
fn tcx(&self) -> TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.a_is_expected }
@ -85,10 +85,10 @@ impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> {
}
}
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx>
for Glb<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx>
for Glb<'combine, 'infcx, 'tcx>
{
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'tcx> {
self.fields.infcx
}

View file

@ -9,7 +9,7 @@ use crate::ty::relate::{Relate, RelateResult, TypeRelation};
use crate::ty::{self, Binder, TypeFoldable};
use crate::mir::interpret::ConstValue;
impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> CombineFields<'a, 'tcx> {
pub fn higher_ranked_sub<T>(
&mut self,
a: &Binder<T>,
@ -60,7 +60,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// Replaces all regions (resp. types) bound by `binder` with placeholder
/// regions (resp. types) and return a map indicating which bound-region
/// placeholder region. This is the first step of checking subtyping

View file

@ -27,8 +27,8 @@ use crate::ty::TyVar;
use crate::ty::{self, Ty};
use crate::ty::relate::{RelateResult, TypeRelation};
pub trait LatticeDir<'f, 'gcx: 'f + 'tcx, 'tcx: 'f>: TypeRelation<'gcx, 'tcx> {
fn infcx(&self) -> &'f InferCtxt<'f, 'gcx, 'tcx>;
pub trait LatticeDir<'f, 'tcx: 'f>: TypeRelation<'tcx> {
fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;
fn cause(&self) -> &ObligationCause<'tcx>;
@ -41,11 +41,11 @@ pub trait LatticeDir<'f, 'gcx: 'f + 'tcx, 'tcx: 'f>: TypeRelation<'gcx, 'tcx> {
fn relate_bound(&mut self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()>;
}
pub fn super_lattice_tys<'a, 'gcx, 'tcx, L>(this: &mut L,
pub fn super_lattice_tys<'a, 'tcx, L>(this: &mut L,
a: Ty<'tcx>,
b: Ty<'tcx>)
-> RelateResult<'tcx, Ty<'tcx>>
where L: LatticeDir<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a
where L: LatticeDir<'a, 'tcx>, 'tcx: 'a
{
debug!("{}.lattice_tys({:?}, {:?})",
this.tag(),

View file

@ -44,9 +44,9 @@ graphs will be printed. \n\
");
}
pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
pub fn maybe_print_constraints_for<'a, 'tcx>(
region_data: &RegionConstraintData<'tcx>,
region_rels: &RegionRelations<'a, 'gcx, 'tcx>)
region_rels: &RegionRelations<'a, 'tcx>)
{
let tcx = region_rels.tcx;
let context = region_rels.context;
@ -107,9 +107,9 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
}
}
struct ConstraintGraph<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
struct ConstraintGraph<'a, 'tcx: 'a> {
graph_name: String,
region_rels: &'a RegionRelations<'a, 'gcx, 'tcx>,
region_rels: &'a RegionRelations<'a, 'tcx>,
map: &'a BTreeMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
node_ids: FxHashMap<Node, usize>,
}
@ -126,11 +126,11 @@ enum Edge<'tcx> {
EnclScope(region::Scope, region::Scope),
}
impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
fn new(name: String,
region_rels: &'a RegionRelations<'a, 'gcx, 'tcx>,
region_rels: &'a RegionRelations<'a, 'tcx>,
map: &'a ConstraintMap<'tcx>)
-> ConstraintGraph<'a, 'gcx, 'tcx> {
-> ConstraintGraph<'a, 'tcx> {
let mut i = 0;
let mut node_ids = FxHashMap::default();
{
@ -161,7 +161,7 @@ impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
fn graph_id(&self) -> dot::Id<'_> {
@ -215,7 +215,7 @@ fn edge_to_nodes(e: &Edge<'_>) -> (Node, Node) {
}
}
impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
fn nodes(&self) -> dot::Nodes<'_, Node> {
@ -246,7 +246,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
pub type ConstraintMap<'tcx> = BTreeMap<Constraint<'tcx>, SubregionOrigin<'tcx>>;
fn dump_region_data_to<'a, 'gcx, 'tcx>(region_rels: &RegionRelations<'a, 'gcx, 'tcx>,
fn dump_region_data_to<'a, 'tcx>(region_rels: &RegionRelations<'a, 'tcx>,
map: &ConstraintMap<'tcx>,
path: &str)
-> io::Result<()> {

View file

@ -30,7 +30,7 @@ mod graphviz;
/// assuming such values can be found. It returns the final values of
/// all the variables as well as a set of errors that must be reported.
pub fn resolve<'tcx>(
region_rels: &RegionRelations<'_, '_, 'tcx>,
region_rels: &RegionRelations<'_, 'tcx>,
var_infos: VarInfos,
data: RegionConstraintData<'tcx>,
) -> (
@ -96,14 +96,14 @@ struct RegionAndOrigin<'tcx> {
type RegionGraph<'tcx> = Graph<(), Constraint<'tcx>>;
struct LexicalResolver<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
region_rels: &'cx RegionRelations<'cx, 'gcx, 'tcx>,
struct LexicalResolver<'cx, 'tcx: 'cx> {
region_rels: &'cx RegionRelations<'cx, 'tcx>,
var_infos: VarInfos,
data: RegionConstraintData<'tcx>,
}
impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.region_rels.tcx
}
@ -136,14 +136,14 @@ 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>) -> 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())
}
}
fn dump_constraints(&self, free_regions: &RegionRelations<'_, '_, 'tcx>) {
fn dump_constraints(&self, free_regions: &RegionRelations<'_, 'tcx>) {
debug!(
"----() Start constraint listing (context={:?}) ()----",
free_regions.context
@ -785,7 +785,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
}
impl<'tcx> LexicalRegionResolutions<'tcx> {
fn normalize<T>(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T
fn normalize<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
where
T: TypeFoldable<'tcx>,
{

View file

@ -8,23 +8,23 @@ use crate::ty::{self, Ty, TyCtxt};
use crate::ty::relate::{Relate, RelateResult, TypeRelation};
/// "Least upper bound" (common supertype)
pub struct Lub<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>,
pub struct Lub<'combine, 'infcx: 'combine, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'tcx>,
a_is_expected: bool,
}
impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
-> Lub<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> Lub<'combine, 'infcx, 'tcx> {
pub fn new(fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool)
-> Lub<'combine, 'infcx, 'tcx>
{
Lub { fields: fields, a_is_expected: a_is_expected }
}
}
impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> {
impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
fn tag(&self) -> &'static str { "Lub" }
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() }
fn tcx(&self) -> TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.a_is_expected }
@ -85,10 +85,10 @@ impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> {
}
}
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx>
for Lub<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx>
for Lub<'combine, 'infcx, 'tcx>
{
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'tcx> {
self.fields.infcx
}

View file

@ -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 },
@ -102,8 +102,8 @@ impl SuppressRegionErrors {
}
}
pub struct InferCtxt<'a, 'gcx, 'tcx> {
pub tcx: TyCtxt<'gcx, 'tcx>,
pub struct InferCtxt<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>,
/// During type-checking/inference of a body, `in_progress_tables`
/// contains a reference to the tables being built up, which are
@ -464,14 +464,14 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
/// Helper type of a temporary returned by `tcx.infer_ctxt()`.
/// 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, 'tcx> {
global_tcx: TyCtxt<'gcx, 'gcx>,
/// `F: for<'b, 'tcx> where 'tcx FnOnce(InferCtxt<'b, 'tcx>)`.
pub struct InferCtxtBuilder<'tcx> {
global_tcx: TyCtxt<'tcx>,
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
}
impl TyCtxt<'gcx, 'gcx> {
pub fn infer_ctxt<'tcx>(self) -> InferCtxtBuilder<'gcx, 'tcx> {
impl TyCtxt<'tcx> {
pub fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> {
InferCtxtBuilder {
global_tcx: self,
fresh_tables: None,
@ -479,7 +479,7 @@ impl TyCtxt<'gcx, 'gcx> {
}
}
impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
impl<'tcx> InferCtxtBuilder<'tcx> {
/// Used only by `rustc_typeck` during body type-checking/inference,
/// will initialize `in_progress_tables` with fresh `TypeckTables`.
pub fn with_fresh_in_progress_tables(mut self, table_owner: DefId) -> Self {
@ -495,10 +495,10 @@ impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
/// the bound values in `C` to their instantiated values in `V`
/// (in other words, `S(C) = V`).
pub fn enter_with_canonical<T, R>(
&'tcx mut self,
&mut self,
span: Span,
canonical: &Canonical<'tcx, T>,
f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>, T, CanonicalVarValues<'tcx>) -> R,
f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>, T, CanonicalVarValues<'tcx>) -> R,
) -> R
where
T: TypeFoldable<'tcx>,
@ -510,7 +510,7 @@ impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
})
}
pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>) -> R) -> R {
pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R) -> R {
let InferCtxtBuilder {
global_tcx,
ref fresh_tables,
@ -567,7 +567,7 @@ impl<'tcx, T> InferOk<'tcx, T> {
/// Extracts `value`, registering any obligations into `fulfill_cx`.
pub fn into_value_registering_obligations(
self,
infcx: &InferCtxt<'_, '_, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
fulfill_cx: &mut dyn TraitEngine<'tcx>,
) -> T {
let InferOk { value, obligations } = self;
@ -598,7 +598,7 @@ pub struct CombinedSnapshot<'a, 'tcx: 'a> {
_in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn is_in_snapshot(&self) -> bool {
self.in_snapshot.get()
}
@ -614,7 +614,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}
pub fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'gcx, 'tcx> {
pub fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'tcx> {
freshen::TypeFreshener::new(self)
}
@ -677,7 +677,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
&'a self,
trace: TypeTrace<'tcx>,
param_env: ty::ParamEnv<'tcx>,
) -> CombineFields<'a, 'gcx, 'tcx> {
) -> CombineFields<'a, 'tcx> {
CombineFields {
infcx: self,
trace,
@ -1548,13 +1548,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}
pub struct ShallowResolver<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct ShallowResolver<'a, 'tcx> {
infcx: &'a InferCtxt<'a, 'tcx>,
}
impl<'a, 'gcx, 'tcx> ShallowResolver<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
#[inline(always)]
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
ShallowResolver { infcx }
}
@ -1599,8 +1599,8 @@ 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<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for ShallowResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -1624,7 +1624,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx>
}
}
impl<'gcx, 'tcx> TypeTrace<'tcx> {
impl<'tcx> TypeTrace<'tcx> {
pub fn span(&self) -> Span {
self.cause.span
}
@ -1641,7 +1641,7 @@ impl<'gcx, 'tcx> TypeTrace<'tcx> {
}
}
pub fn dummy(tcx: TyCtxt<'gcx, 'tcx>) -> TypeTrace<'tcx> {
pub fn dummy(tcx: TyCtxt<'tcx>) -> TypeTrace<'tcx> {
TypeTrace {
cause: ObligationCause::dummy(),
values: Types(ExpectedFound {

View file

@ -38,11 +38,11 @@ pub enum NormalizationStrategy {
Eager,
}
pub struct TypeRelating<'me, 'gcx: 'tcx, 'tcx: 'me, D>
pub struct TypeRelating<'me, 'tcx: 'me, D>
where
D: TypeRelatingDelegate<'tcx>,
{
infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
infcx: &'me InferCtxt<'me, 'tcx>,
/// Callback to use when we deduce an outlives relationship
delegate: D,
@ -135,12 +135,12 @@ struct BoundRegionScope<'tcx> {
#[derive(Copy, Clone)]
struct UniversallyQuantified(bool);
impl<'me, 'gcx, 'tcx, D> TypeRelating<'me, 'gcx, 'tcx, D>
impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx>,
{
pub fn new(
infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
infcx: &'me InferCtxt<'me, 'tcx>,
delegate: D,
ambient_variance: ty::Variance,
) -> Self {
@ -416,7 +416,7 @@ trait VidValuePair<'tcx>: Debug {
/// for more details on why we want them.
fn vid_scopes<D: TypeRelatingDelegate<'tcx>>(
&self,
relate: &'r mut TypeRelating<'_, '_, 'tcx, D>,
relate: &'r mut TypeRelating<'_, 'tcx, D>,
) -> &'r mut Vec<BoundRegionScope<'tcx>>;
/// Given a generalized type G that should replace the vid, relate
@ -424,7 +424,7 @@ trait VidValuePair<'tcx>: Debug {
/// appeared.
fn relate_generalized_ty<D>(
&self,
relate: &mut TypeRelating<'_, '_, 'tcx, D>,
relate: &mut TypeRelating<'_, 'tcx, D>,
generalized_ty: Ty<'tcx>,
) -> RelateResult<'tcx, Ty<'tcx>>
where
@ -442,7 +442,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
fn vid_scopes<D>(
&self,
relate: &'r mut TypeRelating<'_, '_, 'tcx, D>,
relate: &'r mut TypeRelating<'_, 'tcx, D>,
) -> &'r mut Vec<BoundRegionScope<'tcx>>
where
D: TypeRelatingDelegate<'tcx>,
@ -452,7 +452,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
fn relate_generalized_ty<D>(
&self,
relate: &mut TypeRelating<'_, '_, 'tcx, D>,
relate: &mut TypeRelating<'_, 'tcx, D>,
generalized_ty: Ty<'tcx>,
) -> RelateResult<'tcx, Ty<'tcx>>
where
@ -474,7 +474,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
fn vid_scopes<D>(
&self,
relate: &'r mut TypeRelating<'_, '_, 'tcx, D>,
relate: &'r mut TypeRelating<'_, 'tcx, D>,
) -> &'r mut Vec<BoundRegionScope<'tcx>>
where
D: TypeRelatingDelegate<'tcx>,
@ -484,7 +484,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
fn relate_generalized_ty<D>(
&self,
relate: &mut TypeRelating<'_, '_, 'tcx, D>,
relate: &mut TypeRelating<'_, 'tcx, D>,
generalized_ty: Ty<'tcx>,
) -> RelateResult<'tcx, Ty<'tcx>>
where
@ -494,11 +494,11 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
}
}
impl<D> TypeRelation<'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D>
impl<D> TypeRelation<'tcx> for TypeRelating<'me, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx>,
{
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -798,11 +798,11 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
/// scopes.
///
/// [blog post]: https://is.gd/0hKvIr
struct TypeGeneralizer<'me, 'gcx: 'tcx, 'tcx: 'me, D>
struct TypeGeneralizer<'me, 'tcx: 'me, D>
where
D: TypeRelatingDelegate<'tcx> + 'me,
{
infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
infcx: &'me InferCtxt<'me, 'tcx>,
delegate: &'me mut D,
@ -823,11 +823,11 @@ where
universe: ty::UniverseIndex,
}
impl<D> TypeRelation<'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D>
impl<D> TypeRelation<'tcx> for TypeGeneralizer<'me, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx>,
{
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -73,7 +73,7 @@ pub struct OpaqueTypeDecl<'tcx> {
pub origin: hir::ExistTyOrigin,
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// Replaces all opaque types in `value` with fresh inference variables
/// and creates appropriate obligations. For example, given the input:
///
@ -430,8 +430,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
&self,
def_id: DefId,
opaque_defn: &OpaqueTypeDecl<'tcx>,
instantiated_ty: Ty<'gcx>,
) -> Ty<'gcx> {
instantiated_ty: Ty<'tcx>,
) -> Ty<'tcx> {
debug!(
"infer_opaque_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})",
def_id, instantiated_ty
@ -446,7 +446,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// `impl Trait` return type, resulting in the parameters
// shifting.
let id_substs = InternalSubsts::identity_for_item(gcx, def_id);
let map: FxHashMap<Kind<'tcx>, Kind<'gcx>> = opaque_defn
let map: FxHashMap<Kind<'tcx>, Kind<'tcx>> = opaque_defn
.substs
.iter()
.enumerate()
@ -470,7 +470,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
);
// We can unwrap here because our reverse mapper always
// produces things with 'gcx lifetime, though the type folder
// produces things with 'tcx lifetime, though the type folder
// obscures that.
let definition_ty = gcx.lift(&definition_ty).unwrap();
@ -491,14 +491,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
//
// We ignore any type parameters because impl trait values are assumed to
// capture all the in-scope type parameters.
struct OpaqueTypeOutlivesVisitor<'a, 'gcx, 'tcx> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
struct OpaqueTypeOutlivesVisitor<'a, 'tcx> {
infcx: &'a InferCtxt<'a, 'tcx>,
least_region: ty::Region<'tcx>,
span: Span,
}
impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx>
{
impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, 'tcx> {
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
t.skip_binder().visit_with(self);
false // keep visiting
@ -552,27 +551,27 @@ impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx>
}
}
struct ReverseMapper<'gcx, 'tcx> {
tcx: TyCtxt<'gcx, 'tcx>,
struct ReverseMapper<'tcx> {
tcx: TyCtxt<'tcx>,
/// If errors have already been reported in this fn, we suppress
/// our own errors because they are sometimes derivative.
tainted_by_errors: bool,
opaque_type_def_id: DefId,
map: FxHashMap<Kind<'tcx>, Kind<'gcx>>,
map: FxHashMap<Kind<'tcx>, Kind<'tcx>>,
map_missing_regions_to_empty: bool,
/// initially `Some`, set to `None` once error has been reported
hidden_ty: Option<Ty<'tcx>>,
}
impl ReverseMapper<'gcx, 'tcx> {
impl ReverseMapper<'tcx> {
fn new(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
tainted_by_errors: bool,
opaque_type_def_id: DefId,
map: FxHashMap<Kind<'tcx>, Kind<'gcx>>,
map: FxHashMap<Kind<'tcx>, Kind<'tcx>>,
hidden_ty: Ty<'tcx>,
) -> Self {
Self {
@ -599,8 +598,8 @@ impl ReverseMapper<'gcx, 'tcx> {
}
}
impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
@ -724,8 +723,8 @@ impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> {
}
}
struct Instantiator<'a, 'gcx: 'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
struct Instantiator<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
parent_def_id: DefId,
body_id: hir::HirId,
param_env: ty::ParamEnv<'tcx>,
@ -733,7 +732,7 @@ struct Instantiator<'a, 'gcx: 'tcx, 'tcx: 'a> {
obligations: Vec<PredicateObligation<'tcx>>,
}
impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> Instantiator<'a, 'tcx> {
fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: &T) -> T {
debug!("instantiate_opaque_types_in_map(value={:?})", value);
let tcx = self.infcx.tcx;
@ -944,7 +943,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 {

View file

@ -67,7 +67,7 @@ pub struct OutlivesEnvironment<'tcx> {
/// because of implied bounds.
pub type RegionBoundPairs<'tcx> = Vec<(ty::Region<'tcx>, GenericKind<'tcx>)>;
impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> {
impl<'a, 'tcx: 'a> OutlivesEnvironment<'tcx> {
pub fn new(param_env: ty::ParamEnv<'tcx>) -> Self {
let mut env = OutlivesEnvironment {
param_env,
@ -160,7 +160,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> {
/// Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs`
pub fn add_implied_bounds(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
infcx: &InferCtxt<'a, 'tcx>,
fn_sig_tys: &[Ty<'tcx>],
body_id: hir::HirId,
span: Span,
@ -192,7 +192,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> {
/// `RegionConstraintData`.)
fn add_outlives_bounds<I>(
&mut self,
infcx: Option<&InferCtxt<'a, 'gcx, 'tcx>>,
infcx: Option<&InferCtxt<'a, 'tcx>>,
outlives_bounds: I,
) where
I: IntoIterator<Item = OutlivesBound<'tcx>>,

View file

@ -28,9 +28,9 @@ impl<'tcx> FreeRegionMap<'tcx> {
/// cases, this is more conservative than necessary, in order to
/// avoid making arbitrary choices. See
/// `TransitiveRelation::postdom_upper_bound` for more details.
pub fn lub_free_regions<'gcx>(
pub fn lub_free_regions(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
r_a: Region<'tcx>,
r_b: Region<'tcx>,
) -> Region<'tcx> {
@ -91,7 +91,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<'gcx, 'tcx>) -> Option<FreeRegionMap<'tcx>> {
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<FreeRegionMap<'tcx>> {
self.relation.maybe_map(|&fr| tcx.lift(&fr))
.map(|relation| FreeRegionMap { relation })
}

View file

@ -69,7 +69,7 @@ use crate::ty::outlives::Component;
use crate::ty::{self, Region, Ty, TyCtxt, TypeFoldable};
use crate::ty::subst::UnpackedKind;
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// Registers that the given region obligation must be resolved
/// from within the scope of `body_id`. These regions are enqueued
/// and later processed by regionck, when full type information is
@ -226,15 +226,15 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// via a "delegate" of type `D` -- this is usually the `infcx`, which
/// accrues them into the `region_obligations` code, but for NLL we
/// use something else.
pub struct TypeOutlives<'cx, 'gcx: 'tcx, 'tcx: 'cx, D>
pub struct TypeOutlives<'cx, 'tcx: 'cx, D>
where
D: TypeOutlivesDelegate<'tcx>,
{
// See the comments on `process_registered_region_obligations` for the meaning
// of these fields.
delegate: D,
tcx: TyCtxt<'gcx, 'tcx>,
verify_bound: VerifyBoundCx<'cx, 'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
verify_bound: VerifyBoundCx<'cx, 'tcx>,
}
pub trait TypeOutlivesDelegate<'tcx> {
@ -254,13 +254,13 @@ pub trait TypeOutlivesDelegate<'tcx> {
);
}
impl<'cx, 'gcx, 'tcx, D> TypeOutlives<'cx, 'gcx, 'tcx, D>
impl<'cx, 'tcx, D> TypeOutlives<'cx, 'tcx, D>
where
D: TypeOutlivesDelegate<'tcx>,
{
pub fn new(
delegate: D,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
implicit_region_bound: Option<ty::Region<'tcx>>,
param_env: ty::ParamEnv<'tcx>,
@ -487,7 +487,7 @@ where
}
}
impl<'cx, 'gcx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'cx, 'tcx> {
fn push_sub_region_constraint(
&mut self,
origin: SubregionOrigin<'tcx>,

View file

@ -12,16 +12,16 @@ use crate::util::captures::Captures;
/// via a "delegate" of type `D` -- this is usually the `infcx`, which
/// accrues them into the `region_obligations` code, but for NLL we
/// use something else.
pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
tcx: TyCtxt<'gcx, 'tcx>,
pub struct VerifyBoundCx<'cx, 'tcx: 'cx> {
tcx: TyCtxt<'tcx>,
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
implicit_region_bound: Option<ty::Region<'tcx>>,
param_env: ty::ParamEnv<'tcx>,
}
impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
pub fn new(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
implicit_region_bound: Option<ty::Region<'tcx>>,
param_env: ty::ParamEnv<'tcx>,
@ -102,7 +102,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
pub fn projection_declared_bounds_from_trait(
&self,
projection_ty: ty::ProjectionTy<'tcx>,
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'gcx> {
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'tcx> {
self.declared_projection_bounds_from_trait(projection_ty)
}
@ -244,7 +244,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
fn declared_projection_bounds_from_trait(
&self,
projection_ty: ty::ProjectionTy<'tcx>,
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'gcx> {
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'tcx> {
debug!("projection_bounds(projection_ty={:?})", projection_ty);
let tcx = self.tcx;
self.region_bounds_declared_on_associated_item(projection_ty.item_def_id)
@ -284,7 +284,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
fn region_bounds_declared_on_associated_item(
&self,
assoc_item_def_id: DefId,
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'gcx> {
) -> impl Iterator<Item = ty::Region<'tcx>> + 'cx + Captures<'tcx> {
let tcx = self.tcx;
let assoc_item = tcx.associated_item(assoc_item_def_id);
let trait_def_id = assoc_item.container.assert_trait();

View file

@ -22,7 +22,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
/// refactor the constraint set.
pub fn leak_check(
&mut self,
tcx: TyCtxt<'_, '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: TyCtxt<'tcx>,
undo_log: &[UndoLog<'tcx>],
verifys: &[Verify<'tcx>],
) {

View file

@ -700,7 +700,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
pub fn lub_regions(
&mut self,
tcx: TyCtxt<'_, '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: 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: 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: TyCtxt<'tcx>,
t: CombineMapType,
a: Region<'tcx>,
b: Region<'tcx>,
@ -849,8 +849,8 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
}
}
impl<'gcx, 'tcx> GenericKind<'tcx> {
pub fn to_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> {
impl<'tcx> GenericKind<'tcx> {
pub fn to_ty(&self, tcx: TyCtxt<'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),

View file

@ -12,19 +12,19 @@ use crate::ty::fold::{TypeFolder, TypeVisitor};
/// been unified with (similar to `shallow_resolve`, but deep). This is
/// useful for printing messages etc but also required at various
/// points for correctness.
pub struct OpportunisticVarResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct OpportunisticVarResolver<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
}
impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
#[inline]
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
OpportunisticVarResolver { infcx }
}
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -50,18 +50,18 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gc
/// The opportunistic type and region resolver is similar to the
/// opportunistic type resolver, but also opportunistically resolves
/// regions. It is useful for canonicalization.
pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct OpportunisticTypeAndRegionResolver<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
}
impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
impl<'a, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
OpportunisticTypeAndRegionResolver { infcx }
}
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticTypeAndRegionResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -101,20 +101,20 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolv
/// type variables that don't yet have a value. The first unresolved type is stored.
/// It does not construct the fully resolved type (which might
/// involve some hashing and so forth).
pub struct UnresolvedTypeFinder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub struct UnresolvedTypeFinder<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
/// Used to find the type parameter name and location for error reporting.
pub first_unresolved: Option<(Ty<'tcx>,Option<Span>)>,
}
impl<'a, 'gcx, 'tcx> UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
UnresolvedTypeFinder { infcx, first_unresolved: None }
}
}
impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
let t = self.infcx.shallow_resolve(t);
if t.has_infer_types() {
@ -157,7 +157,7 @@ impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'gcx, 'tcx>
/// Full type resolution replaces all type and region variables with
/// their concrete results. If any variable cannot be replaced (never unified, etc)
/// then an `Err` result is returned.
pub fn fully_resolve<'a, 'gcx, 'tcx, T>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
value: &T) -> FixupResult<'tcx, T>
where T : TypeFoldable<'tcx>
{
@ -171,13 +171,13 @@ pub fn fully_resolve<'a, 'gcx, 'tcx, T>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
// N.B. This type is not public because the protocol around checking the
// `err` field is not enforcable otherwise.
struct FullTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
struct FullTypeResolver<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
err: Option<FixupError<'tcx>>,
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -11,14 +11,14 @@ use crate::mir::interpret::ConstValue;
use std::mem;
/// Ensures `a` is made a subtype of `b`. Returns `a` on success.
pub struct Sub<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>,
pub struct Sub<'combine, 'infcx: 'combine, 'tcx: 'infcx> {
fields: &'combine mut CombineFields<'infcx, 'tcx>,
a_is_expected: bool,
}
impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
pub fn new(f: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
-> Sub<'combine, 'infcx, 'gcx, 'tcx>
impl<'combine, 'infcx, 'tcx> Sub<'combine, 'infcx, 'tcx> {
pub fn new(f: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool)
-> Sub<'combine, 'infcx, 'tcx>
{
Sub { fields: f, a_is_expected: a_is_expected }
}
@ -31,9 +31,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
}
}
impl TypeRelation<'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> {
impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
fn tag(&self) -> &'static str { "Sub" }
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.infcx.tcx }
fn tcx(&self) -> TyCtxt<'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

View file

@ -10,7 +10,7 @@ use std::marker::PhantomData;
use std::cell::RefMut;
pub trait ToType {
fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>;
fn to_type<'tcx>(&self, tcx: TyCtxt<'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<'gcx, 'tcx>) -> Ty<'tcx> {
fn to_type<'tcx>(&self, tcx: TyCtxt<'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<'gcx, 'tcx>) -> Ty<'tcx> {
fn to_type<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
tcx.mk_mach_float(self.0)
}
}

View file

@ -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>,
pub tcx: TyCtxt<'tcx>,
/// Side-tables for the body we are in.
// FIXME: Make this lazy to avoid running the TypeckTables query?
@ -781,10 +781,10 @@ 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>,
pub tcx: TyCtxt<'tcx>,
}
impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> {
impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
type Error = !;
type Path = Vec<Symbol>;
@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
type DynExistential = ();
type Const = ();
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'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: TyCtxt<'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: TyCtxt<'tcx>,
module_def_id: DefId,
builtin_lints: T,
) {
@ -1423,7 +1423,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>, pass: T) {
fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
let krate = tcx.hir().krate();
@ -1457,7 +1457,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(tcx: TyCtxt<'tc
}
fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
builtin_lints: T,
) {
let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap();
@ -1491,7 +1491,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: TyCtxt<'tcx>,
builtin_lints: impl FnOnce() -> T + Send,
) {
join(|| {

View file

@ -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>, cnum: CrateNum) -> &'tcx LintLevelMap {
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap {
assert_eq!(cnum, LOCAL_CRATE);
let mut builder = LintLevelMapBuilder {
levels: LintLevelSets::builder(tcx.sess),
@ -787,7 +787,7 @@ fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevel
struct LintLevelMapBuilder<'tcx> {
levels: levels::LintLevelsBuilder<'tcx>,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
}
impl LintLevelMapBuilder<'tcx> {

View file

@ -195,7 +195,7 @@ macro_rules! CloneLiftImpls {
$(
impl<$tcx> $crate::ty::Lift<$tcx> for $ty {
type Lifted = Self;
fn lift_to_tcx<'gcx>(&self, _: $crate::ty::TyCtxt<'gcx, $tcx>) -> Option<Self> {
fn lift_to_tcx(&self, _: $crate::ty::TyCtxt<$tcx>) -> Option<Self> {
Some(Clone::clone(self))
}
}
@ -218,7 +218,7 @@ macro_rules! CloneTypeFoldableImpls {
(for <$tcx:lifetime> { $($ty:ty,)+ }) => {
$(
impl<$tcx> $crate::ty::fold::TypeFoldable<$tcx> for $ty {
fn super_fold_with<'gcx: $tcx, F: $crate::ty::fold::TypeFolder<'gcx, $tcx>>(
fn super_fold_with<F: $crate::ty::fold::TypeFolder<$tcx>>(
&self,
_: &mut F
) -> $ty {
@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl {
{
type Lifted = $lifted;
fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> {
fn lift_to_tcx(&self, tcx: TyCtxt<$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<'gcx, 'tcx>) -> Option<$lifted> {
fn lift_to_tcx(&self, tcx: TyCtxt<$tcx>) -> Option<$lifted> {
EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output())
}
}
@ -332,7 +332,7 @@ macro_rules! BraceStructTypeFoldableImpl {
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
$(where $($wc)*)*
{
fn super_fold_with<'gcx: $tcx, V: $crate::ty::fold::TypeFolder<'gcx, $tcx>>(
fn super_fold_with<V: $crate::ty::fold::TypeFolder<$tcx>>(
&self,
folder: &mut V,
) -> Self {
@ -359,7 +359,7 @@ macro_rules! TupleStructTypeFoldableImpl {
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
$(where $($wc)*)*
{
fn super_fold_with<'gcx: $tcx, V: $crate::ty::fold::TypeFolder<'gcx, $tcx>>(
fn super_fold_with<V: $crate::ty::fold::TypeFolder<$tcx>>(
&self,
folder: &mut V,
) -> Self {
@ -386,7 +386,7 @@ macro_rules! EnumTypeFoldableImpl {
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
$(where $($wc)*)*
{
fn super_fold_with<'gcx: $tcx, V: $crate::ty::fold::TypeFolder<'gcx, $tcx>>(
fn super_fold_with<V: $crate::ty::fold::TypeFolder<$tcx>>(
&self,
folder: &mut V,
) -> Self {

View file

@ -211,7 +211,7 @@ pub trait CrateStore {
fn crates_untracked(&self) -> Vec<CrateNum>;
// utility functions
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata;
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata;
fn metadata_encoding_version(&self) -> &[u8];
}
@ -226,7 +226,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) -> Vec<(CrateNum, LibSource)> {
pub fn used_crates(tcx: TyCtxt<'_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> {
let mut libs = tcx.crates()
.iter()
.cloned()

View file

@ -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>, hir_id: hir::HirId) -> bool {
fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool {
match tcx.hir().find_by_hir_id(hir_id) {
Some(Node::Item(..)) |
Some(Node::ImplItem(..)) |
@ -40,7 +40,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool {
struct MarkSymbolVisitor<'a, 'tcx: 'a> {
worklist: Vec<hir::HirId>,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'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<'_, '_>,
tcx: TyCtxt<'_>,
id: hir::HirId,
attrs: &[ast::Attribute],
) -> bool {
@ -354,7 +354,7 @@ fn has_allow_dead_code_or_lang_attr(
struct LifeSeeder<'k, 'tcx: 'k> {
worklist: Vec<hir::HirId>,
krate: &'k hir::Crate,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
// see `MarkSymbolVisitor::struct_constructors`
struct_constructors: FxHashMap<hir::HirId, hir::HirId>,
}
@ -425,7 +425,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
}
fn create_and_seed_worklist<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate,
) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) {
@ -453,7 +453,7 @@ fn create_and_seed_worklist<'tcx>(
}
fn find_live<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate,
) -> FxHashSet<hir::HirId> {
@ -474,7 +474,7 @@ fn find_live<'tcx>(
}
struct DeadVisitor<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
live_symbols: FxHashSet<hir::HirId>,
}
@ -662,7 +662,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
}
}
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) {
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
let krate = tcx.hir().krate();
let live_symbols = find_live(tcx, access_levels, krate);

View file

@ -81,7 +81,7 @@ pub enum Linkage {
Dynamic,
}
pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
pub fn calculate<'tcx>(tcx: TyCtxt<'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>) {
sess.dependency_formats.set(fmts);
}
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList {
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx>, ty: config::CrateType) -> DependencyList {
let sess = &tcx.sess;
if !sess.opts.output_types.should_codegen() {
@ -241,7 +241,7 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> Depen
}
fn add_library(
tcx: TyCtxt<'_, '_>,
tcx: TyCtxt<'_>,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FxHashMap<CrateNum, LinkagePreference>,
@ -267,7 +267,7 @@ fn add_library(
}
}
fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option<DependencyList> {
fn attempt_static<'tcx>(tcx: TyCtxt<'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>, list: &[Linkage]) {
fn verify_ok<'tcx>(tcx: TyCtxt<'tcx>, list: &[Linkage]) {
let sess = &tcx.sess;
if list.len() == 0 {
return

View file

@ -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)
}

View file

@ -38,7 +38,7 @@ pub enum ExportedSymbol<'tcx> {
}
impl<'tcx> ExportedSymbol<'tcx> {
pub fn symbol_name(&self, tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName {
pub fn symbol_name(&self, tcx: TyCtxt<'tcx>) -> ty::SymbolName {
match *self {
ExportedSymbol::NonGeneric(def_id) => {
tcx.symbol_name(ty::Instance::mono(tcx, def_id))
@ -54,7 +54,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
pub fn compare_stable(
&self,
tcx: TyCtxt<'tcx, '_>,
tcx: TyCtxt<'tcx>,
other: &ExportedSymbol<'tcx>,
) -> cmp::Ordering {
match *self {
@ -91,13 +91,13 @@ 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())
}
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ExportedSymbol<'gcx> {
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ExportedSymbol<'tcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {

View file

@ -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())
}
@ -229,8 +229,8 @@ impl OverloadedCallType {
// The ExprUseVisitor type
//
// This is the code that actually walks the tree.
pub struct ExprUseVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
mc: mc::MemCategorizationContext<'a, 'gcx, 'tcx>,
pub struct ExprUseVisitor<'a, 'tcx: 'a> {
mc: mc::MemCategorizationContext<'a, 'tcx>,
delegate: &'a mut dyn Delegate<'tcx>,
param_env: ty::ParamEnv<'tcx>,
}
@ -254,7 +254,7 @@ macro_rules! return_if_err {
)
}
impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
/// Creates the ExprUseVisitor, configuring it with the various options provided:
///
/// - `delegate` -- who receives the callbacks
@ -268,7 +268,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: TyCtxt<'tcx>,
body_owner: DefId,
param_env: ty::ParamEnv<'tcx>,
region_scope_tree: &'a region::ScopeTree,
@ -287,9 +287,9 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
pub fn with_infer(delegate: &'a mut (dyn Delegate<'tcx>+'a),
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
infcx: &'a InferCtxt<'a, '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<'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.mc.tcx
}
@ -974,7 +974,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
}
}
fn copy_or_move<'a, 'gcx, 'tcx>(mc: &mc::MemCategorizationContext<'a, 'gcx, 'tcx>,
fn copy_or_move<'a, 'tcx>(mc: &mc::MemCategorizationContext<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
cmt: &mc::cmt_<'tcx>,
move_reason: MoveReason)

View file

@ -15,8 +15,8 @@ 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<'gcx, 'tcx>,
pub struct RegionRelations<'a, 'tcx: 'a> {
pub tcx: TyCtxt<'tcx>,
/// The context used to fetch the region maps.
pub context: DefId,
@ -28,9 +28,9 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> {
pub free_regions: &'a FreeRegionMap<'tcx>,
}
impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> RegionRelations<'a, 'tcx> {
pub fn new(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
context: DefId,
region_scope_tree: &'a region::ScopeTree,
free_regions: &'a FreeRegionMap<'tcx>,

View file

@ -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>, module_def_id: DefId) {
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'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: TyCtxt<'tcx>,
}
struct ExprVisitor<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'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>, ty: Ty<'tcx>) -> Ty<'tcx> {
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
let (def, substs) = match ty.sty {
ty::Adt(def, substs) => (def, substs),
_ => return ty

View file

@ -106,7 +106,7 @@ impl LanguageItems {
struct LanguageItemCollector<'tcx> {
items: LanguageItems,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'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>) -> LanguageItemCollector<'tcx> {
fn new(tcx: TyCtxt<'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>) -> LanguageItems {
pub fn collect<'tcx>(tcx: TyCtxt<'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<'tcx, 'gcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Returns the `DefId` for a given `LangItem`.
/// If not found, fatally abort compilation.
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {

View file

@ -38,12 +38,12 @@ impl LibFeatures {
}
pub struct LibFeatureCollector<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
lib_features: LibFeatures,
}
impl LibFeatureCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatureCollector<'tcx> {
fn new(tcx: TyCtxt<'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>) -> LibFeatures {
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LibFeatures {
let mut collector = LibFeatureCollector::new(tcx);
intravisit::walk_crate(&mut collector, tcx.hir().krate());
collector.lib_features

View file

@ -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>, module_def_id: DefId) {
fn check_mod_liveness<'tcx>(tcx: TyCtxt<'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: TyCtxt<'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>, body_owner: DefId) -> IrMaps<'tcx> {
fn new(tcx: TyCtxt<'tcx>, body_owner: DefId) -> IrMaps<'tcx> {
IrMaps {
tcx,
body_owner,

View file

@ -287,14 +287,14 @@ impl HirNode for hir::Pat {
}
#[derive(Clone)]
pub struct MemCategorizationContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
pub tcx: TyCtxt<'gcx, 'tcx>,
pub struct MemCategorizationContext<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>,
pub body_owner: DefId,
pub upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>,
pub region_scope_tree: &'a region::ScopeTree,
pub tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
infcx: Option<&'a InferCtxt<'a, 'gcx, 'tcx>>,
infcx: Option<&'a InferCtxt<'a, 'tcx>>,
}
pub type McResult<T> = Result<T, ()>;
@ -340,7 +340,7 @@ impl MutabilityCategory {
}
fn from_local(
tcx: TyCtxt<'_, '_>,
tcx: TyCtxt<'_>,
tables: &ty::TypeckTables<'_>,
id: ast::NodeId,
) -> MutabilityCategory {
@ -402,14 +402,14 @@ impl MutabilityCategory {
}
}
impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
pub fn new(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
body_owner: DefId,
region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
) -> MemCategorizationContext<'a, 'tcx, 'tcx> {
) -> MemCategorizationContext<'a, 'tcx> {
MemCategorizationContext {
tcx,
body_owner,
@ -422,7 +422,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
/// Creates a `MemCategorizationContext` during type inference.
/// This is used during upvar analysis and a few other places.
/// Because the typeck tables are not yet complete, the results
@ -432,11 +432,11 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
/// temporaries may be overly conservative;
/// - similarly, as the results of upvar analysis are not yet
/// known, the results around upvar accesses may be incorrect.
pub fn with_infer(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
pub fn with_infer(infcx: &'a InferCtxt<'a, 'tcx>,
body_owner: DefId,
region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>)
-> MemCategorizationContext<'a, 'gcx, 'tcx> {
-> MemCategorizationContext<'a, 'tcx> {
let tcx = infcx.tcx;
// Subtle: we can't do rvalue promotion analysis until the
@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
pub fn cat_expr(&self, expr: &hir::Expr) -> McResult<cmt_<'tcx>> {
// This recursion helper avoids going through *too many*
// adjustments, since *only* non-overloaded deref recurses.
fn helper<'a, 'gcx, 'tcx>(mc: &MemCategorizationContext<'a, 'gcx, 'tcx>,
fn helper<'a, 'tcx>(mc: &MemCategorizationContext<'a, 'tcx>,
expr: &hir::Expr,
adjustments: &[adjustment::Adjustment<'tcx>])
-> McResult<cmt_<'tcx>> {
@ -1518,7 +1518,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()

View file

@ -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>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool {
fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool {
if attrs.requests_inline() {
return true
}
@ -43,7 +43,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, attrs: Codeg
}
fn method_might_be_inlined<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
impl_item: &hir::ImplItem,
impl_src: DefId,
) -> bool {
@ -67,7 +67,7 @@ fn method_might_be_inlined<'tcx>(
// Information needed while computing reachability.
struct ReachableContext<'a, 'tcx: 'a> {
// The type context.
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'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: TyCtxt<'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>, crate_num: CrateNum) -> ReachableSet {
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> ReachableSet {
debug_assert!(crate_num == LOCAL_CRATE);
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);

View file

@ -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: TyCtxt<'tcx>,
// The number of expressions and patterns visited in the current body
expr_and_pat_count: usize,
@ -646,9 +646,9 @@ 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>(
pub fn early_free_scope(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
br: &ty::EarlyBoundRegion,
) -> Scope {
let param_owner = tcx.parent(br.def_id).unwrap();
@ -679,7 +679,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<'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope {
pub fn free_scope(&self, tcx: TyCtxt<'tcx>, fr: &ty::FreeRegion) -> Scope {
let param_owner = match fr.bound_region {
ty::BoundRegion::BrNamed(def_id, _) => {
tcx.parent(def_id).unwrap()
@ -1334,7 +1334,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
}
}
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree {
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree {
let closure_base_def_id = tcx.closure_base_def_id(def_id);
if closure_base_def_id != def_id {
return tcx.region_scope_tree(closure_base_def_id);

View file

@ -218,7 +218,7 @@ impl_stable_hash_for!(struct crate::middle::resolve_lifetime::ResolveLifetimes {
});
struct LifetimeContext<'a, 'tcx: 'a> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
map: &'a mut NamedRegionMap,
scope: ScopeRef<'a>,
@ -368,7 +368,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
/// entire crate. You should not read the result of this query
/// directly, but rather use `named_region_map`, `is_late_bound_map`,
/// etc.
fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes {
fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes {
assert_eq!(for_krate, LOCAL_CRATE);
let named_region_map = krate(tcx);
@ -395,7 +395,7 @@ fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum) -> &'tc
tcx.arena.alloc(rl)
}
fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> NamedRegionMap {
fn krate<'tcx>(tcx: TyCtxt<'tcx>) -> NamedRegionMap {
let krate = tcx.hir().krate();
let mut map = NamedRegionMap {
defs: Default::default(),
@ -1098,7 +1098,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 {
@ -1126,7 +1126,7 @@ fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_>, params: &P<[hir::G
}
fn signal_shadowing_problem(
tcx: TyCtxt<'_, '_>,
tcx: TyCtxt<'_>,
name: ast::Name,
orig: Original,
shadower: Shadower,
@ -1166,7 +1166,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: TyCtxt<'tcx>,
scope: ScopeRef<'a>,
labels_in_fn: &'a mut Vec<ast::Ident>,
}
@ -1215,7 +1215,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,
) {
@ -1253,7 +1253,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) {
}
}
fn compute_object_lifetime_defaults(tcx: TyCtxt<'_, '_>) -> HirIdMap<Vec<ObjectLifetimeDefault>> {
fn compute_object_lifetime_defaults(tcx: TyCtxt<'_>) -> HirIdMap<Vec<ObjectLifetimeDefault>> {
let mut map = HirIdMap::default();
for item in tcx.hir().krate().items.values() {
match item.node {
@ -1310,7 +1310,7 @@ fn compute_object_lifetime_defaults(tcx: TyCtxt<'_, '_>) -> HirIdMap<Vec<ObjectL
/// 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]) {

View file

@ -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: TyCtxt<'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: TyCtxt<'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>) -> Index<'tcx> {
pub fn new(tcx: TyCtxt<'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>, module_def_id: DefId) {
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'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: TyCtxt<'tcx>,
}
/// Result of `TyCtxt::eval_stability`.
@ -521,7 +521,7 @@ pub enum EvalResult {
Unmarked,
}
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
impl<'tcx> TyCtxt<'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<'gcx, 'tcx> {
impl<'tcx> TyCtxt<'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<'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>) {
pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'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>) {
}
fn unnecessary_stable_feature_lint<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
span: Span,
feature: Symbol,
since: Symbol,

View file

@ -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: TyCtxt<'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>,
pub fn check_crate<'tcx>(tcx: TyCtxt<'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) -> bool
false
}
fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
fn verify<'tcx>(tcx: TyCtxt<'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<'tcx, 'gcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool {
let lang_items = self.lang_items();
let did = Some(item_def_id);

View file

@ -74,16 +74,16 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
}
}
impl<'gcx, 'tcx> ConstEvalErr<'tcx> {
impl<'tcx> ConstEvalErr<'tcx> {
pub fn struct_error(
&self,
tcx: TyCtxtAt<'gcx, 'tcx>,
tcx: TyCtxtAt<'tcx>,
message: &str,
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
self.struct_generic(tcx, message, None)
}
pub fn report_as_error(&self, tcx: TyCtxtAt<'gcx, 'tcx>, message: &str) -> ErrorHandled {
pub fn report_as_error(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled {
let err = self.struct_error(tcx, message);
match err {
Ok(mut err) => {
@ -96,7 +96,7 @@ impl<'gcx, 'tcx> ConstEvalErr<'tcx> {
pub fn report_as_lint(
&self,
tcx: TyCtxtAt<'gcx, 'tcx>,
tcx: TyCtxtAt<'tcx>,
message: &str,
lint_root: hir::HirId,
span: Option<Span>,
@ -129,7 +129,7 @@ impl<'gcx, 'tcx> ConstEvalErr<'tcx> {
fn struct_generic(
&self,
tcx: TyCtxtAt<'gcx, 'tcx>,
tcx: TyCtxtAt<'tcx>,
message: &str,
lint_root: Option<hir::HirId>,
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
@ -170,7 +170,7 @@ impl<'gcx, 'tcx> ConstEvalErr<'tcx> {
}
}
pub fn struct_error<'gcx, 'tcx>(tcx: TyCtxtAt<'gcx, 'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> {
pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> {
struct_span_err!(tcx.sess, tcx.span, E0080, "{}", msg)
}

View file

@ -66,7 +66,7 @@ enum AllocDiscriminant {
pub fn specialized_encode_alloc_id<'tcx, E: Encoder>(
encoder: &mut E,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
alloc_id: AllocId,
) -> Result<(), E::Error> {
let alloc: GlobalAlloc<'tcx> =

View file

@ -1240,8 +1240,8 @@ impl<'tcx> Terminator<'tcx> {
}
impl<'tcx> TerminatorKind<'tcx> {
pub fn if_<'gcx>(
tcx: TyCtxt<'gcx, 'tcx>,
pub fn if_(
tcx: TyCtxt<'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: TyCtxt<'tcx>,
def_id: DefId,
substs: SubstsRef<'tcx>,
span: Span,
@ -2795,7 +2795,7 @@ impl UserTypeProjection {
CloneTypeFoldableAndLiftImpls! { ProjectionKind, }
impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
use crate::mir::ProjectionElem::*;
let base = self.base.fold_with(folder);
@ -3012,8 +3012,8 @@ pub struct GeneratorLayout<'tcx> {
}
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
pub struct BorrowCheckResult<'gcx> {
pub closure_requirements: Option<ClosureRegionRequirements<'gcx>>,
pub struct BorrowCheckResult<'tcx> {
pub closure_requirements: Option<ClosureRegionRequirements<'tcx>>,
pub used_mut_upvars: SmallVec<[Field; 8]>,
}
@ -3068,7 +3068,7 @@ pub struct BorrowCheckResult<'gcx> {
/// TyCtxt, and hence we cannot use `ReVar` (which is what we use
/// internally within the rest of the NLL code).
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
pub struct ClosureRegionRequirements<'gcx> {
pub struct ClosureRegionRequirements<'tcx> {
/// The number of external regions defined on the closure. In our
/// example above, it would be 3 -- one for `'static`, then `'1`
/// and `'2`. This is just used for a sanity check later on, to
@ -3078,7 +3078,7 @@ pub struct ClosureRegionRequirements<'gcx> {
/// Requirements between the various free regions defined in
/// indices.
pub outlives_requirements: Vec<ClosureOutlivesRequirement<'gcx>>,
pub outlives_requirements: Vec<ClosureOutlivesRequirement<'tcx>>,
}
/// Indicates an outlives constraint between a type or between two
@ -3262,7 +3262,7 @@ EnumTypeFoldableImpl! {
}
impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
use crate::mir::TerminatorKind::*;
let kind = match self.kind {
@ -3430,7 +3430,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
}
impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
match self {
&Place::Projection(ref p) => Place::Projection(p.fold_with(folder)),
_ => self.clone(),
@ -3447,7 +3447,7 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
}
impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
use crate::mir::Rvalue::*;
match *self {
Use(ref op) => Use(op.fold_with(folder)),
@ -3519,7 +3519,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
}
impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
match *self {
Operand::Copy(ref place) => Operand::Copy(place.fold_with(folder)),
Operand::Move(ref place) => Operand::Move(place.fold_with(folder)),
@ -3536,7 +3536,7 @@ impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
}
impl<'tcx> TypeFoldable<'tcx> for Projection<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
use crate::mir::ProjectionElem::*;
let base = self.base.fold_with(folder);
@ -3562,7 +3562,7 @@ impl<'tcx> TypeFoldable<'tcx> for Projection<'tcx> {
}
impl<'tcx> TypeFoldable<'tcx> for Field {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, _: &mut F) -> Self {
*self
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> bool {
@ -3571,7 +3571,7 @@ impl<'tcx> TypeFoldable<'tcx> for Field {
}
impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, _: &mut F) -> Self {
*self
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> bool {
@ -3580,7 +3580,7 @@ impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
}
impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, _: &mut F) -> Self {
self.clone()
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> bool {
@ -3589,7 +3589,7 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
}
impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
Constant {
span: self.span.clone(),
ty: self.ty.fold_with(folder),

View file

@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> {
}
impl<'tcx> MonoItem<'tcx> {
pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx>) -> usize {
pub fn size_estimate(&self, tcx: TyCtxt<'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>) -> SymbolName {
pub fn symbol_name(&self, tcx: TyCtxt<'tcx>) -> SymbolName {
match *self {
MonoItem::Fn(instance) => tcx.symbol_name(instance),
MonoItem::Static(def_id) => {
@ -87,7 +87,7 @@ impl<'tcx> MonoItem<'tcx> {
}
}
pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode {
pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode {
let inline_in_all_cgus =
tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
tcx.sess.opts.optimize != OptLevel::No
@ -131,7 +131,7 @@ impl<'tcx> MonoItem<'tcx> {
}
}
pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Linkage> {
pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx>) -> Option<Linkage> {
let def_id = match *self {
MonoItem::Fn(ref instance) => instance.def_id(),
MonoItem::Static(def_id) => def_id,
@ -167,7 +167,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>) -> bool {
pub fn is_instantiable(&self, tcx: TyCtxt<'tcx>) -> bool {
debug!("is_instantiable({:?})", self);
let (def_id, substs) = match *self {
MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
@ -179,7 +179,7 @@ impl<'tcx> MonoItem<'tcx> {
tcx.substitute_normalize_and_test_predicates((def_id, &substs))
}
pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String {
pub fn to_string(&self, tcx: TyCtxt<'tcx>, debug: bool) -> String {
return match *self {
MonoItem::Fn(instance) => {
to_string_internal(tcx, "fn ", instance, debug)
@ -194,7 +194,7 @@ impl<'tcx> MonoItem<'tcx> {
};
fn to_string_internal<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
prefix: &str,
instance: Instance<'tcx>,
debug: bool,
@ -207,7 +207,7 @@ impl<'tcx> MonoItem<'tcx> {
}
}
pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Span> {
pub fn local_span(&self, tcx: TyCtxt<'tcx>) -> Option<Span> {
match *self {
MonoItem::Fn(Instance { def, .. }) => {
tcx.hir().as_local_hir_id(def.def_id())
@ -333,7 +333,7 @@ impl<'tcx> CodegenUnit<'tcx> {
base_n::encode(hash, base_n::CASE_INSENSITIVE)
}
pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx>) {
pub fn estimate_size(&mut self, tcx: TyCtxt<'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());
@ -359,7 +359,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,14 +370,14 @@ impl<'tcx> CodegenUnit<'tcx> {
pub fn items_in_deterministic_order(
&self,
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> {
// The codegen tests rely on items being process in the same order as
// they appear in the file, so for local items, we sort by node_id first
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct ItemSortKey(Option<HirId>, SymbolName);
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey {
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey {
ItemSortKey(match item {
MonoItem::Fn(ref instance) => {
match instance.def {
@ -413,7 +413,7 @@ impl<'tcx> CodegenUnit<'tcx> {
items
}
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode {
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx>) -> DepNode {
DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone()))
}
}
@ -443,13 +443,13 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> {
}
}
pub struct CodegenUnitNameBuilder<'gcx, 'tcx> {
tcx: TyCtxt<'gcx, 'tcx>,
pub struct CodegenUnitNameBuilder<'tcx> {
tcx: TyCtxt<'tcx>,
cache: FxHashMap<CrateNum, String>,
}
impl CodegenUnitNameBuilder<'gcx, 'tcx> {
pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
impl CodegenUnitNameBuilder<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> Self {
CodegenUnitNameBuilder {
tcx,
cache: Default::default(),

View file

@ -21,7 +21,7 @@ pub struct PlaceTy<'tcx> {
#[cfg(target_arch = "x86_64")]
static_assert_size!(PlaceTy<'_>, 16);
impl<'gcx, 'tcx> PlaceTy<'tcx> {
impl<'tcx> PlaceTy<'tcx> {
pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> {
PlaceTy { ty, variant_index: None }
}
@ -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<'gcx, 'tcx>, f: &Field) -> Ty<'tcx> {
pub fn field_ty(self, tcx: TyCtxt<'tcx>, f: &Field) -> Ty<'tcx> {
let answer = match self.ty.sty {
ty::Adt(adt_def, substs) => {
let variant_def = match self.variant_index {
@ -56,7 +56,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<'gcx, 'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> {
pub fn projection_ty(self, tcx: TyCtxt<'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> {
self.projection_ty_core(tcx, elem, |_, _, ty| ty)
}
@ -67,7 +67,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> {
/// (which should be trivial when `T` = `Ty`).
pub fn projection_ty_core<V, T>(
self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
elem: &ProjectionElem<V, T>,
mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>,
) -> PlaceTy<'tcx>
@ -118,7 +118,7 @@ BraceStructTypeFoldableImpl! {
}
impl<'tcx> Place<'tcx> {
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> PlaceTy<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx>
where
D: HasLocalDecls<'tcx>,
{
@ -139,7 +139,7 @@ pub enum RvalueInitializationState {
}
impl<'tcx> Rvalue<'tcx> {
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
where
D: HasLocalDecls<'tcx>,
{
@ -221,7 +221,7 @@ impl<'tcx> Rvalue<'tcx> {
}
impl<'tcx> Operand<'tcx> {
pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
where
D: HasLocalDecls<'tcx>,
{
@ -234,9 +234,9 @@ impl<'tcx> Operand<'tcx> {
}
impl<'tcx> BinOp {
pub fn ty<'gcx>(
pub fn ty(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>,
) -> Ty<'tcx> {

View file

@ -48,11 +48,11 @@ pub struct AutoTraitInfo<'cx> {
}
pub struct AutoTraitFinder<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
}
impl<'tcx> AutoTraitFinder<'tcx> {
pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self {
pub fn new(tcx: TyCtxt<'tcx>) -> Self {
AutoTraitFinder { tcx }
}
@ -79,7 +79,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
ty: Ty<'tcx>,
orig_env: ty::ParamEnv<'tcx>,
trait_did: DefId,
auto_trait_callback: impl for<'i> Fn(&InferCtxt<'_, 'tcx, 'i>, AutoTraitInfo<'i>) -> A,
auto_trait_callback: impl Fn(&InferCtxt<'_, 'tcx>, AutoTraitInfo<'tcx>) -> A,
) -> AutoTraitResult<A> {
let tcx = self.tcx;
@ -270,16 +270,16 @@ impl AutoTraitFinder<'tcx> {
// the final synthesized generics: we don't want our generated docs page to contain something
// like 'T: Copy + Clone', as that's redundant. Therefore, we keep track of a separate
// 'user_env', which only holds the predicates that will actually be displayed to the user.
fn evaluate_predicates<'b, 'c>(
fn evaluate_predicates(
&self,
infcx: &InferCtxt<'b, 'tcx, 'c>,
infcx: &InferCtxt<'_, 'tcx>,
trait_did: DefId,
ty: Ty<'c>,
param_env: ty::ParamEnv<'c>,
user_env: ty::ParamEnv<'c>,
fresh_preds: &mut FxHashSet<ty::Predicate<'c>>,
ty: Ty<'tcx>,
param_env: ty::ParamEnv<'tcx>,
user_env: ty::ParamEnv<'tcx>,
fresh_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
only_projections: bool,
) -> Option<(ty::ParamEnv<'c>, ty::ParamEnv<'c>)> {
) -> Option<(ty::ParamEnv<'tcx>, ty::ParamEnv<'tcx>)> {
let tcx = infcx.tcx;
let mut select = SelectionContext::with_negative(&infcx, true);
@ -617,20 +617,14 @@ impl AutoTraitFinder<'tcx> {
}
}
fn evaluate_nested_obligations<
'b,
'c,
'd,
'cx,
T: Iterator<Item = Obligation<'cx, ty::Predicate<'cx>>>,
>(
fn evaluate_nested_obligations(
&self,
ty: Ty<'_>,
nested: T,
computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
predicates: &'b mut VecDeque<ty::PolyTraitPredicate<'cx>>,
select: &mut SelectionContext<'c, 'd, 'cx>,
nested: impl Iterator<Item = Obligation<'tcx, ty::Predicate<'tcx>>>,
computed_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
fresh_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
predicates: &mut VecDeque<ty::PolyTraitPredicate<'tcx>>,
select: &mut SelectionContext<'_, 'tcx>,
only_projections: bool,
) -> bool {
let dummy_cause = ObligationCause::misc(DUMMY_SP, hir::DUMMY_HIR_ID);
@ -822,23 +816,23 @@ impl AutoTraitFinder<'tcx> {
return true;
}
pub fn clean_pred<'c, 'd, 'cx>(
pub fn clean_pred(
&self,
infcx: &InferCtxt<'c, 'd, 'cx>,
p: ty::Predicate<'cx>,
) -> ty::Predicate<'cx> {
infcx: &InferCtxt<'_, 'tcx>,
p: ty::Predicate<'tcx>,
) -> ty::Predicate<'tcx> {
infcx.freshen(p)
}
}
// Replaces all ReVars in a type with ty::Region's, using the provided map
pub struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
pub struct RegionReplacer<'a, 'tcx> {
vid_to_region: &'a FxHashMap<ty::RegionVid, ty::Region<'tcx>>,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx
}

View file

@ -29,7 +29,7 @@ impl FulfillmentContext<'tcx> {
}
fn in_environment(
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
obligation: PredicateObligation<'tcx>
) -> InEnvironment<'tcx, PredicateObligation<'tcx>> {
assert!(!infcx.is_in_snapshot());
@ -52,7 +52,7 @@ fn in_environment(
impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn normalize_projection_type(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
_param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
_cause: ObligationCause<'tcx>,
@ -62,7 +62,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn register_predicate_obligation(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
obligation: PredicateObligation<'tcx>,
) {
self.obligations.insert(in_environment(infcx, obligation));
@ -70,7 +70,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn select_all_or_error(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Result<(), Vec<FulfillmentError<'tcx>>> {
self.select_where_possible(infcx)?;
@ -89,7 +89,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn select_where_possible(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Result<(), Vec<FulfillmentError<'tcx>>> {
let mut errors = Vec::new();
let mut next_round = FxHashSet::default();

View file

@ -19,7 +19,7 @@ use crate::ty::fold::TypeFoldable;
/// 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>,
ty: TyCtxt<'tcx>,
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
) -> Vtable<'tcx, ()> {
// Remove any references to regions; this helps improve caching.
@ -73,7 +73,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
})
}
impl<'tcx> TyCtxt<'tcx, 'tcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Monomorphizes a type from the AST by first applying the
/// in-scope substitutions and then normalizing any associated
/// types.
@ -115,19 +115,19 @@ impl<'tcx> DepTrackingMapConfig for TraitSelectionCache<'tcx> {
// # Global Cache
pub struct ProjectionCache<'gcx> {
data: PhantomData<&'gcx ()>
pub struct ProjectionCache<'tcx> {
data: PhantomData<&'tcx ()>
}
impl<'gcx> DepTrackingMapConfig for ProjectionCache<'gcx> {
type Key = Ty<'gcx>;
type Value = Ty<'gcx>;
impl<'tcx> DepTrackingMapConfig for ProjectionCache<'tcx> {
type Key = Ty<'tcx>;
type Value = Ty<'tcx>;
fn to_dep_kind() -> DepKind {
DepKind::TraitSelect
}
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// Finishes processes any obligations that remain in the
/// fulfillment context, and then returns the result with all type
/// variables removed and regions erased. Because this is intended
@ -141,7 +141,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T)
-> T::Lifted
where T: TypeFoldable<'tcx> + ty::Lift<'gcx>
where T: TypeFoldable<'tcx> + ty::Lift<'tcx>
{
debug!("drain_fulfillment_cx_or_panic()");

View file

@ -48,8 +48,8 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) {
/// If there are types that satisfy both impls, invokes `on_overlap`
/// 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>,
pub fn overlapping_impls<'tcx, F1, F2, R>(
tcx: TyCtxt<'tcx>,
impl1_def_id: DefId,
impl2_def_id: DefId,
intercrate_mode: IntercrateMode,
@ -87,7 +87,7 @@ where
})
}
fn with_fresh_ty_vars<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn with_fresh_ty_vars<'cx, 'tcx>(selcx: &mut SelectionContext<'cx, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
impl_def_id: DefId)
-> ty::ImplHeader<'tcx>
@ -111,8 +111,8 @@ fn with_fresh_ty_vars<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, '
/// Can both impl `a` and impl `b` be satisfied by a common type (including
/// where-clauses)? If so, returns an `ImplHeader` that unifies the two impls.
fn overlap<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn overlap<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
a_def_id: DefId,
b_def_id: DefId,
) -> Option<OverlapResult<'tcx>> {
@ -122,7 +122,7 @@ fn overlap<'cx, 'gcx, 'tcx>(
}
fn overlap_within_probe(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
selcx: &mut SelectionContext<'cx, 'tcx>,
a_def_id: DefId,
b_def_id: DefId,
snapshot: &CombinedSnapshot<'_, 'tcx>,
@ -183,8 +183,8 @@ fn overlap_within_probe(
Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder })
}
pub fn trait_ref_is_knowable<'gcx, 'tcx>(
tcx: TyCtxt<'gcx, 'tcx>,
pub fn trait_ref_is_knowable<'tcx>(
tcx: TyCtxt<'tcx>,
trait_ref: ty::TraitRef<'tcx>,
) -> Option<Conflict> {
debug!("trait_ref_is_knowable(trait_ref={:?})", trait_ref);
@ -229,8 +229,8 @@ pub fn trait_ref_is_knowable<'gcx, 'tcx>(
}
}
pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(
tcx: TyCtxt<'gcx, 'tcx>,
pub fn trait_ref_is_local_or_fundamental<'tcx>(
tcx: TyCtxt<'tcx>,
trait_ref: ty::TraitRef<'tcx>,
) -> bool {
trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental)
@ -247,8 +247,8 @@ 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<'gcx, 'tcx>,
pub fn orphan_check<'tcx>(
tcx: TyCtxt<'tcx>,
impl_def_id: DefId,
) -> Result<(), OrphanCheckErr<'tcx>> {
debug!("orphan_check({:?})", impl_def_id);
@ -355,7 +355,7 @@ pub fn orphan_check<'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<'_, '_>,
tcx: TyCtxt<'_>,
trait_ref: ty::TraitRef<'tcx>,
in_crate: InCrate,
) -> Result<(), OrphanCheckErr<'tcx>> {
@ -431,7 +431,7 @@ fn orphan_check_trait_ref<'tcx>(
}
}
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
if ty_is_local_constructor(ty, in_crate) {
vec![]
} else if fundamental_ty(ty) {
@ -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))
}

View file

@ -9,7 +9,7 @@ use super::{ObligationCause, PredicateObligation};
pub trait TraitEngine<'tcx>: 'tcx {
fn normalize_projection_type(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>,
@ -20,7 +20,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
/// parameters (except for `Self`).
fn register_bound(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
ty: Ty<'tcx>,
def_id: DefId,
@ -40,18 +40,18 @@ pub trait TraitEngine<'tcx>: 'tcx {
fn register_predicate_obligation(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
obligation: PredicateObligation<'tcx>,
);
fn select_all_or_error(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Result<(), Vec<FulfillmentError<'tcx>>>;
fn select_where_possible(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Result<(), Vec<FulfillmentError<'tcx>>>;
fn pending_obligations(&self) -> Vec<PredicateObligation<'tcx>>;
@ -60,7 +60,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
pub trait TraitEngineExt<'tcx> {
fn register_predicate_obligations(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
);
}
@ -68,7 +68,7 @@ pub trait TraitEngineExt<'tcx> {
impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
fn register_predicate_obligations(
&mut self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
) {
for obligation in obligations {
@ -78,7 +78,7 @@ impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
}
impl dyn TraitEngine<'tcx> {
pub fn new(tcx: TyCtxt<'_, 'tcx>) -> Box<Self> {
pub fn new(tcx: TyCtxt<'tcx>) -> Box<Self> {
if tcx.sess.opts.debugging_opts.chalk {
Box::new(ChalkFulfillmentContext::new())
} else {

View file

@ -38,7 +38,7 @@ use syntax::ast;
use syntax::symbol::sym;
use syntax_pos::{DUMMY_SP, Span, ExpnInfo, ExpnFormat};
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn report_fulfillment_errors(&self,
errors: &[FulfillmentError<'tcx>],
body_id: Option<hir::BodyId>,
@ -1249,8 +1249,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
expected_ref: ty::PolyTraitRef<'tcx>,
found: ty::PolyTraitRef<'tcx>,
) -> DiagnosticBuilder<'tcx> {
fn build_fn_sig_string<'gcx, 'tcx>(
tcx: TyCtxt<'gcx, 'tcx>,
fn build_fn_sig_string<'tcx>(
tcx: TyCtxt<'tcx>,
trait_ref: &ty::TraitRef<'tcx>,
) -> String {
let inputs = trait_ref.substs.type_at(1);
@ -1296,7 +1296,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}
impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn recursive_type_with_infinite_size_error(self,
type_def_id: DefId)
-> DiagnosticBuilder<'tcx>
@ -1342,7 +1342,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> {
}
}
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>,
body_id: Option<hir::BodyId>) {
// Unable to successfully determine, probably means
@ -1454,13 +1454,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
param_env: ty::ParamEnv<'tcx>,
pred: ty::PolyTraitRef<'tcx>,
) -> bool {
struct ParamToVarFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
struct ParamToVarFolder<'a, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'tcx>,
var_map: FxHashMap<Ty<'tcx>, Ty<'tcx>>
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx }
impl<'a, 'tcx> TypeFolder<'tcx> for ParamToVarFolder<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> { self.infcx.tcx }
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
if let ty::Param(ty::ParamTy {name, .. }) = ty.sty {

View file

@ -68,7 +68,7 @@ pub struct PendingPredicateObligation<'tcx> {
pub stalled_on: Vec<Ty<'tcx>>,
}
impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
impl<'a, 'tcx> FulfillmentContext<'tcx> {
/// Creates a new fulfillment context.
pub fn new() -> FulfillmentContext<'tcx> {
FulfillmentContext {
@ -95,7 +95,7 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
}
/// Attempts to select obligations using `selcx`.
fn select(&mut self, selcx: &mut SelectionContext<'a, 'gcx, 'tcx>)
fn select(&mut self, selcx: &mut SelectionContext<'a, 'tcx>)
-> Result<(), Vec<FulfillmentError<'tcx>>> {
debug!("select(obligation-forest-size={})", self.predicates.len());
@ -143,8 +143,8 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
/// `SomeTrait` or a where-clause that lets us unify `$0` with
/// something concrete. If this fails, we'll unify `$0` with
/// `projection_ty` again.
fn normalize_projection_type<'a, 'gcx>(&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
fn normalize_projection_type(&mut self,
infcx: &InferCtxt<'_, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>)
@ -172,8 +172,8 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
normalized_ty
}
fn register_predicate_obligation<'a, 'gcx>(&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
fn register_predicate_obligation(&mut self,
infcx: &InferCtxt<'_, 'tcx>,
obligation: PredicateObligation<'tcx>)
{
// this helps to reduce duplicate errors, as well as making
@ -190,9 +190,9 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
});
}
fn select_all_or_error<'a, 'gcx>(
fn select_all_or_error(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>
infcx: &InferCtxt<'_, 'tcx>
) -> Result<(),Vec<FulfillmentError<'tcx>>>
{
self.select_where_possible(infcx)?;
@ -209,8 +209,8 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
}
}
fn select_where_possible<'a, 'gcx>(&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>)
fn select_where_possible(&mut self,
infcx: &InferCtxt<'_, 'tcx>)
-> Result<(),Vec<FulfillmentError<'tcx>>>
{
let mut selcx = SelectionContext::new(infcx);
@ -222,8 +222,8 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
}
}
struct FulfillProcessor<'a, 'b: 'a, 'gcx: 'tcx, 'tcx: 'b> {
selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
struct FulfillProcessor<'a, 'b: 'a, 'tcx: 'b> {
selcx: &'a mut SelectionContext<'b, 'tcx>,
register_region_obligations: bool
}
@ -234,7 +234,7 @@ fn mk_pending(os: Vec<PredicateObligation<'tcx>>) -> Vec<PendingPredicateObligat
}).collect()
}
impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, 'tcx> {
impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
type Obligation = PendingPredicateObligation<'tcx>;
type Error = FulfillmentErrorCode<'tcx>;
@ -514,7 +514,7 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx,
}
/// Returns the set of type variables contained in a trait ref
fn trait_ref_type_vars<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tcx>,
fn trait_ref_type_vars<'a, 'tcx>(selcx: &mut SelectionContext<'a, 'tcx>,
t: ty::PolyTraitRef<'tcx>) -> Vec<Ty<'tcx>>
{
t.skip_binder() // ok b/c this check doesn't care about regions

View file

@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> {
}
impl<'tcx> ObligationCause<'tcx> {
pub fn span<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Span {
pub fn span(&self, tcx: TyCtxt<'tcx>) -> Span {
match self.code {
ObligationCauseCode::CompareImplMethodObligation { .. } |
ObligationCauseCode::MainFunctionType |
@ -363,9 +363,9 @@ impl<'tcx> DomainGoal<'tcx> {
}
impl<'tcx> GoalKind<'tcx> {
pub fn from_poly_domain_goal<'gcx>(
pub fn from_poly_domain_goal(
domain_goal: PolyDomainGoal<'tcx>,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
) -> GoalKind<'tcx> {
match domain_goal.no_bound_vars() {
Some(p) => p.into_goal(),
@ -643,8 +643,8 @@ pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
/// `bound` or is not known to meet bound (note that this is
/// conservative towards *no impl*, which is the opposite of the
/// `evaluate` methods).
pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
pub fn type_known_to_meet_bound_modulo_regions<'a, 'tcx>(
infcx: &InferCtxt<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
ty: Ty<'tcx>,
def_id: DefId,
@ -711,7 +711,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
}
fn do_normalize_predicates<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
region_context: DefId,
cause: ObligationCause<'tcx>,
elaborated_env: ty::ParamEnv<'tcx>,
@ -796,7 +796,7 @@ fn do_normalize_predicates<'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: TyCtxt<'tcx>,
region_context: DefId,
unnormalized_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>,
@ -904,8 +904,8 @@ pub fn normalize_param_env_or_error<'tcx>(
)
}
pub fn fully_normalize<'a, 'gcx, 'tcx, T>(
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
pub fn fully_normalize<'a, 'tcx, T>(
infcx: &InferCtxt<'a, 'tcx>,
mut fulfill_cx: FulfillmentContext<'tcx>,
cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
@ -937,7 +937,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>(
/// 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: TyCtxt<'tcx>,
predicates: Vec<ty::Predicate<'tcx>>,
) -> bool {
debug!("normalize_and_test_predicates(predicates={:?})",
@ -966,7 +966,7 @@ fn normalize_and_test_predicates<'tcx>(
}
fn substitute_normalize_and_test_predicates<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
key: (DefId, SubstsRef<'tcx>),
) -> bool {
debug!("substitute_normalize_and_test_predicates(key={:?})",
@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'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: TyCtxt<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>,
) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] {
debug!("vtable_methods({:?})", trait_ref);
@ -1185,7 +1185,7 @@ pub trait ExClauseFold<'tcx>
where
Self: chalk_engine::context::Context + Clone,
{
fn fold_ex_clause_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(
fn fold_ex_clause_with<F: TypeFolder<'tcx>>(
ex_clause: &chalk_engine::ExClause<Self>,
folder: &mut F,
) -> chalk_engine::ExClause<Self>;
@ -1204,18 +1204,18 @@ where
type LiftedDelayedLiteral: Debug + 'tcx;
type LiftedLiteral: Debug + 'tcx;
fn lift_ex_clause_to_tcx<'gcx>(
fn lift_ex_clause_to_tcx(
ex_clause: &chalk_engine::ExClause<Self>,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
) -> Option<Self::LiftedExClause>;
fn lift_delayed_literal_to_tcx<'gcx>(
fn lift_delayed_literal_to_tcx(
ex_clause: &chalk_engine::DelayedLiteral<Self>,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
) -> Option<Self::LiftedDelayedLiteral>;
fn lift_literal_to_tcx<'gcx>(
fn lift_literal_to_tcx(
ex_clause: &chalk_engine::Literal<Self>,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
) -> Option<Self::LiftedLiteral>;
}

View file

@ -83,7 +83,7 @@ pub enum MethodViolationCode {
UndispatchableReceiver,
}
impl<'tcx> TyCtxt<'tcx, 'tcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Returns the object safety violations that affect
/// astconv -- currently, `Self` in supertraits. This is needed
/// because `object_safety_violations` can't be used during
@ -702,6 +702,6 @@ impl<'tcx> TyCtxt<'tcx, 'tcx> {
}
}
pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) -> bool {
pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId) -> bool {
tcx.object_safety_violations(trait_def_id).is_empty()
}

View file

@ -36,7 +36,7 @@ impl OnUnimplementedNote {
}
fn parse_error(
tcx: TyCtxt<'_, '_>,
tcx: TyCtxt<'_>,
span: Span,
message: &str,
label: &str,
@ -52,9 +52,9 @@ fn parse_error(
ErrorReported
}
impl<'gcx, 'tcx> OnUnimplementedDirective {
impl<'tcx> OnUnimplementedDirective {
fn parse(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
items: &[NestedMetaItem],
span: Span,
@ -134,7 +134,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
}
pub fn of_item(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
impl_def_id: DefId,
) -> Result<Option<Self>, ErrorReported> {
@ -166,7 +166,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
pub fn evaluate(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_ref: ty::TraitRef<'tcx>,
options: &[(Symbol, Option<String>)],
) -> OnUnimplementedNote {
@ -214,9 +214,9 @@ impl<'gcx, 'tcx> OnUnimplementedDirective {
}
}
impl<'gcx, 'tcx> OnUnimplementedFormatString {
impl<'tcx> OnUnimplementedFormatString {
fn try_parse(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
from: LocalInternedString,
err_sp: Span,
@ -228,7 +228,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString {
fn verify(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
span: Span,
) -> Result<(), ErrorReported> {
@ -274,7 +274,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString {
pub fn format(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
trait_ref: ty::TraitRef<'tcx>,
options: &FxHashMap<Symbol, String>,
) -> String {

View file

@ -183,8 +183,8 @@ impl<'tcx> ProjectionTyCandidateSet<'tcx> {
///
/// If successful, this may result in additional obligations. Also returns
/// the projection cache key used to track these additional obligations.
pub fn poly_project_and_unify_type<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
pub fn poly_project_and_unify_type<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &PolyProjectionObligation<'tcx>)
-> Result<Option<Vec<PredicateObligation<'tcx>>>,
MismatchedProjectionTypes<'tcx>>
@ -210,8 +210,8 @@ pub fn poly_project_and_unify_type<'cx, 'gcx, 'tcx>(
/// <T as Trait>::U == V
///
/// If successful, this may result in additional obligations.
fn project_and_unify_type<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn project_and_unify_type<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionObligation<'tcx>)
-> Result<Option<Vec<PredicateObligation<'tcx>>>,
MismatchedProjectionTypes<'tcx>>
@ -253,7 +253,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>(
/// them with a fully resolved type where possible. The return value
/// combines the normalized result and any additional obligations that
/// were incurred as result.
pub fn normalize<'a, 'b, 'gcx, 'tcx, T>(selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
pub fn normalize<'a, 'b, 'tcx, T>(selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>,
value: &T)
@ -264,8 +264,8 @@ pub fn normalize<'a, 'b, 'gcx, 'tcx, T>(selcx: &'a mut SelectionContext<'b, 'gcx
}
/// As `normalize`, but with a custom depth.
pub fn normalize_with_depth<'a, 'b, 'gcx, 'tcx, T>(
selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
pub fn normalize_with_depth<'a, 'b, 'tcx, T>(
selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>,
depth: usize,
@ -287,20 +287,20 @@ pub fn normalize_with_depth<'a, 'b, 'gcx, 'tcx, T>(
}
}
struct AssocTypeNormalizer<'a, 'b: 'a, 'gcx: 'b+'tcx, 'tcx: 'b> {
selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
struct AssocTypeNormalizer<'a, 'b: 'a, 'tcx: 'b> {
selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>,
obligations: Vec<PredicateObligation<'tcx>>,
depth: usize,
}
impl<'a, 'b, 'gcx, 'tcx> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
fn new(selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
fn new(selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
cause: ObligationCause<'tcx>,
depth: usize)
-> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx>
-> AssocTypeNormalizer<'a, 'b, 'tcx>
{
AssocTypeNormalizer {
selcx,
@ -322,8 +322,8 @@ 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<'gcx, 'tcx> {
impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
fn tcx<'c>(&'c self) -> TyCtxt<'tcx> {
self.selcx.tcx()
}
@ -456,8 +456,8 @@ impl<'tcx,T> Normalized<'tcx,T> {
/// there are unresolved type variables in the projection, we will
/// substitute a fresh type variable `$X` and generate a new
/// obligation `<T as Trait>::Item == $X` for later.
pub fn normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
pub fn normalize_projection_type<'a, 'b, 'tcx>(
selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>,
@ -501,8 +501,8 @@ pub fn normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
/// often immediately appended to another obligations vector. So now this
/// function takes an obligations vector and appends to it directly, which is
/// slightly uglier but avoids the need for an extra short-lived allocation.
fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
fn opt_normalize_projection_type<'a, 'b, 'tcx>(
selcx: &'a mut SelectionContext<'b, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>,
@ -705,7 +705,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
/// If there are unresolved type variables, then we need to include
/// any subobligations that bind them, at least until those type
/// variables are fully resolved.
fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
fn prune_cache_value_obligations<'a, 'tcx>(infcx: &'a InferCtxt<'a, 'tcx>,
result: &NormalizedTy<'tcx>)
-> NormalizedTy<'tcx> {
if infcx.unresolved_type_vars(&result.value).is_none() {
@ -763,8 +763,8 @@ fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx,
/// that may yet turn out to be wrong. This *may* lead to some sort
/// of trouble, though we don't have a concrete example of how that
/// can occur yet. But it seems risky at best.
fn get_paranoid_cache_value_obligation<'a, 'gcx, 'tcx>(
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
fn get_paranoid_cache_value_obligation<'a, 'tcx>(
infcx: &'a InferCtxt<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>,
@ -799,7 +799,7 @@ fn get_paranoid_cache_value_obligation<'a, 'gcx, 'tcx>(
/// an error for this obligation, but we legitimately should not,
/// because it contains `[type error]`. Yuck! (See issue #29857 for
/// one case where this arose.)
fn normalize_to_error<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tcx>,
fn normalize_to_error<'a, 'tcx>(selcx: &mut SelectionContext<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>,
@ -836,7 +836,7 @@ struct Progress<'tcx> {
}
impl<'tcx> Progress<'tcx> {
fn error<'gcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
fn error(tcx: TyCtxt<'tcx>) -> Self {
Progress {
ty: tcx.types.err,
obligations: vec![],
@ -861,8 +861,8 @@ impl<'tcx> Progress<'tcx> {
///
/// IMPORTANT:
/// - `obligation` must be fully normalized
fn project_type<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn project_type<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>)
-> Result<ProjectedTy<'tcx>, ProjectionTyError<'tcx>>
{
@ -925,8 +925,8 @@ fn project_type<'cx, 'gcx, 'tcx>(
/// The first thing we have to do is scan through the parameter
/// environment to see whether there are any projection predicates
/// there that can answer this question.
fn assemble_candidates_from_param_env<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn assemble_candidates_from_param_env<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
candidate_set: &mut ProjectionTyCandidateSet<'tcx>)
@ -950,8 +950,8 @@ fn assemble_candidates_from_param_env<'cx, 'gcx, 'tcx>(
/// ```
///
/// Here, for example, we could conclude that the result is `i32`.
fn assemble_candidates_from_trait_def<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn assemble_candidates_from_trait_def<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
candidate_set: &mut ProjectionTyCandidateSet<'tcx>)
@ -986,8 +986,8 @@ fn assemble_candidates_from_trait_def<'cx, 'gcx, 'tcx>(
bounds)
}
fn assemble_candidates_from_predicates<'cx, 'gcx, 'tcx, I>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn assemble_candidates_from_predicates<'cx, 'tcx, I>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
candidate_set: &mut ProjectionTyCandidateSet<'tcx>,
@ -1029,8 +1029,8 @@ fn assemble_candidates_from_predicates<'cx, 'gcx, 'tcx, I>(
}
}
fn assemble_candidates_from_impls<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn assemble_candidates_from_impls<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
candidate_set: &mut ProjectionTyCandidateSet<'tcx>)
@ -1177,8 +1177,8 @@ fn assemble_candidates_from_impls<'cx, 'gcx, 'tcx>(
});
}
fn confirm_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
candidate: ProjectionTyCandidate<'tcx>)
@ -1200,8 +1200,8 @@ fn confirm_candidate<'cx, 'gcx, 'tcx>(
}
}
fn confirm_select_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_select_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>,
vtable: Selection<'tcx>)
@ -1230,8 +1230,8 @@ fn confirm_select_candidate<'cx, 'gcx, 'tcx>(
}
}
fn confirm_object_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_object_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
obligation_trait_ref: &ty::TraitRef<'tcx>)
-> Progress<'tcx>
@ -1295,8 +1295,8 @@ fn confirm_object_candidate<'cx, 'gcx, 'tcx>(
confirm_param_env_candidate(selcx, obligation, env_predicate)
}
fn confirm_generator_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_generator_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
vtable: VtableGeneratorData<'tcx, PredicateObligation<'tcx>>)
-> Progress<'tcx>
@ -1348,8 +1348,8 @@ fn confirm_generator_candidate<'cx, 'gcx, 'tcx>(
.with_addl_obligations(obligations)
}
fn confirm_fn_pointer_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_fn_pointer_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
fn_pointer_vtable: VtableFnPointerData<'tcx, PredicateObligation<'tcx>>)
-> Progress<'tcx>
@ -1370,8 +1370,8 @@ fn confirm_fn_pointer_candidate<'cx, 'gcx, 'tcx>(
.with_addl_obligations(obligations)
}
fn confirm_closure_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_closure_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
vtable: VtableClosureData<'tcx, PredicateObligation<'tcx>>)
-> Progress<'tcx>
@ -1402,8 +1402,8 @@ fn confirm_closure_candidate<'cx, 'gcx, 'tcx>(
.with_addl_obligations(obligations)
}
fn confirm_callable_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_callable_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
fn_sig: ty::PolyFnSig<'tcx>,
flag: util::TupleArgumentsFlag)
@ -1437,8 +1437,8 @@ fn confirm_callable_candidate<'cx, 'gcx, 'tcx>(
confirm_param_env_candidate(selcx, obligation, predicate)
}
fn confirm_param_env_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_param_env_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
poly_cache_entry: ty::PolyProjectionPredicate<'tcx>,
) -> Progress<'tcx> {
@ -1478,8 +1478,8 @@ fn confirm_param_env_candidate<'cx, 'gcx, 'tcx>(
}
}
fn confirm_impl_candidate<'cx, 'gcx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
fn confirm_impl_candidate<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligation: &ProjectionTyObligation<'tcx>,
impl_vtable: VtableImplData<'tcx, PredicateObligation<'tcx>>)
-> Progress<'tcx>
@ -1521,8 +1521,8 @@ fn confirm_impl_candidate<'cx, 'gcx, 'tcx>(
///
/// Based on the "projection mode", this lookup may in fact only examine the
/// topmost impl. See the comments for `Reveal` for more details.
fn assoc_ty_def<'cx, 'gcx, 'tcx>(
selcx: &SelectionContext<'cx, 'gcx, 'tcx>,
fn assoc_ty_def<'cx, 'tcx>(
selcx: &SelectionContext<'cx, 'tcx>,
impl_def_id: DefId,
assoc_ty_def_id: DefId)
-> specialization_graph::NodeItem<ty::AssocItem>
@ -1608,8 +1608,8 @@ pub struct ProjectionCacheKey<'tcx> {
ty: ty::ProjectionTy<'tcx>
}
impl<'cx, 'gcx, 'tcx> ProjectionCacheKey<'tcx> {
pub fn from_poly_projection_predicate(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
impl<'cx, 'tcx> ProjectionCacheKey<'tcx> {
pub fn from_poly_projection_predicate(selcx: &mut SelectionContext<'cx, 'tcx>,
predicate: &ty::PolyProjectionPredicate<'tcx>)
-> Option<Self>
{

View file

@ -6,7 +6,7 @@ use syntax::source_map::Span;
use crate::ty::subst::Kind;
use crate::ty::{self, Ty, TyCtxt};
impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> At<'cx, 'tcx> {
/// Given a type `ty` of some value being dropped, computes a set
/// of "kinds" (types, regions) that must be outlive the execution
/// of the destructor. These basically correspond to data that the
@ -85,7 +85,7 @@ pub struct DropckOutlivesResult<'tcx> {
}
impl<'tcx> DropckOutlivesResult<'tcx> {
pub fn report_overflows(&self, tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>) {
pub fn report_overflows(&self, tcx: TyCtxt<'tcx>, span: Span, ty: Ty<'tcx>) {
if let Some(overflow_ty) = self.overflows.iter().next() {
let mut err = struct_span_err!(
tcx.sess,
@ -101,7 +101,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> {
pub fn into_kinds_reporting_overflows(
self,
tcx: TyCtxt<'_, 'tcx>,
tcx: TyCtxt<'tcx>,
span: Span,
ty: Ty<'tcx>,
) -> Vec<Kind<'tcx>> {
@ -185,7 +185,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>, 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

View file

@ -3,7 +3,7 @@ use crate::infer::canonical::OriginalQueryValues;
use crate::traits::{EvaluationResult, PredicateObligation, SelectionContext,
TraitQueryMode, OverflowError};
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// Evaluates whether the predicate can be satisfied (by any means)
/// in the given `ParamEnv`.
pub fn predicate_may_hold(

View file

@ -14,7 +14,7 @@ use crate::ty::{self, Ty, TyCtxt};
use super::NoSolution;
impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> At<'cx, 'tcx> {
/// Normalize `value` in the context of the inference context,
/// yielding a resulting type, or an error if `value` cannot be
/// normalized. If you don't care about regions, you should prefer
@ -73,8 +73,8 @@ pub struct NormalizationResult<'tcx> {
pub normalized_ty: Ty<'tcx>,
}
struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
struct QueryNormalizer<'cx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'tcx>,
cause: &'cx ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
obligations: Vec<PredicateObligation<'tcx>>,
@ -82,8 +82,8 @@ struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
anon_depth: usize,
}
impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx> {
fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> {
impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
fn tcx<'c>(&'c self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -10,7 +10,7 @@
use crate::ty::{self, Ty, TyCtxt};
use crate::ty::fold::{TypeFoldable, TypeFolder};
impl<'tcx> TyCtxt<'tcx, 'tcx> {
impl<'tcx> TyCtxt<'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> {
}
struct NormalizeAfterErasingRegionsFolder<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>,
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
}
impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
impl TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}

View file

@ -64,7 +64,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for OutlivesBound<'tcx> {
}
}
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// Implied bounds are region relationships that we deduce
/// automatically. The idea is that (e.g.) a caller must check that a
/// function's argument types are well-formed immediately before

View file

@ -21,25 +21,25 @@ impl<'tcx> AscribeUserType<'tcx> {
}
}
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx> {
impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
type QueryResponse = ();
fn try_fast_path(
_tcx: TyCtxt<'gcx, 'tcx>,
_tcx: TyCtxt<'tcx>,
_key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
None
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_ascribe_user_type(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, ()>,
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}

View file

@ -14,9 +14,9 @@ pub struct CustomTypeOp<F, G> {
}
impl<F, G> CustomTypeOp<F, G> {
pub fn new<'gcx, 'tcx, R>(closure: F, description: G) -> Self
pub fn new<'tcx, R>(closure: F, description: G) -> Self
where
F: FnOnce(&InferCtxt<'_, 'gcx, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
F: FnOnce(&InferCtxt<'_, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
G: Fn() -> String,
{
CustomTypeOp {
@ -26,9 +26,9 @@ impl<F, G> CustomTypeOp<F, G> {
}
}
impl<'gcx, 'tcx, F, R, G> super::TypeOp<'gcx, 'tcx> for CustomTypeOp<F, G>
impl<'tcx, F, R, G> super::TypeOp<'tcx> for CustomTypeOp<F, G>
where
F: for<'a, 'cx> FnOnce(&'a InferCtxt<'cx, 'gcx, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
F: for<'a, 'cx> FnOnce(&'a InferCtxt<'cx, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
G: Fn() -> String,
{
type Output = R;
@ -38,7 +38,7 @@ where
/// (they will be given over to the NLL region solver).
fn fully_perform(
self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
if cfg!(debug_assertions) {
info!("fully_perform({:?})", self);
@ -59,8 +59,8 @@ where
/// Executes `op` and then scrapes out all the "old style" region
/// constraints that result, creating query-region-constraints.
fn scrape_region_constraints<'gcx, 'tcx, R>(
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
fn scrape_region_constraints<'tcx, R>(
infcx: &InferCtxt<'_, 'tcx>,
op: impl FnOnce() -> Fallible<InferOk<'tcx, R>>,
) -> Fallible<(R, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
let mut fulfill_cx = TraitEngine::new(infcx.tcx);

View file

@ -14,11 +14,11 @@ impl<'tcx> Eq<'tcx> {
}
}
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> {
impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
type QueryResponse = ();
fn try_fast_path(
_tcx: TyCtxt<'gcx, 'tcx>,
_tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Eq<'tcx>>,
) -> Option<Self::QueryResponse> {
if key.value.a == key.value.b {
@ -29,14 +29,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> {
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_eq(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, ()>,
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}

View file

@ -14,20 +14,20 @@ impl<'tcx> ImpliedOutlivesBounds<'tcx> {
}
}
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds<'tcx> {
impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
type QueryResponse = Vec<OutlivesBound<'tcx>>;
fn try_fast_path(
_tcx: TyCtxt<'gcx, 'tcx>,
_tcx: TyCtxt<'tcx>,
_key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
None
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
// FIXME this `unchecked_map` is only necessary because the
// query is defined as taking a `ParamEnvAnd<Ty>`; it should
// take a `ImpliedOutlivesBounds` instead
@ -40,7 +40,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds<
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self::QueryResponse>,
v: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>> {
v
}

View file

@ -23,7 +23,7 @@ pub mod subtype;
/// "Type ops" are used in NLL to perform some particular action and
/// extract out the resulting region constraints (or an error if it
/// cannot be completed).
pub trait TypeOp<'gcx, 'tcx>: Sized + fmt::Debug {
pub trait TypeOp<'tcx>: Sized + fmt::Debug {
type Output;
/// Processes the operation and all resulting obligations,
@ -31,7 +31,7 @@ pub trait TypeOp<'gcx, 'tcx>: Sized + fmt::Debug {
/// (they will be given over to the NLL region solver).
fn fully_perform(
self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)>;
}
@ -44,16 +44,16 @@ pub trait TypeOp<'gcx, 'tcx>: Sized + fmt::Debug {
/// which produces the resulting query region constraints.
///
/// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html
pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
fmt::Debug + Sized + TypeFoldable<'tcx> + Lift<'gcx>
pub trait QueryTypeOp<'tcx>:
fmt::Debug + Sized + TypeFoldable<'tcx> + Lift<'tcx>
{
type QueryResponse: TypeFoldable<'tcx> + Lift<'gcx>;
type QueryResponse: TypeFoldable<'tcx> + Lift<'tcx>;
/// Give query the option for a simple fast path that never
/// 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<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse>;
@ -64,29 +64,29 @@ 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<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>>;
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>>;
/// Casts a lifted query result (which is in the gcx lifetime)
/// into the tcx lifetime. This is always just an identity cast,
/// but the generic code doesn't realize it -- put another way, in
/// the generic code, we have a `Lifted<'gcx, Self::QueryResponse>`
/// the generic code, we have a `Lifted<'tcx, Self::QueryResponse>`
/// and we want to convert that to a `Self::QueryResponse`. This is
/// not a priori valid, so we can't do it -- but in practice, it
/// is always a no-op (e.g., the lifted form of a type,
/// `Ty<'gcx>`, is a subtype of `Ty<'tcx>`). So we have to push
/// `Ty<'tcx>`, is a subtype of `Ty<'tcx>`). So we have to push
/// the operation into the impls that know more specifically what
/// `QueryResponse` is. This operation would (maybe) be nicer with
/// something like HKTs or GATs, since then we could make
/// `QueryResponse` parametric and `'gcx` and `'tcx` etc.
/// `QueryResponse` parametric and `'tcx` and `'tcx` etc.
fn shrink_to_tcx_lifetime(
lifted_query_result: &'a CanonicalizedQueryResponse<'gcx, Self::QueryResponse>,
lifted_query_result: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>>;
fn fully_perform_into(
query_key: ParamEnvAnd<'tcx, Self>,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>,
) -> Fallible<Self::QueryResponse> {
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
@ -133,15 +133,15 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
}
}
impl<'gcx: 'tcx, 'tcx, Q> TypeOp<'gcx, 'tcx> for ParamEnvAnd<'tcx, Q>
impl<'tcx, Q> TypeOp<'tcx> for ParamEnvAnd<'tcx, Q>
where
Q: QueryTypeOp<'gcx, 'tcx>,
Q: QueryTypeOp<'tcx>,
{
type Output = Q::QueryResponse;
fn fully_perform(
self,
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
infcx: &InferCtxt<'_, 'tcx>,
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
let mut qrc = vec![];
let r = Q::fully_perform_into(self, infcx, &mut qrc)?;

View file

@ -18,13 +18,13 @@ where
}
}
impl<'gcx: 'tcx, 'tcx, T> super::QueryTypeOp<'gcx, 'tcx> for Normalize<T>
impl<'tcx, T> super::QueryTypeOp<'tcx> for Normalize<T>
where
T: Normalizable<'gcx, 'tcx>,
T: Normalizable<'tcx>,
{
type QueryResponse = T;
fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
fn try_fast_path(_tcx: TyCtxt<'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
if !key.value.value.has_projections() {
Some(key.value.value)
} else {
@ -33,99 +33,87 @@ where
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
T::type_op_method(tcx, canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, T>,
v: &'a CanonicalizedQueryResponse<'tcx, T>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, T>> {
T::shrink_to_tcx_lifetime(v)
}
}
pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx> + Copy {
pub trait Normalizable<'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'tcx> + Copy {
fn type_op_method(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>>;
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>>;
/// Converts from the `'gcx` (lifted) form of `Self` into the `tcx`
/// Converts from the `'tcx` (lifted) form of `Self` into the `tcx`
/// form of `Self`.
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self>,
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>>;
}
impl Normalizable<'gcx, 'tcx> for Ty<'tcx>
where
'gcx: 'tcx,
{
impl Normalizable<'tcx> for Ty<'tcx> {
fn type_op_method(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_ty(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self>,
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}
impl Normalizable<'gcx, 'tcx> for ty::Predicate<'tcx>
where
'gcx: 'tcx,
{
impl Normalizable<'tcx> for ty::Predicate<'tcx> {
fn type_op_method(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_predicate(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self>,
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}
impl Normalizable<'gcx, 'tcx> for ty::PolyFnSig<'tcx>
where
'gcx: 'tcx,
{
impl Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
fn type_op_method(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_poly_fn_sig(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self>,
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}
impl Normalizable<'gcx, 'tcx> for ty::FnSig<'tcx>
where
'gcx: 'tcx,
{
impl Normalizable<'tcx> for ty::FnSig<'tcx> {
fn type_op_method(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_fn_sig(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, Self>,
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}

View file

@ -15,14 +15,11 @@ impl<'tcx> DropckOutlives<'tcx> {
}
}
impl super::QueryTypeOp<'gcx, 'tcx> for DropckOutlives<'tcx>
where
'gcx: 'tcx,
{
impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
type QueryResponse = DropckOutlivesResult<'tcx>;
fn try_fast_path(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
if trivial_dropck_outlives(tcx, key.value.dropped_ty) {
@ -33,9 +30,9 @@ where
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
// Subtle: note that we are not invoking
// `infcx.at(...).dropck_outlives(...)` here, but rather the
// underlying `dropck_outlives` query. This same underlying
@ -58,7 +55,7 @@ where
}
fn shrink_to_tcx_lifetime(
lifted_query_result: &'a CanonicalizedQueryResponse<'gcx, Self::QueryResponse>,
lifted_query_result: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>> {
lifted_query_result
}

View file

@ -13,11 +13,11 @@ impl<'tcx> ProvePredicate<'tcx> {
}
}
impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> {
impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
type QueryResponse = ();
fn try_fast_path(
tcx: TyCtxt<'gcx, 'tcx>,
tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
// Proving Sized, very often on "obviously sized" types like
@ -38,14 +38,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> {
}
fn perform_query(
tcx: TyCtxt<'gcx, 'tcx>,
canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> {
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_prove_predicate(canonicalized)
}
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'gcx, ()>,
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}

Some files were not shown because too many files have changed in this diff Show more