We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d7041de commit 827a181Copy full SHA for 827a181
compiler/rustc_middle/src/ty/util.rs
@@ -827,7 +827,10 @@ impl<'tcx> TyCtxt<'tcx> {
827
// | Yes | No | No | !(true && !false) |
828
// | No | No | Yes | !(false && !false) |
829
!(self.is_private_dep(key)
830
- && !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).
831
+ // Treat that kind of crate as "indirect", since it's an implementation detail of
832
+ // the language.
833
+ && !self.extern_crate(key.as_def_id()).map_or(false, |e| e.is_direct()))
834
}
835
836
0 commit comments