about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-14 20:01:12 +0000
committerbors <bors@rust-lang.org>2023-08-14 20:01:12 +0000
commitf960bdf1feacad4ab5a079c76ff31053c1799f71 (patch)
tree69c0d9ba66b39bdcebb231b85fece5c86337425a /tests/codegen
parent4cea2bc339db4efdc0fbcf44760c2e9a75d73e31 (diff)
parent5f0c17faa7a1f3179292d6aa578ec849904ff60d (diff)
downloadrust-f960bdf1feacad4ab5a079c76ff31053c1799f71.tar.gz
rust-f960bdf1feacad4ab5a079c76ff31053c1799f71.zip
Auto merge of #114821 - matthiaskrgr:rollup-bahtz9m, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114745 (Make Const more useful in smir)
 - #114752 (fixed *const [type error] does not implement the Copy trait)
 - #114760 (DebugInfo: Updates test cases that add method declarations.)
 - #114815 (Update books)
 - #114817 (Remove unnecessary FIXME)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/method-declaration.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/codegen/method-declaration.rs b/tests/codegen/method-declaration.rs
new file mode 100644
index 00000000000..4ae332b0107
--- /dev/null
+++ b/tests/codegen/method-declaration.rs
@@ -0,0 +1,26 @@
+// compile-flags: -g -Cno-prepopulate-passes
+
+// Verify that we added a declaration for a method.
+
+// CHECK: define{{.*}}@method{{.*}} !dbg ![[METHOD_DEF_DBG:[0-9]+]]
+// CHECK: define{{.*}}@function{{.*}} !dbg ![[FUNC_DEF_DBG:[0-9]+]]
+
+#![crate_type = "lib"]
+
+// CHECK-DAG: ![[FOO_DBG:[0-9]+]] = !DICompositeType(tag: {{.*}} name: "Foo", {{.*}} identifier:
+pub struct Foo;
+
+impl Foo {
+    // CHECK-DAG: ![[METHOD_DEF_DBG]] = distinct !DISubprogram(name: "method"{{.*}}, scope: ![[FOO_DBG]]{{.*}}DISPFlagDefinition{{.*}}, declaration: ![[METHOD_DECL_DBG:[0-9]+]]
+    // CHECK-DAG: ![[METHOD_DECL_DBG]] = !DISubprogram(name: "method"{{.*}}, scope: ![[FOO_DBG]]
+    #[no_mangle]
+    pub fn method() {}
+}
+
+// CHECK: ![[FUNC_DEF_DBG]] = distinct !DISubprogram(name: "function"
+// CHECK-NOT: declaration
+// CHECK-SAME: DISPFlagDefinition
+// CHECK-NOT: declaration
+// CHECK-SAME: )
+#[no_mangle]
+pub fn function() {}