forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#116145 - ouz-a:opaque_cast_clean-2, r=lcnr
Monomorphize OpaqueCast In previous attempt, rust-lang#116140 we thought `OpaqueCast` was unused during few places, but we were wrong, in reality we didn't have any test that could test it, so in this pr attempt is to correct the behavior of few `OpaqueCast`s in rustc. r? `@lcnr`
- Loading branch information
Showing
6 changed files
with
35 additions
and
4 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
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// compile-flags: --edition=2021 | ||
// check-pass | ||
// build-pass | ||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() { | ||
|
13 changes: 13 additions & 0 deletions
13
tests/ui/type-alias-impl-trait/opaque-cast-monormophize-2.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 @@ | ||
// build-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
const fn foo<T: Copy>(x: T) { | ||
type Opaque<T: Copy> = impl Copy; | ||
let foo: Opaque<T> = (x, 2u32); | ||
let (a, b): (T, u32) = foo; | ||
} | ||
|
||
fn main() { | ||
const CONST: () = foo::<u32>(42u32); | ||
CONST | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/ui/type-alias-impl-trait/opaque-cast-monormophize.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 @@ | ||
// build-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn foo<T: Copy>(x: T) { | ||
type Opaque<T: Copy> = impl Copy; | ||
let foo: &Opaque<T> = &(x, 2u32); | ||
let (a, b): (T, u32) = *foo; | ||
} | ||
|
||
fn main() { | ||
foo::<u32>(1); | ||
} |