Description
While technically this could shouldn't compile, it shouldn't ICE
Code
fn main() {}
fn example(
planarity_epsilon: f32
) -> f32 {
(0..10).map(|_| {
const EPS: f32 = 3e-2;
let EPS = planarity_epsilon;
let z = 0.01 * EPS;
return z;
}).sum::<f32>()
}
Meta
Happens on playground on currrent nightly (1.69.0)
Error output
Compiling playground v0.0.1 (/playground)
warning: floating-point types cannot be used in patterns
--> src/main.rs:10:13
|
10 | let EPS = planarity_epsilon;
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, [see issue #41620 <https://github.com/rust-lang/rust/issues/41620>](https://github.com/rust-lang/rust/issues/41620)
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
error[[E0005]](https://doc.rust-lang.org/nightly/error_codes/E0005.html): refutable pattern in local binding
--> src/main.rs:10:13
|
9 | const EPS: f32 = 3e-2;
| -------------- constant defined here
10 | let EPS = planarity_epsilon;
| ^^^
| |
| pattern `_` not covered
| missing patterns are not covered because `eps` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `eps_var`
|
= note: the matched value is of type `f32`
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_mir_build/src/build/expr/as_place.rs:258:31
stack backtrace:
0: 0x7f96fb18aafa - std::backtrace_rs::backtrace::libunwind::trace::h34498aba16c27c5d
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f96fb18aafa - std::backtrace_rs::backtrace::trace_unsynchronized::h9289a4d08e8f8065
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f96fb18aafa - std::sys_common::backtrace::_print_fmt::hdc48108f3bcc17d7
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f96fb18aafa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0e26d08b27a6dd1d
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f96fb1ee27e - core::fmt::write::h72fef7731620cf25
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/core/src/fmt/mod.rs:1232:17
5: 0x7f96fb17da65 - std::io::Write::write_fmt::h2c6467b36a994dc1
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/io/mod.rs:1684:15
6: 0x7f96fb18a8c5 - std::sys_common::backtrace::_print::h9ed7190f3ab4032b
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7f96fb18a8c5 - std::sys_common::backtrace::print::h82d15082d5d08ddd
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7f96fb18d63f - std::panicking::default_hook::{{closure}}::h8c24b2c3eee8f54e
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:271:22
9: 0x7f96fb18d37b - std::panicking::default_hook::hcd9302e49bce35d9
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:290:9
10: 0x7f96fe3f93f5 - rustc_driver_impl[4d5cb03342eaf40]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f96fb18de7d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h157f8bd1e3a60b9e
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/alloc/src/boxed.rs:2001:9
12: 0x7f96fb18de7d - std::panicking::rust_panic_with_hook::h8dc9549cbbb83c93
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:696:13
13: 0x7f96fb18dbb2 - std::panicking::begin_panic_handler::{{closure}}::h9b0840da0b1a0862
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:581:13
14: 0x7f96fb18af66 - std::sys_common::backtrace::__rust_end_short_backtrace::h1673dd05d1a0dc8f
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys_common/backtrace.rs:137:18
15: 0x7f96fb18d902 - rust_begin_unwind
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:579:5
16: 0x7f96fb1ea5e3 - core::panicking::panic_fmt::hdf244b8669b920f6
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/core/src/panicking.rs:64:14
17: 0x7f96fb1ea67d - core::panicking::panic::hf55dbc2325ee7c2c
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/core/src/panicking.rs:114:5
18: 0x7f96fc82bc07 - <rustc_mir_build[49031d7458832483]::build::expr::as_place::PlaceBuilder>::to_place
19: 0x7f96fd432c23 - <rustc_mir_build[49031d7458832483]::build::Builder>::match_simplified_candidates
20: 0x7f96fd439b36 - <rustc_mir_build[49031d7458832483]::build::Builder>::match_candidates
21: 0x7f96fc8388e8 - <rustc_mir_build[49031d7458832483]::build::Builder>::lower_match_tree
22: 0x7f96fc8482e7 - <rustc_mir_build[49031d7458832483]::build::Builder>::place_into_pattern
23: 0x7f96fc83db90 - <rustc_mir_build[49031d7458832483]::build::Builder>::ast_block_stmts
24: 0x7f96fc839be0 - <rustc_mir_build[49031d7458832483]::build::Builder>::ast_block
25: 0x7f96fc81f65e - <rustc_mir_build[49031d7458832483]::build::Builder>::expr_into_dest
26: 0x7f96fc8440d6 - <rustc_mir_build[49031d7458832483]::build::Builder>::as_temp_inner
27: 0x7f96fc82052c - <rustc_mir_build[49031d7458832483]::build::Builder>::expr_into_dest
28: 0x7f96fc81e795 - <rustc_mir_build[49031d7458832483]::build::Builder>::expr_into_dest
29: 0x7f96fc81e795 - <rustc_mir_build[49031d7458832483]::build::Builder>::expr_into_dest
30: 0x7f96fd451041 - rustc_mir_build[49031d7458832483]::build::mir_built
31: 0x7f96fd5bef2d - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::mir_built, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
32: 0x7f96fccf55fd - rustc_mir_transform[45b77d39479c82e6]::check_unsafety::unsafety_check_result
33: 0x7f96fd208847 - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::unsafety_check_result, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
34: 0x7f96fd20843a - <rustc_query_impl[63b69567f1ef9f27]::Queries as rustc_middle[9cf018341417739a]::ty::query::QueryEngine>::unsafety_check_result
35: 0x7f96fccf7ea2 - rustc_mir_transform[45b77d39479c82e6]::check_unsafety::unsafety_check_result
36: 0x7f96fd208847 - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::unsafety_check_result, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
37: 0x7f96fd6134c0 - rustc_mir_transform[45b77d39479c82e6]::mir_const
38: 0x7f96fd611c9e - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::mir_const, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
39: 0x7f96fd242538 - rustc_mir_transform[45b77d39479c82e6]::mir_promoted
40: 0x7f96fd2405f1 - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::mir_promoted, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
41: 0x7f96fd23ef01 - rustc_borrowck[ddc587a7aa92d709]::mir_borrowck
42: 0x7f96fd4fbe1d - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::mir_borrowck, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
43: 0x7f96fc85878f - rustc_data_structures[dc1364207e8b6339]::sync::par_for_each_in::<&[rustc_span[25e4e29a33f2c9a0]::def_id::LocalDefId], <rustc_middle[9cf018341417739a]::hir::map::Map>::par_body_owners<rustc_interface[7d9b2342fec184f0]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
44: 0x7f96fc8583ae - <rustc_session[947bba98393ca4fe]::session::Session>::time::<(), rustc_interface[7d9b2342fec184f0]::passes::analysis::{closure#2}>
45: 0x7f96fc857b30 - rustc_interface[7d9b2342fec184f0]::passes::analysis
46: 0x7f96fdc56ded - rustc_query_system[a5365f90e46f8ee6]::query::plumbing::try_execute_query::<rustc_query_impl[63b69567f1ef9f27]::queries::analysis, rustc_query_impl[63b69567f1ef9f27]::plumbing::QueryCtxt>
47: 0x7f96fdc56aef - <rustc_query_impl[63b69567f1ef9f27]::Queries as rustc_middle[9cf018341417739a]::ty::query::QueryEngine>::analysis
48: 0x7f96fda7b476 - <rustc_middle[9cf018341417739a]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[4d5cb03342eaf40]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>>
49: 0x7f96fd64e038 - rustc_span[25e4e29a33f2c9a0]::with_source_map::<core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>, rustc_interface[7d9b2342fec184f0]::interface::run_compiler<core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>, rustc_driver_impl[4d5cb03342eaf40]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
50: 0x7f96fd6456bc - std[97c6a3d67a80fb6d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7d9b2342fec184f0]::util::run_in_thread_pool_with_globals<rustc_interface[7d9b2342fec184f0]::interface::run_compiler<core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>, rustc_driver_impl[4d5cb03342eaf40]::run_compiler::{closure#1}>::{closure#0}, core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>>
51: 0x7f96fd6450ea - <<std[97c6a3d67a80fb6d]::thread::Builder>::spawn_unchecked_<rustc_interface[7d9b2342fec184f0]::util::run_in_thread_pool_with_globals<rustc_interface[7d9b2342fec184f0]::interface::run_compiler<core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>, rustc_driver_impl[4d5cb03342eaf40]::run_compiler::{closure#1}>::{closure#0}, core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[87ae5becae78eb7d]::result::Result<(), rustc_span[25e4e29a33f2c9a0]::ErrorGuaranteed>>::{closure#1} as core[87ae5becae78eb7d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
52: 0x7f96fb197cb3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfea88e05acd13bd2
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/alloc/src/boxed.rs:1987:9
53: 0x7f96fb197cb3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h31d26542010403e8
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/alloc/src/boxed.rs:1987:9
54: 0x7f96fb197cb3 - std::sys::unix::thread::Thread::new::thread_start::h6a6d49bd896852f8
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/sys/unix/thread.rs:108:17
55: 0x7f96fb05d609 - start_thread
56: 0x7f96faf80133 - clone
57: 0x0 - <unknown>
error: 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.69.0-nightly (f77bfb733 2023-03-01) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_built] building MIR for `example::{closure#0}`
#1 [unsafety_check_result] unsafety-checking `example::{closure#0}`
#2 [unsafety_check_result] unsafety-checking `example`
#3 [mir_const] preparing `example` for borrow checking
#4 [mir_promoted] processing MIR for `example`
#5 [mir_borrowck] borrow-checking `example`
#6 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0005`.
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground` due to previous error; 1 warning emitted
Backtrace
Compiling playground v0.0.1 (/playground) warning: floating-point types cannot be used in patterns --> src/main.rs:8:13 | 8 | let EPS = planarity_epsilon; | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, [see issue #41620 ](https://github.com//issues/41620) = note: `#[warn(illegal_floating_point_literal_pattern)]` on by defaulterror[E0005]: refutable pattern in local binding
--> src/main.rs:8:13
|
7 | const EPS: f32 = 3e-2;
| -------------- constant defined here
8 | let EPS = planarity_epsilon;
| ^^^
| |
| pattern _
not covered
| missing patterns are not covered because eps
is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: eps_var
|
= note: the matched value is of type f32
thread 'rustc' panicked at 'called Option::unwrap()
on a None
value', compiler/rustc_mir_build/src/build/expr/as_place.rs:258:31
stack backtrace:
0: rust_begin_unwind
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/std/src/panicking.rs:579:5
1: core::panicking::panic_fmt
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/core/src/panicking.rs:64:14
2: core::panicking::panic
at /rustc/f77bfb7336f21bfe6a5fb5f7358d4406e2597289/library/core/src/panicking.rs:114:5
3: <rustc_mir_build::build::expr::as_place::PlaceBuilder>::to_place
4: <rustc_mir_build::build::Builder>::match_simplified_candidates
5: <rustc_mir_build::build::Builder>::match_candidates
6: <rustc_mir_build::build::Builder>::lower_match_tree
7: <rustc_mir_build::build::Builder>::place_into_pattern
8: <rustc_mir_build::build::Builder>::ast_block_stmts
9: <rustc_mir_build::build::Builder>::ast_block
10: <rustc_mir_build::build::Builder>::expr_into_dest
11: <rustc_mir_build::build::Builder>::as_temp_inner
12: <rustc_mir_build::build::Builder>::expr_into_dest
13: <rustc_mir_build::build::Builder>::expr_into_dest
14: <rustc_mir_build::build::Builder>::expr_into_dest
15: rustc_mir_build::build::mir_built
16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_built, rustc_query_impl::plumbing::QueryCtxt>
17: rustc_mir_transform::check_unsafety::unsafety_check_result
18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result
20: rustc_mir_transform::check_unsafety::unsafety_check_result
21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
22: rustc_mir_transform::mir_const
23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
24: rustc_mir_transform::mir_promoted
25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
26: rustc_borrowck::mir_borrowck
27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
28: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
29: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#2}>
30: rustc_interface::passes::analysis
31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
33: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
34: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
note: Some details are omitted, run with RUST_BACKTRACE=full
for a verbose backtrace.
error: 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.69.0-nightly (f77bfb7 2023-03-01) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_built] building MIR for example::{closure#0}
#1 [unsafety_check_result] unsafety-checking example::{closure#0}
#2 [unsafety_check_result] unsafety-checking example
#3 [mir_const] preparing example
for borrow checking
#4 [mir_promoted] processing MIR for example
#5 [mir_borrowck] borrow-checking example
#6 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try rustc --explain E0005
.
warning: playground
(bin "playground") generated 1 warning
error: could not compile playground
due to previous error; 1 warning emitted
``` ```