We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98e07b3 commit 626bc09Copy full SHA for 626bc09
gcc/testsuite/rust/execute/torture/issue-1481.rs
@@ -0,0 +1,35 @@
1
+/* { dg-output "called Foo::print\\(\\)\r*" } */
2
+/* { dg-options "-w" } */
3
+
4
+#[lang = "sized"]
5
+trait Sized {}
6
7
+trait Printable {
8
+ fn print(&self);
9
+}
10
11
+struct Foo;
12
13
+impl Printable for Foo {
14
+ fn print(&self) {
15
+ // Simulate output
16
+ unsafe {
17
+ puts("called Foo::print()\0" as *const _ as *const i8);
18
+ }
19
20
21
22
+fn get_printable() -> impl Printable {
23
+ Foo
24
25
26
+extern "C" {
27
+ fn puts(s: *const i8);
28
29
30
+fn main() -> i32 {
31
+ let p = get_printable();
32
+ p.print();
33
34
+ 0
35
0 commit comments