Skip to content

Commit a82e2ab

Browse files
authored
Rollup merge of #96726 - oli-obk:no_cross_inference, r=Mark-Simulacrum
Add regression and bug tests this tracks the behaviour from #96572 in our test suite
2 parents 416d600 + a75d559 commit a82e2ab

6 files changed

+103
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
5+
fn main() {
6+
type T = impl Copy;
7+
let foo: T = (1u32, 2u32);
8+
let x: (_, _) = foo;
9+
println!("{:?}", x);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// known-bug
2+
// failure-status: 101
3+
// compile-flags: --edition=2021 --crate-type=lib
4+
// rustc-env:RUST_BACKTRACE=0
5+
6+
// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
7+
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
8+
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
9+
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
10+
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
11+
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
12+
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
13+
// normalize-stderr-test "#.*\n" -> ""
14+
// normalize-stderr-test ".*delayed.*\n" -> ""
15+
16+
// tracked in https://github.com/rust-lang/rust/issues/96572
17+
18+
#![feature(type_alias_impl_trait)]
19+
20+
fn main() {
21+
type T = impl Copy;
22+
let foo: T = (1u32, 2u32);
23+
let (a, b): (u32, u32) = foo;
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
2+
3+
error: internal compiler error: broken MIR in DefId(0:3 ~ cross_inference_pattern_bug[646d]::main) ((_1.0: u32)): can't project out of PlaceTy { ty: main::T, variant_index: None }
4+
--> $DIR/cross_inference_pattern_bug.rs:23:10
5+
|
6+
LL | let (a, b): (u32, u32) = foo;
7+
| ^
8+
|
9+
10+
error: internal compiler error: TyKind::Error constructed but no error reported
11+
|
12+
13+
error: internal compiler error: TyKind::Error constructed but no error reported
14+
|
15+
16+
error: internal compiler error: broken MIR in DefId(0:3 ~ cross_inference_pattern_bug[646d]::main) ((_1.1: u32)): can't project out of PlaceTy { ty: main::T, variant_index: None }
17+
--> $DIR/cross_inference_pattern_bug.rs:23:13
18+
|
19+
LL | let (a, b): (u32, u32) = foo;
20+
| ^
21+
|
22+
23+
error: internal compiler error: TyKind::Error constructed but no error reported
24+
|
25+
26+
error: internal compiler error: TyKind::Error constructed but no error reported
27+
|
28+
29+
thread 'rustc' panicked
30+
31+
query stack during panic:
32+
end of query stack
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// known-bug
2+
// compile-flags: --edition=2021 --crate-type=lib
3+
// rustc-env:RUST_BACKTRACE=0
4+
5+
// tracked in https://github.com/rust-lang/rust/issues/96572
6+
7+
#![feature(type_alias_impl_trait)]
8+
9+
fn main() {
10+
type T = impl Copy; // error: unconstrained opaque type
11+
let foo: T = (1u32, 2u32);
12+
let (a, b) = foo; // removing this line makes the code compile
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unconstrained opaque type
2+
--> $DIR/cross_inference_pattern_bug_no_type.rs:10:14
3+
|
4+
LL | type T = impl Copy; // error: unconstrained opaque type
5+
| ^^^^^^^^^
6+
|
7+
= note: `T` must be used in combination with a concrete type within the same module
8+
9+
error: aborting due to previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// check-pass
2+
3+
fn foo(b: bool) -> impl Copy {
4+
if b {
5+
return (5,6)
6+
}
7+
let x: (_, _) = foo(true);
8+
println!("{:?}", x);
9+
(1u32, 2u32)
10+
}
11+
12+
fn main() {
13+
foo(false);
14+
}

0 commit comments

Comments
 (0)