Skip to content

Commit 8786671

Browse files
committed
fix comment and add delay_span_bug
1 parent 3cb1ed4 commit 8786671

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustc_typeck/impl_wf_check.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::constrained_generic_params as cgp;
1212
use rustc::hir;
1313
use rustc::hir::itemlikevisit::ItemLikeVisitor;
1414
use rustc::hir::def_id::DefId;
15-
use rustc::ty::{self, TyCtxt};
15+
use rustc::ty::{self, TyCtxt, TypeFoldable};
1616
use rustc::ty::query::Providers;
1717
use rustc::util::nodemap::{FxHashMap, FxHashSet};
1818
use std::collections::hash_map::Entry::{Occupied, Vacant};
@@ -99,8 +99,13 @@ fn enforce_impl_params_are_constrained(
9999
) {
100100
// Every lifetime used in an associated type must be constrained.
101101
let impl_self_ty = tcx.type_of(impl_def_id);
102-
if impl_self_ty.sty == ty::Error {
103-
// Don't complain about unconstrained type params when self ty doesn't exist. (#36836)
102+
if impl_self_ty.references_error() {
103+
// Don't complain about unconstrained type params when self ty isn't known due to errors.
104+
// (#36836)
105+
tcx.sess.delay_span_bug(tcx.def_span(impl_def_id), &format(
106+
"potentially unconstrained type parameters weren't evaluated on `{:?}`",
107+
impl_self_ty,
108+
));
104109
return;
105110
}
106111
let impl_generics = tcx.generics_of(impl_def_id);

0 commit comments

Comments
 (0)