mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
diagnostics: don't crash if an injected crate shows up in suggestions
This commit is contained in:
@@ -876,7 +876,10 @@ pub fn is_user_visible_dep(self, key: CrateNum) -> bool {
|
||||
// | 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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user