Skip to content

Commit

Permalink
fix comment and add delay_span_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Sep 3, 2019
1 parent 3cb1ed4 commit 8786671
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/librustc_typeck/impl_wf_check.rs
Expand Up @@ -12,7 +12,7 @@ use crate::constrained_generic_params as cgp;
use rustc::hir;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::def_id::DefId;
use rustc::ty::{self, TyCtxt};
use rustc::ty::{self, TyCtxt, TypeFoldable};
use rustc::ty::query::Providers;
use rustc::util::nodemap::{FxHashMap, FxHashSet};
use std::collections::hash_map::Entry::{Occupied, Vacant};
Expand Down Expand Up @@ -99,8 +99,13 @@ fn enforce_impl_params_are_constrained(
) {
// Every lifetime used in an associated type must be constrained.
let impl_self_ty = tcx.type_of(impl_def_id);
if impl_self_ty.sty == ty::Error {
// Don't complain about unconstrained type params when self ty doesn't exist. (#36836)
if impl_self_ty.references_error() {
// Don't complain about unconstrained type params when self ty isn't known due to errors.
// (#36836)
tcx.sess.delay_span_bug(tcx.def_span(impl_def_id), &format(
"potentially unconstrained type parameters weren't evaluated on `{:?}`",
impl_self_ty,
));
return;
}
let impl_generics = tcx.generics_of(impl_def_id);
Expand Down

0 comments on commit 8786671

Please sign in to comment.