Skip to content

Commit fee8391

Browse files
committed
moved renamed docs formatted auxiliary | issue-16822.rs
1 parent d9df2a2 commit fee8391

File tree

3 files changed

+39
-22
lines changed

3 files changed

+39
-22
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/16822
2+
//
3+
//! ICE when using RefCell::borrow_mut()
4+
//! inside match statement with cross-crate generics.
5+
//!
6+
//! The bug occurred when:
7+
//! - A library defines a generic struct with RefCell<T> and uses borrow_mut() in match
8+
//! - Main crate implements the library trait for its own type
9+
//! - Cross-crate generic constraint causes type inference issues
10+
//!
11+
//! The problematic match statement is in the auxiliary file, this file triggers it.
12+
//! Original error: assertion failed in ty.rs:2481 during type inference.
13+
14+
//@ run-pass
15+
//@ aux-build:cross-crate-refcell-match.rs
16+
17+
extern crate cross_crate_refcell_match as lib;
18+
19+
use std::cell::RefCell;
20+
21+
struct App {
22+
i: isize,
23+
}
24+
25+
impl lib::Update for App {
26+
fn update(&mut self) {
27+
self.i += 1;
28+
}
29+
}
30+
31+
fn main() {
32+
let app = App { i: 5 };
33+
let window = lib::Window {
34+
data: RefCell::new(app),
35+
};
36+
// This specific pattern (RefCell::borrow_mut in match with cross-crate generics)
37+
// caused the ICE in the original issue
38+
window.update(1);
39+
}

tests/ui/issue-16822.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)