Repository navigation
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-pattern_types`#![feature(pattern_types)]``#![feature(pattern_types)]`
Description
While checkout out this ice (which does not require a feature gate btw, so potential beta-to-stable regression, which is inconvenient
snippet:
use std::pat::pattern_type;
type Always = pattern_type!(Option<u32> is Some(_));
Version information
rustc 1.79.0-nightly (537aab7a2 2024-04-08)
binary: rustc
commit-hash: 537aab7a2e7fe9cdf50b5ff18485e0793cd8db62
commit-date: 2024-04-08
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0658]: use of unstable library feature 'core_pattern_type'
--> /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:15
|
3 | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^^^^^^
|
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable
= note: this compiler was built on 2024-04-08; consider upgrading it if it is out of date
error[E0658]: pattern types are unstable
--> /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:15
|
3 | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #54882 <https://github.com/rust-lang/rust/issues/54882> for more information
= help: add `#![feature(pattern_types)]` to the crate attributes to enable
= note: this compiler was built on 2024-04-08; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:53
|
3 | type Always = pattern_type!(Option<u32> is Some(_));
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs`
error[E0658]: use of unstable library feature 'core_pattern_type'
--> /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:1:5
|
1 | use std::pat::pattern_type;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable
= note: this compiler was built on 2024-04-08; consider upgrading it if it is out of date
error: internal compiler error: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2252:26: unsupported pattern for pattern type: Pat {
hir_id: HirId(DefId(0:4 ~ mvce[b30d]::Always).7),
kind: TupleStruct(
Resolved(
None,
Path {
span: /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:44: 3:48 (#0),
res: Err,
segments: [
PathSegment {
ident: Some#0,
hir_id: HirId(DefId(0:4 ~ mvce[b30d]::Always).5),
res: Err,
args: None,
infer_args: true,
},
],
},
),
[
Pat {
hir_id: HirId(DefId(0:4 ~ mvce[b30d]::Always).6),
kind: Wild,
span: /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:49: 3:50 (#0),
default_binding_modes: true,
},
],
None,
),
span: /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:44: 3:51 (#0),
default_binding_modes: true,
}
--> /tmp/icemaker_global_tempdir.ACwscHoXGDVj/rustc_testrunner_tmpdir_reporting.LrjHdxKAtSsK/mvce.rs:3:44
|
3 | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^
thread 'rustc' panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2252:26:
Box<dyn Any>
stack backtrace:
0: 0x76636502a885 - std::backtrace_rs::backtrace::libunwind::trace::h3c5d6be2ca224618
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x76636502a885 - std::backtrace_rs::backtrace::trace_unsynchronized::h07f25bfbbc81f9b7
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x76636502a885 - std::sys_common::backtrace::_print_fmt::hf0313e0fd41b1242
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:68:5
3: 0x76636502a885 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha80bcf755077e3a1
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:44:22
4: 0x766365079b4b - core::fmt::rt::Argument::fmt::hea7d7a647aef4433
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/core/src/fmt/rt.rs:142:9
5: 0x766365079b4b - core::fmt::write::h0eafe6836efd2236
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/core/src/fmt/mod.rs:1153:17
6: 0x76636501f47f - std::io::Write::write_fmt::hee25aa3e7912fe48
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/io/mod.rs:1843:15
7: 0x76636502a65e - std::sys_common::backtrace::_print::h0c8b5670573775f7
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:47:5
8: 0x76636502a65e - std::sys_common::backtrace::print::hb0c84899d27bc992
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:34:9
9: 0x76636502d159 - std::panicking::default_hook::{{closure}}::hdd10a62b37f83705
10: 0x76636502ce75 - std::panicking::default_hook::h491d7bd053f3c065
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/panicking.rs:291:9
11: 0x76636185be5f - std[8cce646dcc9f51a2]::panicking::update_hook::<alloc[7e5e1bdade7884f3]::boxed::Box<rustc_driver_impl[b1693766bfe96bed]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x76636502d85c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h673a5ec9e27814ea
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2032:9
13: 0x76636502d85c - std::panicking::rust_panic_with_hook::h2f18055510e9d6ac
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/panicking.rs:792:13
14: 0x76636188bed4 - std[8cce646dcc9f51a2]::panicking::begin_panic::<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>::{closure#0}
15: 0x766361888c46 - std[8cce646dcc9f51a2]::sys_common::backtrace::__rust_end_short_backtrace::<std[8cce646dcc9f51a2]::panicking::begin_panic<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>::{closure#0}, !>
16: 0x766361888926 - std[8cce646dcc9f51a2]::panicking::begin_panic::<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>
17: 0x7663618952d1 - <rustc_errors[6ec141f8b50a2d31]::diagnostic::BugAbort as rustc_errors[6ec141f8b50a2d31]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18: 0x76636190ab28 - <rustc_errors[6ec141f8b50a2d31]::DiagCtxt>::span_bug::<rustc_span[c8203a7ebedcd79e]::span_encoding::Span, alloc[7e5e1bdade7884f3]::string::String>
19: 0x76636194573d - rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt::<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}
20: 0x7663619461aa - rustc_middle[29872c107b60a246]::ty::context::tls::with_opt::<rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x76636192abfb - rustc_middle[29872c107b60a246]::ty::context::tls::with_context_opt::<rustc_middle[29872c107b60a246]::ty::context::tls::with_opt<rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x766361927107 - rustc_middle[29872c107b60a246]::util::bug::span_bug_fmt::<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>
23: 0x766362e71d12 - <dyn rustc_hir_analysis[79635f1fa32cabba]::hir_ty_lowering::HirTyLowerer>::lower_ty_common
24: 0x766360971cf3 - rustc_hir_analysis[79635f1fa32cabba]::collect::type_of::type_of
25: 0x766362cc64a2 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 8usize]>>
26: 0x766362cc50e1 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::DefIdCache<rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
27: 0x766362cc4bdb - rustc_query_impl[51661ff1e116d73e]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
28: 0x76636321343a - <rustc_hir_analysis[79635f1fa32cabba]::collect::CollectItemTypesVisitor as rustc_hir[7361c4e2026484da]::intravisit::Visitor>::visit_item
29: 0x76636320987f - rustc_hir_analysis[79635f1fa32cabba]::check::wfcheck::check_well_formed
30: 0x766363209773 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>
31: 0x766363208f00 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::VecCache<rustc_hir[7361c4e2026484da]::hir_id::OwnerId, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
32: 0x766363208c7f - rustc_query_impl[51661ff1e116d73e]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
33: 0x766363206bd3 - rustc_hir_analysis[79635f1fa32cabba]::check::wfcheck::check_mod_type_wf
34: 0x766363206a1b - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>
35: 0x7663636a3870 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::DefaultCache<rustc_span[c8203a7ebedcd79e]::def_id::LocalModDefId, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
36: 0x7663636a361b - rustc_query_impl[51661ff1e116d73e]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
37: 0x766362ec418f - rustc_hir_analysis[79635f1fa32cabba]::check_crate
38: 0x766362ed816a - rustc_interface[e7aac3eeb74c4c0c]::passes::analysis
39: 0x766362ed7cc7 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>
40: 0x766363a54ce5 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::SingleCache<rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
41: 0x766363a54a49 - rustc_query_impl[51661ff1e116d73e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
42: 0x7663638eec22 - rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler::<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}
43: 0x7663639cc01d - std[8cce646dcc9f51a2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_with_globals<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_pool_with_globals<rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>
44: 0x7663639cbe2a - <<std[8cce646dcc9f51a2]::thread::Builder>::spawn_unchecked_<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_with_globals<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_pool_with_globals<rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#1} as core[7ebb3dbf9c5383ca]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x76636503728b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea2f762c1fe3db14
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2018:9
46: 0x76636503728b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h79ea2eedb7e4df53
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2018:9
47: 0x76636503728b - std::sys::pal::unix::thread::Thread::new::thread_start::h83279d19c2446390
at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys/pal/unix/thread.rs:108:17
48: 0x766364dd555a - <unknown>
49: 0x766364e52a3c - <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: rustc 1.79.0-nightly (537aab7a2 2024-04-08) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [type_of] expanding type alias `Always`
#1 [check_well_formed] checking that `Always` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.
I clicked the tracking issue from
= note: see issue #54882 #54882 for more information
= help: add #![feature(pattern_types)] to the crate attributes to enable
= note: this compiler was built on 2024-04-08; consider upgrading it if it is out of date
which is about an optimize attribute and does not mention patterns or links to a related PR at all? 🤔
Reacted by 许杰友 Jieyou Xu (Joe)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-pattern_types`#![feature(pattern_types)]``#![feature(pattern_types)]`
Activity
compiler-errors commentedon Apr 8, 2024
What do you mean? Why would this beta a beta-to-stable regression? It regressed with #107606.
compiler-errors commentedon Apr 8, 2024
cc @oli-obk pattern types need a real tracking issue, and you need to delay a span bug here rather than ICE
matthiaskrgr commentedon Apr 8, 2024
right now: beta -> nightly regression
once nightly gets promoted to beta: stable -> beta regression
once beta gets promoted to stable: stable -> stable regression?
compiler-errors commentedon Apr 8, 2024
yes? but you can say that about every single regression that ever gets filed lol
matthiaskrgr commentedon Apr 8, 2024
exactly, unless it gets fixed in time :)
compiler-errors commentedon Apr 8, 2024
I don't see the purpose of pointing out that this is a potential beta regression before it has even landed on nightly, unless there's some reason that this is particularly difficult to fix, particularly affects user-facing code, or we expect it to slip the beta promotion for some reason.
matthiaskrgr commentedon Apr 8, 2024
Well, there are a few cases where feature gates actually do work and prevent crashes on stable 🙃
oli-obk commentedon Apr 8, 2024
maybe internal features should just hard abort compilation if they aren't set
matthiaskrgr commentedon Apr 8, 2024
might also solve some of the internal-feature ices we are getting from time to time
workingjubilee commentedon Apr 9, 2024
...I do not see how it would be a regression, because we can safely bet on no one requiring the
pattern_type!macro before the feature's library API landed.The code did not travel back in time to 1.77 compilers and suddenly become usable stable API.
Rollup merge of rust-lang#123648 - oli-obk:pattern_types_syntax, r=co…
matthiaskrgr commentedon Apr 9, 2024
its a regression because the compiler now crashes/ICEs where it would previously just show an error message.
workingjubilee commentedon Apr 9, 2024
please show me the codebase that regressed.
matthiaskrgr commentedon Apr 9, 2024
#123643 (comment)
workingjubilee commentedon Apr 9, 2024
code that was not committed until April 8th, thus incapable of regressing on stable, yes.
matthiaskrgr commentedon Apr 9, 2024
ah yes not yet. this is why I wrote
so potential beta-to-stable regression, which is inconvenient;)workingjubilee commentedon Apr 9, 2024
If it arrived on 1.79 on stable, it would be code that, since the moment it has been useful to write, has always ICEd. 1.79 cannot retrocausally regress code, unless you have a TARDIS or somesuch.
matthiaskrgr commentedon Apr 9, 2024
I it was code that did not ICE on 1.78, and now ICEs on 1.79, so that makes it a regression.
workingjubilee commentedon Apr 9, 2024
It was code that did not exist in this world on 1.78. It didn't exist in some timeless platonic realm of Forms. No actual programs were harmed in the making of this music video.
workingjubilee commentedon Apr 9, 2024
I suppose if you insist we can call them "regressions" when they involve code samples that just came into being, but I wish to know what I should call it when my actual tests fail from version to version of rustc and I have to spend hours bisecting the issue and figuring out where in the codebase it has gone wrong and fixing the problem before the new version comes out, either in the code or in rustc. Because it sure isn't a just-fabricated problem with just-fabricated code, it's something that matters in code that is supposed to build and work on the latest stable Rust version.
oli-obk commentedon Apr 9, 2024
What it is is a feature gated feature ICEing without the feature gate, so we would see it ICE on stable if untreated. This means it is a higher priority ICE than an ICE that is only reachable with feature gates.
We have not used "regression" as a term for "error -> ICE" changes, as by definition that'a true for any ICE that does not require feature gates. If we flagged it as a regression, that would flood and taint the actually problematic regressions.
We do flag these as regressions if there is no error before the ICE, as the user then has no information on how to fix it.
So while @matthiaskrgr is technically correct, in practice we don't and shouldn't use this terminology
Unrolled build for rust-lang#123648