diagnostics: don't crash if an injected crate shows up in suggestions
This commit is contained in:
parent
0ca70be11b
commit
d47dc326d6
1 changed files with 4 additions and 1 deletions
|
@ -876,7 +876,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
// | Yes | No | No | !(true && !false) |
|
||||
// | No | No | Yes | !(false && !false) |
|
||||
!(self.is_private_dep(key)
|
||||
&& !self.extern_crate(key.as_def_id()).expect("crate must exist").is_direct())
|
||||
// If `extern_crate` is `None`, then the crate was injected (e.g., by the allocator).
|
||||
// Treat that kind of crate as "indirect", since it's an implementation detail of
|
||||
// the language.
|
||||
&& !self.extern_crate(key.as_def_id()).map_or(false, |e| e.is_direct()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue