diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-09-03 08:12:28 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-09-03 09:17:30 -0700 |
| commit | 87866714ee1cf3fba6e659f46413e361b9088362 (patch) | |
| tree | 51d1e2f892b7b22770e4377cc77a565a604d8596 | |
| parent | 3cb1ed4279d8ca4528e3777d5470ca7dc85a976a (diff) | |
| download | rust-87866714ee1cf3fba6e659f46413e361b9088362.tar.gz rust-87866714ee1cf3fba6e659f46413e361b9088362.zip | |
fix comment and add delay_span_bug
| -rw-r--r-- | src/librustc_typeck/impl_wf_check.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 8e69fbd9a79..82acbf7c748 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -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}; @@ -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); |
