-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 "raw ptr comparison should already be caught in the trait system" #105047
Comments
This also reproduces on stable with function pointers (example adapted from #70861): fn foo() {}
const FOO: fn() = foo;
fn bar() {}
const BAR: fn() = bar;
const fn hello() {
match FOO {
FOO => (),
BAR => (),
_ => unreachable!(),
}
} Gives the same ICE:
Backtrace:
```
thread 'rustc' panicked at 'Box', /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
0: 0x7fa9c242ebaa - std::backtrace_rs::backtrace::libunwind::trace::h9d4d46a1241d4149
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fa9c242ebaa - std::backtrace_rs::backtrace::trace_unsynchronized::h1d977e0ccdc95d1a
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fa9c242ebaa - std::sys_common::backtrace::_print_fmt::h2f16d6748c69c3cb
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7fa9c242ebaa - ::fmt::h23aff7f8c54e6645
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fa9c2492b4f - core::fmt::write::h79726c2a902099f4
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/core/src/fmt/mod.rs:1254:17
5: 0x7fa9c24217e5 - std::io::Write::write_fmt::h95eedad6917eaf86
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/io/mod.rs:1698:15
6: 0x7fa9c242e975 - std::sys_common::backtrace::_print::h24fa32acab53acd8
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7fa9c242e975 - std::sys_common::backtrace::print::h94b47d816d0ea14c
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7fa9c243161e - std::panicking::default_hook::{{closure}}::h3bfad4b8b9ac0389
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:271:22
9: 0x7fa9c24313c5 - std::panicking::default_hook::hd7b308d8bc779cf9
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:290:9
10: 0x7fa9c56d6e85 - >::call_once::{shim:vtable#0}
11: 0x7fa9c2431e14 - as core::ops::function::Fn>::call::hca7afd504fdadbfc
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:2002:9
12: 0x7fa9c2431e14 - std::panicking::rust_panic_with_hook::hcec224f40e508f49
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:696:13
13: 0x7fa9c5671641 - std[d743b6fa88cd7a4c]::panicking::begin_panic::::{closure#0}
14: 0x7fa9c566ebf6 - std[d743b6fa88cd7a4c]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
15: 0x7fa9c5686496 - std[d743b6fa88cd7a4c]::panicking::begin_panic::
16: 0x7fa9c56416e2 - ::span_bug::
17: 0x7fa9c5641587 - ::span_bug::
18: 0x7fa9c56474bb - rustc_middle[344b7a5778ebfb41]::util::bug::opt_span_bug_fmt::::{closure#0}
19: 0x7fa9c564750a - rustc_middle[344b7a5778ebfb41]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
20: 0x7fa9c5646c96 - rustc_middle[344b7a5778ebfb41]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
21: 0x7fa9c5646b66 - rustc_middle[344b7a5778ebfb41]::util::bug::opt_span_bug_fmt::
22: 0x7fa9c3c02894 - rustc_middle[344b7a5778ebfb41]::util::bug::span_bug_fmt::
23: 0x7fa9c568b29f - ::build_error
24: 0x7fa9c49bc2d7 - ::visit_basic_block_data
25: 0x7fa9c49b91fe - ::check_body
26: 0x7fa9c49b739c - >::call_once
27: 0x7fa9c49b5dc3 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::
28: 0x7fa9c40bc6c5 - rustc_mir_transform[c5d3163ff4a25b61]::mir_promoted
29: 0x7fa9c40bb03e - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::
30: 0x7fa9c45991f5 - >::call_once
31: 0x7fa9c4597a00 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::
32: 0x7fa9c4b720f0 - rustc_data_structures[3749598f95b8ed78]::sync::par_for_each_in::<&[rustc_span[d779338a88541528]::def_id::LocalDefId], ::par_body_owners::{closure#0}>
33: 0x7fa9c4b71d26 - ::time::<(), rustc_interface[cc30d76fa8dae5fc]::passes::analysis::{closure#2}>
34: 0x7fa9c4b7154f - rustc_interface[cc30d76fa8dae5fc]::passes::analysis
35: 0x7fa9c4e9a5e2 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::
36: 0x7fa9c4e9a2f0 - ::analysis
37: 0x7fa9c4d1e089 - ::enter::>
38: 0x7fa9c4846e01 - ::enter::, rustc_span[d779338a88541528]::ErrorGuaranteed>>
39: 0x7fa9c4844fb1 - rustc_span[d779338a88541528]::with_source_map::, rustc_interface[cc30d76fa8dae5fc]::interface::run_compiler, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
40: 0x7fa9c484455f - std[d743b6fa88cd7a4c]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>
41: 0x7fa9c4f7f52e - <::spawn_unchecked_, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#1} as core[4ada38e0d5cae8be]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
42: 0x7fa9c243bf15 - as core::ops::function::FnOnce>::call_once::h843c8319f93d5fbd
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:1988:9
43: 0x7fa9c243bf15 - as core::ops::function::FnOnce>::call_once::h9f6cdb354bbcea1a
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:1988:9
44: 0x7fa9c243bf15 - std::sys::unix::thread::Thread::new::thread_start::h53e32c182a23b75f
at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys/unix/thread.rs:108:17
45: 0x7fa9c2309609 - start_thread
46: 0x7fa9c222c133 - clone
47: 0x0 -
```
Note that there is an allow-by-default forward compat lint against it: |
Triage: No longer ICE since today's nightly, @rustbot label: +E-needs-test |
Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq Right now we destructure the constant as far as we can, but with this PR we just don't take it apart anymore. This is preparatory work for moving to always using valtrees, as these will just do a single conversion of the constant to a valtree at the start, and if that fails, fall back to `PartialEq`. This removes a few cases where we emitted the `unreachable pattern` lint, because we stop looking into the constant deeply enough to detect that a constant is already covered by another pattern. Previous work: rust-lang#70743 This is groundwork towards fixing rust-lang#83085 and rust-lang#105047
Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq Right now we destructure the constant as far as we can, but with this PR we just don't take it apart anymore. This is preparatory work for moving to always using valtrees, as these will just do a single conversion of the constant to a valtree at the start, and if that fails, fall back to `PartialEq`. This removes a few cases where we emitted the `unreachable pattern` lint, because we stop looking into the constant deeply enough to detect that a constant is already covered by another pattern. Previous work: rust-lang/rust#70743 This is groundwork towards fixing rust-lang/rust#83085 and rust-lang/rust#105047
No longer ICEs because the ICE was temporarily(?) changed to an explicit error. This change was made in 147e850 as part of #110393 (thanks @fee1-dead). |
…xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
…xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
…xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
…xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
…xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
Code
Error output
internal compiler error: compiler/rustc_const_eval/src/transform/check_consts/ops.rs:611: raw ptr comparison should already be caught in the trait system
Full output including backtrace
Regression
Regression in nightly-2022-07-28, somewhere in rollup 2a22093
Very likely due to #99704, which added this assertion (@fee1-dead, @oli-obk)
Version
The text was updated successfully, but these errors were encountered: