do not try fetching the ancestors of errored trait impls
This commit is contained in:
parent
d3df8512d2
commit
455e6140d8
3 changed files with 19 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::ich::{self, StableHashingContext};
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
use crate::ty::fold::TypeFoldable;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
@ -226,7 +227,8 @@ pub fn ancestors(
|
|||
start_from_impl: DefId,
|
||||
) -> Result<Ancestors<'tcx>, ErrorReported> {
|
||||
let specialization_graph = tcx.specialization_graph_of(trait_def_id);
|
||||
if specialization_graph.has_errored {
|
||||
|
||||
if specialization_graph.has_errored || tcx.type_of(start_from_impl).references_error() {
|
||||
Err(ErrorReported)
|
||||
} else {
|
||||
Ok(Ancestors {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#![feature(min_specialization)]
|
||||
|
||||
trait Trait {}
|
||||
impl Trait for NonExistent {}
|
||||
//~^ ERROR cannot find type `NonExistent` in this scope
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,9 @@
|
|||
error[E0412]: cannot find type `NonExistent` in this scope
|
||||
--> $DIR/impl-on-nonexisting.rs:4:16
|
||||
|
|
||||
LL | impl Trait for NonExistent {}
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Add table
Reference in a new issue