Skip to content

Commit 5ffbec8

Browse files
committed
add regression test
1 parent f1b180a commit 5ffbec8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Tests that multiple derefs in a projection does not cause an ICE
2+
//! when checking const precise drops.
3+
//!
4+
//! Regression test for <https://github.com/rust-lang/rust/issues/147733>
5+
6+
#![feature(const_precise_live_drops)]
7+
struct Foo(u32);
8+
impl Foo {
9+
const fn get(self: Box<&Self>, f: &u32) -> u32 {
10+
//~^ ERROR destructor of `Box<&Foo>` cannot be evaluated at compile-time
11+
self.0
12+
}
13+
}
14+
15+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0493]: destructor of `Box<&Foo>` cannot be evaluated at compile-time
2+
--> $DIR/precise-drop-nested-deref-ice.rs:9:18
3+
|
4+
LL | const fn get(self: Box<&Self>, f: &u32) -> u32 {
5+
| ^^^^ the destructor for this type cannot be evaluated in constant functions
6+
...
7+
LL | }
8+
| - value is dropped here
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0493`.

0 commit comments

Comments
 (0)