Repository: rust
Issue: rustdoc: ICE: synthetic auto trait impls: `unexpected region: RePlaceholder[…]` involving TAIT
Labels: T-rustdoc,A-lifetimes,I-ICE,T-compiler,C-bug,A-synthetic-impls,F-type_alias_impl_trait,A-auto-traits,S-has-mcve

<!--
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

this commit codes https://github.com/Sherlock-Holo/compio_compat/commit/468c054752932add17d0f30a90f129350cfb36dd


### 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.77.0-nightly (bf3c6c5be 2024-02-01)
binary: rustc
commit-hash: bf3c6c5bed498f41ad815641319a1ad9bcecb8e8
commit-date: 2024-02-01
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6
```

### Error output

```
error: internal compiler error: src/librustdoc/clean/auto_trait.rs:745:18: unexpected region: RePlaceholder(!1_BoundRegion { var: 0, kind: BrAnon })

thread 'rustc' panicked at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/compiler/rustc_errors/src/lib.rs:932:30:
Box<dyn Any>
stack backtrace:
   0:     0x75078af8cd16 - std::backtrace_rs::backtrace::libunwind::trace::he544685250360e22
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x75078af8cd16 - std::backtrace_rs::backtrace::trace_unsynchronized::h664adef12633380a
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x75078af8cd16 - std::sys_common::backtrace::_print_fmt::hba7ee045aeee07b0
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x75078af8cd16 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc80b7ff177a688f2
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x75078afdf770 - core::fmt::rt::Argument::fmt::h605309ab4829b6b5
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/fmt/rt.rs:142:9
   5:     0x75078afdf770 - core::fmt::write::h5f24f526de99e105
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/fmt/mod.rs:1120:17
   6:     0x75078af8061f - std::io::Write::write_fmt::h711c920f97cd3d8c
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/io/mod.rs:1846:15
   7:     0x75078af8caf4 - std::sys_common::backtrace::_print::ha279702af2871260
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x75078af8caf4 - std::sys_common::backtrace::print::hc1f3820f405abdd3
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x75078af8f887 - std::panicking::default_hook::{{closure}}::h5058841d19c78172
  10:     0x75078af8f5e9 - std::panicking::default_hook::h60a42497ec033f97
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/panicking.rs:292:9
  11:     0x750787b371fc - std[4337b1e3d1c66af6]::panicking::update_hook::<alloc[6a28242b4f343ab9]::boxed::Box<rustc_driver_impl[e51f6499da6a94b9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x75078af8ffd6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h437fd8fcb0ff0cea
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/alloc/src/boxed.rs:2029:9
  13:     0x75078af8ffd6 - std::panicking::rust_panic_with_hook::h294fbe090fe44fa4
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/panicking.rs:785:13
  14:     0x750787b693b4 - std[4337b1e3d1c66af6]::panicking::begin_panic::<rustc_errors[37e82e04e08bc148]::ExplicitBug>::{closure#0}
  15:     0x750787b65aa6 - std[4337b1e3d1c66af6]::sys_common::backtrace::__rust_end_short_backtrace::<std[4337b1e3d1c66af6]::panicking::begin_panic<rustc_errors[37e82e04e08bc148]::ExplicitBug>::{closure#0}, !>
  16:     0x750787b60d06 - std[4337b1e3d1c66af6]::panicking::begin_panic::<rustc_errors[37e82e04e08bc148]::ExplicitBug>
  17:     0x750787b74591 - <rustc_errors[37e82e04e08bc148]::diagnostic_builder::BugAbort as rustc_errors[37e82e04e08bc148]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x750787f2cbcb - <rustc_errors[37e82e04e08bc148]::DiagCtxt>::bug::<alloc[6a28242b4f343ab9]::string::String>
  19:     0x750787fc3ceb - rustc_middle[9b442554c155189d]::util::bug::opt_span_bug_fmt::<rustc_span[ecf473d7733698d2]::span_encoding::Span>::{closure#0}
  20:     0x750787faca2a - rustc_middle[9b442554c155189d]::ty::context::tls::with_opt::<rustc_middle[9b442554c155189d]::util::bug::opt_span_bug_fmt<rustc_span[ecf473d7733698d2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x750787fac8c8 - rustc_middle[9b442554c155189d]::ty::context::tls::with_context_opt::<rustc_middle[9b442554c155189d]::ty::context::tls::with_opt<rustc_middle[9b442554c155189d]::util::bug::opt_span_bug_fmt<rustc_span[ecf473d7733698d2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x750785f61d40 - rustc_middle[9b442554c155189d]::util::bug::bug_fmt
  23:     0x5aba61135c63 - <rustdoc[3384abbdb6741cf]::clean::auto_trait::RegionReplacer as rustc_type_ir[d836307668432e47]::fold::TypeFolder<rustc_middle[9b442554c155189d]::ty::context::TyCtxt>>::fold_region
  24:     0x5aba61077b2e - <&rustc_middle[9b442554c155189d]::ty::list::List<rustc_middle[9b442554c155189d]::ty::generic_args::GenericArg> as rustc_type_ir[d836307668432e47]::fold::TypeFoldable<rustc_middle[9b442554c155189d]::ty::context::TyCtxt>>::try_fold_with::<rustdoc[3384abbdb6741cf]::clean::auto_trait::RegionReplacer>
  25:     0x5aba61071bcb - <rustc_middle[9b442554c155189d]::ty::Ty as rustc_type_ir[d836307668432e47]::fold::TypeSuperFoldable<rustc_middle[9b442554c155189d]::ty::context::TyCtxt>>::try_super_fold_with::<rustdoc[3384abbdb6741cf]::clean::auto_trait::RegionReplacer>
  26:     0x5aba61077e9e - <&rustc_middle[9b442554c155189d]::ty::list::List<rustc_middle[9b442554c155189d]::ty::generic_args::GenericArg> as rustc_type_ir[d836307668432e47]::fold::TypeFoldable<rustc_middle[9b442554c155189d]::ty::context::TyCtxt>>::try_fold_with::<rustdoc[3384abbdb6741cf]::clean::auto_trait::RegionReplacer>
  27:     0x5aba61130ad5 - <rustdoc[3384abbdb6741cf]::clean::auto_trait::AutoTraitFinder>::param_env_to_generics
  28:     0x5aba60fd2be6 - <rustc_trait_selection[549d5aadac124ff9]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[3384abbdb6741cf]::clean::types::Generics, <rustdoc[3384abbdb6741cf]::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  29:     0x5aba6112fb56 - <rustdoc[3384abbdb6741cf]::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  30:     0x5aba6114e477 - rustdoc[3384abbdb6741cf]::clean::utils::get_auto_trait_and_blanket_impls
  31:     0x5aba612614ae - <rustdoc[3384abbdb6741cf]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[3384abbdb6741cf]::visit::DocVisitor>::visit_item
  32:     0x5aba6126182a - <rustdoc[3384abbdb6741cf]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[3384abbdb6741cf]::visit::DocVisitor>::visit_item
  33:     0x5aba6126182a - <rustdoc[3384abbdb6741cf]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[3384abbdb6741cf]::visit::DocVisitor>::visit_item
  34:     0x5aba6125e225 - rustdoc[3384abbdb6741cf]::passes::collect_trait_impls::collect_trait_impls
  35:     0x5aba611833fe - rustdoc[3384abbdb6741cf]::core::run_global_ctxt
  36:     0x5aba6128edb6 - rustdoc[3384abbdb6741cf]::main_args::{closure#1}::{closure#0}::{closure#0}
  37:     0x5aba6108585e - rustc_interface[e57535df52585ed5]::interface::run_compiler::<core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>, rustdoc[3384abbdb6741cf]::main_args::{closure#1}>::{closure#0}
  38:     0x5aba610488d0 - std[4337b1e3d1c66af6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e57535df52585ed5]::util::run_in_thread_with_globals<rustc_interface[e57535df52585ed5]::util::run_in_thread_pool_with_globals<rustc_interface[e57535df52585ed5]::interface::run_compiler<core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>, rustdoc[3384abbdb6741cf]::main_args::{closure#1}>::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>
  39:     0x5aba61090ade - <<std[4337b1e3d1c66af6]::thread::Builder>::spawn_unchecked_<rustc_interface[e57535df52585ed5]::util::run_in_thread_with_globals<rustc_interface[e57535df52585ed5]::util::run_in_thread_pool_with_globals<rustc_interface[e57535df52585ed5]::interface::run_compiler<core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>, rustdoc[3384abbdb6741cf]::main_args::{closure#1}>::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cc6cd760d986f799]::result::Result<(), rustc_span[ecf473d7733698d2]::ErrorGuaranteed>>::{closure#1} as core[cc6cd760d986f799]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x75078af99675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc4b9a6efba849e51
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/alloc/src/boxed.rs:2015:9
  41:     0x75078af99675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc525ee5ac423ddcd
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/alloc/src/boxed.rs:2015:9
  42:     0x75078af99675 - std::sys::pal::unix::thread::Thread::new::thread_start::h31b81f67226864c0
                               at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/std/src/sys/pal/unix/thread.rs:108:17
  43:     0x750784caa9eb - <unknown>
  44:     0x750784d2e8ac - <unknown>
  45:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md

note: please attach the file at `/home/sherlock/git/compio_compat/rustc-ice-2024-02-03T11_08_13-130160.txt` to your bug report

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `compio_compat`

Caused by:
  process didn't exit successfully: `/home/sherlock/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --edition=2021 --crate-type lib --crate-name compio_compat src/lib.rs -o /home/sherlock/git/compio_compat/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=150 -C metadata=82bf5ac2095ab40f -L dependency=/home/sherlock/git/compio_compat/target/debug/deps --extern compio_buf=/home/sherlock/git/compio_compat/target/debug/deps/libcompio_buf-3f6a7492d880a9a6.rmeta --extern compio_io=/home/sherlock/git/compio_compat/target/debug/deps/libcompio_io-6ba0a1a4d4aab3c6.rmeta --extern futures_util=/home/sherlock/git/compio_compat/target/debug/deps/libfutures_util-9f338ae92a96bae3.rmeta --crate-version 0.1.0` (exit status: 101)
```

[rustc-ice-2024-02-03T11_08_13-130160.txt](https://github.com/rust-lang/rust/files/14151157/rustc-ice-2024-02-03T11_08_13-130160.txt)

<!--
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>

```
 Documenting compio_compat v0.1.0 (/home/sherlock/git/compio_compat)
error: internal compiler error: src/librustdoc/clean/auto_trait.rs:745:18: unexpected region: RePlaceholder(!1_BoundRegion { var: 0, kind: BrAnon })

thread 'rustc' panicked at /rustc/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/compiler/rustc_errors/src/lib.rs:932:30:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic_builder::BugAbort as rustc_errors::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxt>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustdoc::clean::auto_trait::RegionReplacer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_region
   8: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustdoc::clean::auto_trait::RegionReplacer>
   9: <rustc_middle::ty::Ty as rustc_type_ir::fold::TypeSuperFoldable<rustc_middle::ty::context::TyCtxt>>::try_super_fold_with::<rustdoc::clean::auto_trait::RegionReplacer>
  10: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustdoc::clean::auto_trait::RegionReplacer>
  11: <rustdoc::clean::auto_trait::AutoTraitFinder>::param_env_to_generics
  12: <rustc_trait_selection::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc::clean::types::Generics, <rustdoc::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  13: <rustdoc::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  14: rustdoc::clean::utils::get_auto_trait_and_blanket_impls
  15: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
  16: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
  17: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
  18: rustdoc::passes::collect_trait_impls::collect_trait_impls
  19: rustdoc::core::run_global_ctxt
  20: rustdoc::main_args::{closure#1}::{closure#0}::{closure#0}
  21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md

note: please attach the file at `/home/sherlock/git/compio_compat/rustc-ice-2024-02-03T11_11_10-133512.txt` to your bug report

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `compio_compat`

Caused by:
  process didn't exit successfully: `/home/sherlock/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --edition=2021 --crate-type lib --crate-name compio_compat src/lib.rs -o /home/sherlock/git/compio_compat/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=150 -C metadata=82bf5ac2095ab40f -L dependency=/home/sherlock/git/compio_compat/target/debug/deps --extern compio_buf=/home/sherlock/git/compio_compat/target/debug/deps/libcompio_buf-3f6a7492d880a9a6.rmeta --extern compio_io=/home/sherlock/git/compio_compat/target/debug/deps/libcompio_io-6ba0a1a4d4aab3c6.rmeta --extern futures_util=/home/sherlock/git/compio_compat/target/debug/deps/libfutures_util-9f338ae92a96bae3.rmeta --crate-version 0.1.0` (exit status: 101)
```

</p>
</details>