-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() { | ||
type T = impl Copy; | ||
let foo: T = (1u32, 2u32); | ||
let x: (_, _) = foo; | ||
println!("{:?}", x); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// known-bug | ||
// failure-status: 101 | ||
// compile-flags: --edition=2021 --crate-type=lib | ||
// rustc-env:RUST_BACKTRACE=0 | ||
|
||
// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" | ||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" | ||
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" | ||
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" | ||
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" | ||
// normalize-stderr-test "note: compiler flags.*\n\n" -> "" | ||
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" | ||
// normalize-stderr-test "#.*\n" -> "" | ||
// normalize-stderr-test ".*delayed.*\n" -> "" | ||
|
||
// tracked in https://github.com/rust-lang/rust/issues/96572 | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() { | ||
type T = impl Copy; | ||
let foo: T = (1u32, 2u32); | ||
let (a, b): (u32, u32) = foo; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
error: internal compiler error: no errors encountered even though `delay_span_bug` issued | ||
|
||
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 } | ||
--> $DIR/cross_inference_pattern_bug.rs:23:10 | ||
| | ||
LL | let (a, b): (u32, u32) = foo; | ||
| ^ | ||
| | ||
|
||
error: internal compiler error: TyKind::Error constructed but no error reported | ||
| | ||
|
||
error: internal compiler error: TyKind::Error constructed but no error reported | ||
| | ||
|
||
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 } | ||
--> $DIR/cross_inference_pattern_bug.rs:23:13 | ||
| | ||
LL | let (a, b): (u32, u32) = foo; | ||
| ^ | ||
| | ||
|
||
error: internal compiler error: TyKind::Error constructed but no error reported | ||
| | ||
|
||
error: internal compiler error: TyKind::Error constructed but no error reported | ||
| | ||
|
||
thread 'rustc' panicked | ||
|
||
query stack during panic: | ||
end of query stack |
13 changes: 13 additions & 0 deletions
13
src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// known-bug | ||
// compile-flags: --edition=2021 --crate-type=lib | ||
// rustc-env:RUST_BACKTRACE=0 | ||
|
||
// tracked in https://github.com/rust-lang/rust/issues/96572 | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() { | ||
type T = impl Copy; // error: unconstrained opaque type | ||
let foo: T = (1u32, 2u32); | ||
let (a, b) = foo; // removing this line makes the code compile | ||
} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: unconstrained opaque type | ||
--> $DIR/cross_inference_pattern_bug_no_type.rs:10:14 | ||
| | ||
LL | type T = impl Copy; // error: unconstrained opaque type | ||
| ^^^^^^^^^ | ||
| | ||
= note: `T` must be used in combination with a concrete type within the same module | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// check-pass | ||
|
||
fn foo(b: bool) -> impl Copy { | ||
if b { | ||
return (5,6) | ||
} | ||
let x: (_, _) = foo(true); | ||
println!("{:?}", x); | ||
(1u32, 2u32) | ||
} | ||
|
||
fn main() { | ||
foo(false); | ||
} |