Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: cannot convert '{erased} to a region vid #125564

Open
matthiaskrgr opened this issue May 26, 2024 · 6 comments
Open

ICE: cannot convert '{erased} to a region vid #125564

matthiaskrgr opened this issue May 26, 2024 · 6 comments
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-adt_const_params `#![feature(adt_const_params)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(adt_const_params, generic_const_exprs)]

const fn concat_strs() -> &'static str {
    const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}

    impl<const A: &'static str, const B: &'static str> Inner<A, B>
    where
        [(); A.len()]:,
        [(); B.len()]:,
        [(); A.len() + B.len()]:,
    {
        const ABSTR: &'static str = unsafe {
            std::str::from_utf8_unchecked(&concat_arr(
                A.as_ptr().cast().read(),
                B.as_ptr().cast().read(),
            ))
        };
    }
}

original:

#![feature(adt_const_params, generic_const_exprs)]

const fn concat_strs<const A: &'static str>() -> &'static str {
    const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}

    impl<const A: &'static str, const B: &'static str> Inner<A, B>
    where
        [(); A.len()]:,
        [(); B.len()]:,
        [(); A.len() + B.len()]:,
    {
        const ABSTR: &'static str = unsafe {
            std::str::from_utf8_unchecked(&concat_arr(
                A.as_ptr().cast().read(),
                B.as_ptr().cast().read(),
            ))
        };
    }
}

Version information

rustc 1.80.0-nightly (1ba35e9bb 2024-05-25)
binary: rustc
commit-hash: 1ba35e9bb44d416fc2ebf897855454258b650b01
commit-date: 2024-05-25
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2

Program output

error[E0412]: cannot find type `Inner` in this scope
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:6:56
  |
6 |     impl<const A: &'static str, const B: &'static str> Inner<A, B>
  |                                                        ^^^^^ not found in this scope

warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:1:12
  |
1 | #![feature(adt_const_params, generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^
  |
  = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:1:30
  |
1 | #![feature(adt_const_params, generic_const_exprs)]
  |                              ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:19:2
   |
19 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs`

error[E0308]: mismatched types
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:3:27
  |
3 | const fn concat_strs() -> &'static str {
  |          -----------      ^^^^^^^^^^^^ expected `&str`, found `()`
  |          |
  |          implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:4:84
  |
4 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |              ----------                                                            ^^^^^^^^^^^ expected `[u8; M + N]`, found `()`
  |              |
  |              implicitly returns `()` as its body has no tail or `return` expression
  |
note: consider returning one of these bindings
 --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:4:57
  |
4 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |                                                         ^           ^

warning: type annotations needed
  --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:14:35
   |
14 |                 A.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
   = note: `#[warn(tyvar_behind_raw_pointer)]` on by default

warning: type annotations needed
  --> /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:15:35
   |
15 |                 B.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:880:36: cannot convert `'{erased}` to a region vid

thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:880:36:
Box<dyn Any>
stack backtrace:
   0:     0x786c185c8075 - std::backtrace_rs::backtrace::libunwind::trace::h90fcfe28ddb0241a
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x786c185c8075 - std::backtrace_rs::backtrace::trace_unsynchronized::h295e5065b6a00265
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x786c185c8075 - std::sys_common::backtrace::_print_fmt::hcc6f2b94476e542d
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x786c185c8075 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed2c5e0a0ce6836c
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x786c1861718b - core::fmt::rt::Argument::fmt::h1df61bd36deed924
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/core/src/fmt/rt.rs:165:63
   5:     0x786c1861718b - core::fmt::write::h846d656f7222a8c0
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/core/src/fmt/mod.rs:1172:21
   6:     0x786c185bcdcf - std::io::Write::write_fmt::h67d939b7212f6891
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/io/mod.rs:1835:15
   7:     0x786c185c7e4e - std::sys_common::backtrace::_print::hcb12f24eca79ee8b
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x786c185c7e4e - std::sys_common::backtrace::print::h7a02369029f2cb19
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x786c185ca879 - std::panicking::default_hook::{{closure}}::he817c31d2eff8a0b
  10:     0x786c185ca61a - std::panicking::default_hook::h9dce7ab19378e0f9
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/panicking.rs:298:9
  11:     0x786c150f0160 - std[6f3c54f961bcd653]::panicking::update_hook::<alloc[6e197ba0e7511b9e]::boxed::Box<rustc_driver_impl[297cb1e57032d44d]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x786c185cafab - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h178099f3431bb0b9
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/alloc/src/boxed.rs:2077:9
  13:     0x786c185cafab - std::panicking::rust_panic_with_hook::h114664f4a33b113f
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/panicking.rs:799:13
  14:     0x786c151200b4 - std[6f3c54f961bcd653]::panicking::begin_panic::<rustc_errors[9eb651f4c119cf9e]::ExplicitBug>::{closure#0}
  15:     0x786c1511ce66 - std[6f3c54f961bcd653]::sys_common::backtrace::__rust_end_short_backtrace::<std[6f3c54f961bcd653]::panicking::begin_panic<rustc_errors[9eb651f4c119cf9e]::ExplicitBug>::{closure#0}, !>
  16:     0x786c1511cb46 - std[6f3c54f961bcd653]::panicking::begin_panic::<rustc_errors[9eb651f4c119cf9e]::ExplicitBug>
  17:     0x786c15129651 - <rustc_errors[9eb651f4c119cf9e]::diagnostic::BugAbort as rustc_errors[9eb651f4c119cf9e]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x786c155f81cc - rustc_middle[1e04d1e697039279]::util::bug::opt_span_bug_fmt::<rustc_span[4b65ca1f0ca9c763]::span_encoding::Span>::{closure#0}
  19:     0x786c155dc59a - rustc_middle[1e04d1e697039279]::ty::context::tls::with_opt::<rustc_middle[1e04d1e697039279]::util::bug::opt_span_bug_fmt<rustc_span[4b65ca1f0ca9c763]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x786c155dc41b - rustc_middle[1e04d1e697039279]::ty::context::tls::with_context_opt::<rustc_middle[1e04d1e697039279]::ty::context::tls::with_opt<rustc_middle[1e04d1e697039279]::util::bug::opt_span_bug_fmt<rustc_span[4b65ca1f0ca9c763]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x786c1397b620 - rustc_middle[1e04d1e697039279]::util::bug::bug_fmt
  22:     0x786c167357fb - <rustc_borrowck[edc41e3fea2de417]::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle[1e04d1e697039279]::ty::ParamEnvAnd<rustc_middle[1e04d1e697039279]::traits::query::type_op::ProvePredicate>>
  23:     0x786c1672dd06 - <rustc_borrowck[edc41e3fea2de417]::type_check::TypeVerifier as rustc_middle[1e04d1e697039279]::mir::visit::Visitor>::visit_constant
  24:     0x786c140202cb - <rustc_borrowck[edc41e3fea2de417]::type_check::TypeVerifier as rustc_middle[1e04d1e697039279]::mir::visit::Visitor>::visit_body
  25:     0x786c16719c71 - <rustc_borrowck[edc41e3fea2de417]::type_check::TypeVerifier as rustc_middle[1e04d1e697039279]::mir::visit::Visitor>::visit_operand
  26:     0x786c1401fb9d - <rustc_borrowck[edc41e3fea2de417]::type_check::TypeVerifier as rustc_middle[1e04d1e697039279]::mir::visit::Visitor>::visit_body
  27:     0x786c13ff462b - rustc_borrowck[edc41e3fea2de417]::type_check::type_check
  28:     0x786c13927fd7 - rustc_borrowck[edc41e3fea2de417]::nll::compute_regions
  29:     0x786c172cba6b - rustc_borrowck[edc41e3fea2de417]::do_mir_borrowck
  30:     0x786c172be03e - rustc_query_impl[2b30849480afbfc2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2b30849480afbfc2]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1e04d1e697039279]::query::erase::Erased<[u8; 8usize]>>
  31:     0x786c1676dc84 - rustc_query_system[f641f50659fb4646]::query::plumbing::try_execute_query::<rustc_query_impl[2b30849480afbfc2]::DynamicConfig<rustc_query_system[f641f50659fb4646]::query::caches::VecCache<rustc_span[4b65ca1f0ca9c763]::def_id::LocalDefId, rustc_middle[1e04d1e697039279]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2b30849480afbfc2]::plumbing::QueryCtxt, true>
  32:     0x786c1688a074 - rustc_query_impl[2b30849480afbfc2]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  33:     0x786c16749204 - rustc_interface[2ec5f1d4cd1ff974]::passes::analysis
  34:     0x786c16748395 - rustc_query_impl[2b30849480afbfc2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2b30849480afbfc2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1e04d1e697039279]::query::erase::Erased<[u8; 1usize]>>
  35:     0x786c171c38ce - rustc_query_system[f641f50659fb4646]::query::plumbing::try_execute_query::<rustc_query_impl[2b30849480afbfc2]::DynamicConfig<rustc_query_system[f641f50659fb4646]::query::caches::SingleCache<rustc_middle[1e04d1e697039279]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2b30849480afbfc2]::plumbing::QueryCtxt, true>
  36:     0x786c171c34fa - rustc_query_impl[2b30849480afbfc2]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  37:     0x786c16fb5bce - rustc_interface[2ec5f1d4cd1ff974]::interface::run_compiler::<core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>, rustc_driver_impl[297cb1e57032d44d]::run_compiler::{closure#0}>::{closure#1}
  38:     0x786c16fa2549 - std[6f3c54f961bcd653]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2ec5f1d4cd1ff974]::util::run_in_thread_with_globals<rustc_interface[2ec5f1d4cd1ff974]::util::run_in_thread_pool_with_globals<rustc_interface[2ec5f1d4cd1ff974]::interface::run_compiler<core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>, rustc_driver_impl[297cb1e57032d44d]::run_compiler::{closure#0}>::{closure#1}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>::{closure#0}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>
  39:     0x786c16fa2308 - <<std[6f3c54f961bcd653]::thread::Builder>::spawn_unchecked_<rustc_interface[2ec5f1d4cd1ff974]::util::run_in_thread_with_globals<rustc_interface[2ec5f1d4cd1ff974]::util::run_in_thread_pool_with_globals<rustc_interface[2ec5f1d4cd1ff974]::interface::run_compiler<core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>, rustc_driver_impl[297cb1e57032d44d]::run_compiler::{closure#0}>::{closure#1}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>::{closure#0}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5392e317ecfab49a]::result::Result<(), rustc_span[4b65ca1f0ca9c763]::ErrorGuaranteed>>::{closure#2} as core[5392e317ecfab49a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x786c185d4d8b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfe2f8026e195e1aa
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/alloc/src/boxed.rs:2063:9
  41:     0x786c185d4d8b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3bdc22bc8cf7a921
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/alloc/src/boxed.rs:2063:9
  42:     0x786c185d4d8b - std::sys::pal::unix::thread::Thread::new::thread_start::h9cbf23e48f3c3fdb
                               at /rustc/1ba35e9bb44d416fc2ebf897855454258b650b01/library/std/src/sys/pal/unix/thread.rs:108:17
  43:     0x786c11eaa1cf - <unknown>
  44:     0x786c11f2b6ec - <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-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.80.0-nightly (1ba35e9bb 2024-05-25) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2

query stack during panic:
#0 [mir_borrowck] borrow-checking `concat_strs::<impl at /tmp/icemaker_global_tempdir.VrW7PdSYIB8H/rustc_testrunner_tmpdir_reporting.79VNYkEwgPVK/mvce.rs:6:5: 10:34>::ABSTR`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 4 warnings emitted

Some errors have detailed explanations: E0308, E0412, E0601.
For more information about an error, try `rustc --explain E0308`.

@rustbot label +F-adt_const_params +F-generic_const_exprs

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels May 26, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-adt_const_params `#![feature(adt_const_params)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` labels May 26, 2024
@matthiaskrgr
Copy link
Member Author

#![allow(incomplete_features)]
#![feature(adt_const_params, generic_const_exprs)]
#![allow(dead_code)]

const fn catone<const M: usize>(_a: &[u8; M]) -> [u8; M + 1]
where
    [(); M + 1]:,
{
    unimplemented!()
}

struct Catter<const A: &'static [u8]>;
impl<const A: &'static [u8]> Catter<A>
where
    [(); A.len() + 1]:,
{
    const ZEROS: &'static [u8; A.len()] = &[0_u8; A.len()];
    const R: &'static [u8] = &catone(Self::ZEROS);
}

fn main() {}

@matthiaskrgr
Copy link
Member Author

#125451

@fmease fmease changed the title ICE cannot convert '{erased}` to a region vid ICE cannot convert '{erased} to a region vid May 26, 2024
@fmease fmease changed the title ICE cannot convert '{erased} to a region vid ICE: cannot convert '{erased} to a region vid May 26, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 26, 2024
@Jaic1
Copy link
Contributor

Jaic1 commented Sep 26, 2024

Is this ICE still reproducible now? I cannot reproduce it on my local machine.

Version info:

rustc 1.83.0-nightly (363ae4188 2024-09-24)
binary: rustc
commit-hash: 363ae4188316b8b22cf6c1890bc73d84d05f70a4
commit-date: 2024-09-24
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Test case:

#![allow(incomplete_features)]
#![feature(unsized_const_params, generic_const_exprs)]

const fn concat_strs() -> &'static str {
    const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}

    impl<const A: &'static str, const B: &'static str> Inner<A, B>
    where
        [(); A.len()]:,
        [(); B.len()]:,
        [(); A.len() + B.len()]:,
    {
        const ABSTR: &'static str = unsafe {
            std::str::from_utf8_unchecked(&concat_arr(
                A.as_ptr().cast().read(),
                B.as_ptr().cast().read(),
            ))
        };
    }
}

