Repository: rust
Issue: Panic while compiling sqlx with or without vendored openssl
Labels: I-ICE,T-compiler,C-bug,S-needs-repro

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

### Code

https://codeberg.org/grafcube/wordforge/src/branch/flake-nix

The issue occured on my new device running NixOS. I cloned my repo and ran `nix develop` and then `cargo leptos build`. I tried using vendored dependencies according to launchbadge/sqlx#2244 but that didn't help. The branch linked above only differs from the main branch by the flake.nix file and the vendored dependencies for openssl. As far as I can tell, the error shouldn't also cause a compiler panic, so I opened this issue. I apologize for being unable to make a smaller example since I don't know exactly where the issue lies.

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.74.0-nightly (4e78abb43 2023-08-28)
binary: rustc
commit-hash: 4e78abb437a0478d1f42115198ee45888e5330fd
commit-date: 2023-08-28
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0
```

### Error output

[rustc-ice-2023-08-29T15:36:00.898907847Z-447547.txt](https://github.com/rust-lang/rust/files/12466438/rustc-ice-2023-08-29T15.36.00.898907847Z-447547.txt)

```
error: libssl.so.3: cannot open shared object file: No such file or directory
  --> /home/username/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.6.3/src/lib.rs:67:1
   |
67 | pub extern crate sqlx_macros;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved imports `self::encode::Encode`, `self::decode::Decode`, `super::Decode`, `super::Encode`, `super::FromRow`, `super::Type`
   --> /home/username/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.6.3/src/lib.rs:126:9
    |
126 | pub use self::encode::Encode;
    |         ^^^^^^^^^^^^^^^^^^^^
...
137 | pub use self::decode::Decode;
    |         ^^^^^^^^^^^^^^^^^^^^
...
151 |     pub use super::Decode;
    |             ^^^^^^^^^^^^^
152 |     pub use super::Encode;
    |             ^^^^^^^^^^^^^
153 |     pub use super::Executor;
154 |     pub use super::FromRow;
    |             ^^^^^^^^^^^^^^
...
158 |     pub use super::Type;
    |             ^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_resolve/src/lib.rs:1998:67:
internal error: entered unreachable code

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please attach the file at `/home/username/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.6.3/rustc-ice-2023-08-29T15:36:00.898907847Z-447547.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
For more information about this error, try `rustc --explain E0432`.
error: could not compile `sqlx` (lib) due to 2 previous errors
Error: Failed to build wordforge
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4e78abb437a0478d1f42115198ee45888e5330fd/library/std/src/panicking.rs:619:5
   1: core::panicking::panic_fmt
             at /rustc/4e78abb437a0478d1f42115198ee45888e5330fd/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/4e78abb437a0478d1f42115198ee45888e5330fd/library/core/src/panicking.rs:127:5
   3: <rustc_resolve::Resolver>::resolve_rustdoc_path
   4: <rustc_resolve::late::LateResolutionVisitor>::resolve_and_cache_rustdoc_path
   5: <rustc_resolve::late::LateResolutionVisitor>::resolve_doc_links
   6: <rustc_resolve::late::LateResolutionVisitor>::resolve_item
   7: <rustc_resolve::late::LateResolutionVisitor as rustc_ast::visit::Visitor>::visit_item
   8: <rustc_resolve::Resolver>::late_resolve_crate
   9: <rustc_session::session::Session>::time::<(), <rustc_resolve::Resolver>::resolve_crate::{closure#0}>
  10: rustc_interface::passes::resolver_for_lowering
      [... omitted 2 frames ...]
  11: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>
  12: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

</p>
</details>