Open
Description
Code
#![allow(incomplete_features)]
#![feature(ergonomic_clones)]
use std::clone::UseCloned;
impl UseCloned for Option<(S, S, S)> {}
struct S;
fn main() {
macro_rules! m {
($p:pat = $s:expr) => {
match $s {
Some($p) => {}
_ => {}
}
};
}
let mut tup1: Option<(S, S, S)> = None;
let mut _closure = use || {
m!((_, _, ref mut _borrow) = tup1);
};
}
A mutant of tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-inside.rs
Meta
rustc --version --verbose
:
rustc 1.89.0-nightly (5d707b07e 2025-06-02)
binary: rustc
commit-hash: 5d707b07e42766c080c5012869c9988a18dcbb83
commit-date: 2025-06-02
host: aarch64-apple-darwin
release: 1.89.0-nightly
LLVM version: 20.1.5
Error output
command: rustc
error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
--> ec_1.rs:6:1
|
6 | impl UseCloned for Option<(S, S, S)> {}
| ^^^^^^^^^^^^^^^^^^^-----------------
| |
| `Option` is not defined in the current crate
|
= note: impl doesn't have any local type before any uncovered type parameters
= note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
= note: define and implement a trait or new type instead
thread 'rustc' panicked at compiler/rustc_borrowck/src/lib.rs:1619:51:
index out of bounds: the len is 9 but the index is 9
Backtrace
thread 'rustc' panicked at compiler/rustc_borrowck/src/lib.rs:1619:51:
index out of bounds: the len is 9 but the index is 9
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: <rustc_borrowck::MirBorrowckCtxt as rustc_mir_dataflow::framework::visitor::ResultsVisitor<rustc_borrowck::dataflow::Borrowck>>::visit_after_early_statement_effect
4: rustc_borrowck::do_mir_borrowck
5: rustc_borrowck::mir_borrowck
[... omitted 1 frame ...]
6: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
7: rustc_interface::passes::run_required_analyses
8: rustc_interface::passes::analysis
[... omitted 1 frame ...]
9: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
10: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
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: please make sure that you have updated to the latest nightly
note: please attach the file at `/Users/jisukbyun/workspace/250203 scratch/rustc-ice-2025-06-03T08_38_21-83141.txt` to your bug report
query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0117`.
Bisects to
searched nightlies: from nightly-2025-01-01 to nightly-2025-06-02
regressed nightly: nightly-2025-03-08
searched commit range: b74da96...f5a1ef7
regressed commit: f5a1ef7
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --end=2025-06-02 --regress ice --preserve --script rustc -- ec_1.rs
********************************************************************************
Regression in f5a1ef7121ad661b5a21a1d02941c8064d54ee0b
********************************************************************************
Attempting to search unrolled perf builds
Found commits ["5cf66023", "16414e51", "0b6c069b", "aa349152", "275aad33", "eaf94402"]
installing 5cf660233fcc08fce21f8845d36982b25cb0535c
testing...
RESULT: 5cf660233fcc08fce21f8845d36982b25cb0535c, ===> Script found ICE
Regression in https://github.com/rust-lang-ci/rust/commit/5cf660233fcc08fce21f8845d36982b25cb0535c
The PR introducing the regression in this rollup is #134797: Ergonomic ref counting
Notes
- ICE location:
compiler/rustc_borrowck/src/lib.rs Line-1619
rust/compiler/rustc_borrowck/src/lib.rs
Lines 1617 to 1620 in 5d707b0
@rustbot label F-ergonomic_clones