fn main() {}

Command:

rustc +nightly ice-125564.rs -Zincremental-verify-ich=yes -Cincremental=dir -Cdebuginfo=2
Program Output
error[E0412]: cannot find type `Inner` in this scope
 --> ice-125564.rs:7:56
  |
7 |     impl<const A: &'static str, const B: &'static str> Inner<A, B>
  |                                                        ^^^^^ not found in this scope

error[E0308]: mismatched types
 --> ice-125564.rs:4:27
  |
4 | const fn concat_strs() -> &'static str {
  |          -----------      ^^^^^^^^^^^^ expected `&str`, found `()`
  |          |
  |          implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
 --> ice-125564.rs:5:84
  |
5 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |              ----------                                                            ^^^^^^^^^^^ expected `[u8; M + N]`, found `()`
  |              |
  |              implicitly returns `()` as its body has no tail or `return` expression
  |
note: consider returning one of these bindings
 --> ice-125564.rs:5:57
  |
5 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |                                                         ^           ^

warning: type annotations needed
  --> ice-125564.rs:15:35
   |
15 |                 A.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
   = note: `#[warn(tyvar_behind_raw_pointer)]` on by default

warning: type annotations needed
  --> ice-125564.rs:16:35
   |
16 |                 B.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>

error: aborting due to 3 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`.

@jakehemmerle
Copy link

jakehemmerle commented Oct 3, 2024

Running @Jaic1 's code above, I also got the same exact output.

rustc 1.83.0-nightly (06bb8364a 2024-10-01)
binary: rustc
commit-hash: 06bb8364aaffefb0ce67e5f5445e66ec99c1f66e
commit-date: 2024-10-01
host: aarch64-apple-darwin
release: 1.83.0-nightly
LLVM version: 19.1.0
Details

error[E0412]: cannot find type `Inner` in this scope
 --> test.rs:7:56
  |
7 |     impl<const A: &'static str, const B: &'static str> Inner<A, B>
  |                                                        ^^^^^ not found in this scope

error[E0308]: mismatched types
 --> test.rs:4:27
  |
4 | const fn concat_strs() -> &'static str {
  |          -----------      ^^^^^^^^^^^^ expected `&str`, found `()`
  |          |
  |          implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
 --> test.rs:5:84
  |
5 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |              ----------                                                            ^^^^^^^^^^^ expected `[u8; M + N]`, found `()`
  |              |
  |              implicitly returns `()` as its body has no tail or `return` expression
  |
note: consider returning one of these bindings
 --> test.rs:5:57
  |
5 |     const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
  |                                                         ^           ^

warning: type annotations needed
  --> test.rs:15:35
   |
15 |                 A.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
   = note: `#[warn(tyvar_behind_raw_pointer)]` on by default

warning: type annotations needed
  --> test.rs:16:35
   |
16 |                 B.as_ptr().cast().read(),
   |                                   ^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>

error: aborting due to 3 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`.

@Jaic1
Copy link
Contributor

Jaic1 commented Oct 4, 2024

maybe cc @matthiaskrgr

@matthiaskrgr
Copy link
Member Author

seems to be fixed indeed 👍

@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-adt_const_params `#![feature(adt_const_params)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants