Closed
Description
auto-reduced (treereduce-rust):
//@compile-flags: --crate-type=lib
#![feature(impl_trait_in_bindings)]
fn new() {
let i: i32 = 0;
let j: &impl PartialEq = &i;
}
original:
use std::ops::Add;
fn new() {
let i: i32 = 0;
let j: &impl PartialEq = &i;
//~^ `impl Trait` is not allowed in the type of variable bindings
}
Version information
rustc 1.85.0-nightly (f5079d00e 2024-12-14)
binary: rustc
commit-hash: f5079d00e63718235f95353df38ebb0891bab5b4
commit-date: 2024-12-14
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(impl_trait_in_bindings) --crate-type=lib
Program output
warning: unused variable: `j`
--> /tmp/icemaker_global_tempdir.IDmpCOQFuoUf/rustc_testrunner_tmpdir_reporting.ewZJCTGzPUBc/mvce.rs:3:9
|
3 | let j: &impl PartialEq = &i;
| ^ help: if this is intentional, prefix it with an underscore: `_j`
|
= note: `#[warn(unused_variables)]` on by default
warning: function `new` is never used
--> /tmp/icemaker_global_tempdir.IDmpCOQFuoUf/rustc_testrunner_tmpdir_reporting.ewZJCTGzPUBc/mvce.rs:1:4
|
1 | fn new() {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
error: internal compiler error: /rustc/f5079d00e63718235f95353df38ebb0891bab5b4/compiler/rustc_middle/src/hir/mod.rs:182:32: No HirId for DefId(0:4 ~ mvce[e79c]::new::{opaque#0})
thread 'rustc' panicked at /rustc/f5079d00e63718235f95353df38ebb0891bab5b4/compiler/rustc_middle/src/hir/mod.rs:182:32:
Box<dyn Any>
stack backtrace:
0: 0x76318f58e4ea - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::ha0c263ead94684c1
1: 0x76318fe13d26 - core::fmt::write::h3e3bbe3ca914e5b8
2: 0x763190e126d1 - std::io::Write::write_fmt::h8644899506913dbe
3: 0x76318f58e342 - std::sys::backtrace::BacktraceLock::print::h860b21be370591ee
4: 0x76318f59083a - std::panicking::default_hook::{{closure}}::h3ee6bbfbfbc66430
5: 0x76318f590683 - std::panicking::default_hook::h79822c95ebfc3bcf
6: 0x76318e6e5138 - std[1a5d30e1e0c007d8]::panicking::update_hook::<alloc[14385021349c12d]::boxed::Box<rustc_driver_impl[82473e392678a029]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x76318f590ff8 - std::panicking::rust_panic_with_hook::h4c5c19cf2bfcc665
8: 0x76318e71aec1 - std[1a5d30e1e0c007d8]::panicking::begin_panic::<rustc_errors[45f849f7416f2b46]::ExplicitBug>::{closure#0}
9: 0x76318e710066 - std[1a5d30e1e0c007d8]::sys::backtrace::__rust_end_short_backtrace::<std[1a5d30e1e0c007d8]::panicking::begin_panic<rustc_errors[45f849f7416f2b46]::ExplicitBug>::{closure#0}, !>
10: 0x76318e70fe1f - std[1a5d30e1e0c007d8]::panicking::begin_panic::<rustc_errors[45f849f7416f2b46]::ExplicitBug>
11: 0x76318e724e61 - <rustc_errors[45f849f7416f2b46]::diagnostic::BugAbort as rustc_errors[45f849f7416f2b46]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x76318ed1acd3 - rustc_middle[c13b89039089cda2]::util::bug::opt_span_bug_fmt::<rustc_span[23dbc7880e66e138]::span_encoding::Span>::{closure#0}
13: 0x76318ed0069a - rustc_middle[c13b89039089cda2]::ty::context::tls::with_opt::<rustc_middle[c13b89039089cda2]::util::bug::opt_span_bug_fmt<rustc_span[23dbc7880e66e138]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x76318ed0052b - rustc_middle[c13b89039089cda2]::ty::context::tls::with_context_opt::<rustc_middle[c13b89039089cda2]::ty::context::tls::with_opt<rustc_middle[c13b89039089cda2]::util::bug::opt_span_bug_fmt<rustc_span[23dbc7880e66e138]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x76318cf1da20 - rustc_middle[c13b89039089cda2]::util::bug::bug_fmt
16: 0x7631900b8c17 - rustc_query_impl[3a08df5daa2e46f1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3a08df5daa2e46f1]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c13b89039089cda2]::query::erase::Erased<[u8; 8usize]>>
17: 0x7631900b84b6 - rustc_query_system[accb4f7494381bff]::query::plumbing::try_execute_query::<rustc_query_impl[3a08df5daa2e46f1]::DynamicConfig<rustc_data_structures[3d96f073365b50c5]::vec_cache::VecCache<rustc_span[23dbc7880e66e138]::def_id::LocalDefId, rustc_middle[c13b89039089cda2]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[accb4f7494381bff]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[3a08df5daa2e46f1]::plumbing::QueryCtxt, false>
18: 0x7631900b7f0f - rustc_query_impl[3a08df5daa2e46f1]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace
19: 0x76318fe564fa - <rustc_middle[c13b89039089cda2]::hir::provide::{closure#4} as core[11d5bfe1ac835d3b]::ops::function::FnOnce<(rustc_middle[c13b89039089cda2]::ty::context::TyCtxt, rustc_span[23dbc7880e66e138]::def_id::LocalDefId)>>::call_once
20: 0x76318fe5573b - rustc_query_impl[3a08df5daa2e46f1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3a08df5daa2e46f1]::query_impl::def_span::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c13b89039089cda2]::query::erase::Erased<[u8; 8usize]>>
21: 0x76318fe53b5f - rustc_query_system[accb4f7494381bff]::query::plumbing::try_execute_query::<rustc_query_impl[3a08df5daa2e46f1]::DynamicConfig<rustc_query_system[accb4f7494381bff]::query::caches::DefIdCache<rustc_middle[c13b89039089cda2]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3a08df5daa2e46f1]::plumbing::QueryCtxt, false>
22: 0x76318fe537b1 - rustc_query_impl[3a08df5daa2e46f1]::query_impl::def_span::get_query_non_incr::__rust_end_short_backtrace
23: 0x763190379cca - <rustc_metadata[241cef8911bf509e]::rmeta::encoder::EncodeContext>::encode_def_ids
24: 0x763190b93b9f - <rustc_metadata[241cef8911bf509e]::rmeta::encoder::EncodeContext>::encode_crate_root
25: 0x763190ec84d8 - rustc_metadata[241cef8911bf509e]::rmeta::encoder::encode_metadata
26: 0x763190ecf4f6 - rustc_metadata[241cef8911bf509e]::fs::encode_and_write_metadata
27: 0x763190ece33e - <rustc_interface[a99d718c7cf4de93]::queries::Linker>::codegen_and_build_linker
28: 0x763190e7ef5d - rustc_interface[a99d718c7cf4de93]::interface::run_compiler::<(), rustc_driver_impl[82473e392678a029]::run_compiler::{closure#0}>::{closure#1}
29: 0x763190dce9c7 - std[1a5d30e1e0c007d8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a99d718c7cf4de93]::util::run_in_thread_with_globals<rustc_interface[a99d718c7cf4de93]::util::run_in_thread_pool_with_globals<rustc_interface[a99d718c7cf4de93]::interface::run_compiler<(), rustc_driver_impl[82473e392678a029]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
30: 0x763190dce660 - <<std[1a5d30e1e0c007d8]::thread::Builder>::spawn_unchecked_<rustc_interface[a99d718c7cf4de93]::util::run_in_thread_with_globals<rustc_interface[a99d718c7cf4de93]::util::run_in_thread_pool_with_globals<rustc_interface[a99d718c7cf4de93]::interface::run_compiler<(), rustc_driver_impl[82473e392678a029]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[11d5bfe1ac835d3b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x763190dcda01 - std::sys::pal::unix::thread::Thread::new::thread_start::h25b199c02c59f5cc
32: 0x76318aea339d - <unknown>
33: 0x76318af2849c - <unknown>
34: 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: please make sure that you have updated to the latest nightly
note: rustc 1.85.0-nightly (f5079d00e 2024-12-14) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(impl_trait_in_bindings) --crate-type lib -Z dump-mir-dir=dir
query stack during panic:
#0 [local_def_id_to_hir_id] getting HIR ID of `new::{opaque#0}`
#1 [def_span] looking up span for `new::{opaque#0}`
end of query stack
error: aborting due to 1 previous error; 2 warnings emitted
@rustbot label +F-impl_trait_in_bindings
Metadata
Metadata
Assignees
Labels
Area: Crate metadataCategory: This is a bug.`#![feature(impl_trait_in_bindings)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.