about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs14
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs3
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs3
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs8
-rw-r--r--compiler/rustc_monomorphize/src/lib.rs3
-rw-r--r--compiler/rustc_trait_selection/src/solve/project_goals.rs5
-rw-r--r--compiler/rustc_trait_selection/src/solve/trait_goals.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs12
-rw-r--r--compiler/rustc_trait_selection/src/traits/wf.rs2
10 files changed, 33 insertions, 24 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 2e0bf592cd3..7d96daa7833 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -539,7 +539,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
         if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
             let tcx = self.tcx();
             let trait_ref =
-                ty::TraitRef::from_lang_item(tcx.at(self.last_span), LangItem::Copy, [place_ty.ty]);
+                ty::TraitRef::from_lang_item(tcx, LangItem::Copy, self.last_span, [place_ty.ty]);
 
             // To have a `Copy` operand, the type `T` of the
             // value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1239,8 +1239,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                 self.check_rvalue(body, rv, location);
                 if !self.unsized_feature_enabled() {
                     let trait_ref = ty::TraitRef::from_lang_item(
-                        tcx.at(self.last_span),
+                        tcx,
                         LangItem::Sized,
+                        self.last_span,
                         [place_ty],
                     );
                     self.prove_trait_ref(
@@ -1815,7 +1816,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                             // Make sure that repeated elements implement `Copy`.
                             let ty = place.ty(body, tcx).ty;
                             let trait_ref =
-                                ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Copy, [ty]);
+                                ty::TraitRef::from_lang_item(tcx, LangItem::Copy, span, [ty]);
 
                             self.prove_trait_ref(
                                 trait_ref,
@@ -1828,7 +1829,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
             }
 
             &Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, ty) => {
-                let trait_ref = ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Sized, [ty]);
+                let trait_ref = ty::TraitRef::from_lang_item(tcx, LangItem::Sized, span, [ty]);
 
                 self.prove_trait_ref(
                     trait_ref,
@@ -1840,7 +1841,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
             Rvalue::ShallowInitBox(operand, ty) => {
                 self.check_operand(operand, location);
 
-                let trait_ref = ty::TraitRef::from_lang_item(tcx.at(span), LangItem::Sized, [*ty]);
+                let trait_ref = ty::TraitRef::from_lang_item(tcx, LangItem::Sized, span, [*ty]);
 
                 self.prove_trait_ref(
                     trait_ref,
@@ -1938,8 +1939,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                     CastKind::Pointer(PointerCast::Unsize) => {
                         let &ty = ty;
                         let trait_ref = ty::TraitRef::from_lang_item(
-                            tcx.at(span),
+                            tcx,
                             LangItem::CoerceUnsized,
+                            span,
                             [op.ty(body, tcx), ty],
                         );
 
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs
index 7b65c828c33..60d4e6ece48 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs
@@ -158,8 +158,9 @@ impl Qualif for NeedsNonConstDrop {
             ObligationCause::dummy_with_span(cx.body.span),
             cx.param_env,
             ty::Binder::dummy(ty::TraitRef::from_lang_item(
-                cx.tcx.at(cx.body.span),
+                cx.tcx,
                 LangItem::Destruct,
+                cx.body.span,
                 [ty],
             ))
             .with_constness(ty::BoundConstness::ConstIfConst),
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 17952c601d2..bfa83a2ee26 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -765,8 +765,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
             self.cause.clone(),
             self.param_env,
             ty::TraitRef::from_lang_item(
-                self.tcx.at(self.cause.span),
+                self.tcx,
                 hir::LangItem::PointerLike,
+                self.cause.span,
                 [a],
             ),
         ));
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 149fb3609aa..32809783c29 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -3,7 +3,6 @@
 #![allow(rustc::usage_of_ty_tykind)]
 
 use crate::infer::canonical::Canonical;
-use crate::ty::query::TyCtxtAt;
 use crate::ty::subst::{GenericArg, InternalSubsts, SubstsRef};
 use crate::ty::visit::ValidateBoundVars;
 use crate::ty::InferTy::*;
@@ -836,12 +835,13 @@ impl<'tcx> TraitRef<'tcx> {
     }
 
     pub fn from_lang_item(
-        tcx: TyCtxtAt<'tcx>,
+        tcx: TyCtxt<'tcx>,
         trait_lang_item: LangItem,
+        span: Span,
         substs: impl IntoIterator<Item: Into<ty::GenericArg<'tcx>>>,
     ) -> Self {
-        let trait_def_id = tcx.require_lang_item(trait_lang_item, Some(tcx.span));
-        Self::new(tcx.tcx, trait_def_id, substs)
+        let trait_def_id = tcx.require_lang_item(trait_lang_item, Some(span));
+        Self::new(tcx, trait_def_id, substs)
     }
 
     pub fn from_method(
diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs
index c71ee8e74d1..7253acf61e6 100644
--- a/compiler/rustc_monomorphize/src/lib.rs
+++ b/compiler/rustc_monomorphize/src/lib.rs
@@ -31,8 +31,9 @@ fn custom_coerce_unsize_info<'tcx>(
     target_ty: Ty<'tcx>,
 ) -> CustomCoerceUnsized {
     let trait_ref = ty::Binder::dummy(ty::TraitRef::from_lang_item(
-        tcx,
+        tcx.tcx,
         LangItem::CoerceUnsized,
+        tcx.span,
         [source_ty, target_ty],
     ));
 
diff --git a/compiler/rustc_trait_selection/src/solve/project_goals.rs b/compiler/rustc_trait_selection/src/solve/project_goals.rs
index bc5bb2e0c48..e5d51064c8d 100644
--- a/compiler/rustc_trait_selection/src/solve/project_goals.rs
+++ b/compiler/rustc_trait_selection/src/solve/project_goals.rs
@@ -275,7 +275,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
                 }
             };
         let output_is_sized_pred = tupled_inputs_and_output.map_bound(|(_, output)| {
-            ty::TraitRef::from_lang_item(tcx.at(DUMMY_SP), LangItem::Sized, [output])
+            ty::TraitRef::from_lang_item(tcx, LangItem::Sized, DUMMY_SP, [output])
         });
 
         let pred = tupled_inputs_and_output
@@ -335,8 +335,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
                 ty::Alias(_, _) | ty::Param(_) | ty::Placeholder(..) => {
                     // FIXME(ptr_metadata): It would also be possible to return a `Ok(Ambig)` with no constraints.
                     let sized_predicate = ty::TraitRef::from_lang_item(
-                        tcx.at(DUMMY_SP),
+                        tcx,
                         LangItem::Sized,
+                        DUMMY_SP,
                         [ty::GenericArg::from(goal.predicate.self_ty())],
                     );
                     ecx.add_goal(goal.with(tcx, sized_predicate));
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
index 7253b8d038b..af5892e1b40 100644
--- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs
+++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
@@ -243,7 +243,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
                 }
             };
         let output_is_sized_pred = tupled_inputs_and_output.map_bound(|(_, output)| {
-            ty::TraitRef::from_lang_item(tcx.at(DUMMY_SP), LangItem::Sized, [output])
+            ty::TraitRef::from_lang_item(tcx, LangItem::Sized, DUMMY_SP, [output])
         });
 
         let pred = tupled_inputs_and_output
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 61922ec9ad7..68e3600a5e4 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -1683,7 +1683,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
                                 &obligation.with(
                                     selcx.tcx(),
                                     ty::Binder::dummy(
-                                        ty::TraitRef::from_lang_item(selcx.tcx().at(obligation.cause.span()), LangItem::Sized, [self_ty]),
+                                        ty::TraitRef::from_lang_item(selcx.tcx(), LangItem::Sized, obligation.cause.span(),[self_ty]),
                                     )
                                     .without_const(),
                                 ),
@@ -1949,8 +1949,9 @@ fn confirm_builtin_candidate<'cx, 'tcx>(
         });
         if check_is_sized {
             let sized_predicate = ty::Binder::dummy(ty::TraitRef::from_lang_item(
-                tcx.at(obligation.cause.span()),
+                tcx,
                 LangItem::Sized,
+                obligation.cause.span(),
                 [self_ty],
             ))
             .without_const();
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index 6604b1aceff..089f680654e 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -646,8 +646,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             output_ty,
             &mut nested,
         );
