Closed
Description
auto-reduced (treereduce-rust):
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub fn is_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src>,
{
}
}
fn test() {
#[repr(C)]
struct Src {
a: &'a str,
g: G,
}
assert::is_transmutable::<&mut Src, &mut Dst>();
}
original:
//@ check-pass
//! When safety is assumed, a transmutation over exclusive references should be
//! accepted if the source type potentially carries safety invariants.
#![crate_type = "lib"]
#![feature(transmutability)]
#![allow(dead_code)]
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub fn is_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }>
{}
}
fn test() {
#[repr(C)]
struct Src {
a: &'a str,
g: G,
}
type Dst = u8;
assert::is_transmutable::<&mut Src, &mut Dst>();
}
Version information
rustc 1.82.0-nightly (4d5b3b196 2024-08-20)
binary: rustc
commit-hash: 4d5b3b196284aded6ae99d12bcf149ffdc8ef379
commit-date: 2024-08-20
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0261]: use of undeclared lifetime name `'a`
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:14:13
|
13 | struct Src {
| - help: consider introducing lifetime `'a` here: `<'a>`
14 | a: &'a str,
| ^^ undeclared lifetime
error[E0412]: cannot find type `G` in this scope
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:15:12
|
15 | g: G,
| ^ not found in this scope
|
help: you might be missing a type parameter
|
13 | struct Src<G> {
| +++
error[E0412]: cannot find type `Dst` in this scope
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:18:46
|
18 | assert::is_transmutable::<&mut Src, &mut Dst>();
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
11 | fn test<Dst>() {
| +++++
warning: unused import: `Assume`
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:2:20
|
2 | use std::mem::{Assume, BikeshedIntrinsicFrom};
| ^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:19:2
|
19 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs`
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:2:20
|
2 | 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-08-20; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:2:28
|
2 | 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-08-20; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'transmutability'
--> /tmp/icemaker_global_tempdir.11e6Po1ssj9b/rustc_testrunner_tmpdir_reporting.TfSZCUR9yS0l/mvce.rs:6:14
|
6 | Dst: BikeshedIntrinsicFrom<Src>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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-08-20; consider upgrading it if it is out of date
thread 'rustc' panicked at compiler/rustc_transmute/src/layout/tree.rs:488:49:
called `Result::unwrap()` on an `Err` value: ReferencesError(ErrorGuaranteed(()))
stack backtrace:
0: 0x75f78cfbc8bd - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf9983800a10aa2c6
1: 0x75f78d805457 - core::fmt::write::h878015f659953925
2: 0x75f78e799351 - std::io::Write::write_fmt::h3c30dbfe90a8ec80
3: 0x75f78cfbef9b - std::panicking::default_hook::{{closure}}::h4de9d0974edce2a2
4: 0x75f78cfbec0e - std::panicking::default_hook::h37c112ea75e0ed52
5: 0x75f78c140db9 - std[ad0fe81d36b825dd]::panicking::update_hook::<alloc[80838699efa87670]::boxed::Box<rustc_driver_impl[e626c935ad353586]::install_ice_hook::{closure#0}>>::{closure#0}
6: 0x75f78cfbf8b7 - std::panicking::rust_panic_with_hook::he404808eae2fa6a3
7: 0x75f78cfbf577 - std::panicking::begin_panic_handler::{{closure}}::h2e0f2172b8396a90
8: 0x75f78cfbcd79 - std::sys::backtrace::__rust_end_short_backtrace::h8e04dc1a1de87bcf
9: 0x75f78cfbf244 - rust_begin_unwind
10: 0x75f789e9bd73 - core::panicking::panic_fmt::h7c850fd3e66ca6f3
11: 0x75f789f5aad6 - core::result::unwrap_failed::h8a305cb559451044
12: 0x75f78cefad67 - <rustc_transmute[a3340d9efd954e09]::layout::tree::Tree<rustc_transmute[a3340d9efd954e09]::layout::rustc::Def, rustc_transmute[a3340d9efd954e09]::layout::rustc::Ref>>::from_ty
13: 0x75f78ceff8b7 - <rustc_transmute[a3340d9efd954e09]::rustc::TransmuteTypeEnv>::is_transmutable
14: 0x75f78e58180e - <rustc_trait_selection[c090ce818561ca7c]::traits::select::SelectionContext>::poly_select::{closure#0}
15: 0x75f789e60970 - <rustc_trait_selection[c090ce818561ca7c]::traits::fulfill::FulfillProcessor as rustc_data_structures[c066231c7fa32b84]::obligation_forest::ObligationProcessor>::process_obligation
16: 0x75f78d8087f7 - <rustc_data_structures[c066231c7fa32b84]::obligation_forest::ObligationForest<rustc_trait_selection[c090ce818561ca7c]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[c090ce818561ca7c]::traits::fulfill::FulfillProcessor>
17: 0x75f78a4aa3f3 - <rustc_hir_typeck[35f980454f904813]::fn_ctxt::FnCtxt>::confirm_builtin_call
18: 0x75f78e2d8e65 - <rustc_hir_typeck[35f980454f904813]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
19: 0x75f78e2d21fd - <rustc_hir_typeck[35f980454f904813]::fn_ctxt::FnCtxt>::check_block_with_expected
20: 0x75f78e2d96c8 - <rustc_hir_typeck[35f980454f904813]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
21: 0x75f78d8c01b7 - rustc_hir_typeck[35f980454f904813]::check::check_fn
22: 0x75f78deda8f2 - rustc_hir_typeck[35f980454f904813]::typeck
23: 0x75f78deda335 - rustc_query_impl[c25b9b67542a1b7e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c25b9b67542a1b7e]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b9d4f7314f7035ba]::query::erase::Erased<[u8; 8usize]>>
24: 0x75f78db84e7d - rustc_query_system[33396c7944b94add]::query::plumbing::try_execute_query::<rustc_query_impl[c25b9b67542a1b7e]::DynamicConfig<rustc_query_system[33396c7944b94add]::query::caches::VecCache<rustc_span[bd867921c9292620]::def_id::LocalDefId, rustc_middle[b9d4f7314f7035ba]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c25b9b67542a1b7e]::plumbing::QueryCtxt, false>
25: 0x75f78db84095 - rustc_query_impl[c25b9b67542a1b7e]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
26: 0x75f78db83d1b - <rustc_middle[b9d4f7314f7035ba]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[9db2b2b48bb4004b]::check_crate::{closure#4}>::{closure#0}
27: 0x75f78db81a64 - rustc_hir_analysis[9db2b2b48bb4004b]::check_crate
28: 0x75f78db7a27f - rustc_interface[91cc5f479e6877b9]::passes::run_required_analyses
29: 0x75f78e351bde - rustc_interface[91cc5f479e6877b9]::passes::analysis
30: 0x75f78e351bb1 - rustc_query_impl[c25b9b67542a1b7e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c25b9b67542a1b7e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b9d4f7314f7035ba]::query::erase::Erased<[u8; 1usize]>>
31: 0x75f78e76b46e - rustc_query_system[33396c7944b94add]::query::plumbing::try_execute_query::<rustc_query_impl[c25b9b67542a1b7e]::DynamicConfig<rustc_query_system[33396c7944b94add]::query::caches::SingleCache<rustc_middle[b9d4f7314f7035ba]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c25b9b67542a1b7e]::plumbing::QueryCtxt, false>
32: 0x75f78e76b1cf - rustc_query_impl[c25b9b67542a1b7e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
33: 0x75f78e5e57aa - rustc_interface[91cc5f479e6877b9]::interface::run_compiler::<core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>, rustc_driver_impl[e626c935ad353586]::run_compiler::{closure#0}>::{closure#1}
34: 0x75f78e672a90 - std[ad0fe81d36b825dd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[91cc5f479e6877b9]::util::run_in_thread_with_globals<rustc_interface[91cc5f479e6877b9]::util::run_in_thread_pool_with_globals<rustc_interface[91cc5f479e6877b9]::interface::run_compiler<core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>, rustc_driver_impl[e626c935ad353586]::run_compiler::{closure#0}>::{closure#1}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>::{closure#0}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>
35: 0x75f78e6730fa - <<std[ad0fe81d36b825dd]::thread::Builder>::spawn_unchecked_<rustc_interface[91cc5f479e6877b9]::util::run_in_thread_with_globals<rustc_interface[91cc5f479e6877b9]::util::run_in_thread_pool_with_globals<rustc_interface[91cc5f479e6877b9]::interface::run_compiler<core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>, rustc_driver_impl[e626c935ad353586]::run_compiler::{closure#0}>::{closure#1}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>::{closure#0}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a74943f2cbe9718]::result::Result<(), rustc_span[bd867921c9292620]::ErrorGuaranteed>>::{closure#1} as core[4a74943f2cbe9718]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x75f78e67346b - std::sys::pal::unix::thread::Thread::new::thread_start::hf4aaee2b23b0d10a
37: 0x75f788aa339d - <unknown>
38: 0x75f788b2849c - <unknown>
39: 0x0 - <unknown>
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.82.0-nightly (4d5b3b196 2024-08-20) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `test`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0261, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0261`.
@rustbot label +F-transmutability