rustc: use intern_* instead of mk_* where possible.
This commit is contained in:
parent
196b2e0d82
commit
7e4d8718cb
@ -2600,7 +2600,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal {
|
||||
&self.mk_goals(iter::once(goal))[0]
|
||||
&self.intern_goals(&[goal])[0]
|
||||
}
|
||||
|
||||
pub fn lint_node<S: Into<MultiSpan>>(self,
|
||||
|
@ -431,8 +431,10 @@ pub fn ty_fn_sig<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
||||
sig.map_bound(|sig| {
|
||||
let state_did = tcx.lang_items().gen_state().unwrap();
|
||||
let state_adt_ref = tcx.adt_def(state_did);
|
||||
let state_substs = tcx.mk_substs([sig.yield_ty.into(),
|
||||
sig.return_ty.into()].iter());
|
||||
let state_substs = tcx.intern_substs(&[
|
||||
sig.yield_ty.into(),
|
||||
sig.return_ty.into(),
|
||||
]);
|
||||
let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
|
||||
|
||||
tcx.mk_fn_sig(iter::once(env_ty),
|
||||
|
@ -669,7 +669,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
|
||||
assert_eq!(self.mir_def_id, def_id);
|
||||
let ty = tcx.type_of(def_id);
|
||||
let ty = indices.fold_to_region_vids(tcx, &ty);
|
||||
ty::Binder::dummy(tcx.mk_type_list(iter::once(ty)))
|
||||
ty::Binder::dummy(tcx.intern_type_list(&[ty]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
let substs = if let Some(ty) = ty {
|
||||
tcx.mk_substs(iter::once(ty.into()))
|
||||
tcx.intern_substs(&[ty.into()])
|
||||
} else {
|
||||
Substs::identity_for_item(tcx, def_id)
|
||||
};
|
||||
|
@ -861,8 +861,10 @@ impl MirPass for StateTransform {
|
||||
// Compute GeneratorState<yield_ty, return_ty>
|
||||
let state_did = tcx.lang_items().gen_state().unwrap();
|
||||
let state_adt_ref = tcx.adt_def(state_did);
|
||||
let state_substs = tcx.mk_substs([yield_ty.into(),
|
||||
mir.return_ty().into()].iter());
|
||||
let state_substs = tcx.intern_substs(&[
|
||||
yield_ty.into(),
|
||||
mir.return_ty().into(),
|
||||
]);
|
||||
let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
|
||||
|
||||
// We rename RETURN_PLACE which has type mir.return_ty to new_ret_local
|
||||
|
@ -220,7 +220,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
|
||||
// `Implemented(Self: Trait<P1..Pn>) :- FromEnv(Self: Trait<P1..Pn>)`
|
||||
let implemented_from_env = ProgramClause {
|
||||
goal: impl_trait,
|
||||
hypotheses: tcx.mk_goals(iter::once(from_env)),
|
||||
hypotheses: tcx.intern_goals(&[from_env]),
|
||||
};
|
||||
let clauses = iter::once(Clause::ForAll(ty::Binder::dummy(implemented_from_env)));
|
||||
|
||||
@ -256,7 +256,7 @@ fn implied_bound_from_trait<'a, 'tcx>(
|
||||
// `FromEnv(WC) :- FromEnv(Self: Trait<P1..Pn>)`
|
||||
Clause::ForAll(where_clause.lower().map_bound(|goal| ProgramClause {
|
||||
goal: goal.into_from_env_goal(),
|
||||
hypotheses: tcx.mk_goals(iter::once(Goal::from(impl_trait))),
|
||||
hypotheses: tcx.intern_goals(&[Goal::from(impl_trait)]),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
|
||||
.map(|wc| Goal::from_poly_domain_goal(wc, tcx)),
|
||||
),
|
||||
};
|
||||
tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::dummy(clause))))
|
||||
tcx.intern_clauses(&[Clause::ForAll(ty::Binder::dummy(clause))])
|
||||
}
|
||||
|
||||
pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
|
||||
@ -344,7 +344,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
|
||||
.map(|wc| Goal::from_poly_domain_goal(wc, tcx)),
|
||||
),
|
||||
};
|
||||
tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::dummy(clause))))
|
||||
tcx.intern_clauses(&[Clause::ForAll(ty::Binder::dummy(clause))])
|
||||
}
|
||||
|
||||
pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user