Skip to content

Commit caa265e

Browse files
Rollup merge of #153546 - DanielEScherzer:test-references-extern, r=ehuss
tests/ui/extern: add annotations for reference rules
2 parents 1b64473 + e24dc1d commit caa265e

13 files changed

Lines changed: 22 additions & 12 deletions

tests/ui/extern/extern-crate-rename.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ aux-build:m1.rs
22
//@ aux-build:m2.rs
3+
//@ reference: items.extern-crate.as
34

45

56
extern crate m1;

tests/ui/extern/extern-crate-rename.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0259]: the name `m1` is defined multiple times
2-
--> $DIR/extern-crate-rename.rs:6:1
2+
--> $DIR/extern-crate-rename.rs:7:1
33
|
44
LL | extern crate m1;
55
| ---------------- previous import of the extern crate `m1` here

tests/ui/extern/extern-ffi-fn-with-body.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ reference: items.extern.fn.body
2+
//@ reference: items.fn.extern.intro
3+
14
extern "C" {
25
fn foo() -> i32 { //~ ERROR incorrect function inside `extern` block
36
return 0;

tests/ui/extern/extern-ffi-fn-with-body.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: incorrect function inside `extern` block
2-
--> $DIR/extern-ffi-fn-with-body.rs:2:8
2+
--> $DIR/extern-ffi-fn-with-body.rs:5:8
33
|
44
LL | extern "C" {
55
| ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body

tests/ui/extern/extern-thiscall.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ run-pass
22
//@ only-x86
3+
//@ reference: items.extern.abi.thiscall
34

45
trait A {
56
extern "thiscall" fn test1(i: i32);

tests/ui/extern/function-definition-in-extern-block-75283.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ reference: items.extern.fn.body
12
// https://github.com/rust-lang/rust/issues/75283
23
extern "C" {
34
fn lol() { //~ ERROR incorrect function inside `extern` block

tests/ui/extern/function-definition-in-extern-block-75283.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: incorrect function inside `extern` block
2-
--> $DIR/function-definition-in-extern-block-75283.rs:3:8
2+
--> $DIR/function-definition-in-extern-block-75283.rs:4:8
33
|
44
LL | extern "C" {
55
| ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body

tests/ui/extern/issue-28324.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ reference: const-eval.const-expr.path-static
2+
//@ reference: items.extern.static.safety
13
extern "C" {
24
static error_message_count: u32;
35
}

tests/ui/extern/issue-28324.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0080]: cannot access extern static `error_message_count`
2-
--> $DIR/issue-28324.rs:5:23
2+
--> $DIR/issue-28324.rs:7:23
33
|
44
LL | pub static BAZ: u32 = *&error_message_count;
55
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAZ` failed here
66

77
error[E0133]: use of extern static is unsafe and requires unsafe function or block
8-
--> $DIR/issue-28324.rs:5:25
8+
--> $DIR/issue-28324.rs:7:25
99
|
1010
LL | pub static BAZ: u32 = *&error_message_count;
1111
| ^^^^^^^^^^^^^^^^^^^ use of extern static

tests/ui/extern/issue-47725.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ reference: items.extern.attributes.link_name.allowed-positions
12
#![warn(unused_attributes)] //~ NOTE lint level is defined here
23

34
#[link_name = "foo"]

0 commit comments

Comments
 (0)