-        let tr =
-            ty::TraitRef::from_lang_item(self.tcx().at(cause.span), LangItem::Sized, [output_ty]);
+        let tr = ty::TraitRef::from_lang_item(self.tcx(), LangItem::Sized, cause.span, [output_ty]);
         nested.push(Obligation::new(self.infcx.tcx, cause, obligation.param_env, tr));
 
         Ok(ImplSourceFnPointerData { fn_ty: self_ty, nested })
@@ -1051,8 +1050,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
                 // We can only make objects from sized types.
                 let tr = ty::Binder::dummy(ty::TraitRef::from_lang_item(
-                    tcx.at(cause.span),
+                    tcx,
                     LangItem::Sized,
+                    cause.span,
                     [source],
                 ));
                 nested.push(predicate_to_obligation(tr.without_const().to_predicate(tcx)));
@@ -1281,8 +1281,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                         obligation.recursion_depth + 1,
                         self_ty.rebind(ty::TraitPredicate {
                             trait_ref: ty::TraitRef::from_lang_item(
-                                self.tcx().at(cause.span),
+                                self.tcx(),
                                 LangItem::Destruct,
+                                cause.span,
                                 [nested_ty],
                             ),
                             constness: ty::BoundConstness::ConstIfConst,
@@ -1306,8 +1307,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 _ => {
                     let predicate = self_ty.rebind(ty::TraitPredicate {
                         trait_ref: ty::TraitRef::from_lang_item(
-                            self.tcx().at(cause.span),
+                            self.tcx(),
                             LangItem::Destruct,
+                            cause.span,
                             [nested_ty],
                         ),
                         constness: ty::BoundConstness::ConstIfConst,
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 9e659362ff2..517f4522d61 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -449,7 +449,7 @@ impl<'tcx> WfPredicates<'tcx> {
         if !subty.has_escaping_bound_vars() {
             let cause = self.cause(cause);
             let trait_ref =
-                ty::TraitRef::from_lang_item(self.tcx.at(cause.span), LangItem::Sized, [subty]);
+                ty::TraitRef::from_lang_item(self.tcx, LangItem::Sized, cause.span, [subty]);
             self.out.push(traits::Obligation::with_depth(
                 self.tcx,
                 cause,