Skip to content

Commit d14af13

Browse files
committed
Make all object-safety methods require a global TyCtxt
1 parent 451987d commit d14af13

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/librustc/traits/error_reporting.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
754754
}
755755

756756
ty::Predicate::ObjectSafe(trait_def_id) => {
757-
let violations = self.tcx.object_safety_violations(trait_def_id);
757+
let violations = self.tcx.global_tcx()
758+
.object_safety_violations(trait_def_id);
758759
self.tcx.report_object_safety_error(span,
759760
trait_def_id,
760761
violations)
@@ -875,7 +876,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
875876
}
876877

877878
TraitNotObjectSafe(did) => {
878-
let violations = self.tcx.object_safety_violations(did);
879+
let violations = self.tcx.global_tcx().object_safety_violations(did);
879880
self.tcx.report_object_safety_error(span, did, violations)
880881
}
881882

src/librustc/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub enum MethodViolationCode {
8989
NonStandardSelfType,
9090
}
9191

92-
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
92+
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
9393

9494
/// Returns the object safety violations that affect
9595
/// astconv - currently, Self in supertraits. This is needed

src/librustc_typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
10131013
// most importantly, that the supertraits don't contain Self,
10141014
// to avoid ICE-s.
10151015
let object_safety_violations =
1016-
tcx.astconv_object_safety_violations(principal.def_id());
1016+
tcx.global_tcx().astconv_object_safety_violations(principal.def_id());
10171017
if !object_safety_violations.is_empty() {
10181018
tcx.report_object_safety_error(
10191019
span, principal.def_id(), object_safety_violations)

0 commit comments

Comments
 (0)