Closed
Description
Code
// check-pass
//! The implementation should behave correctly when the `ASSUME` parameters are
//! provided indirectly through an abstraction.
#![crate_type = "lib"]
#![feature(transmutability)]
#![allow(dead_code, incomplete_features, non_camel_case_types)]
mod assert {
use std::mem::BikeshedIntrinsicFrom;
pub fn is_transmutable<
Src,
Dst,
Context,
const ASSUME_ALIGNMENT: bool,
const ASSUME_LIFETIMES: bool,
const ASSUME_VALIDITY: bool,
const ASSUME_VISIBILITY: bool,
>()
where
Dst: BikeshedIntrinsicFrom<
Src,
Context,
ASSUME_ALIGNMENT,
ASSUME_LIFETIMES,
ASSUME_VALIDITY,
ASSUME_VISIBILITY,
>,
{}
}
fn via_const() {
struct Context;
#[repr(C)] struct Src;
#[repr(C)] struct Dst;
const FALSE: bool = false;
assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>();
}
Meta
rustc --version --verbose
:
rustc 1.65.0-nightly (52e003a6e 2022-09-12)
binary: rustc
commit-hash: 52e003a6e93940ae49cbfc806c72ed5b0217cf4e
commit-date: 2022-09-12
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0
Error output
rustc 2abbbf3c158d6067aa29f0c337a40e687485635b.rs -Zsave-analysis
error[E0107]: this trait takes at most 3 generic arguments but 6 generic arguments were supplied
--> 2abbbf3c158d6067aa29f0c337a40e687485635b.rs:22:14
|
22 | Dst: BikeshedIntrinsicFrom<
| ^^^^^^^^^^^^^^^^^^^^^ expected at most 3 generic arguments
...
26 | / ASSUME_LIFETIMES,
27 | | ASSUME_VALIDITY,
28 | | ASSUME_VISIBILITY,
| |_____________________________- help: remove these generic arguments
|
note: trait defined here, with at most 3 generic parameters: `Src`, `Context`, `ASSUME`
--> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/mem/transmutability.rs:12:18
|
12 | pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
| ^^^^^^^^^^^^^^^^^^^^^ --- ------- ------------------------------------------
thread 'rustc' panicked at 'The given `Const` must be an ADT.', compiler/rustc_transmute/src/lib.rs:129:27
stack backtrace:
0: 0x7f68f28deae0 - std::backtrace_rs::backtrace::libunwind::trace::h1c2ca0e3b42eaee9
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f68f28deae0 - std::backtrace_rs::backtrace::trace_unsynchronized::hd0d0dff3b385c10d
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f68f28deae0 - std::sys_common::backtrace::_print_fmt::h3851320453a7905a
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f68f28deae0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdc1f5f5a5ec68c4f
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f68f293998e - core::fmt::write::ha881914735928258
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/core/src/fmt/mod.rs:1202:17
5: 0x7f68f28cf3a5 - std::io::Write::write_fmt::h81e30ab88fd106fb
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/io/mod.rs:1679:15
6: 0x7f68f28e1793 - std::sys_common::backtrace::_print::he2273e403fb56617
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f68f28e1793 - std::sys_common::backtrace::print::h81209fa6fac724dc
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f68f28e1793 - std::panicking::default_hook::{{closure}}::hef76e7b6f73cf52c
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/panicking.rs:295:22
9: 0x7f68f28e147f - std::panicking::default_hook::h1918d0720840f772
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/panicking.rs:314:9
10: 0x7f68f5155091 - rustc_driver[a054b29372bf3d00]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f68f28e1fcd - std::panicking::rust_panic_with_hook::he49130873518bb61
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/panicking.rs:702:17
12: 0x7f68f28e1e27 - std::panicking::begin_panic_handler::{{closure}}::h16dc09d2016cb140
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/panicking.rs:588:13
13: 0x7f68f28def8c - std::sys_common::backtrace::__rust_end_short_backtrace::h21c54107da161fbe
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys_common/backtrace.rs:138:18
14: 0x7f68f28e1b42 - rust_begin_unwind
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/panicking.rs:584:5
15: 0x7f68f2936563 - core::panicking::panic_fmt::h6789db8417e42777
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/core/src/panicking.rs:142:14
16: 0x7f68f2936421 - core::panicking::panic_display::h0847cc760c608118
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/core/src/panicking.rs:72:5
17: 0x7f68f29363cb - core::panicking::panic_str::h043976e0ee1af89d
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/core/src/panicking.rs:56:5
18: 0x7f68f2936106 - core::option::expect_failed::h1e776128c0a3a3bd
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/core/src/option.rs:1880:5
19: 0x7f68f6067a50 - <rustc_transmute[d19b7036f8ea2373]::Assume>::from_const
20: 0x7f68f3af93cb - <rustc_trait_selection[e3078ee5a849d5ae]::traits::select::SelectionContext>::confirm_candidate
21: 0x7f68f473451d - <rustc_trait_selection[e3078ee5a849d5ae]::traits::select::SelectionContext>::evaluate_stack
22: 0x7f68f438a2a7 - <rustc_trait_selection[e3078ee5a849d5ae]::traits::select::SelectionContext>::evaluate_predicate_recursively
23: 0x7f68f4389841 - <rustc_trait_selection[e3078ee5a849d5ae]::traits::select::SelectionContext>::evaluate_root_obligation
24: 0x7f68f43882ae - <rustc_infer[b63748091100ed8c]::infer::InferCtxtBuilder>::enter_with_canonical::<rustc_middle[a24124e45df50e2f]::ty::ParamEnvAnd<rustc_middle[a24124e45df50e2f]::ty::Predicate>, core[b238962d2d57df33]::result::Result<rustc_middle[a24124e45df50e2f]::traits::select::EvaluationResult, rustc_middle[a24124e45df50e2f]::traits::select::OverflowError>, rustc_traits[1008b83a028d6294]::evaluate_obligation::evaluate_obligation::{closure#0}>
25: 0x7f68f4387b43 - rustc_traits[1008b83a028d6294]::evaluate_obligation::evaluate_obligation
26: 0x7f68f4621046 - rustc_query_system[256085fdb334aba0]::query::plumbing::get_query::<rustc_query_impl[ced6625f8be067e9]::queries::evaluate_obligation, rustc_query_impl[ced6625f8be067e9]::plumbing::QueryCtxt>
27: 0x7f68f4620c05 - <rustc_query_impl[ced6625f8be067e9]::Queries as rustc_middle[a24124e45df50e2f]::ty::query::QueryEngine>::evaluate_obligation
28: 0x7f68f3cf3838 - <rustc_trait_selection[e3078ee5a849d5ae]::traits::fulfill::FulfillProcessor as rustc_data_structures[5d1944ccce21f6dd]::obligation_forest::ObligationProcessor>::process_obligation
29: 0x7f68f3cef4dc - <rustc_data_structures[5d1944ccce21f6dd]::obligation_forest::ObligationForest<rustc_trait_selection[e3078ee5a849d5ae]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[e3078ee5a849d5ae]::traits::fulfill::FulfillProcessor, rustc_data_structures[5d1944ccce21f6dd]::obligation_forest::Outcome<rustc_trait_selection[e3078ee5a849d5ae]::traits::fulfill::PendingPredicateObligation, rustc_infer[b63748091100ed8c]::traits::FulfillmentErrorCode>>
30: 0x7f68f3ceefc6 - <rustc_trait_selection[e3078ee5a849d5ae]::traits::fulfill::FulfillmentContext as rustc_infer[b63748091100ed8c]::traits::engine::TraitEngine>::select_where_possible
31: 0x7f68f3d3c769 - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_argument_types
32: 0x7f68f3ce557e - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_call
33: 0x7f68f3cb0c0b - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
34: 0x7f68f3cdf032 - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_block_with_expected
35: 0x7f68f3cb0d34 - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
36: 0x7f68f47c46e6 - <rustc_typeck[f9fb96d1f3240f55]::check::fn_ctxt::FnCtxt>::check_return_expr
37: 0x7f68f47c1f77 - rustc_typeck[f9fb96d1f3240f55]::check::check::check_fn
38: 0x7f68f47b2cc8 - <rustc_infer[b63748091100ed8c]::infer::InferCtxtBuilder>::enter::<&rustc_middle[a24124e45df50e2f]::ty::context::TypeckResults, <rustc_typeck[f9fb96d1f3240f55]::check::inherited::InheritedBuilder>::enter<rustc_typeck[f9fb96d1f3240f55]::check::typeck_with_fallback<rustc_typeck[f9fb96d1f3240f55]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[a24124e45df50e2f]::ty::context::TypeckResults>::{closure#0}>
39: 0x7f68f47b0f09 - rustc_typeck[f9fb96d1f3240f55]::check::typeck
40: 0x7f68f49b1763 - rustc_query_system[256085fdb334aba0]::query::plumbing::try_execute_query::<rustc_query_impl[ced6625f8be067e9]::plumbing::QueryCtxt, rustc_query_system[256085fdb334aba0]::query::caches::DefaultCache<rustc_span[36846d30320f513e]::def_id::LocalDefId, &rustc_middle[a24124e45df50e2f]::ty::context::TypeckResults>>
41: 0x7f68f509c8b3 - <rustc_query_impl[ced6625f8be067e9]::Queries as rustc_middle[a24124e45df50e2f]::ty::query::QueryEngine>::typeck
42: 0x7f68f519b2d2 - <rustc_save_analysis[e5c0ef7964d7ec38]::dump_visitor::DumpVisitor as rustc_hir[ede12ac116e4c0dd]::intravisit::Visitor>::visit_item
43: 0x7f68f5193006 - <rustc_save_analysis[e5c0ef7964d7ec38]::dump_visitor::DumpVisitor as rustc_hir[ede12ac116e4c0dd]::intravisit::Visitor>::visit_nested_item
44: 0x7f68f51bf477 - rustc_hir[ede12ac116e4c0dd]::intravisit::walk_mod::<rustc_save_analysis[e5c0ef7964d7ec38]::dump_visitor::DumpVisitor>
45: 0x7f68f519733d - <rustc_save_analysis[e5c0ef7964d7ec38]::dump_visitor::DumpVisitor>::process_crate
46: 0x7f68f516e4ea - <rustc_middle[a24124e45df50e2f]::dep_graph::dep_node::DepKind as rustc_query_system[256085fdb334aba0]::dep_graph::DepKind>::with_deps::<rustc_save_analysis[e5c0ef7964d7ec38]::process_crate<rustc_save_analysis[e5c0ef7964d7ec38]::DumpHandler>::{closure#0}, ()>
47: 0x7f68f5183432 - rustc_save_analysis[e5c0ef7964d7ec38]::process_crate::<rustc_save_analysis[e5c0ef7964d7ec38]::DumpHandler>
48: 0x7f68f5164355 - <rustc_session[a50bb367cd7c215b]::session::Session>::time::<(), rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}::{closure#2}::{closure#3}::{closure#0}>
49: 0x7f68f3f0c9e8 - <rustc_interface[7d9ecf7fedc15f38]::passes::QueryContext>::enter::<rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>
50: 0x7f68f3f0025c - rustc_interface[7d9ecf7fedc15f38]::interface::create_compiler_and_run::<core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>, rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}>
51: 0x7f68f3efeba1 - <scoped_tls[4ddec3e49b1e7bc3]::ScopedKey<rustc_span[36846d30320f513e]::SessionGlobals>>::set::<rustc_interface[7d9ecf7fedc15f38]::interface::run_compiler<core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>, rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}>::{closure#0}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>
52: 0x7f68f3efe88f - std[c9bb85619de87dc0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7d9ecf7fedc15f38]::util::run_in_thread_pool_with_globals<rustc_interface[7d9ecf7fedc15f38]::interface::run_compiler<core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>, rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}>::{closure#0}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>::{closure#0}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>
53: 0x7f68f4fc2e10 - <<std[c9bb85619de87dc0]::thread::Builder>::spawn_unchecked_<rustc_interface[7d9ecf7fedc15f38]::util::run_in_thread_pool_with_globals<rustc_interface[7d9ecf7fedc15f38]::interface::run_compiler<core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>, rustc_driver[a054b29372bf3d00]::run_compiler::{closure#1}>::{closure#0}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>::{closure#0}, core[b238962d2d57df33]::result::Result<(), rustc_errors[eaf6ef1658443b65]::ErrorGuaranteed>>::{closure#1} as core[b238962d2d57df33]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
54: 0x7f68f28ebda3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9d94991792052068
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/alloc/src/boxed.rs:1940:9
55: 0x7f68f28ebda3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0cfd73444d1fba49
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/alloc/src/boxed.rs:1940:9
56: 0x7f68f28ebda3 - std::sys::unix::thread::Thread::new::thread_start::h5b75e3993bacfde3
at /rustc/52e003a6e93940ae49cbfc806c72ed5b0217cf4e/library/std/src/sys/unix/thread.rs:108:17
57: 0x7f68f264478d - <unknown>
58: 0x7f68f26c58e4 - clone
59: 0x0 - <unknown>
error: internal compiler error: unexpected panic
note: 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: rustc 1.65.0-nightly (52e003a6e 2022-09-12) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z save-analysis
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `via_const::Dst: core::mem::transmutability::BikeshedIntrinsicFrom<via_const::Src, via_const::Context, false>`
#1 [typeck] type-checking `via_const`
end of query stack
error: aborting due to previous error
For more information about this error, try `rustc --explain E0107`.
Backtrace
<backtrace>