Open NMAGZ opened 1 year ago
Probably another case of https://github.com/rust-lang/rust/issues/83085
Can't reproduce with rustc 1.68 nor nightly
rustc 1.70.0-nightly (511364e78 2023-03-16)
binary: rustc
commit-hash: 511364e7874dba9649a264100407e4bffe7b5425
commit-date: 2023-03-16
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
@rustbot label +S-bug-has-mcve
This still reproduces with -Cincremental=. -Zincremental-verify-ich=yes
Thanks @matthiaskrgr, I was able to reproduce with those flags. Minimized with icemelter ice.rs -- rustc +nightly -Cincremental=. -Zincremental-verify-ich=yes
(see Icemelter):
mod bytes_num {
use std::{error::Error, time::Duration};
const MINUTE_CHARS: &[char] = &['m'];
const NANOSECOND: u64 = 1;
const MICROSECOND: u64 = NANOSECOND * 1000;
const MILLISECOND: u64 = MICROSECOND * 1000;
const SECOND: u64 = MILLISECOND * 1000;
const MINUTE: u64 = SECOND * 60;
fn foo(bar: &str) -> Result<Duration, Box<Error>> {
let u = [].as_slice();
let unit = match u {
MINUTE_CHARS => MINUTE,
_ => return Err(From::from(format!("Unknown Unit '{:?}' in '{}'", u, bar))),
};
Ok(Duration::from_secs(1))
}
}
mod duration {
use std::error::Error;
const MEBIBYTES_SHORT: &[char] = &['m'];
const BYTES: u64 = 1;
const KIBIBYTES: u64 = BYTES * 1024;
const MEBIBYTES: u64 = KIBIBYTES * 1024;
fn baz() -> Result<u64, Box<Error>> {
let u = [].as_slice();
let unit = match u {
MEBIBYTES_SHORT => MEBIBYTES,
};
Ok(1)
}
}
fn main() {}
I'm unable to reproduce it with rustc 1.77.0-nightly (d5fd09972 2024-01-22).
Code
Meta
rustc --version --verbose
:Error output
Backtrace
``` > RUST_BACKTRACE=1 cargo build Compiling demo v0.1.0 (/Users/zipper/Rust/magz/demo) thread 'rustc' panicked at 'forcing query with already existing `DepNode` - query-key: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, constness: NotConst }, value: Val(ByRef { alloc: ConstAllocation { .. }, offset: Size(0 bytes) }, &[char]) } - dep-node: deref_mir_constant(6c0d3808aaf7532e-5e094c413a0202f3)', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/compiler/rustc_query_system/src/dep_graph/graph.rs:316:9 stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2:>::with_task::, rustc_middle::mir::ConstantKind>
3: rustc_query_system::query::plumbing::get_query::
4: ::deref_mir_constant
5: ::recur
6: ::to_pat
7: ::const_to_pat
8: ::lower_path
9: ::lower_pattern
10: ::lower_pattern
11: ::lower_pattern
12: as alloc::vec::spec_from_iter::SpecFromIter, ::check_match::{closure#0}>>>::from_iter
13: ::visit_expr
14: ::visit_local
15: rustc_hir::intravisit::walk_expr::
16: ::visit_expr
17: rustc_mir_build::thir::pattern::check_match::check_match
18: >::with_task::
19: rustc_query_system::query::plumbing::try_execute_query::>
20: rustc_query_system::query::plumbing::get_query::
21: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], ::par_body_owners::{closure#0}>
22: ::time::<(), rustc_interface::passes::analysis::{closure#1}::{closure#0}::{closure#0}>
23: ::time::<(), rustc_interface::passes::analysis::{closure#1}>
24: rustc_interface::passes::analysis
25: >::with_task::>
26: rustc_query_system::query::plumbing::try_execute_query::>>
27: rustc_query_system::query::plumbing::get_query::
28: ::enter::>
29: rustc_span::with_source_map::, rustc_interface::interface::run_compiler, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
30: >::set::, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.67.1 (d5a82bbd2 2023-02-07) running on aarch64-apple-darwin
note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [deref_mir_constant] dereferencing MIR constant
#1 [check_match] match-checking `duration::baz`
#2 [analysis] running analysis passes on this crate
end of query stack
warning: unused variable: `unit`
--> src/main.rs:21:13
|
21 | let unit = match u {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_unit`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `unit`
--> src/main.rs:61:13
|
61 | let unit = match u {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_unit`
warning: `demo` (bin "demo") generated 2 warnings
error: could not compile `demo`; 2 warnings emitted
```