Closed
Description
Code
trait Fun {
type Assoc;
}
trait Trait: for<'v> Fun<Assoc = &'v ()> {}
impl<F: for<'v> Fun<Assoc = &'v ()>> Trait for F {}
fn main() {}
Meta
rustc --version --verbose
: current nightly
rustc 1.83.0-nightly (9c01301c5 2024-09-05)
binary: rustc
commit-hash: 9c01301c52df5d2d7b6fe337707a74e011d68d6f
commit-date: 2024-09-05
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Error output
rustc main.rs
error[E0582]: binding for associated type `Assoc` references lifetime `'v`, which does not appear in the trait input types
--> src/main.rs:5:26
|
5 | trait Trait: for<'v> Fun<Assoc = &'v ()> {}
| ^^^^^^^^^^^^^^
error[E0582]: binding for associated type `Assoc` references lifetime `'v`, which does not appear in the trait input types
--> src/main.rs:7:21
|
7 | impl<F: for<'v> Fun<Assoc = &'v ()>> Trait for F {}
| ^^^^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:634:21:
internal error: entered unreachable code: control flow ensures we have a `BindingObligation` or `WhereClauseInExpr` here...
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_placeholder_failure
3: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_region_errors
4: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
5: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
6: rustc_hir_analysis::check_crate
7: rustc_interface::passes::run_required_analyses
8: rustc_interface::passes::analysis
[... omitted 1 frame ...]
9: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
#0 [check_well_formed] checking that `<impl at src/main.rs:7:1: 7:49>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0582`.
Backtrace
stack backtrace:
0: 0x714380c67be5 - std::backtrace::Backtrace::create::h0b20d70bbd20825c
1: 0x71437f42bb05 - std::backtrace::Backtrace::force_capture::heb2536b9591609d6
2: 0x71437e55c457 - std[c093c6b05171ebdd]::panicking::update_hook::<alloc[78698482508a29ba]::boxed::Box<rustc_driver_impl[ff0605cbafb5cd86]::install_ice_hook::{closure#0}>>::{closure#0}
3: 0x71437f442f28 - std::panicking::rust_panic_with_hook::hbc158dc145985f20
4: 0x71437f442cc3 - std::panicking::begin_panic_handler::{{closure}}::ha4ff8d0a34f0db3b
5: 0x71437f440939 - std::sys::backtrace::__rust_end_short_backtrace::h99054fe005abe325
6: 0x71437f4429c4 - rust_begin_unwind
7: 0x71437c2aaa43 - core::panicking::panic_fmt::h700376aebf176cba
8: 0x71437f26b152 - <rustc_trait_selection[cbbf0906eb8ebddd]::error_reporting::TypeErrCtxt>::report_placeholder_failure
9: 0x71437f2676de - <rustc_trait_selection[cbbf0906eb8ebddd]::error_reporting::TypeErrCtxt>::report_region_errors
10: 0x71437d264874 - rustc_hir_analysis[cf1168cfed07072a]::check::wfcheck::check_well_formed
11: 0x714380016ce7 - rustc_query_impl[33864bfff5ddc18b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33864bfff5ddc18b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>
12: 0x714380016f74 - rustc_query_system[1d740a2f543ea37c]::query::plumbing::try_execute_query::<rustc_query_impl[33864bfff5ddc18b]::DynamicConfig<rustc_query_system[1d740a2f543ea37c]::query::caches::VecCache<rustc_hir[f1bc196970cb7291]::hir_id::OwnerId, rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33864bfff5ddc18b]::plumbing::QueryCtxt, false>
13: 0x714380016cc6 - rustc_query_impl[33864bfff5ddc18b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
14: 0x714380017a8b - rustc_hir_analysis[cf1168cfed07072a]::check::wfcheck::check_mod_type_wf
15: 0x7143800178c9 - rustc_query_impl[33864bfff5ddc18b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33864bfff5ddc18b]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>
16: 0x714380b58e7b - rustc_query_system[1d740a2f543ea37c]::query::plumbing::try_execute_query::<rustc_query_impl[33864bfff5ddc18b]::DynamicConfig<rustc_query_system[1d740a2f543ea37c]::query::caches::DefaultCache<rustc_span[d096ceaba54bbd14]::def_id::LocalModDefId, rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33864bfff5ddc18b]::plumbing::QueryCtxt, false>
17: 0x714380b58c2d - rustc_query_impl[33864bfff5ddc18b]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
18: 0x7143803c303d - rustc_hir_analysis[cf1168cfed07072a]::check_crate
19: 0x714380653bd1 - rustc_interface[a1713937163ca6a0]::passes::run_required_analyses
20: 0x7143809c895e - rustc_interface[a1713937163ca6a0]::passes::analysis
21: 0x7143809c8931 - rustc_query_impl[33864bfff5ddc18b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33864bfff5ddc18b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>
22: 0x714380b76c6e - rustc_query_system[1d740a2f543ea37c]::query::plumbing::try_execute_query::<rustc_query_impl[33864bfff5ddc18b]::DynamicConfig<rustc_query_system[1d740a2f543ea37c]::query::caches::SingleCache<rustc_middle[680a3b16fcb54e30]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33864bfff5ddc18b]::plumbing::QueryCtxt, false>
23: 0x714380b769cf - rustc_query_impl[33864bfff5ddc18b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
24: 0x7143809ab9fa - rustc_interface[a1713937163ca6a0]::interface::run_compiler::<core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>, rustc_driver_impl[ff0605cbafb5cd86]::run_compiler::{closure#0}>::{closure#1}
25: 0x714380a64e10 - std[c093c6b05171ebdd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a1713937163ca6a0]::util::run_in_thread_with_globals<rustc_interface[a1713937163ca6a0]::util::run_in_thread_pool_with_globals<rustc_interface[a1713937163ca6a0]::interface::run_compiler<core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>, rustc_driver_impl[ff0605cbafb5cd86]::run_compiler::{closure#0}>::{closure#1}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>::{closure#0}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>
26: 0x714380a6547a - <<std[c093c6b05171ebdd]::thread::Builder>::spawn_unchecked_<rustc_interface[a1713937163ca6a0]::util::run_in_thread_with_globals<rustc_interface[a1713937163ca6a0]::util::run_in_thread_pool_with_globals<rustc_interface[a1713937163ca6a0]::interface::run_compiler<core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>, rustc_driver_impl[ff0605cbafb5cd86]::run_compiler::{closure#0}>::{closure#1}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>::{closure#0}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ec44d53398c8912e]::result::Result<(), rustc_span[d096ceaba54bbd14]::ErrorGuaranteed>>::{closure#1} as core[ec44d53398c8912e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: 0x714380a6586b - std::sys::pal::unix::thread::Thread::new::thread_start::h7725d3f895339174
28: 0x71437ac94ac3 - start_thread
at ./nptl/pthread_create.c:442:8
29: 0x71437ad26850 - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
30: 0x0 - <unknown>