Make all object-safety methods require a global TyCtxt

This commit is contained in:
Michael Hewson 2018-07-02 18:30:59 -04:00
parent 451987d86c
commit d14af130f6
3 changed files with 5 additions and 4 deletions

View file

@ -754,7 +754,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
ty::Predicate::ObjectSafe(trait_def_id) => {
let violations = self.tcx.object_safety_violations(trait_def_id);
let violations = self.tcx.global_tcx()
.object_safety_violations(trait_def_id);
self.tcx.report_object_safety_error(span,
trait_def_id,
violations)
@ -875,7 +876,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
TraitNotObjectSafe(did) => {
let violations = self.tcx.object_safety_violations(did);
let violations = self.tcx.global_tcx().object_safety_violations(did);
self.tcx.report_object_safety_error(span, did, violations)
}

View file

@ -89,7 +89,7 @@ pub enum MethodViolationCode {
NonStandardSelfType,
}
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
/// Returns the object safety violations that affect
/// astconv - currently, Self in supertraits. This is needed

View file

@ -1013,7 +1013,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
// most importantly, that the supertraits don't contain Self,
// to avoid ICE-s.
let object_safety_violations =
tcx.astconv_object_safety_violations(principal.def_id());
tcx.global_tcx().astconv_object_safety_violations(principal.def_id());
if !object_safety_violations.is_empty() {
tcx.report_object_safety_error(
span, principal.def_id(), object_safety_violations)