diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs')
-rw-r--r-- | src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs b/src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs deleted file mode 100644 index 48d4b0c96..000000000 --- a/src/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Another example from issue #84660, this time weaponized as a safe transmute: an opaque type in an -// impl header being accepted was used to create unsoundness. - -#![feature(type_alias_impl_trait)] - -trait Foo {} -impl Foo for () {} -type Bar = impl Foo; -fn _defining_use() -> Bar {} - -trait Trait<T, In> { - type Out; - fn convert(i: In) -> Self::Out; -} - -impl<In, Out> Trait<Bar, In> for Out { - type Out = Out; - fn convert(_i: In) -> Self::Out { - unreachable!(); - } -} - -impl<In, Out> Trait<(), In> for Out { //~ ERROR conflicting implementations of trait `Trait<Bar, _>` - type Out = In; - fn convert(i: In) -> Self::Out { - i - } -} - -fn transmute<In, Out>(i: In) -> Out { - <Out as Trait<Bar, In>>::convert(i) -} - -fn main() { - let d; - { - let x = "Hello World".to_string(); - d = transmute::<&String, &String>(&x); - } - println!("{}", d); -} |