about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-07-26 10:04:02 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-03-11 12:05:02 +0000
commitcb4751d4b87e1c8ebdeb381abe3785486a59968e (patch)
tree7e40c81d8bbec10bd16102231ac20828f7b0f4f6 /compiler/rustc_codegen_cranelift/example
parent2c6a12ec44d0426c8939123c2f2cf27d2217de13 (diff)
downloadrust-cb4751d4b87e1c8ebdeb381abe3785486a59968e.tar.gz
rust-cb4751d4b87e1c8ebdeb381abe3785486a59968e.zip
Implement `#[define_opaque]` attribute for functions.
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example')
-rw-r--r--compiler/rustc_codegen_cranelift/example/issue-72793.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_cranelift/example/issue-72793.rs b/compiler/rustc_codegen_cranelift/example/issue-72793.rs
index 2e08fbca8ef..95d58b90e79 100644
--- a/compiler/rustc_codegen_cranelift/example/issue-72793.rs
+++ b/compiler/rustc_codegen_cranelift/example/issue-72793.rs
@@ -2,23 +2,21 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod helper {
-    pub trait T {
-        type Item;
-    }
+pub trait T {
+    type Item;
+}
 
-    pub type Alias<'a> = impl T<Item = &'a ()>;
+pub type Alias<'a> = impl T<Item = &'a ()>;
 
-    struct S;
-    impl<'a> T for &'a S {
-        type Item = &'a ();
-    }
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
+}
 
-    pub fn filter_positive<'a>() -> Alias<'a> {
-        &S
-    }
+#[define_opaque(Alias)]
+pub fn filter_positive<'a>() -> Alias<'a> {
+    &S
 }
-use helper::*;
 
 fn with_positive(fun: impl Fn(Alias<'_>)) {
     fun(filter_positive());