Closed
Description
auto-reduced (treereduce-rust):
#![feature(effects)]
#![feature(generic_const_exprs)]
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub fn is_transmutable<
Src,
Dst,
const ASSUME_ALIGNMENT: bool,
const ASSUME_LIFETIMES: bool,
const ASSUME_SAFETY: bool,
const ASSUME_VALIDITY: bool,
>()
where
Dst: BikeshedIntrinsicFrom<
Src,
{ }
>,
{}
}
const fn from_options() -> Assume {
#[repr(C)] struct Src;
#[repr(C)] struct Dst;
assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
}
original code
original:
//! The implementation must behave well if const values of wrong types are
//! provided.
#![crate_type = "lib"]
#![feature(adt_const_params)]
#![feature(generic_const_exprs)]
#![feature(transmutability)]
#![allow(dead_code, incomplete_features, non_camel_case_types)]
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub fn is_transmutable<
Src,
Dst,
const ASSUME_ALIGNMENT: bool,
const ASSUME_LIFETIMES: bool,
const ASSUME_SAFETY: bool,
const ASSUME_VALIDITY: bool,
>()
where
Dst: BikeshedIntrinsicFrom<
Src,
{ from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
>,
{}
const fn from_options(
alignment: bool,
lifetimes: bool,
mem: bool,
validity: bool,
) -> Assume {
Assume {
alignment,
lifetimes,
safety,
validity,
}
}
}
const fn from_options(
alignment: bool,
lifetimes: bool,
safety: bool,
validity: bool,
) -> Assume {
#[repr(C)] struct Src;
#[repr(C)] struct Dst;
assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>(); //~ ERROR mismatched types
assert::is_transmutable::<Src, Dst, false, {0u8}, false, false>(); //~ ERROR mismatched types
assert::is_transmutable::<Src, Dst, false, false, {0u8}, false>(); //~ ERROR mismatched types
assert::is_transmutable::<Src, Dst, false, false, false, {0u8}>(); //~ ERROR mismatched types
}
Version information
rustc 1.81.0-nightly (c25ac9d6c 2024-06-12)
binary: rustc
commit-hash: c25ac9d6cc285e57e1176dc2da6848b9d0163810
commit-date: 2024-06-12
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(effects)
Program output
error: expected parameter name, found `,`
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:33:9
|
33 | ,
| ^ expected parameter name
error[E0412]: cannot find type `Assume` in this scope
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:34:10
|
34 | ) -> Assume {
| ^^^^^^ not found in this scope
|
help: consider importing this struct
|
10 + use std::mem::Assume;
|
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:6:12
|
6 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: unused import: `Assume`
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:11:20
|
11 | use std::mem::{Assume, BikeshedIntrinsicFrom};
| ^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unnecessary braces around const expression
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:37:41
|
37 | assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
| ^ ^
|
= note: `#[warn(unused_braces)]` on by default
help: remove these braces
|
37 - assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
37 + assert::is_transmutable::<Src, Dst, 0u8, false, false, false>();
|
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:41:2
|
41 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs`
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:11:20
|
11 | use std::mem::{Assume, BikeshedIntrinsicFrom};
| ^^^^^^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on 2024-06-12; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:11:28
|
11 | use std::mem::{Assume, BikeshedIntrinsicFrom};
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on 2024-06-12; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:22:14
|
22 | Dst: BikeshedIntrinsicFrom<
| ______________^
23 | | Src,
24 | | { }
25 | | >,
| |_________^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on 2024-06-12; consider upgrading it if it is out of date
error[E0308]: mismatched types
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:24:13
|
24 | { }
| ^^^^ expected `Assume`, found `()`
error[E0308]: mismatched types
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:37:42
|
37 | assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
| ^^^ expected `bool`, found `u8`
error: internal compiler error: compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3181:28: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes
--> /tmp/icemaker_global_tempdir.gyO3p0Hj3Cay/rustc_testrunner_tmpdir_reporting.BhKMfGPdeI3U/mvce.rs:37:36
|
37 | assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
| ^^^
thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3181:28:
Box<dyn Any>
stack backtrace:
0: 0x7272e781dae5 - std::backtrace_rs::backtrace::libunwind::trace::h6be50cef0e090531
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x7272e781dae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h84167074cb4f1713
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7272e781dae5 - std::sys_common::backtrace::_print_fmt::hb5cf039fd1f30b07
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7272e781dae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h01adaba1565f117f
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7272e786e77b - core::fmt::rt::Argument::fmt::h2910e36f4e21d32d
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/fmt/rt.rs:165:63
5: 0x7272e786e77b - core::fmt::write::h6d9d2f7ff8571b34
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/fmt/mod.rs:1168:21
6: 0x7272e78126bf - std::io::Write::write_fmt::hd882c0f914f56bf0
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/io/mod.rs:1835:15
7: 0x7272e781d8be - std::sys_common::backtrace::_print::hcc6c907dafd9aacb
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7272e781d8be - std::sys_common::backtrace::print::h2c716a051c9b24be
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7272e78202f9 - std::panicking::default_hook::{{closure}}::he8ad829f77bd4e23
10: 0x7272e782009c - std::panicking::default_hook::heb22a1402d2cff23
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:292:9
11: 0x7272e40b2c9f - std[5c07af62f3786d14]::panicking::update_hook::<alloc[eebcfc85002bd7db]::boxed::Box<rustc_driver_impl[2b4723ede88f52b1]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7272e7820bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd8f0fcaec26c179e
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2076:9
13: 0x7272e7820bff - std::panicking::rust_panic_with_hook::hc9dbad8884217847
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:801:13
14: 0x7272e40e3621 - std[5c07af62f3786d14]::panicking::begin_panic::<rustc_errors[d9dad43edaa48690]::ExplicitBug>::{closure#0}
15: 0x7272e40e03d6 - std[5c07af62f3786d14]::sys_common::backtrace::__rust_end_short_backtrace::<std[5c07af62f3786d14]::panicking::begin_panic<rustc_errors[d9dad43edaa48690]::ExplicitBug>::{closure#0}, !>
16: 0x7272e40e00b6 - std[5c07af62f3786d14]::panicking::begin_panic::<rustc_errors[d9dad43edaa48690]::ExplicitBug>
17: 0x7272e40ecb71 - <rustc_errors[d9dad43edaa48690]::diagnostic::BugAbort as rustc_errors[d9dad43edaa48690]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18: 0x7272e4b40868 - <rustc_errors[d9dad43edaa48690]::DiagCtxt>::span_bug::<rustc_span[9012e0e35e67507c]::span_encoding::Span, alloc[eebcfc85002bd7db]::string::String>
19: 0x7272e4b87e6d - rustc_middle[f645b954b6a941ee]::util::bug::opt_span_bug_fmt::<rustc_span[9012e0e35e67507c]::span_encoding::Span>::{closure#0}
20: 0x7272e4b8830a - rustc_middle[f645b954b6a941ee]::ty::context::tls::with_opt::<rustc_middle[f645b954b6a941ee]::util::bug::opt_span_bug_fmt<rustc_span[9012e0e35e67507c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7272e4b607ab - rustc_middle[f645b954b6a941ee]::ty::context::tls::with_context_opt::<rustc_middle[f645b954b6a941ee]::ty::context::tls::with_opt<rustc_middle[f645b954b6a941ee]::util::bug::opt_span_bug_fmt<rustc_span[9012e0e35e67507c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7272e4b5ef97 - rustc_middle[f645b954b6a941ee]::util::bug::span_bug_fmt::<rustc_span[9012e0e35e67507c]::span_encoding::Span>
23: 0x7272e4c3ea75 - <rustc_infer[fa1e69436ce00111]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[40614f5ce45f7871]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::get_safe_transmute_error_and_reason
24: 0x7272e4c2f2b1 - <rustc_infer[fa1e69436ce00111]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[40614f5ce45f7871]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
25: 0x7272e4c41917 - <rustc_infer[fa1e69436ce00111]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[40614f5ce45f7871]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
26: 0x7272e4c2ba15 - <rustc_infer[fa1e69436ce00111]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[40614f5ce45f7871]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
27: 0x7272e23f3861 - <rustc_hir_typeck[4e714526a792ece6]::fn_ctxt::FnCtxt>::confirm_builtin_call
28: 0x7272e6026ab2 - <rustc_hir_typeck[4e714526a792ece6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
29: 0x7272e6021c41 - <rustc_hir_typeck[4e714526a792ece6]::fn_ctxt::FnCtxt>::check_block_with_expected
30: 0x7272e602724e - <rustc_hir_typeck[4e714526a792ece6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
31: 0x7272e55babee - rustc_hir_typeck[4e714526a792ece6]::check::check_fn
32: 0x7272e55b13fe - rustc_hir_typeck[4e714526a792ece6]::typeck
33: 0x7272e55b0e7b - rustc_query_impl[860f4585269295fe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[860f4585269295fe]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 8usize]>>
34: 0x7272e56b97ee - rustc_query_system[88bb5c8529314a04]::query::plumbing::try_execute_query::<rustc_query_impl[860f4585269295fe]::DynamicConfig<rustc_query_system[88bb5c8529314a04]::query::caches::VecCache<rustc_span[9012e0e35e67507c]::def_id::LocalDefId, rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[860f4585269295fe]::plumbing::QueryCtxt, false>
35: 0x7272e56b82d5 - rustc_query_impl[860f4585269295fe]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
36: 0x7272e56b7f0b - <rustc_middle[f645b954b6a941ee]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[f165ce28b444ebe1]::check_crate::{closure#4}>::{closure#0}
37: 0x7272e56b69bc - rustc_hir_analysis[f165ce28b444ebe1]::check_crate
38: 0x7272e5e4f13e - rustc_interface[8465b2f8b714accd]::passes::analysis
39: 0x7272e5e4ec87 - rustc_query_impl[860f4585269295fe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[860f4585269295fe]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 1usize]>>
40: 0x7272e61f7d25 - rustc_query_system[88bb5c8529314a04]::query::plumbing::try_execute_query::<rustc_query_impl[860f4585269295fe]::DynamicConfig<rustc_query_system[88bb5c8529314a04]::query::caches::SingleCache<rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[860f4585269295fe]::plumbing::QueryCtxt, false>
41: 0x7272e61f7a8f - rustc_query_impl[860f4585269295fe]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
42: 0x7272e60d0952 - rustc_interface[8465b2f8b714accd]::interface::run_compiler::<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}
43: 0x7272e60ef649 - std[5c07af62f3786d14]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8465b2f8b714accd]::util::run_in_thread_with_globals<rustc_interface[8465b2f8b714accd]::util::run_in_thread_pool_with_globals<rustc_interface[8465b2f8b714accd]::interface::run_compiler<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>
44: 0x7272e60ef3fa - <<std[5c07af62f3786d14]::thread::Builder>::spawn_unchecked_<rustc_interface[8465b2f8b714accd]::util::run_in_thread_with_globals<rustc_interface[8465b2f8b714accd]::util::run_in_thread_pool_with_globals<rustc_interface[8465b2f8b714accd]::interface::run_compiler<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#2} as core[207868f0da9fe1eb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x7272e782aa7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd64233370b4bbb13
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2062:9
46: 0x7272e782aa7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8b9a0bf226b4eb10
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2062:9
47: 0x7272e782aa7b - std::sys::pal::unix::thread::Thread::new::thread_start::h25e4cee516ffa27e
at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys/pal/unix/thread.rs:108:17
48: 0x7272e0ca6ded - <unknown>
49: 0x7272e0d2a0dc - <unknown>
50: 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.81.0-nightly (c25ac9d6c 2024-06-12) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(effects) -Z dump-mir-dir=dir
query stack during panic:
#0 [typeck] type-checking `from_options`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0308, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0308`.
@rustbot label +F-adt_const_params +F-generic_const_exprs +F-transmutability +F-effects
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(effects)]``#![feature(generic_const_exprs)]``#![feature(transmutability)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.