Closed rayhem closed 1 year ago
Digging deeper, this is trivially reproducible with the following in my environment:
fn main() {
let filename = std::path::Path::from(format!("{}/day{:02}.txt", "foobar", 01));
}
Running this with nightly produces E0277, E0308, and E0277 errors indicating the path doesn't have a size at compile time (probably the correct behavior).
I ran cargo bisect-rustc
on the code above, and here is the result, where regression means ICE disappeared:
searched nightlies: from nightly-2022-09-17 to nightly-2022-12-12 regressed nightly: nightly-2022-09-20 searched commit range: https://github.com/rust-lang/rust/compare/a37499ae66ec5fc52a93d71493b78fb141c32f6b...2019147c5642c08cdb9ad4cacd97dd1fa4ffa701 regressed commit: https://github.com/rust-lang/rust/commit/503e19d01e941b88bf6d5b28e9108d046abcfa2d #101629 (cc @compiler-errors)
This is landing in 1.66 which will come in a few days.
Code
You can see the full context for the change that triggered the panic at https://github.com/rayhem/advent/commit/99a2921e828506bc66a09da793f73710e68d6413.
Long story short, I was working on generalizing some execution + display code for this year's Advent of Code. I believe this issue arose due to an interaction with this function,
and how I store my puzzles,
as this was the section of code I was working on refactoring.
Meta
rustc --version --verbose
:Error output
See errorlog.txt for a full log.
Backtrace
``` thread 'rustc' panicked at 'Box', /rustc/897e37553bba8b42751c67658967889d11ecd120/compiler/rustc_errors/src/lib.rs:1462:9
stack backtrace:
0: std::panicking::begin_panic::
1: std::panic::panic_any::
2: ::bug::<&alloc::string::String>
3: ::bug::<&alloc::string::String>
4: rustc_middle::ty::context::tls::with_context_opt::::{closure#0}, ()>::{closure#0}, ()>
5: rustc_middle::util::bug::opt_span_bug_fmt::
6: rustc_middle::util::bug::bug_fmt
7: ::expr_ty_adjusted
8: ::note_obligation_cause_code::
9: ::note_obligation_cause
10: ::report_selection_error
11: ::report_fulfillment_error
12: ::report_fulfillment_errors
13: ::check_call
14: ::check_expr_with_expectation_and_args
15: ::check_decl
16: ::check_block_with_expected
17: ::check_expr_with_expectation_and_args
18: ::check_expr_with_expectation_and_args
19: ::check_block_with_expected
20: ::check_expr_with_expectation_and_args
21: ::check_match::{closure#0}
22: ::check_expr_with_expectation_and_args
23: ::check_block_with_expected
24: ::check_expr_with_expectation_and_args
25: ::check_match::{closure#0}
26: ::check_expr_with_expectation_and_args
27: ::check_expr_with_expectation_and_args
28: ::check_block_with_expected
29: ::check_expr_with_expectation_and_args
30: ::check_return_expr
31: rustc_typeck::check::check::check_fn
32: ::enter::<&rustc_middle::ty::context::TypeckResults, ::enter::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
33: rustc_typeck::check::typeck
34: >::with_task::
35: rustc_query_system::query::plumbing::try_execute_query::>
36: ::typeck
37: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], ::par_body_owners::{closure#0}>
38: rustc_typeck::check::typeck_item_bodies
39: >::with_task::
40: rustc_query_system::query::plumbing::try_execute_query::>
41: rustc_query_system::query::plumbing::get_query::
42: ::time::<(), rustc_typeck::check_crate::{closure#7}>
43: rustc_typeck::check_crate
44: rustc_interface::passes::analysis
45: >::with_task::>
46: rustc_query_system::query::plumbing::try_execute_query::>>
47: rustc_query_system::query::plumbing::get_query::
48: ::enter::>
49: rustc_interface::interface::create_compiler_and_run::, rustc_driver::run_compiler::{closure#1}>
50: >::set::, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
```