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: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes #110969

Closed
matthiaskrgr opened this issue Apr 28, 2023 · 6 comments
Closed
Assignees
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 28, 2023

Code

#![feature(adt_const_params, generic_const_exprs)]

mod assert {
    use std::mem::BikeshedIntrinsicFrom;

    pub fn is_transmutable<Src, Dst, Context, const ASSUME: std::mem::Assume>()
    where
        Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
    {
    }
}

fn via_associated_const() {
    struct Context;
    #[repr(C)]
    struct Src;
    #[repr(C)]
    struct Dst;

    trait Trait {
        const FALSE: bool = assert::is_transmutable::<Src, Dst, Context, {}>();
    }
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (1a6ae3d69 2023-04-27)
binary: rustc
commit-hash: 1a6ae3d692cfb52b21d0f45ba50b659486e53d6c
commit-date: 2023-04-27
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/compiler/rustc_errors/src/lib.rs:994:33
stack backtrace:
   0:     0x7f9426968dd3 - std::backtrace_rs::backtrace::libunwind::trace::h6e4c3ff5deb44997
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9426968dd3 - std::backtrace_rs::backtrace::trace_unsynchronized::he3e7c373d8655f6e
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9426968dd3 - std::sys_common::backtrace::_print_fmt::h774256cf97fa2301
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9426968dd3 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h36eaa86a8ee6a367
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f94269c9d1f - core::fmt::write::h3c0ebeb8db84710a
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/core/src/fmt/mod.rs:1247:17
   5:     0x7f942695bf31 - std::io::Write::write_fmt::ha0a9fca2cc6c86f4
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/io/mod.rs:1712:15
   6:     0x7f9426968be5 - std::sys_common::backtrace::_print::he1934fb1298af79f
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f9426968be5 - std::sys_common::backtrace::print::h22b3a24893f55e19
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f942696b7a7 - std::panicking::default_hook::{{closure}}::h4cfc297c99c00c80
   9:     0x7f942696b595 - std::panicking::default_hook::h38264502a1c86629
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/panicking.rs:288:9
  10:     0x7f9429bcd995 - <rustc_driver_impl[665c2c951ba5c700]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[4d2c7613b0460bf9]::ops::function::FnOnce<(&core[4d2c7613b0460bf9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f942696bee5 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3fc27fbd0b808503
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/alloc/src/boxed.rs:1976:9
  12:     0x7f942696bee5 - std::panicking::rust_panic_with_hook::h1e1e5ea0c75de1ac
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/panicking.rs:695:13
  13:     0x7f942a7835b1 - std[7c935f5e62ac4d4a]::panicking::begin_panic::<rustc_errors[e55e3e6173e5f1b2]::ExplicitBug>::{closure#0}
  14:     0x7f942a77f7e6 - std[7c935f5e62ac4d4a]::sys_common::backtrace::__rust_end_short_backtrace::<std[7c935f5e62ac4d4a]::panicking::begin_panic<rustc_errors[e55e3e6173e5f1b2]::ExplicitBug>::{closure#0}, !>
  15:     0x7f942a7c6b86 - std[7c935f5e62ac4d4a]::panicking::begin_panic::<rustc_errors[e55e3e6173e5f1b2]::ExplicitBug>
  16:     0x7f942a74ebd0 - <rustc_errors[e55e3e6173e5f1b2]::HandlerInner>::span_bug::<rustc_span[345a043cb23f5451]::span_encoding::Span, &alloc[2599f363fb6da781]::string::String>
  17:     0x7f942a74ea07 - <rustc_errors[e55e3e6173e5f1b2]::Handler>::span_bug::<rustc_span[345a043cb23f5451]::span_encoding::Span, &alloc[2599f363fb6da781]::string::String>
  18:     0x7f942a7420eb - rustc_middle[2e211ef8f51c3e9f]::util::bug::opt_span_bug_fmt::<rustc_span[345a043cb23f5451]::span_encoding::Span>::{closure#0}
  19:     0x7f942a74213a - rustc_middle[2e211ef8f51c3e9f]::ty::context::tls::with_opt::<rustc_middle[2e211ef8f51c3e9f]::util::bug::opt_span_bug_fmt<rustc_span[345a043cb23f5451]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7f942a72d94a - rustc_middle[2e211ef8f51c3e9f]::ty::context::tls::with_context_opt::<rustc_middle[2e211ef8f51c3e9f]::ty::context::tls::with_opt<rustc_middle[2e211ef8f51c3e9f]::util::bug::opt_span_bug_fmt<rustc_span[345a043cb23f5451]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7f942a72d684 - rustc_middle[2e211ef8f51c3e9f]::util::bug::span_bug_fmt::<rustc_span[345a043cb23f5451]::span_encoding::Span>
  22:     0x7f942a816b02 - <rustc_infer[5b810fe4891e76cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[23d6d08c417822be]::traits::error_reporting::InferCtxtPrivExt>::get_safe_transmute_error_and_reason
  23:     0x7f942a81095d - <rustc_infer[5b810fe4891e76cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[23d6d08c417822be]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
  24:     0x7f942a81b501 - <rustc_infer[5b810fe4891e76cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[23d6d08c417822be]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  25:     0x7f942a80eae6 - <rustc_infer[5b810fe4891e76cb]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[23d6d08c417822be]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  26:     0x7f9427d4ce6e - <rustc_hir_typeck[78d1f94bea54683c]::fn_ctxt::FnCtxt>::check_argument_types
  27:     0x7f9427d390b5 - <rustc_hir_typeck[78d1f94bea54683c]::fn_ctxt::FnCtxt>::check_call
  28:     0x7f9428122c56 - <rustc_hir_typeck[78d1f94bea54683c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7f94281317bb - <rustc_hir_typeck[78d1f94bea54683c]::fn_ctxt::FnCtxt>::check_expr_coercible_to_type
  30:     0x7f94282d8354 - rustc_hir_typeck[78d1f94bea54683c]::typeck
  31:     0x7f94282cd1a2 - rustc_query_system[8ee6a44bbdd9789e]::query::plumbing::try_execute_query::<rustc_query_impl[b74813339e67425]::queries::typeck, rustc_query_impl[b74813339e67425]::plumbing::QueryCtxt>
  32:     0x7f94288542e3 - rustc_query_system[8ee6a44bbdd9789e]::query::plumbing::try_execute_query::<rustc_query_impl[b74813339e67425]::queries::used_trait_imports, rustc_query_impl[b74813339e67425]::plumbing::QueryCtxt>
  33:     0x7f942901c055 - rustc_hir_analysis[4f0f3b855eb4184d]::check_crate
  34:     0x7f942900fcb3 - rustc_interface[9d89f9644268c7b1]::passes::analysis
  35:     0x7f9429344e22 - rustc_query_system[8ee6a44bbdd9789e]::query::plumbing::try_execute_query::<rustc_query_impl[b74813339e67425]::queries::analysis, rustc_query_impl[b74813339e67425]::plumbing::QueryCtxt>
  36:     0x7f9429344b30 - <rustc_query_impl[b74813339e67425]::Queries as rustc_middle[2e211ef8f51c3e9f]::ty::query::QueryEngine>::analysis
  37:     0x7f9428dd2bda - <rustc_middle[2e211ef8f51c3e9f]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[665c2c951ba5c700]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>>
  38:     0x7f9428dd1e18 - <rustc_interface[9d89f9644268c7b1]::interface::Compiler>::enter::<rustc_driver_impl[665c2c951ba5c700]::run_compiler::{closure#1}::{closure#2}, core[4d2c7613b0460bf9]::result::Result<core[4d2c7613b0460bf9]::option::Option<rustc_interface[9d89f9644268c7b1]::queries::Linker>, rustc_span[345a043cb23f5451]::ErrorGuaranteed>>
  39:     0x7f9428dcfe3f - rustc_span[345a043cb23f5451]::set_source_map::<core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>, rustc_interface[9d89f9644268c7b1]::interface::run_compiler<core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>, rustc_driver_impl[665c2c951ba5c700]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  40:     0x7f9428dcf4d0 - std[7c935f5e62ac4d4a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9d89f9644268c7b1]::util::run_in_thread_pool_with_globals<rustc_interface[9d89f9644268c7b1]::interface::run_compiler<core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>, rustc_driver_impl[665c2c951ba5c700]::run_compiler::{closure#1}>::{closure#0}, core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>>
  41:     0x7f9428dcedf1 - <<std[7c935f5e62ac4d4a]::thread::Builder>::spawn_unchecked_<rustc_interface[9d89f9644268c7b1]::util::run_in_thread_pool_with_globals<rustc_interface[9d89f9644268c7b1]::interface::run_compiler<core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>, rustc_driver_impl[665c2c951ba5c700]::run_compiler::{closure#1}>::{closure#0}, core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4d2c7613b0460bf9]::result::Result<(), rustc_span[345a043cb23f5451]::ErrorGuaranteed>>::{closure#1} as core[4d2c7613b0460bf9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f94269763f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heda7e3f0ddfef0e0
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/alloc/src/boxed.rs:1962:9
  43:     0x7f94269763f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8175f644b868a011
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/alloc/src/boxed.rs:1962:9
  44:     0x7f94269763f5 - std::sys::unix::thread::Thread::new::thread_start::hcd7d2cf5c9a6a624
                               at /rustc/1a6ae3d692cfb52b21d0f45ba50b659486e53d6c/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7f9426710bb5 - <unknown>
  46:     0x7f9426792d90 - <unknown>
  47:                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: rustc 1.71.0-nightly (1a6ae3d69 2023-04-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `via_associated_const::Trait::FALSE`
#1 [used_trait_imports] finding used_trait_imports `via_associated_const::Trait::FALSE`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors; 2 warnings emitted

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

@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. requires-nightly This issue requires a nightly compiler in some way. labels Apr 28, 2023
@matthiaskrgr
Copy link
Member Author

Seems to be another issue of #109800 cc @bryangarza

@bryangarza
Copy link
Contributor

bryangarza commented Apr 29, 2023

Great! Thanks.

@rustbot
Copy link
Collaborator

rustbot commented Apr 29, 2023

Error: Parsing assign command in comment failed: ...' assign ' | error: specify user to assign to at >| ''...

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@bryangarza
Copy link
Contributor

@rustbot claim

@matthiaskrgr
Copy link
Member Author

Great! Thanks.

not sure if that was sarcasm or not 🙈

@bryangarza
Copy link
Contributor

Great! Thanks.

not sure if that was sarcasm or not 🙈

Lol, it wasn't 😂 I appreciate you finding these ICEs :)

bryangarza added a commit to bryangarza/rust that referenced this issue Jul 20, 2023
This patch updates the code that constructs the `Assume` type to return an
error instead of silently falling back to a default `Assume`. This fixes an ICE
where error reporting would get a different `is_transmutable` result that is
inconsistent with the original one computed during trait confirmation.

Fixes rust-lang#110969
@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 Apr 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 27, 2024
@bors bors closed this as completed in 012f9e2 Apr 28, 2024
blyxyas pushed a commit to blyxyas/rust that referenced this issue Apr 28, 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants