rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.37k stars 12.72k forks source link

ICE: effects: expected region for `'x/#1` (`'x/#1/1`) but found `Type(())` when instantiating args=`[false, ()]` #125877

Open matthiaskrgr opened 5 months ago

matthiaskrgr commented 5 months ago

original:

#![feature(effects)]
#[const_trait]
trait Main {
    fn compute<T: ~const Aux>() -> u32;
}

impl const Main for () {
    fn compute<'x, 'y, 'z: 'x>() -> u32 {}
}

#[const_trait]
trait Aux {}

impl const Aux for () {}

fn main() {
    const _: u32 = <()>::compute::<()>();
}

Version information

rustc 1.80.0-nightly (12b5d3c29 2024-06-02)
binary: rustc
commit-hash: 12b5d3c29c221a4c61f9e6863f4bc1133f3e3403
commit-date: 2024-06-02
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6

Command: /home/matthias/.rustup/toolchains/master/bin/rustc

Program output

``` error[E0658]: const trait impls are experimental --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:4:19 | 4 | fn compute() -> u32; | ^^^^^^ | = note: see issue #67792 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on 2024-06-02; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:7:6 | 7 | impl const Main for () { | ^^^^^ | = note: see issue #67792 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on 2024-06-02; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:14:6 | 14 | impl const Aux for () {} | ^^^^^ | = note: see issue #67792 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on 2024-06-02; consider upgrading it if it is out of date error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:2:1 | 2 | #[const_trait] | ^^^^^^^^^^^^^^ | = note: see issue #67792 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on 2024-06-02; consider upgrading it if it is out of date error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:11:1 | 11 | #[const_trait] | ^^^^^^^^^^^^^^ | = note: see issue #67792 for more information = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on 2024-06-02; consider upgrading it if it is out of date error[E0049]: method `compute` has 0 type parameters but its trait declaration has 1 type parameter --> /tmp/icemaker_global_tempdir.bK55YoS20qrj/rustc_testrunner_tmpdir_reporting.MEMab5bWwSDM/mvce.rs:8:16 | 4 | fn compute() -> u32; | - expected 1 type parameter ... 8 | fn compute<'x, 'y, 'z: 'x>() -> u32 {} | ^^ ^^ ^^ | | | found 0 type parameters thread 'rustc' panicked at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/compiler/rustc_type_ir/src/binder.rs:780:9: expected region for `'x/#1` ('x/#1/1) but found Type(()) when instantiating args=[false, ()] stack backtrace: 0: 0x769a0501dcc5 - std::backtrace_rs::backtrace::libunwind::trace::h5c601cdef598aaa0 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5 1: 0x769a0501dcc5 - std::backtrace_rs::backtrace::trace_unsynchronized::h3304d594bcf5ce4b at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x769a0501dcc5 - std::sys_common::backtrace::_print_fmt::h2549dec49bea2d98 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys_common/backtrace.rs:68:5 3: 0x769a0501dcc5 - ::fmt::h04c91bbe9af2a729 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys_common/backtrace.rs:44:22 4: 0x769a0506e46b - core::fmt::rt::Argument::fmt::h97420e8fd0085884 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/core/src/fmt/rt.rs:165:63 5: 0x769a0506e46b - core::fmt::write::h01dd1670b7b9cf91 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/core/src/fmt/mod.rs:1168:21 6: 0x769a05012a4f - std::io::Write::write_fmt::h90070e824a2a3a2f at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/io/mod.rs:1835:15 7: 0x769a0501da9e - std::sys_common::backtrace::_print::h45ccaa1c1aca1add at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys_common/backtrace.rs:47:5 8: 0x769a0501da9e - std::sys_common::backtrace::print::hf13fbbec12656116 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys_common/backtrace.rs:34:9 9: 0x769a050204d9 - std::panicking::default_hook::{{closure}}::h0560bcddc75439af 10: 0x769a0502027a - std::panicking::default_hook::hb65cbbd101f7744c at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/panicking.rs:298:9 11: 0x769a0173fd30 - std[a775f339eb2c908d]::panicking::update_hook::>::{closure#0} 12: 0x769a05020c0b - as core::ops::function::Fn>::call::hf5609484f859850d at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/alloc/src/boxed.rs:2077:9 13: 0x769a05020c0b - std::panicking::rust_panic_with_hook::hd28b3d7b65cbce3b at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/panicking.rs:799:13 14: 0x769a05020984 - std::panicking::begin_panic_handler::{{closure}}::ha8bcc51435d20919 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/panicking.rs:664:13 15: 0x769a0501e189 - std::sys_common::backtrace::__rust_end_short_backtrace::hc70c274bd540ad18 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys_common/backtrace.rs:171:18 16: 0x769a050206b7 - rust_begin_unwind at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/panicking.rs:652:5 17: 0x769a0506aa03 - core::panicking::panic_fmt::hf39c48c9ef9a4449 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/core/src/panicking.rs:72:14 18: 0x769a01be4195 - >::region_param_expected 19: 0x769a03eae7ef - >::try_fold_with::>.cold 20: 0x769a02c29e77 - as rustc_type_ir[228918f94797f562]::fold::TypeFolder>::fold_ty 21: 0x769a032d1e7d - rustc_ty_utils[19af1cc05f4ff8a6]::abi::fn_abi_of_instance 22: 0x769a032d1bb3 - rustc_query_impl[5794e5c3e93d6bbc]::plumbing::__rust_begin_short_backtrace::> 23: 0x769a032cfb55 - rustc_query_system[3938cdb6d095e7a2]::query::plumbing::try_execute_query::)>, rustc_middle[bef47f67271d9a46]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[5794e5c3e93d6bbc]::plumbing::QueryCtxt, false> 24: 0x769a032cf7af - rustc_query_impl[5794e5c3e93d6bbc]::query_impl::fn_abi_of_instance::get_query_non_incr::__rust_end_short_backtrace 25: 0x769a031c32b3 - >::terminator 26: 0x769a00b4e281 - rustc_const_eval[6ba209fe2493db55]::const_eval::eval_queries::eval_to_allocation_raw_provider 27: 0x769a0310bcb6 - rustc_query_impl[5794e5c3e93d6bbc]::plumbing::__rust_begin_short_backtrace::> 28: 0x769a0310b4d9 - rustc_query_system[3938cdb6d095e7a2]::query::plumbing::try_execute_query::, rustc_middle[bef47f67271d9a46]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[5794e5c3e93d6bbc]::plumbing::QueryCtxt, false> 29: 0x769a0310b0b0 - rustc_query_impl[5794e5c3e93d6bbc]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace 30: 0x769a0310c818 - rustc_const_eval[6ba209fe2493db55]::const_eval::eval_queries::eval_to_const_value_raw_provider 31: 0x769a0310c636 - rustc_query_impl[5794e5c3e93d6bbc]::plumbing::__rust_begin_short_backtrace::> 32: 0x769a0310b49c - rustc_query_system[3938cdb6d095e7a2]::query::plumbing::try_execute_query::, rustc_middle[bef47f67271d9a46]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[5794e5c3e93d6bbc]::plumbing::QueryCtxt, false> 33: 0x769a0310afb2 - rustc_query_impl[5794e5c3e93d6bbc]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace 34: 0x769a031e989f - ::par_body_owners::::{closure#0} 35: 0x769a031e7cf1 - rustc_hir_analysis[8b4104a21d8e4643]::check_crate 36: 0x769a03171cfe - rustc_interface[a03d98276cabf663]::passes::analysis 37: 0x769a0317185b - rustc_query_impl[5794e5c3e93d6bbc]::plumbing::__rust_begin_short_backtrace::> 38: 0x769a0399b465 - rustc_query_system[3938cdb6d095e7a2]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5794e5c3e93d6bbc]::plumbing::QueryCtxt, false> 39: 0x769a0399b1cf - rustc_query_impl[5794e5c3e93d6bbc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 40: 0x769a037eb652 - rustc_interface[a03d98276cabf663]::interface::run_compiler::, rustc_driver_impl[7cac6a613f152b21]::run_compiler::{closure#0}>::{closure#1} 41: 0x769a037d70c9 - std[a775f339eb2c908d]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[7cac6a613f152b21]::run_compiler::{closure#0}>::{closure#1}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>>::{closure#0}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>> 42: 0x769a037d6e7c - <::spawn_unchecked_, rustc_driver_impl[7cac6a613f152b21]::run_compiler::{closure#0}>::{closure#1}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>>::{closure#0}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f142f84f3f08b4f]::result::Result<(), rustc_span[dff96a22867030c9]::ErrorGuaranteed>>::{closure#2} as core[2f142f84f3f08b4f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 43: 0x769a0502abfb - as core::ops::function::FnOnce>::call_once::h73c010387396631a at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/alloc/src/boxed.rs:2063:9 44: 0x769a0502abfb - as core::ops::function::FnOnce>::call_once::hcaeb0c9aa85d79b5 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/alloc/src/boxed.rs:2063:9 45: 0x769a0502abfb - std::sys::pal::unix::thread::Thread::new::thread_start::h51fdb75527a8aba4 at /rustc/12b5d3c29c221a4c61f9e6863f4bc1133f3e3403/library/std/src/sys/pal/unix/thread.rs:108:17 46: 0x7699fe4aa1cf - 47: 0x7699fe52b6ec - 48: 0x0 - 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 make sure that you have updated to the latest nightly note: rustc 1.80.0-nightly (12b5d3c29 2024-06-02) running on x86_64-unknown-linux-gnu query stack during panic: #0 [fn_abi_of_instance] computing call ABI of `::compute` #1 [eval_to_allocation_raw] const-evaluating + checking `main::_` end of query stack error: aborting due to 6 previous errors Some errors have detailed explanations: E0049, E0658. For more information about an error, try `rustc --explain E0049`. ```

@rustbot label +F-effects

cushionbadak commented 5 months ago

By the way, it appears that the two seed files associated with this ICE issue are identical.

1: tests/crashes/121957-1.rs https://github.com/rust-lang/rust/blob/06d99cd6947db110d5b8cd44b91852372083d087/tests/crashes/121957-1.rs#L1-L20

2: tests/crashes/121957-2.rs https://github.com/rust-lang/rust/blob/06d99cd6947db110d5b8cd44b91852372083d087/tests/crashes/121957-2.rs#L1-L20