Skip to content

Commit 68bd9c6

Browse files
committed
Update tests.
1 parent ca2ab07 commit 68bd9c6

File tree

52 files changed

+177
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+177
-125
lines changed

tests/ui/associated-types/issue-91231.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![feature(extern_types)]
44
#![allow(dead_code)]
55

6-
extern {
6+
extern "C" {
77
type Extern;
88
}
99

tests/ui/attributes/key-value-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bug!();
3939
macro_rules! doc_comment {
4040
($x:expr) => {
4141
#[doc = $x]
42-
extern {}
42+
extern "C" {}
4343
};
4444
}
4545

tests/ui/borrowck/issue-92157.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#[cfg(target_os = "linux")]
77
#[link(name = "c")]
8-
extern {}
8+
extern "C" {}
99

1010
#[lang = "start"]
1111
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {

tests/ui/coherence/coherence-negative-impls-copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl !Copy for WithDrop {}
1818

1919
struct Type;
2020
trait Trait {}
21-
extern {
21+
extern "C" {
2222
type ExternType;
2323
}
2424

tests/ui/conditional-compilation/cfg_accessible-not_sure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const B: bool = true;
6363

6464
// ForeignType::unresolved - error
6565

66-
extern {
66+
extern "C" {
6767
type ForeignType;
6868
}
6969

tests/ui/consts/const-eval/validation-ice-extern-type-field.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(extern_types)]
22

3-
extern {
3+
extern "C" {
44
type Opaque;
55
}
66

tests/ui/delegation/glob-non-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait OtherTrait {
1111
reuse Trait::*; //~ ERROR glob delegation is only supported in impls
1212
}
1313

14-
extern {
14+
extern "C" {
1515
reuse Trait::*; //~ ERROR delegation is not supported in `extern` blocks
1616
}
1717

tests/ui/extern/extern-type-diag-not-similar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// because they are both extern types.
55

66
#![feature(extern_types)]
7-
extern {
7+
extern "C" {
88
type ShouldNotBeMentioned;
99
}
1010

11-
extern {
11+
extern "C" {
1212
type Foo;
1313
}
1414

tests/ui/extern/issue-10025.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-pass
22
//@ pretty-expanded FIXME #23616
3-
#![allow(dead_code)]
3+
#![allow(dead_code, missing_abi)]
44

55
unsafe extern fn foo() {}
66
unsafe extern "C" fn bar() {}

tests/ui/extern/issue-95829.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition:2018
22

3-
extern {
3+
extern "C" {
44
async fn L() { //~ ERROR: incorrect function inside `extern` block
55
//~^ ERROR: functions in `extern` blocks cannot have `async` qualifier
66
async fn M() {}

tests/ui/extern/issue-95829.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: incorrect function inside `extern` block
22
--> $DIR/issue-95829.rs:4:14
33
|
4-
LL | extern {
5-
| ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
4+
LL | extern "C" {
5+
| ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
66
LL | async fn L() {
77
| ______________^___-
88
| | |
@@ -18,8 +18,8 @@ LL | | }
1818
error: functions in `extern` blocks cannot have `async` qualifier
1919
--> $DIR/issue-95829.rs:4:5
2020
|
21-
LL | extern {
22-
| ------ in this `extern` block
21+
LL | extern "C" {
22+
| ---------- in this `extern` block
2323
LL | async fn L() {
2424
| ^^^^^ help: remove the `async` qualifier
2525

tests/ui/extern/not-in-block.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![crate_type = "lib"]
2+
#![allow(missing_abi)]
23

34
extern fn none_fn(x: bool) -> i32;
45
//~^ ERROR free function without a body

tests/ui/extern/not-in-block.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: free function without a body
2-
--> $DIR/not-in-block.rs:3:1
2+
--> $DIR/not-in-block.rs:4:1
33
|
44
LL | extern fn none_fn(x: bool) -> i32;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,7 +14,7 @@ LL | extern { fn none_fn(x: bool) -> i32; }
1414
| ~~~~~~~~ +
1515

1616
error: free function without a body
17-
--> $DIR/not-in-block.rs:5:1
17+
--> $DIR/not-in-block.rs:6:1
1818
|
1919
LL | extern "C" fn c_fn(x: bool) -> i32;
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Regression test for issue #91370.
22

3-
extern {
3+
extern "C" {
44
//~^ `extern` blocks define existing foreign functions
55
fn f() {
66
//~^ incorrect function inside `extern` block

tests/ui/foreign/issue-91370-foreign-fn-block-impl.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: incorrect function inside `extern` block
22
--> $DIR/issue-91370-foreign-fn-block-impl.rs:5:8
33
|
4-
LL | extern {
5-
| ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
4+
LL | extern "C" {
5+
| ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
66
LL |
77
LL | fn f() {
88
| ________^___-

tests/ui/invalid/invalid-rustc_legacy_const_generics-arguments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct S;
2121
#[rustc_legacy_const_generics(0usize)] //~ ERROR suffixed literals are not allowed in attributes
2222
fn foo6<const X: usize>() {}
2323

24-
extern {
24+
extern "C" {
2525
#[rustc_legacy_const_generics(1)] //~ ERROR attribute should be applied to a function
2626
fn foo7<const X: usize>(); //~ ERROR foreign items may not have const parameters
2727
}

tests/ui/linkage-attr/issue-109144.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#![crate_type = "lib"]
22
#[link(kind = "static", modifiers = "+whole-archive,+bundle")]
33
//~^ ERROR `#[link]` attribute requires a `name = "string"` argument
4-
extern {}
4+
extern "C" {}

tests/ui/lint/function-item-references.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn baz(x: u32, y: u32) -> u32 { x + y }
1111
unsafe fn unsafe_fn() { }
1212
extern "C" fn c_fn() { }
1313
unsafe extern "C" fn unsafe_c_fn() { }
14-
unsafe extern fn variadic(_x: u32, _args: ...) { }
14+
unsafe extern "C" fn variadic(_x: u32, _args: ...) { }
1515
fn take_generic_ref<'a, T>(_x: &'a T) { }
1616
fn take_generic_array<T, const N: usize>(_x: [T; N]) { }
1717
fn multiple_generic<T, U>(_x: T, _y: U) { }

tests/ui/lint/lint-ctypes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extern "C" {
7272
pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `Box<u32>`
7373
pub fn raw_array(arr: [u8; 8]); //~ ERROR: uses type `[u8; 8]`
7474

75-
pub fn no_niche_a(a: Option<UnsafeCell<extern fn()>>);
75+
pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
7676
//~^ ERROR: uses type `Option<UnsafeCell<extern "C" fn()>>`
7777
pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
7878
//~^ ERROR: uses type `Option<UnsafeCell<&i32>>`

tests/ui/lint/lint-ctypes.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ LL | pub fn raw_array(arr: [u8; 8]);
227227
error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
228228
--> $DIR/lint-ctypes.rs:75:26
229229
|
230-
LL | pub fn no_niche_a(a: Option<UnsafeCell<extern fn()>>);
231-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
230+
LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
231+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
232232
|
233233
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
234234
= note: enum has no representation hint
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
warning: extern declarations without an explicit ABI are deprecated
2+
--> $DIR/suggest-libname-only-1.rs:7:1
3+
|
4+
LL | extern { }
5+
| ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
6+
|
7+
= note: `#[warn(missing_abi)]` on by default
8+
19
error: could not find native static library `libfoo.a`, perhaps an -L flag is missing?
210
|
311
= help: only provide the library name `foo`, not the full filename
412

5-
error: aborting due to 1 previous error
13+
error: aborting due to 1 previous error; 1 warning emitted
614

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
warning: extern declarations without an explicit ABI are deprecated
2+
--> $DIR/suggest-libname-only-2.rs:7:1
3+
|
4+
LL | extern { }
5+
| ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
6+
|
7+
= note: `#[warn(missing_abi)]` on by default
8+
19
error: could not find native static library `bar.lib`, perhaps an -L flag is missing?
210
|
311
= help: only provide the library name `bar`, not the full filename
412

5-
error: aborting due to 1 previous error
13+
error: aborting due to 1 previous error; 1 warning emitted
614

tests/ui/offset-of/offset-of-dst-field.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct Beta {
1616
z: dyn Trait,
1717
}
1818

19-
extern {
19+
extern "C" {
2020
type Extern;
2121
}
2222

tests/ui/parser/bad-fn-ptr-qualifier.fixed

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
pub type T0 = fn(); //~ ERROR an `fn` pointer type cannot be `const`
66
pub type T1 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
7-
pub type T2 = unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
7+
pub type T2 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
88
pub type T3 = fn(); //~ ERROR an `fn` pointer type cannot be `async`
9-
pub type T4 = extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
9+
pub type T4 = extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
1010
pub type T5 = unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
1111
pub type T6 = unsafe extern "C" fn();
1212
//~^ ERROR an `fn` pointer type cannot be `const`
1313
//~| ERROR an `fn` pointer type cannot be `async`
1414

1515
pub type FTT0 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `const`
1616
pub type FTT1 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
17-
pub type FTT2 = for<'a> unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
17+
pub type FTT2 = for<'a> unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
1818
pub type FTT3 = for<'a> fn(); //~ ERROR an `fn` pointer type cannot be `async`
19-
pub type FTT4 = for<'a> extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
19+
pub type FTT4 = for<'a> extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
2020
pub type FTT5 = for<'a> unsafe extern "C" fn();
2121
//~^ ERROR an `fn` pointer type cannot be `async`
2222
pub type FTT6 = for<'a> unsafe extern "C" fn();

tests/ui/parser/bad-fn-ptr-qualifier.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
pub type T0 = const fn(); //~ ERROR an `fn` pointer type cannot be `const`
66
pub type T1 = const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
7-
pub type T2 = const unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
7+
pub type T2 = const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
88
pub type T3 = async fn(); //~ ERROR an `fn` pointer type cannot be `async`
9-
pub type T4 = async extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
9+
pub type T4 = async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
1010
pub type T5 = async unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
1111
pub type T6 = const async unsafe extern "C" fn();
1212
//~^ ERROR an `fn` pointer type cannot be `const`
1313
//~| ERROR an `fn` pointer type cannot be `async`
1414

1515
pub type FTT0 = for<'a> const fn(); //~ ERROR an `fn` pointer type cannot be `const`
1616
pub type FTT1 = for<'a> const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
17-
pub type FTT2 = for<'a> const unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
17+
pub type FTT2 = for<'a> const unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
1818
pub type FTT3 = for<'a> async fn(); //~ ERROR an `fn` pointer type cannot be `async`
19-
pub type FTT4 = for<'a> async extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
19+
pub type FTT4 = for<'a> async extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
2020
pub type FTT5 = for<'a> async unsafe extern "C" fn();
2121
//~^ ERROR an `fn` pointer type cannot be `async`
2222
pub type FTT6 = for<'a> const async unsafe extern "C" fn();

tests/ui/parser/bad-fn-ptr-qualifier.stderr

+16-16
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ LL + pub type T1 = extern "C" fn();
2929
error: an `fn` pointer type cannot be `const`
3030
--> $DIR/bad-fn-ptr-qualifier.rs:7:15
3131
|
32-
LL | pub type T2 = const unsafe extern fn();
33-
| -----^^^^^^^^^^^^^^^^^^^
32+
LL | pub type T2 = const unsafe extern "C" fn();
33+
| -----^^^^^^^^^^^^^^^^^^^^^^^
3434
| |
3535
| `const` because of this
3636
|
3737
help: remove the `const` qualifier
3838
|
39-
LL - pub type T2 = const unsafe extern fn();
40-
LL + pub type T2 = unsafe extern fn();
39+
LL - pub type T2 = const unsafe extern "C" fn();
40+
LL + pub type T2 = unsafe extern "C" fn();
4141
|
4242

4343
error: an `fn` pointer type cannot be `async`
@@ -57,15 +57,15 @@ LL + pub type T3 = fn();
5757
error: an `fn` pointer type cannot be `async`
5858
--> $DIR/bad-fn-ptr-qualifier.rs:9:15
5959
|
60-
LL | pub type T4 = async extern fn();
61-
| -----^^^^^^^^^^^^
60+
LL | pub type T4 = async extern "C" fn();
61+
| -----^^^^^^^^^^^^^^^^
6262
| |
6363
| `async` because of this
6464
|
6565
help: remove the `async` qualifier
6666
|
67-
LL - pub type T4 = async extern fn();
68-
LL + pub type T4 = extern fn();
67+
LL - pub type T4 = async extern "C" fn();
68+
LL + pub type T4 = extern "C" fn();
6969
|
7070

7171
error: an `fn` pointer type cannot be `async`
@@ -141,15 +141,15 @@ LL + pub type FTT1 = for<'a> extern "C" fn();
141141
error: an `fn` pointer type cannot be `const`
142142
--> $DIR/bad-fn-ptr-qualifier.rs:17:17
143143
|
144-
LL | pub type FTT2 = for<'a> const unsafe extern fn();
145-
| ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^
144+
LL | pub type FTT2 = for<'a> const unsafe extern "C" fn();
145+
| ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^
146146
| |
147147
| `const` because of this
148148
|
149149
help: remove the `const` qualifier
150150
|
151-
LL - pub type FTT2 = for<'a> const unsafe extern fn();
152-
LL + pub type FTT2 = for<'a> unsafe extern fn();
151+
LL - pub type FTT2 = for<'a> const unsafe extern "C" fn();
152+
LL + pub type FTT2 = for<'a> unsafe extern "C" fn();
153153
|
154154

155155
error: an `fn` pointer type cannot be `async`
@@ -169,15 +169,15 @@ LL + pub type FTT3 = for<'a> fn();
169169
error: an `fn` pointer type cannot be `async`
170170
--> $DIR/bad-fn-ptr-qualifier.rs:19:17
171171
|
172-
LL | pub type FTT4 = for<'a> async extern fn();
173-
| ^^^^^^^^-----^^^^^^^^^^^^
172+
LL | pub type FTT4 = for<'a> async extern "C" fn();
173+
| ^^^^^^^^-----^^^^^^^^^^^^^^^^
174174
| |
175175
| `async` because of this
176176
|
177177
help: remove the `async` qualifier
178178
|
179-
LL - pub type FTT4 = for<'a> async extern fn();
180-
LL + pub type FTT4 = for<'a> extern fn();
179+
LL - pub type FTT4 = for<'a> async extern "C" fn();
180+
LL + pub type FTT4 = for<'a> extern "C" fn();
181181
|
182182

183183
error: an `fn` pointer type cannot be `async`

tests/ui/parser/bad-lit-suffixes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![feature(rustc_attrs)]
22

3-
extern
3+
extern //~ WARN missing_abi
44
"C"suffix //~ ERROR suffixes on string literals are invalid
55
fn foo() {}
66

7-
extern
7+
extern //~ WARN missing_abi
88
"C"suffix //~ ERROR suffixes on string literals are invalid
99
{}
1010

0 commit comments

Comments
 (0)