Skip to content

Commit 5ab3e61

Browse files
committed
Update tests.
1 parent ca2ab07 commit 5ab3e61

File tree

62 files changed

+198
-143
lines changed

Some content is hidden

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

62 files changed

+198
-143
lines changed

compiler/rustc_codegen_gcc/example/mini_core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl<T> Index<usize> for [T] {
639639
}
640640
}
641641

642-
extern {
642+
extern "C" {
643643
type VaListImpl;
644644
}
645645

compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ fn main() {
258258

259259
assert_eq!(((|()| 42u8) as fn(()) -> u8)(()), 42);
260260

261-
extern {
261+
extern "C" {
262262
#[linkage = "weak"]
263263
static ABC: *const u8;
264264
}
265265

266266
{
267-
extern {
267+
extern "C" {
268268
#[linkage = "weak"]
269269
static ABC: *const u8;
270270
}

compiler/rustc_codegen_gcc/example/std_example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::arch::x86_64::*;
77
use std::io::Write;
88
use std::ops::Coroutine;
99

10-
extern {
10+
extern "C" {
1111
pub fn printf(format: *const i8, ...) -> i32;
1212
}
1313

src/tools/clippy/tests/ui/boxed_local.rs

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ mod issue_3739 {
173173
/// This shouldn't warn for `boxed_local` as it is intended to called from non-Rust code.
174174
pub extern "C" fn do_not_warn_me(_c_pointer: Box<String>) -> () {}
175175

176+
#[allow(missing_abi)]
176177
#[rustfmt::skip] // Forces rustfmt to not add ABI
177178
pub extern fn do_not_warn_me_no_abi(_c_pointer: Box<String>) -> () {}
178179

src/tools/clippy/tests/ui/boxed_local.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
1414
| ^^^^^^^^^^^
1515

1616
error: local variable doesn't need to be boxed here
17-
--> tests/ui/boxed_local.rs:188:44
17+
--> tests/ui/boxed_local.rs:189:44
1818
|
1919
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
2020
| ^
2121

2222
error: local variable doesn't need to be boxed here
23-
--> tests/ui/boxed_local.rs:196:16
23+
--> tests/ui/boxed_local.rs:197:16
2424
|
2525
LL | fn foo(x: Box<u32>) {}
2626
| ^

src/tools/clippy/tests/ui/doc/doc-fixable.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn parenthesized_word() {}
239239
/// UXes
240240
fn plural_acronym_test() {}
241241

242-
extern {
242+
extern "C" {
243243
/// `foo()`
244244
fn in_extern();
245245
}

src/tools/clippy/tests/ui/doc/doc-fixable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn parenthesized_word() {}
239239
/// UXes
240240
fn plural_acronym_test() {}
241241

242-
extern {
242+
extern "C" {
243243
/// foo()
244244
fn in_extern();
245245
}

src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ mod msrv {
150150
//~^ ERROR: this could be a `const fn`
151151

152152
#[rustfmt::skip]
153+
#[allow(missing_abi)]
153154
const extern fn implicit_c() {}
154155
//~^ ERROR: this could be a `const fn`
155156

src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.rs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ mod msrv {
150150
//~^ ERROR: this could be a `const fn`
151151

152152
#[rustfmt::skip]
153+
#[allow(missing_abi)]
153154
extern fn implicit_c() {}
154155
//~^ ERROR: this could be a `const fn`
155156

src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ LL | const extern "C" fn c() {}
222222
| +++++
223223

224224
error: this could be a `const fn`
225-
--> tests/ui/missing_const_for_fn/could_be_const.rs:153:9
225+
--> tests/ui/missing_const_for_fn/could_be_const.rs:154:9
226226
|
227227
LL | extern fn implicit_c() {}
228228
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -233,7 +233,7 @@ LL | const extern fn implicit_c() {}
233233
| +++++
234234

235235
error: this could be a `const fn`
236-
--> tests/ui/missing_const_for_fn/could_be_const.rs:170:9
236+
--> tests/ui/missing_const_for_fn/could_be_const.rs:171:9
237237
|
238238
LL | / pub fn new(strings: Vec<String>) -> Self {
239239
LL | | Self { strings }
@@ -246,7 +246,7 @@ LL | pub const fn new(strings: Vec<String>) -> Self {
246246
| +++++
247247

248248
error: this could be a `const fn`
249-
--> tests/ui/missing_const_for_fn/could_be_const.rs:175:9
249+
--> tests/ui/missing_const_for_fn/could_be_const.rs:176:9
250250
|
251251
LL | / pub fn empty() -> Self {
252252
LL | | Self { strings: Vec::new() }
@@ -259,7 +259,7 @@ LL | pub const fn empty() -> Self {
259259
| +++++
260260

261261
error: this could be a `const fn`
262-
--> tests/ui/missing_const_for_fn/could_be_const.rs:186:9
262+
--> tests/ui/missing_const_for_fn/could_be_const.rs:187:9
263263
|
264264
LL | / pub fn new(text: String) -> Self {
265265
LL | | let vec = Vec::new();
@@ -273,7 +273,7 @@ LL | pub const fn new(text: String) -> Self {
273273
| +++++
274274

275275
error: this could be a `const fn`
276-
--> tests/ui/missing_const_for_fn/could_be_const.rs:205:5
276+
--> tests/ui/missing_const_for_fn/could_be_const.rs:206:5
277277
|
278278
LL | fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
279279
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -284,7 +284,7 @@ LL | const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
284284
| +++++
285285

286286
error: this could be a `const fn`
287-
--> tests/ui/missing_const_for_fn/could_be_const.rs:209:5
287+
--> tests/ui/missing_const_for_fn/could_be_const.rs:210:5
288288
|
289289
LL | extern "C-unwind" fn c_unwind() {}
290290
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -295,7 +295,7 @@ LL | const extern "C-unwind" fn c_unwind() {}
295295
| +++++
296296

297297
error: this could be a `const fn`
298-
--> tests/ui/missing_const_for_fn/could_be_const.rs:211:5
298+
--> tests/ui/missing_const_for_fn/could_be_const.rs:212:5
299299
|
300300
LL | extern "system" fn system() {}
301301
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -306,7 +306,7 @@ LL | const extern "system" fn system() {}
306306
| +++++
307307

308308
error: this could be a `const fn`
309-
--> tests/ui/missing_const_for_fn/could_be_const.rs:213:5
309+
--> tests/ui/missing_const_for_fn/could_be_const.rs:214:5
310310
|
311311
LL | extern "system-unwind" fn system_unwind() {}
312312
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -317,7 +317,7 @@ LL | const extern "system-unwind" fn system_unwind() {}
317317
| +++++
318318

319319
error: this could be a `const fn`
320-
--> tests/ui/missing_const_for_fn/could_be_const.rs:215:5
320+
--> tests/ui/missing_const_for_fn/could_be_const.rs:216:5
321321
|
322322
LL | pub extern "vectorcall" fn std_call() {}
323323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -328,7 +328,7 @@ LL | pub const extern "vectorcall" fn std_call() {}
328328
| +++++
329329

330330
error: this could be a `const fn`
331-
--> tests/ui/missing_const_for_fn/could_be_const.rs:217:5
331+
--> tests/ui/missing_const_for_fn/could_be_const.rs:218:5
332332
|
333333
LL | pub extern "vectorcall-unwind" fn std_call_unwind() {}
334334
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

0 commit comments

Comments
 (0)