From 8a3edb1d661ed5ce685bd5dcfa600b6e02897b86 Mon Sep 17 00:00:00 2001
From: Mark Rousskov <mark.simulacrum@gmail.com>
Date: Tue, 1 Sep 2020 17:12:52 -0400
Subject: [PATCH] Update tests for extern block linting

---
 .../src/error_codes/E0044.md                  |   6 +-
 .../src/error_codes/E0130.md                  |   6 +-
 .../src/error_codes/E0454.md                  |   4 +-
 .../src/error_codes/E0455.md                  |   4 +-
 .../src/error_codes/E0458.md                  |   2 +-
 .../src/error_codes/E0459.md                  |   4 +-
 .../src/error_codes/E0617.md                  |   4 +-
 .../src/error_codes/E0724.md                  |   2 +-
 compiler/rustc_llvm/src/lib.rs                |   2 +-
 library/core/src/sync/atomic.rs               |   4 +-
 library/std/src/ffi/c_str.rs                  |  14 +--
 .../src/language-features/link-args.md        |   2 +-
 src/test/codegen/call-llvm-intrinsics.rs      |   2 +-
 src/test/codegen/dealloc-no-unwind.rs         |   2 +-
 src/test/codegen/debug-column.rs              |   2 +-
 src/test/codegen/ffi-const.rs                 |   2 +-
 src/test/codegen/ffi-out-of-bounds-loads.rs   |   2 +-
 src/test/codegen/ffi-pure.rs                  |   2 +-
 src/test/codegen/ffi-returns-twice.rs         |   2 +-
 .../codegen/riscv-abi/call-llvm-intrinsics.rs |   2 +-
 src/test/codegen/unwind-extern-imports.rs     |   2 +-
 src/test/debuginfo/type-names.rs              |  58 +++++----
 src/test/incremental/foreign.rs               |   8 +-
 .../archive-duplicate-names/foo.rs            |   2 +-
 .../run-make-fulldeps/c-dynamic-dylib/foo.rs  |   2 +-
 .../run-make-fulldeps/c-dynamic-rlib/foo.rs   |   2 +-
 .../run-make-fulldeps/c-static-dylib/foo.rs   |   2 +-
 .../run-make-fulldeps/c-static-rlib/foo.rs    |   2 +-
 .../compiler-lookup-paths/d.rs                |   2 +-
 .../compiler-rt-works-on-mingw/foo.rs         |   8 +-
 .../extern-fn-generic/test.rs                 |  14 +--
 .../extern-fn-generic/testcrate.rs            |   8 +-
 .../extern-fn-mangle/test.rs                  |  10 +-
 .../extern-fn-struct-passing-abi/test.rs      |  32 ++---
 .../extern-fn-with-extern-types/test.rs       |   2 +-
 .../extern-fn-with-packed-struct/test.rs      |   4 +-
 .../extern-fn-with-union/test.rs              |  10 +-
 .../extern-fn-with-union/testcrate.rs         |   4 +-
 .../interdependent-c-libraries/bar.rs         |   6 +-
 .../interdependent-c-libraries/foo.rs         |   6 +-
 src/test/run-make-fulldeps/issue-15460/foo.rs |   2 +-
 .../run-make-fulldeps/issue-25581/test.rs     |   4 +-
 src/test/run-make-fulldeps/issue-28595/a.rs   |   2 +-
 src/test/run-make-fulldeps/issue-28595/b.rs   |   7 +-
 .../link-cfg/dep-with-staticlib.rs            |   2 +-
 src/test/run-make-fulldeps/link-cfg/dep.rs    |   2 +-
 .../run-make-fulldeps/link-cfg/no-deps.rs     |   2 +-
 .../run-make-fulldeps/link-path-order/main.rs |   8 +-
 .../linkage-attr-on-static/bar.rs             |   2 +-
 .../long-linker-command-lines/foo.rs          |   2 +-
 .../longjmp-across-rust/main.rs               |   9 +-
 .../lto-no-link-whole-rlib/lib1.rs            |   2 +-
 .../lto-no-link-whole-rlib/lib2.rs            |   2 +-
 src/test/run-make-fulldeps/manual-link/foo.rs |   6 +-
 .../no-duplicate-libs/main.rs                 |   2 +-
 .../sanitizer-cdylib-link/program.rs          |   2 +-
 .../sanitizer-dylib-link/program.rs           |   2 +-
 .../sanitizer-staticlib-link/program.rs       |   2 +-
 .../save-analysis-fail/foo.rs                 | 112 +++++++++---------
 .../run-make-fulldeps/static-nobundle/bbb.rs  |   2 +-
 .../staticlib-blank-lib/foo.rs                |   2 +-
 .../run-make-fulldeps/target-specs/foo.rs     |  16 +--
 src/test/run-make/issue-36710/foo.rs          |   4 +-
 src/test/run-make/wasm-import-module/bar.rs   |   4 +-
 src/test/run-make/wasm-import-module/foo.rs   |   2 +-
 src/test/run-pass-valgrind/osx-frameworks.rs  |   6 +-
 .../check-doc-alias-attr-location.rs          |   6 +-
 src/test/rustdoc-ui/coverage/basic.rs         |   2 +-
 src/test/rustdoc/auxiliary/issue-34274.rs     |   2 +-
 src/test/rustdoc/foreigntype-reexport.rs      |  10 +-
 src/test/rustdoc/foreigntype.rs               |   2 +-
 .../inline_local/glob-extern-no-defaults.rs   |   2 +-
 src/test/rustdoc/inline_local/glob-extern.rs  |   2 +-
 src/test/rustdoc/issue-22038.rs               |   4 +-
 src/test/rustdoc/sanitizer-option.rs          |   2 +-
 src/test/rustdoc/titles.rs                    |   6 +-
 src/test/ui-fulldeps/switch-stdout.rs         |   5 +-
 src/test/ui/abi/anon-extern-mod.rs            |   2 +-
 .../anon-extern-mod-cross-crate-1.rs          |   4 +-
 src/test/ui/abi/auxiliary/foreign_lib.rs      |   9 +-
 src/test/ui/abi/c-stack-as-value.rs           |   2 +-
 src/test/ui/abi/cabi-int-widening.rs          |   2 +-
 .../anon-extern-mod-cross-crate-1.rs          |   4 +-
 .../anon-extern-mod-cross-crate-1.rs          |   4 +-
 .../auxiliary/extern-crosscrate-source.rs     |  19 ++-
 src/test/ui/abi/extern/extern-call-deep.rs    |  17 ++-
 src/test/ui/abi/extern/extern-call-deep2.rs   |  23 ++--
 .../ui/abi/extern/extern-call-indirect.rs     |  17 ++-
 src/test/ui/abi/extern/extern-call-scrub.rs   |  23 ++--
 src/test/ui/abi/extern/extern-pass-TwoU16s.rs |   7 +-
 src/test/ui/abi/extern/extern-pass-TwoU32s.rs |   7 +-
 src/test/ui/abi/extern/extern-pass-TwoU64s.rs |   7 +-
 src/test/ui/abi/extern/extern-pass-TwoU8s.rs  |   7 +-
 src/test/ui/abi/extern/extern-pass-char.rs    |   3 +-
 src/test/ui/abi/extern/extern-pass-double.rs  |   2 +-
 src/test/ui/abi/extern/extern-pass-empty.rs   |   6 +-
 src/test/ui/abi/extern/extern-pass-u32.rs     |   3 +-
 src/test/ui/abi/extern/extern-pass-u64.rs     |   3 +-
 .../ui/abi/extern/extern-return-TwoU16s.rs    |   5 +-
 .../ui/abi/extern/extern-return-TwoU32s.rs    |   5 +-
 .../ui/abi/extern/extern-return-TwoU64s.rs    |   5 +-
 .../ui/abi/extern/extern-return-TwoU8s.rs     |   5 +-
 .../ui/abi/foreign/auxiliary/foreign_lib.rs   |   9 +-
 .../ui/abi/foreign/foreign-call-no-runtime.rs |  29 +++--
 .../ui/abi/foreign/foreign-fn-with-byval.rs   |   8 +-
 src/test/ui/abi/foreign/foreign-no-abi.rs     |   2 +-
 .../issues/issue-62350-sysv-neg-reg-counts.rs |  16 +--
 .../ui/abi/mir/mir_codegen_calls_variadic.rs  |  13 +-
 src/test/ui/abi/segfault-no-out-of-stack.rs   |  18 ++-
 src/test/ui/abi/stack-probes.rs               |   6 +-
 src/test/ui/abi/statics/static-mut-foreign.rs |   2 +-
 src/test/ui/abi/struct-enums/struct-return.rs |  58 +++++----
 src/test/ui/abi/variadic-ffi.rs               |   6 +-
 src/test/ui/attributes/item-attributes.rs     |  41 +++----
 src/test/ui/attributes/obsolete-attr.rs       |   2 +-
 src/test/ui/attributes/obsolete-attr.stderr   |   2 +-
 src/test/ui/auxiliary/extern-statics.rs       |   2 +-
 .../link-cfg-works-transitive-dylib.rs        |   2 +-
 .../link-cfg-works-transitive-rlib.rs         |   2 +-
 src/test/ui/bad/bad-extern-link-attrs.rs      |   2 +-
 src/test/ui/c-stack-returning-int64.rs        |   8 +-
 src/test/ui/c-variadic/variadic-ffi-1.rs      |   8 +-
 .../c-variadic/variadic-ffi-no-fixed-args.rs  |   4 +-
 src/test/ui/cfg/conditional-compile.rs        |  64 +++++-----
 src/test/ui/check-doc-alias-attr-location.rs  |   6 +-
 .../consts/const-eval/extern_fat_pointer.rs   |   2 +-
 ...st-size_of_val-align_of_val-extern-type.rs |   4 +-
 src/test/ui/empty/empty-linkname.rs           |   3 +-
 src/test/ui/error-codes/E0044.rs              |  11 +-
 src/test/ui/error-codes/E0130.rs              |   7 +-
 src/test/ui/error-codes/E0454.rs              |   2 +-
 src/test/ui/error-codes/E0454.stderr          |   2 +-
 src/test/ui/error-codes/E0458.rs              |   4 +-
 src/test/ui/error-codes/E0458.stderr          |   4 +-
 src/test/ui/error-codes/E0459.rs              |   2 +-
 src/test/ui/error-codes/E0459.stderr          |   2 +-
 src/test/ui/error-codes/E0617.rs              |   2 +-
 src/test/ui/extern/extern-pub.rs              |   5 +-
 .../ui/extern/extern-types-distinct-types.rs  |   4 +-
 .../extern/extern-types-manual-sync-send.rs   |  10 +-
 .../ui/extern/extern-types-not-sync-send.rs   |   6 +-
 .../extern/extern-types-not-sync-send.stderr  |   4 +-
 .../ui/extern/extern-types-pointer-cast.rs    |   3 +-
 .../ui/extern/extern-types-size_of_val.rs     |   8 +-
 .../ui/extern/extern-types-thin-pointer.rs    |   3 +-
 src/test/ui/extern/extern-types-trait-impl.rs |   9 +-
 src/test/ui/extern/extern-types-unsized.rs    |   4 +-
 .../ui/extern/extern-types-unsized.stderr     |  16 +--
 .../issue-36122-accessing-externed-dst.rs     |   2 +-
 .../feature-gate-cfg-target-thread-local.rs   |   3 +-
 .../feature-gate-extern_types.rs              |   2 +-
 .../feature-gates/feature-gate-ffi_const.rs   |   2 +-
 .../ui/feature-gates/feature-gate-ffi_pure.rs |   2 +-
 .../feature-gate-ffi_returns_twice.rs         |   2 +-
 .../feature-gates/feature-gate-link_args.rs   |   3 +-
 .../feature-gate-link_args.stderr             |   6 +-
 .../ui/feature-gates/feature-gate-link_cfg.rs |   2 +-
 .../feature-gate-link_llvm_intrinsics.rs      |   7 +-
 .../ui/feature-gates/feature-gate-linkage.rs  |   2 +-
 .../feature-gate-non_ascii_idents.rs          |   2 +-
 .../ui/feature-gates/feature-gate-simd-ffi.rs |   2 +-
 .../feature-gate-static-nobundle.rs           |   4 +-
 .../feature-gate-static-nobundle.stderr       |   4 +-
 .../feature-gate-unwind-attributes.rs         |  10 +-
 .../issue-43106-gating-of-builtin-attrs.rs    |   2 +-
 ...issue-43106-gating-of-builtin-attrs.stderr |   4 +-
 src/test/ui/ffi_const2.rs                     |   2 +-
 src/test/ui/foreign-unsafe-fn-called.rs       |   2 +-
 src/test/ui/foreign/foreign-fn-linkname.rs    |   6 +-
 src/test/ui/foreign/foreign-int-types.rs      |   5 +-
 .../ui/foreign/foreign-mod-unused-const.rs    |   5 +-
 src/test/ui/foreign/foreign2.rs               |  11 +-
 src/test/ui/functions-closures/fn-abi.rs      |   4 +-
 .../ui/generics/generic-extern-lifetime.rs    |  20 ++--
 .../generics/generic-extern-lifetime.stderr   |  26 ++--
 src/test/ui/generics/generic-extern.rs        |   2 +-
 src/test/ui/imports/glob-resolve1.rs          |  10 +-
 src/test/ui/imports/glob-resolve1.stderr      |  30 ++---
 src/test/ui/issues/auxiliary/issue-15562.rs   |   2 +-
 src/test/ui/issues/auxiliary/issue-16725.rs   |   2 +-
 src/test/ui/issues/auxiliary/issue-25185-1.rs |   2 +-
 src/test/ui/issues/issue-10877.rs             |   8 +-
 src/test/ui/issues/issue-10877.stderr         |  12 +-
 src/test/ui/issues/issue-1251.rs              |   5 +-
 src/test/ui/issues/issue-14227.rs             |   2 +-
 src/test/ui/issues/issue-15487.rs             |   9 +-
 src/test/ui/issues/issue-16149.rs             |   4 +-
 src/test/ui/issues/issue-16250.rs             |   5 +-
 src/test/ui/issues/issue-16538.rs             |   2 +-
 src/test/ui/issues/issue-1866.rs              |   8 +-
 .../ui/issues/issue-18804/auxiliary/lib.rs    |   6 +-
 src/test/ui/issues/issue-20313-rpass.rs       |   6 +-
 src/test/ui/issues/issue-20313.rs             |   5 +-
 src/test/ui/issues/issue-2214.rs              |  18 ++-
 src/test/ui/issues/issue-28324.rs             |   2 +-
 src/test/ui/issues/issue-28472.rs             |   2 +-
 src/test/ui/issues/issue-28676.rs             |  25 ++--
 src/test/ui/issues/issue-32201.rs             |   2 +-
 src/test/ui/issues/issue-3656.rs              |   7 +-
 src/test/ui/issues/issue-43925.rs             |   4 +-
 src/test/ui/issues/issue-43925.stderr         |   6 +-
 src/test/ui/issues/issue-43926.rs             |   4 +-
 src/test/ui/issues/issue-43926.stderr         |   6 +-
 src/test/ui/issues/issue-5791.rs              |   4 +-
 src/test/ui/issues/issue-6470.rs              |   5 +-
 src/test/ui/link-cfg-works.rs                 |   4 +-
 .../auxiliary/def_colliding_external.rs       |   4 +-
 src/test/ui/linkage-attr/invalid-link-args.rs |   4 +-
 ...e-detect-local-generated-name-collision.rs |   6 +-
 src/test/ui/linkage-attr/linkage2.rs          |   7 +-
 src/test/ui/linkage-attr/linkage2.stderr      |   6 +-
 src/test/ui/linkage-attr/linkage3.rs          |   7 +-
 src/test/ui/linkage-attr/linkage3.stderr      |   6 +-
 src/test/ui/linkage1.rs                       |   2 +-
 .../ui/lint/dead-code/leading-underscore.rs   |   4 +-
 .../ui/lint/dead-code/lint-dead-code-3.rs     |   6 +-
 .../ui/lint/inline-trait-and-foreign-items.rs |   2 +-
 src/test/ui/lint/lint-ctypes-enum.rs          |  41 +++++--
 src/test/ui/lint/lint-ctypes-enum.stderr      |  43 ++++---
 src/test/ui/lint/lint-ctypes.rs               |  14 +--
 src/test/ui/lint/unreachable_pub-pub_crate.rs |   2 +-
 src/test/ui/lint/unreachable_pub.rs           |   2 +-
 .../warn-unused-inline-on-fn-prototypes.rs    |   2 +-
 src/test/ui/macros/macros-in-extern.rs        |  14 ++-
 src/test/ui/mismatched_types/issue-26480.rs   |   2 +-
 src/test/ui/nil-decl-in-foreign.rs            |   4 +-
 src/test/ui/no-patterns-in-args.rs            |   4 +-
 src/test/ui/osx-frameworks.rs                 |   5 +-
 src/test/ui/parser/attrs-after-extern-mod.rs  |   2 +-
 .../ui/parser/attrs-after-extern-mod.stderr   |   4 +-
 src/test/ui/parser/bad-lit-suffixes.stderr    |  13 +-
 .../ui/parser/doc-before-extern-rbrace.rs     |   2 +-
 src/test/ui/parser/duplicate-visibility.rs    |   2 +-
 .../ui/parser/duplicate-visibility.stderr     |   4 +-
 src/test/ui/parser/extern-no-fn.rs            |   2 +-
 src/test/ui/parser/extern-no-fn.stderr        |   4 +-
 src/test/ui/parser/fn-body-eq-expr-semi.rs    |   2 +-
 .../ui/parser/fn-body-eq-expr-semi.stderr     |   8 +-
 .../parser/fn-body-optional-semantic-fail.rs  |   2 +-
 .../fn-body-optional-semantic-fail.stderr     |   4 +-
 .../parser/fn-body-optional-syntactic-pass.rs |   4 +-
 src/test/ui/parser/fn-header-semantic-fail.rs |   2 +-
 .../ui/parser/fn-header-semantic-fail.stderr  |  20 ++--
 .../ui/parser/fn-header-syntactic-pass.rs     |  12 +-
 .../ui/parser/foreign-const-semantic-fail.rs  |   2 +-
 .../parser/foreign-const-semantic-fail.stderr |   4 +-
 .../ui/parser/foreign-const-syntactic-fail.rs |   2 +-
 .../ui/parser/foreign-static-semantic-fail.rs |   2 +-
 .../foreign-static-semantic-fail.stderr       |   8 +-
 .../parser/foreign-static-syntactic-pass.rs   |   6 +-
 .../ui/parser/no-const-fn-in-extern-block.rs  |   2 +-
 .../parser/no-const-fn-in-extern-block.stderr |   8 +-
 .../ui/parser/self-param-semantic-fail.rs     |   6 +-
 .../ui/parser/self-param-syntactic-pass.rs    |   2 +-
 src/test/ui/parser/unsafe-foreign-mod.rs      |   4 -
 src/test/ui/parser/unsafe-foreign-mod.stderr  |   8 +-
 .../variadic-ffi-semantic-restrictions.rs     |  10 +-
 .../variadic-ffi-semantic-restrictions.stderr |  30 ++---
 src/test/ui/priv-in-bad-locations.rs          |   2 +-
 src/test/ui/priv-in-bad-locations.stderr      |   2 +-
 src/test/ui/privacy/privacy1.rs               |   2 +-
 src/test/ui/privacy/private-in-public-warn.rs |   2 +-
 src/test/ui/privacy/pub-extern-privacy.rs     |   2 +-
 .../ui/proc-macro/macros-in-extern-derive.rs  |   2 +-
 src/test/ui/proc-macro/macros-in-extern.rs    |   6 +-
 .../improper_ctypes/extern_crate_improper.rs  |   6 +-
 .../improper_ctypes/same_crate_proper.rs      |  17 +--
 .../feature-gate-raw-dylib-2.rs               |   4 +-
 .../feature-gate-raw-dylib.rs                 |   4 +-
 .../feature-gate-raw-dylib.stderr             |   4 +-
 .../link-ordinal-and-name.rs                  |   2 +-
 .../link-ordinal-invalid-format.rs            |   4 +-
 .../link-ordinal-too-large.rs                 |   4 +-
 src/test/ui/safe-extern-statics-mut.rs        |   2 +-
 src/test/ui/safe-extern-statics.rs            |   2 +-
 src/test/ui/sepcomp/sepcomp-extern.rs         |   2 +-
 src/test/ui/simple_global_asm.rs              |  14 ++-
 src/test/ui/span/lint-unused-unsafe.rs        |   2 +-
 .../static-mut-foreign-requires-unsafe.rs     |   6 +-
 src/test/ui/static_sized_requirement.rs       |   2 +-
 src/test/ui/stmt_expr_attrs_no_feature.rs     |   2 +-
 src/test/ui/structs-enums/foreign-struct.rs   |   6 +-
 .../thread-local-extern-static.rs             |   2 +-
 src/test/ui/warn-ctypes-inhibit.rs            |   6 +-
 src/test/ui/wasm-import-module.rs             |   6 +-
 285 files changed, 1010 insertions(+), 947 deletions(-)

diff --git a/compiler/rustc_error_codes/src/error_codes/E0044.md b/compiler/rustc_error_codes/src/error_codes/E0044.md
index 635ff953290..ed7daf8ddd9 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0044.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0044.md
@@ -3,13 +3,13 @@ You cannot use type or const parameters on foreign items.
 Example of erroneous code:
 
 ```compile_fail,E0044
-extern { fn some_func<T>(x: T); }
+extern "C" { fn some_func<T>(x: T); }
 ```
 
 To fix this, replace the generic parameter with the specializations that you
 need:
 
 ```
-extern { fn some_func_i32(x: i32); }
-extern { fn some_func_i64(x: i64); }
+extern "C" { fn some_func_i32(x: i32); }
+extern "C" { fn some_func_i64(x: i64); }
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0130.md b/compiler/rustc_error_codes/src/error_codes/E0130.md
index a270feaf58c..2cd27b5ec05 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0130.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0130.md
@@ -3,7 +3,7 @@ A pattern was declared as an argument in a foreign function declaration.
 Erroneous code example:
 
 ```compile_fail,E0130
-extern {
+extern "C" {
     fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
                                 //        function declarations
 }
@@ -17,7 +17,7 @@ struct SomeStruct {
     b: u32,
 }
 
-extern {
+extern "C" {
     fn foo(s: SomeStruct); // ok!
 }
 ```
@@ -25,7 +25,7 @@ extern {
 Or:
 
 ```
-extern {
+extern "C" {
     fn foo(a: (u32, u32)); // ok!
 }
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0454.md b/compiler/rustc_error_codes/src/error_codes/E0454.md
index 23ca6c7824d..95a22b92e36 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0454.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0454.md
@@ -3,7 +3,7 @@ A link name was given with an empty name.
 Erroneous code example:
 
 ```compile_fail,E0454
-#[link(name = "")] extern {}
+#[link(name = "")] extern "C" {}
 // error: `#[link(name = "")]` given with empty name
 ```
 
@@ -11,5 +11,5 @@ The rust compiler cannot link to an external library if you don't give it its
 name. Example:
 
 ```no_run
-#[link(name = "some_lib")] extern {} // ok!
+#[link(name = "some_lib")] extern "C" {} // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0455.md b/compiler/rustc_error_codes/src/error_codes/E0455.md
index 2f80c34b889..84689b3ece6 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0455.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0455.md
@@ -4,7 +4,7 @@ as frameworks are specific to that operating system.
 Erroneous code example:
 
 ```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos)
-#[link(name = "FooCoreServices", kind = "framework")] extern {}
+#[link(name = "FooCoreServices", kind = "framework")] extern "C" {}
 // OS used to compile is Linux for example
 ```
 
@@ -12,7 +12,7 @@ To solve this error you can use conditional compilation:
 
 ```
 #[cfg_attr(target="macos", link(name = "FooCoreServices", kind = "framework"))]
-extern {}
+extern "C" {}
 ```
 
 Learn more in the [Conditional Compilation][conditional-compilation] section
diff --git a/compiler/rustc_error_codes/src/error_codes/E0458.md b/compiler/rustc_error_codes/src/error_codes/E0458.md
index 075226ac98b..359aeb6fd9a 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0458.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0458.md
@@ -3,7 +3,7 @@ An unknown "kind" was specified for a link attribute.
 Erroneous code example:
 
 ```compile_fail,E0458
-#[link(kind = "wonderful_unicorn")] extern {}
+#[link(kind = "wonderful_unicorn")] extern "C" {}
 // error: unknown kind: `wonderful_unicorn`
 ```
 
diff --git a/compiler/rustc_error_codes/src/error_codes/E0459.md b/compiler/rustc_error_codes/src/error_codes/E0459.md
index 6f75f2a99a5..4a49a765445 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0459.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0459.md
@@ -3,7 +3,7 @@ A link was used without a name parameter.
 Erroneous code example:
 
 ```compile_fail,E0459
-#[link(kind = "dylib")] extern {}
+#[link(kind = "dylib")] extern "C" {}
 // error: `#[link(...)]` specified without `name = "foo"`
 ```
 
@@ -11,5 +11,5 @@ Please add the name parameter to allow the rust compiler to find the library
 you want. Example:
 
 ```no_run
-#[link(kind = "dylib", name = "some_lib")] extern {} // ok!
+#[link(kind = "dylib", name = "some_lib")] extern "C" {} // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0617.md b/compiler/rustc_error_codes/src/error_codes/E0617.md
index 61b56766c26..1c5d1f87b91 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0617.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0617.md
@@ -3,7 +3,7 @@ Attempted to pass an invalid type of variable into a variadic function.
 Erroneous code example:
 
 ```compile_fail,E0617
-extern {
+extern "C" {
     fn printf(c: *const i8, ...);
 }
 
@@ -21,7 +21,7 @@ to import from `std::os::raw`).
 In this case, `c_double` has the same size as `f64` so we can use it directly:
 
 ```no_run
-# extern {
+# extern "C" {
 #     fn printf(c: *const i8, ...);
 # }
 unsafe {
diff --git a/compiler/rustc_error_codes/src/error_codes/E0724.md b/compiler/rustc_error_codes/src/error_codes/E0724.md
index e8f84d0fc7d..70578acbe0d 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0724.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0724.md
@@ -18,7 +18,7 @@ the function inside of an `extern` block.
 ```
 #![feature(ffi_returns_twice)]
 
-extern {
+extern "C" {
    #[ffi_returns_twice] // ok!
    pub fn foo();
 }
diff --git a/compiler/rustc_llvm/src/lib.rs b/compiler/rustc_llvm/src/lib.rs
index b2ffa271f62..592010d78cf 100644
--- a/compiler/rustc_llvm/src/lib.rs
+++ b/compiler/rustc_llvm/src/lib.rs
@@ -38,7 +38,7 @@ pub fn initialize_available_targets() {
         ($cfg:meta, $($method:ident),*) => { {
             #[cfg($cfg)]
             fn init() {
-                extern {
+                extern "C" {
                     $(fn $method();)*
                 }
                 unsafe {
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index d03c19e51f3..a167f0ffa09 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -809,7 +809,7 @@ impl AtomicBool {
     /// ```ignore (extern-declaration)
     /// # fn main() {
     /// use std::sync::atomic::AtomicBool;
-    /// extern {
+    /// extern "C" {
     ///     fn my_atomic_op(arg: *mut bool);
     /// }
     ///
@@ -2068,7 +2068,7 @@ macro_rules! atomic_int {
             /// # fn main() {
             #[doc = concat!($extra_feature, "use std::sync::atomic::", stringify!($atomic_type), ";")]
             ///
-            /// extern {
+            /// extern "C" {
             #[doc = concat!("    fn my_atomic_op(arg: *mut ", stringify!($int_type), ");")]
             /// }
             ///
diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs
index 60b642a6dba..230ef0b23db 100644
--- a/library/std/src/ffi/c_str.rs
+++ b/library/std/src/ffi/c_str.rs
@@ -86,7 +86,7 @@ use crate::sys;
 /// use std::ffi::CString;
 /// use std::os::raw::c_char;
 ///
-/// extern {
+/// extern "C" {
 ///     fn my_printer(s: *const c_char);
 /// }
 ///
@@ -144,7 +144,7 @@ pub struct CString {
 /// use std::ffi::CStr;
 /// use std::os::raw::c_char;
 ///
-/// extern { fn my_string() -> *const c_char; }
+/// extern "C" { fn my_string() -> *const c_char; }
 ///
 /// unsafe {
 ///     let slice = CStr::from_ptr(my_string());
@@ -159,7 +159,7 @@ pub struct CString {
 /// use std::os::raw::c_char;
 ///
 /// fn work(data: &CStr) {
-///     extern { fn work_with(data: *const c_char); }
+///     extern "C" { fn work_with(data: *const c_char); }
 ///
 ///     unsafe { work_with(data.as_ptr()) }
 /// }
@@ -174,7 +174,7 @@ pub struct CString {
 /// use std::ffi::CStr;
 /// use std::os::raw::c_char;
 ///
-/// extern { fn my_string() -> *const c_char; }
+/// extern "C" { fn my_string() -> *const c_char; }
 ///
 /// fn my_string_safe() -> String {
 ///     unsafe {
@@ -359,7 +359,7 @@ impl CString {
     /// use std::ffi::CString;
     /// use std::os::raw::c_char;
     ///
-    /// extern { fn puts(s: *const c_char); }
+    /// extern "C" { fn puts(s: *const c_char); }
     ///
     /// let to_print = CString::new("Hello!").expect("CString::new failed");
     /// unsafe {
@@ -465,7 +465,7 @@ impl CString {
     /// use std::ffi::CString;
     /// use std::os::raw::c_char;
     ///
-    /// extern {
+    /// extern "C" {
     ///     fn some_extern_function(s: *mut c_char);
     /// }
     ///
@@ -1147,7 +1147,7 @@ impl CStr {
     /// use std::ffi::CStr;
     /// use std::os::raw::c_char;
     ///
-    /// extern {
+    /// extern "C" {
     ///     fn my_string() -> *const c_char;
     /// }
     ///
diff --git a/src/doc/unstable-book/src/language-features/link-args.md b/src/doc/unstable-book/src/language-features/link-args.md
index 2507197661a..da36e158001 100644
--- a/src/doc/unstable-book/src/language-features/link-args.md
+++ b/src/doc/unstable-book/src/language-features/link-args.md
@@ -15,7 +15,7 @@ usage would be:
 #![feature(link_args)]
 
 #[link_args = "-foo -bar -baz"]
-extern {}
+extern "C" {}
 # fn main() {}
 ```
 
diff --git a/src/test/codegen/call-llvm-intrinsics.rs b/src/test/codegen/call-llvm-intrinsics.rs
index 24e3d3cd64b..998099c2390 100644
--- a/src/test/codegen/call-llvm-intrinsics.rs
+++ b/src/test/codegen/call-llvm-intrinsics.rs
@@ -13,7 +13,7 @@ impl Drop for A {
     }
 }
 
-extern {
+extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32;
 }
diff --git a/src/test/codegen/dealloc-no-unwind.rs b/src/test/codegen/dealloc-no-unwind.rs
index ff21b4caa83..f047c7a180c 100644
--- a/src/test/codegen/dealloc-no-unwind.rs
+++ b/src/test/codegen/dealloc-no-unwind.rs
@@ -8,7 +8,7 @@ struct A;
 
 impl Drop for A {
     fn drop(&mut self) {
-        extern { fn foo(); }
+        extern "C" { fn foo(); }
         unsafe { foo(); }
     }
 }
diff --git a/src/test/codegen/debug-column.rs b/src/test/codegen/debug-column.rs
index f348c48566d..5d3afef5289 100644
--- a/src/test/codegen/debug-column.rs
+++ b/src/test/codegen/debug-column.rs
@@ -18,7 +18,7 @@ fn main() {
     }
 }
 
-extern {
+extern "C" {
     fn giraffe();
     fn turtle();
 }
diff --git a/src/test/codegen/ffi-const.rs b/src/test/codegen/ffi-const.rs
index 440d022a12c..67baf6fdd3e 100644
--- a/src/test/codegen/ffi-const.rs
+++ b/src/test/codegen/ffi-const.rs
@@ -4,7 +4,7 @@
 
 pub fn bar() { unsafe { foo() } }
 
-extern {
+extern "C" {
     // CHECK-LABEL: declare void @foo()
     // CHECK-SAME: [[ATTRS:#[0-9]+]]
     // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}readnone{{.*}} }
diff --git a/src/test/codegen/ffi-out-of-bounds-loads.rs b/src/test/codegen/ffi-out-of-bounds-loads.rs
index 139a06ab53d..dc16306eb96 100644
--- a/src/test/codegen/ffi-out-of-bounds-loads.rs
+++ b/src/test/codegen/ffi-out-of-bounds-loads.rs
@@ -11,7 +11,7 @@ struct S {
     f3: i32,
 }
 
-extern {
+extern "C" {
     fn foo(s: S);
 }
 
diff --git a/src/test/codegen/ffi-pure.rs b/src/test/codegen/ffi-pure.rs
index f0ebc1caa09..3afb0856c9d 100644
--- a/src/test/codegen/ffi-pure.rs
+++ b/src/test/codegen/ffi-pure.rs
@@ -4,7 +4,7 @@
 
 pub fn bar() { unsafe { foo() } }
 
-extern {
+extern "C" {
     // CHECK-LABEL: declare void @foo()
     // CHECK-SAME: [[ATTRS:#[0-9]+]]
     // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}readonly{{.*}} }
diff --git a/src/test/codegen/ffi-returns-twice.rs b/src/test/codegen/ffi-returns-twice.rs
index 4db328f1cdf..75301dfd346 100644
--- a/src/test/codegen/ffi-returns-twice.rs
+++ b/src/test/codegen/ffi-returns-twice.rs
@@ -4,7 +4,7 @@
 
 pub fn bar() { unsafe { foo() } }
 
-extern {
+extern "C" {
     // CHECK-LABEL: declare void @foo()
     // CHECK-SAME: [[ATTRS:#[0-9]+]]
     // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}returns_twice{{.*}} }
diff --git a/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs b/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
index f100a23a318..31a88f2c0a9 100644
--- a/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
+++ b/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
@@ -13,7 +13,7 @@ impl Drop for A {
     }
 }
 
-extern {
+extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32;
 }
diff --git a/src/test/codegen/unwind-extern-imports.rs b/src/test/codegen/unwind-extern-imports.rs
index 8403e1e9da9..a2ba24aca25 100644
--- a/src/test/codegen/unwind-extern-imports.rs
+++ b/src/test/codegen/unwind-extern-imports.rs
@@ -4,7 +4,7 @@
 #![crate_type = "lib"]
 #![feature(unwind_attributes)]
 
-extern {
+extern "C" {
 // CHECK: Function Attrs:{{.*}}nounwind
 // CHECK-NEXT: declare void @extern_fn
     fn extern_fn();
diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs
index 1e0e8beb10f..43e68fedbfa 100644
--- a/src/test/debuginfo/type-names.rs
+++ b/src/test/debuginfo/type-names.rs
@@ -23,7 +23,6 @@
 // gdbg-check:type = struct Struct2
 // gdbr-check:type = type_names::mod1::Struct2
 
-
 // ENUMS
 // gdb-command:whatis simple_enum_1
 // gdbg-check:type = union Enum1
@@ -45,7 +44,6 @@
 // gdbg-check:type = union Enum3<type_names::Struct1>
 // gdbr-check:type = type_names::mod1::mod2::Enum3<type_names::Struct1>
 
-
 // TUPLES
 // gdb-command:whatis tuple1
 // gdbg-check:type = struct (u32, type_names::Struct1, type_names::mod1::mod2::Enum3<type_names::mod1::Struct2>)
@@ -55,7 +53,6 @@
 // gdbg-check:type = struct ((type_names::Struct1, type_names::mod1::mod2::Struct3), type_names::mod1::Enum2, char)
 // gdbr-check:type = ((type_names::Struct1, type_names::mod1::mod2::Struct3), type_names::mod1::Enum2, char)
 
-
 // BOX
 // gdb-command:whatis box1
 // gdbg-check:type = struct (alloc::boxed::Box<f32>, i32)
@@ -65,7 +62,6 @@
 // gdbg-check:type = struct (alloc::boxed::Box<type_names::mod1::mod2::Enum3<f32>>, i32)
 // gdbr-check:type = (alloc::boxed::Box<type_names::mod1::mod2::Enum3<f32>>, i32)
 
-
 // REFERENCES
 // gdb-command:whatis ref1
 // gdbg-check:type = struct (&type_names::Struct1, i32)
@@ -83,7 +79,6 @@
 // gdbg-check:type = struct (&mut type_names::GenericStruct<type_names::mod1::Enum2, f64>, i32)
 // gdbr-check:type = (&mut type_names::GenericStruct<type_names::mod1::Enum2, f64>, i32)
 
-
 // RAW POINTERS
 // gdb-command:whatis mut_ptr1
 // gdbg-check:type = struct (*mut type_names::Struct1, isize)
@@ -109,7 +104,6 @@
 // gdbg-check:type = struct (*const type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
 // gdbr-check:type = (*const type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
 
-
 // VECTORS
 // gdb-command:whatis fixed_size_vec1
 // gdbg-check:type = struct ([type_names::Struct1; 3], i16)
@@ -127,7 +121,6 @@
 // gdbg-check:type = struct &[type_names::mod1::Enum2]
 // gdbr-check:type = &[type_names::mod1::Enum2]
 
-
 // TRAITS
 // gdb-command:whatis box_trait
 // gdbg-check:type = struct Box<Trait1>
@@ -153,7 +146,6 @@
 // gdbg-check:type = struct &mut Trait2<type_names::mod1::mod2::Struct3, type_names::GenericStruct<usize, isize>>
 // gdbr-check:type = type_names::&mut Trait2<type_names::mod1::mod2::Struct3, type_names::GenericStruct<usize, isize>>
 
-
 // BARE FUNCTIONS
 // gdb-command:whatis rust_fn
 // gdbg-check:type = struct (fn(core::option::Option<isize>, core::option::Option<&type_names::mod1::Struct2>), usize)
@@ -199,7 +191,6 @@
 // gdbg-check:type = struct (unsafe extern "C" fn(*const u8, ...) -> isize, usize)
 // gdbr-check:type = (unsafe extern "C" fn(*const u8, ...) -> isize, usize)
 
-
 // CLOSURES
 // gdb-command:whatis closure1
 // gdbg-check:type = struct (closure, usize)
@@ -219,7 +210,7 @@ use std::marker::PhantomData;
 use std::ptr;
 
 pub struct Struct1;
-struct GenericStruct<T1, T2>(PhantomData<(T1,T2)>);
+struct GenericStruct<T1, T2>(PhantomData<(T1, T2)>);
 
 enum Enum1 {
     Variant1,
@@ -246,8 +237,12 @@ mod mod1 {
     }
 }
 
-trait Trait1 { fn dummy(&self) { } }
-trait Trait2<T1, T2> { fn dummy(&self, _: T1, _:T2) { } }
+trait Trait1 {
+    fn dummy(&self) {}
+}
+trait Trait2<T1, T2> {
+    fn dummy(&self, _: T1, _: T2) {}
+}
 
 impl Trait1 for isize {}
 impl<T1, T2> Trait2<T1, T2> for isize {}
@@ -257,16 +252,26 @@ extern "C" fn extern_c_fn(_: isize) {}
 unsafe fn unsafe_fn(_: Result<char, f64>) {}
 extern "stdcall" fn extern_stdcall_fn() {}
 
-fn rust_fn_with_return_value(_: f64) -> usize { 4 }
-extern "C" fn extern_c_fn_with_return_value() -> Struct1 { Struct1 }
-unsafe fn unsafe_fn_with_return_value(_: GenericStruct<u16, u8>) -> mod1::Struct2 { mod1::Struct2 }
-extern "stdcall" fn extern_stdcall_fn_with_return_value(_: Box<isize>) -> usize { 0 }
+fn rust_fn_with_return_value(_: f64) -> usize {
+    4
+}
+extern "C" fn extern_c_fn_with_return_value() -> Struct1 {
+    Struct1
+}
+unsafe fn unsafe_fn_with_return_value(_: GenericStruct<u16, u8>) -> mod1::Struct2 {
+    mod1::Struct2
+}
+extern "stdcall" fn extern_stdcall_fn_with_return_value(_: Box<isize>) -> usize {
+    0
+}
 
-fn generic_function<T>(x: T) -> T { x }
+fn generic_function<T>(x: T) -> T {
+    x
+}
 
 #[allow(improper_ctypes)]
-extern {
-    fn printf(_:*const u8, ...) -> isize;
+extern "C" {
+    fn printf(_: *const u8, ...) -> isize;
 }
 
 // In many of the cases below, the type that is actually under test is wrapped
@@ -277,7 +282,6 @@ extern {
 // printed correctly, so the tests below just construct a tuple type that will
 // then *contain* the type name that we want to see.
 fn main() {
-
     // Structs
     let simple_struct = Struct1;
     let generic_struct1: GenericStruct<mod1::Struct2, mod1::mod2::Struct3> =
@@ -336,11 +340,11 @@ fn main() {
     let mut_ref_trait = (&mut mut_int1) as &mut Trait1;
 
     let generic_box_trait = (box 0_isize) as Box<Trait2<i32, mod1::Struct2>>;
-    let generic_ref_trait  = (&0_isize) as &Trait2<Struct1, Struct1>;
+    let generic_ref_trait = (&0_isize) as &Trait2<Struct1, Struct1>;
 
     let mut generic_mut_ref_trait_impl = 0_isize;
-    let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl) as
-        &mut Trait2<mod1::mod2::Struct3, GenericStruct<usize, isize>>;
+    let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl)
+        as &mut Trait2<mod1::mod2::Struct3, GenericStruct<usize, isize>>;
 
     // Bare Functions
     let rust_fn = (rust_fn, 0_usize);
@@ -364,11 +368,13 @@ fn main() {
     // how that maps to rustc's internal representation of these forms.
     // Once closures have reached their 1.0 form, the tests below should
     // probably be expanded.
-    let closure1 = (|x:isize| {}, 0_usize);
-    let closure2 = (|x:i8, y: f32| { (x as f32) + y }, 0_usize);
+    let closure1 = (|x: isize| {}, 0_usize);
+    let closure2 = (|x: i8, y: f32| (x as f32) + y, 0_usize);
 
     zzz(); // #break
 }
 
 #[inline(never)]
-fn zzz() { () }
+fn zzz() {
+    ()
+}
diff --git a/src/test/incremental/foreign.rs b/src/test/incremental/foreign.rs
index 498bf892250..f46f92eb500 100644
--- a/src/test/incremental/foreign.rs
+++ b/src/test/incremental/foreign.rs
@@ -13,7 +13,7 @@ use std::ffi::CString;
 mod mlibc {
     use libc::{c_char, c_long, c_longlong};
 
-    extern {
+    extern "C" {
         pub fn atol(x: *const c_char) -> c_long;
         pub fn atoll(x: *const c_char) -> c_longlong;
     }
@@ -31,6 +31,8 @@ fn atoll(s: String) -> i64 {
 
 pub fn main() {
     assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string()));
-    assert_eq!((atoll("11111111111111111".to_string()) * 10),
-             atoll("111111111111111110".to_string()));
+    assert_eq!(
+        (atoll("11111111111111111".to_string()) * 10),
+        atoll("111111111111111110".to_string())
+    );
 }
diff --git a/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs b/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs
index 5f5ed424ba9..0bf13c406ab 100644
--- a/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs
+++ b/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs
@@ -1,7 +1,7 @@
 #![crate_type = "rlib"]
 
 #[link(name = "foo", kind = "static")]
-extern {
+extern "C" {
     fn foo();
     fn bar();
 }
diff --git a/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs b/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs
index 14f67017a3b..9f7a9e2213c 100644
--- a/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs
+++ b/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs
@@ -1,7 +1,7 @@
 #![crate_type = "dylib"]
 
 #[link(name = "cfoo")]
-extern {
+extern "C" {
     fn foo();
 }
 
diff --git a/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs b/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs
index 9bf3689cd36..3dd376f1ff5 100644
--- a/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs
+++ b/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs
@@ -1,7 +1,7 @@
 #![crate_type = "rlib"]
 
 #[link(name = "cfoo")]
-extern {
+extern "C" {
     fn foo();
 }
 
diff --git a/src/test/run-make-fulldeps/c-static-dylib/foo.rs b/src/test/run-make-fulldeps/c-static-dylib/foo.rs
index 25e1ed2a9d3..1e8af4d4404 100644
--- a/src/test/run-make-fulldeps/c-static-dylib/foo.rs
+++ b/src/test/run-make-fulldeps/c-static-dylib/foo.rs
@@ -1,7 +1,7 @@
 #![crate_type = "dylib"]
 
 #[link(name = "cfoo", kind = "static")]
-extern {
+extern "C" {
     fn foo();
 }
 
diff --git a/src/test/run-make-fulldeps/c-static-rlib/foo.rs b/src/test/run-make-fulldeps/c-static-rlib/foo.rs
index d434ecfa8bb..9c6d2080ef4 100644
--- a/src/test/run-make-fulldeps/c-static-rlib/foo.rs
+++ b/src/test/run-make-fulldeps/c-static-rlib/foo.rs
@@ -1,7 +1,7 @@
 #![crate_type = "rlib"]
 
 #[link(name = "cfoo", kind = "static")]
-extern {
+extern "C" {
     fn foo();
 }
 
diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs
index ca2676cf67d..6cd9916b6f6 100644
--- a/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs
+++ b/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs
@@ -1,4 +1,4 @@
 #![crate_type = "rlib"]
 
 #[link(name = "native", kind = "static")]
-extern {}
+extern "C" {}
diff --git a/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs b/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs
index 7b5c740cb49..7fdb8158871 100644
--- a/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs
+++ b/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs
@@ -1,6 +1,10 @@
-extern { fn foo(); }
+extern "C" {
+    fn foo();
+}
 
 pub fn main() {
-    unsafe { foo(); }
+    unsafe {
+        foo();
+    }
     assert_eq!(7f32.powi(3), 343f32);
 }
diff --git a/src/test/run-make-fulldeps/extern-fn-generic/test.rs b/src/test/run-make-fulldeps/extern-fn-generic/test.rs
index 0666bf4262d..c9baa489881 100644
--- a/src/test/run-make-fulldeps/extern-fn-generic/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-generic/test.rs
@@ -1,22 +1,20 @@
 extern crate testcrate;
 
-extern "C" fn bar<T>(ts: testcrate::TestStruct<T>) -> T { ts.y }
+extern "C" fn bar<T>(ts: testcrate::TestStruct<T>) -> T {
+    ts.y
+}
 
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     fn call(c: extern "C" fn(testcrate::TestStruct<i32>) -> i32) -> i32;
 }
 
 fn main() {
     // Let's test calling it cross crate
-    let back = unsafe {
-        testcrate::call(testcrate::foo::<i32>)
-    };
+    let back = unsafe { testcrate::call(testcrate::foo::<i32>) };
     assert_eq!(3, back);
 
     // And just within this crate
-    let back = unsafe {
-        call(bar::<i32>)
-    };
+    let back = unsafe { call(bar::<i32>) };
     assert_eq!(3, back);
 }
diff --git a/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs b/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs
index f0a721d35e2..39f76e59ca0 100644
--- a/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs
+++ b/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs
@@ -3,12 +3,14 @@
 #[repr(C)]
 pub struct TestStruct<T> {
     pub x: u8,
-    pub y: T
+    pub y: T,
 }
 
-pub extern "C" fn foo<T>(ts: TestStruct<T>) -> T { ts.y }
+pub extern "C" fn foo<T>(ts: TestStruct<T>) -> T {
+    ts.y
+}
 
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     pub fn call(c: extern "C" fn(TestStruct<i32>) -> i32) -> i32;
 }
diff --git a/src/test/run-make-fulldeps/extern-fn-mangle/test.rs b/src/test/run-make-fulldeps/extern-fn-mangle/test.rs
index b213534c958..40b08f1ed70 100644
--- a/src/test/run-make-fulldeps/extern-fn-mangle/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-mangle/test.rs
@@ -1,11 +1,15 @@
 #[no_mangle]
-pub extern "C" fn foo() -> i32 { 3 }
+pub extern "C" fn foo() -> i32 {
+    3
+}
 
 #[no_mangle]
-pub extern "C" fn bar() -> i32 { 5 }
+pub extern "C" fn bar() -> i32 {
+    5
+}
 
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     fn add() -> i32;
 }
 
diff --git a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs
index 615163d9ad2..afe0f52ef0b 100644
--- a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs
@@ -7,7 +7,7 @@ struct Rect {
     a: i32,
     b: i32,
     c: i32,
-    d: i32
+    d: i32,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -15,7 +15,7 @@ struct Rect {
 struct BiggerRect {
     s: Rect,
     a: i32,
-    b: i32
+    b: i32,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -23,7 +23,7 @@ struct BiggerRect {
 struct FloatRect {
     a: i32,
     b: i32,
-    c: f64
+    c: f64,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -33,14 +33,14 @@ struct Huge {
     b: i32,
     c: i32,
     d: i32,
-    e: i32
+    e: i32,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq)]
 #[repr(C)]
 struct FloatPoint {
     x: f64,
-    y: f64
+    y: f64,
 }
 
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -58,13 +58,22 @@ struct IntOdd {
 }
 
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect);
 
     fn byval_many_rect(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, s: Rect);
 
-    fn byval_rect_floats(a: f32, b: f32, c: f64, d: f32, e: f32,
-                         f: f32, g: f64, s: Rect, t: FloatRect);
+    fn byval_rect_floats(
+        a: f32,
+        b: f32,
+        c: f64,
+        d: f32,
+        e: f32,
+        f: f32,
+        g: f64,
+        s: Rect,
+        t: FloatRect,
+    );
 
     fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect);
 
@@ -107,12 +116,7 @@ fn main() {
         byval_many_rect(1, 2, 3, 4, 5, 6, s);
         byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u);
         byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s);
-        byval_rect_with_many_huge(v, v, v, v, v, v, Rect {
-            a: 123,
-            b: 456,
-            c: 789,
-            d: 420
-        });
+        byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 });
         split_rect(1, 2, s);
         split_rect_floats(1., 2., u);
         split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s);
diff --git a/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs b/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs
index 6c027cc8f57..90a6ebaf1aa 100644
--- a/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs
@@ -1,7 +1,7 @@
 #![feature(extern_types)]
 
 #[link(name = "ctest", kind = "static")]
-extern {
+extern "C" {
     type data;
 
     fn data_create(magic: u32) -> *mut data;
diff --git a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs
index 7d7658ceeb3..2f261efb510 100644
--- a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs
@@ -3,11 +3,11 @@
 struct Foo {
     a: i8,
     b: i16,
-    c: i8
+    c: i8,
 }
 
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     fn foo(f: Foo) -> Foo;
 }
 
diff --git a/src/test/run-make-fulldeps/extern-fn-with-union/test.rs b/src/test/run-make-fulldeps/extern-fn-with-union/test.rs
index 007dfdb5e10..438fbddf31f 100644
--- a/src/test/run-make-fulldeps/extern-fn-with-union/test.rs
+++ b/src/test/run-make-fulldeps/extern-fn-with-union/test.rs
@@ -2,7 +2,7 @@ extern crate testcrate;
 
 use std::mem;
 
-extern {
+extern "C" {
     fn give_back(tu: testcrate::TestUnion) -> u64;
 }
 
@@ -10,14 +10,10 @@ fn main() {
     let magic: u64 = 0xDEADBEEF;
 
     // Let's test calling it cross crate
-    let back = unsafe {
-        testcrate::give_back(mem::transmute(magic))
-    };
+    let back = unsafe { testcrate::give_back(mem::transmute(magic)) };
     assert_eq!(magic, back);
 
     // And just within this crate
-    let back = unsafe {
-        give_back(mem::transmute(magic))
-    };
+    let back = unsafe { give_back(mem::transmute(magic)) };
     assert_eq!(magic, back);
 }
diff --git a/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs b/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs
index b51526dfcee..28d91ff37c3 100644
--- a/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs
+++ b/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs
@@ -2,10 +2,10 @@
 
 #[repr(C)]
 pub struct TestUnion {
-    _val: u64
+    _val: u64,
 }
 
 #[link(name = "ctest", kind = "static")]
-extern {
+extern "C" {
     pub fn give_back(tu: TestUnion) -> u64;
 }
diff --git a/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs b/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs
index 2794be53ce4..3c2c3f21814 100644
--- a/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs
+++ b/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs
@@ -3,10 +3,12 @@
 extern crate foo;
 
 #[link(name = "bar", kind = "static")]
-extern {
+extern "C" {
     fn bar();
 }
 
 pub fn doit() {
-    unsafe { bar(); }
+    unsafe {
+        bar();
+    }
 }
diff --git a/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs b/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs
index 891c47d61de..a69809726c6 100644
--- a/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs
+++ b/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs
@@ -1,10 +1,12 @@
 #![crate_type = "rlib"]
 
 #[link(name = "foo", kind = "static")]
-extern {
+extern "C" {
     fn foo();
 }
 
 pub fn doit() {
-    unsafe { foo(); }
+    unsafe {
+        foo();
+    }
 }
diff --git a/src/test/run-make-fulldeps/issue-15460/foo.rs b/src/test/run-make-fulldeps/issue-15460/foo.rs
index 9beafd9ff35..b4eaa0b31c5 100644
--- a/src/test/run-make-fulldeps/issue-15460/foo.rs
+++ b/src/test/run-make-fulldeps/issue-15460/foo.rs
@@ -1,6 +1,6 @@
 #![crate_type = "dylib"]
 
 #[link(name = "foo", kind = "static")]
-extern {
+extern "C" {
     pub fn foo();
 }
diff --git a/src/test/run-make-fulldeps/issue-25581/test.rs b/src/test/run-make-fulldeps/issue-25581/test.rs
index 5dfa6bb7b69..ba6749c9722 100644
--- a/src/test/run-make-fulldeps/issue-25581/test.rs
+++ b/src/test/run-make-fulldeps/issue-25581/test.rs
@@ -1,11 +1,11 @@
 #[link(name = "test", kind = "static")]
-extern {
+extern "C" {
     fn slice_len(s: &[u8]) -> usize;
     fn slice_elem(s: &[u8], idx: usize) -> u8;
 }
 
 fn main() {
-    let data = [1,2,3,4,5];
+    let data = [1, 2, 3, 4, 5];
 
     unsafe {
         assert_eq!(data.len(), slice_len(&data) as usize);
diff --git a/src/test/run-make-fulldeps/issue-28595/a.rs b/src/test/run-make-fulldeps/issue-28595/a.rs
index 44836415186..07863cf64d6 100644
--- a/src/test/run-make-fulldeps/issue-28595/a.rs
+++ b/src/test/run-make-fulldeps/issue-28595/a.rs
@@ -1,6 +1,6 @@
 #![crate_type = "rlib"]
 
 #[link(name = "a", kind = "static")]
-extern {
+extern "C" {
     pub fn a();
 }
diff --git a/src/test/run-make-fulldeps/issue-28595/b.rs b/src/test/run-make-fulldeps/issue-28595/b.rs
index 24ab412284d..1f389859fad 100644
--- a/src/test/run-make-fulldeps/issue-28595/b.rs
+++ b/src/test/run-make-fulldeps/issue-28595/b.rs
@@ -1,11 +1,12 @@
 extern crate a;
 
 #[link(name = "b", kind = "static")]
-extern {
+extern "C" {
     pub fn b();
 }
 
-
 fn main() {
-    unsafe { b(); }
+    unsafe {
+        b();
+    }
 }
diff --git a/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs b/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs
index 55c96df7b58..5ad66475d00 100644
--- a/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs
+++ b/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs
@@ -3,6 +3,6 @@
 
 #[link(name = "return1", cfg(foo))]
 #[link(name = "return3", kind = "static", cfg(bar))]
-extern {
+extern "C" {
     pub fn my_function() -> i32;
 }
diff --git a/src/test/run-make-fulldeps/link-cfg/dep.rs b/src/test/run-make-fulldeps/link-cfg/dep.rs
index 149ae61bf88..40de77f05b3 100644
--- a/src/test/run-make-fulldeps/link-cfg/dep.rs
+++ b/src/test/run-make-fulldeps/link-cfg/dep.rs
@@ -3,6 +3,6 @@
 
 #[link(name = "return1", cfg(foo))]
 #[link(name = "return2", cfg(bar))]
-extern {
+extern "C" {
     pub fn my_function() -> i32;
 }
diff --git a/src/test/run-make-fulldeps/link-cfg/no-deps.rs b/src/test/run-make-fulldeps/link-cfg/no-deps.rs
index 6dba7fe218e..ba5a8711a26 100644
--- a/src/test/run-make-fulldeps/link-cfg/no-deps.rs
+++ b/src/test/run-make-fulldeps/link-cfg/no-deps.rs
@@ -2,7 +2,7 @@
 
 #[link(name = "return1", cfg(foo))]
 #[link(name = "return2", cfg(bar))]
-extern {
+extern "C" {
     fn my_function() -> i32;
 }
 
diff --git a/src/test/run-make-fulldeps/link-path-order/main.rs b/src/test/run-make-fulldeps/link-path-order/main.rs
index 10f12823bd3..8024e343d19 100644
--- a/src/test/run-make-fulldeps/link-path-order/main.rs
+++ b/src/test/run-make-fulldeps/link-path-order/main.rs
@@ -2,15 +2,13 @@
 
 extern crate libc;
 
-#[link(name="foo", kind = "static")]
-extern {
+#[link(name = "foo", kind = "static")]
+extern "C" {
     fn should_return_one() -> libc::c_int;
 }
 
 fn main() {
-    let result = unsafe {
-        should_return_one()
-    };
+    let result = unsafe { should_return_one() };
 
     if result != 1 {
         std::process::exit(255);
diff --git a/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs b/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs
index b827532e889..68607cbb657 100644
--- a/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs
+++ b/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs
@@ -5,7 +5,7 @@
 static BAZ: i32 = 21;
 
 #[link(name = "foo", kind = "static")]
-extern {
+extern "C" {
     fn what() -> i32;
 }
 
diff --git a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
index f313798de21..db238c0cf1a 100644
--- a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
+++ b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
@@ -25,7 +25,7 @@ fn write_test_case(file: &Path, n: usize) -> HashSet<String> {
         writeln!(f, "#[link(name = \"S{}{}S\")]", prefix, i).unwrap();
         libs.insert(format!("{}{}", prefix, i));
     }
-    writeln!(f, "extern {{}}\nfn main() {{}}").unwrap();
+    writeln!(f, "extern \"C\" {{}}\nfn main() {{}}").unwrap();
     f.into_inner().unwrap();
 
     libs
diff --git a/src/test/run-make-fulldeps/longjmp-across-rust/main.rs b/src/test/run-make-fulldeps/longjmp-across-rust/main.rs
index 5b43c1cc3b7..cc1d5b126dd 100644
--- a/src/test/run-make-fulldeps/longjmp-across-rust/main.rs
+++ b/src/test/run-make-fulldeps/longjmp-across-rust/main.rs
@@ -1,6 +1,6 @@
 #[link(name = "foo", kind = "static")]
-extern {
-    fn test_start(f: extern fn());
+extern "C" {
+    fn test_start(f: extern "C" fn());
     fn test_end();
 }
 
@@ -13,11 +13,10 @@ fn main() {
 struct A;
 
 impl Drop for A {
-    fn drop(&mut self) {
-    }
+    fn drop(&mut self) {}
 }
 
-extern fn test_middle() {
+extern "C" fn test_middle() {
     let _a = A;
     foo();
 }
diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs
index 4b43b86600c..f70bb338223 100644
--- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs
+++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs
@@ -1,7 +1,7 @@
 #![crate_type = "rlib"]
 
 #[link(name = "foo", kind = "static")]
-extern {
+extern "C" {
     fn foo() -> i32;
 }
 
diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs
index c9e1baa434b..2dec2a2718e 100644
--- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs
+++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs
@@ -3,7 +3,7 @@
 extern crate lib1;
 
 #[link(name = "bar", kind = "static")]
-extern {
+extern "C" {
     fn foo() -> i32;
 }
 
diff --git a/src/test/run-make-fulldeps/manual-link/foo.rs b/src/test/run-make-fulldeps/manual-link/foo.rs
index f5cd598abc6..c1f28236ffd 100644
--- a/src/test/run-make-fulldeps/manual-link/foo.rs
+++ b/src/test/run-make-fulldeps/manual-link/foo.rs
@@ -1,9 +1,11 @@
 #![crate_type = "rlib"]
 
-extern {
+extern "C" {
     fn bar();
 }
 
 pub fn foo() {
-    unsafe { bar(); }
+    unsafe {
+        bar();
+    }
 }
diff --git a/src/test/run-make-fulldeps/no-duplicate-libs/main.rs b/src/test/run-make-fulldeps/no-duplicate-libs/main.rs
index 298018ca718..b25ef35ada6 100644
--- a/src/test/run-make-fulldeps/no-duplicate-libs/main.rs
+++ b/src/test/run-make-fulldeps/no-duplicate-libs/main.rs
@@ -1,7 +1,7 @@
 #[link(name = "foo")] // linker should drop this library, no symbols used
 #[link(name = "bar")] // symbol comes from this library
 #[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it
-extern {
+extern "C" {
     fn bar();
 }
 
diff --git a/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs b/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs
index 3bbbcd9c6f8..ef053aa2e7a 100644
--- a/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs
+++ b/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn overflow();
 }
 
diff --git a/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs b/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs
index 3bbbcd9c6f8..ef053aa2e7a 100644
--- a/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs
+++ b/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn overflow();
 }
 
diff --git a/src/test/run-make-fulldeps/sanitizer-staticlib-link/program.rs b/src/test/run-make-fulldeps/sanitizer-staticlib-link/program.rs
index 21e1ade2cd5..ec59bdb11c8 100644
--- a/src/test/run-make-fulldeps/sanitizer-staticlib-link/program.rs
+++ b/src/test/run-make-fulldeps/sanitizer-staticlib-link/program.rs
@@ -1,5 +1,5 @@
 #[link(name = "library")]
-extern {
+extern "C" {
     fn overflow();
 }
 
diff --git a/src/test/run-make-fulldeps/save-analysis-fail/foo.rs b/src/test/run-make-fulldeps/save-analysis-fail/foo.rs
index 5d504ced65e..94879c2a6ed 100644
--- a/src/test/run-make-fulldeps/save-analysis-fail/foo.rs
+++ b/src/test/run-make-fulldeps/save-analysis-fail/foo.rs
@@ -1,4 +1,4 @@
-#![ crate_name = "test" ]
+#![crate_name = "test"]
 #![feature(box_syntax)]
 #![feature(rustc_private)]
 
@@ -9,11 +9,10 @@ extern crate krate2;
 extern crate krate2 as krate3;
 
 use rustc_graphviz::RenderOption;
-use std::collections::{HashMap,HashSet};
 use std::cell::RefCell;
+use std::collections::{HashMap, HashSet};
 use std::io::Write;
 
-
 use sub::sub2 as msalias;
 use sub::sub2;
 use sub::sub2::nested_struct as sub_struct;
@@ -30,7 +29,7 @@ static bob: Option<graphviz::RenderOption> = None;
 // buglink test - see issue #1337.
 
 fn test_alias<I: Iterator>(i: Option<<I as Iterator>::Item>) {
-    let s = sub_struct{ field2: 45u32, };
+    let s = sub_struct { field2: 45u32 };
 
     // import tests
     fn foo(x: &Write) {}
@@ -80,7 +79,7 @@ mod sub {
 
         pub enum nested_enum {
             Nest2 = 2,
-            Nest3 = 3
+            Nest3 = 3,
         }
     }
 }
@@ -101,7 +100,9 @@ struct some_fields {
 type SF = some_fields;
 
 trait SuperTrait {
-    fn qux(&self) { panic!(); }
+    fn qux(&self) {
+        panic!();
+    }
 }
 
 trait SomeTrait: SuperTrait {
@@ -136,8 +137,7 @@ impl SomeTrait for some_fields {
     }
 }
 
-impl SuperTrait for some_fields {
-}
+impl SuperTrait for some_fields {}
 
 impl SubTrait for some_fields {}
 
@@ -150,17 +150,14 @@ impl some_fields {
         42
     }
 
-    fn align_to<T>(&mut self) {
-
-    }
+    fn align_to<T>(&mut self) {}
 
     fn test(&mut self) {
         self.align_to::<bool>();
     }
 }
 
-impl SuperTrait for nofields {
-}
+impl SuperTrait for nofields {}
 impl SomeTrait for nofields {
     fn Method(&self, x: u32) -> u32 {
         self.Method(x);
@@ -186,59 +183,70 @@ enum SomeEnum<'a> {
     Ints(isize, isize),
     Floats(f64, f64),
     Strings(&'a str, &'a str, &'a str),
-    MyTypes(MyType, MyType)
+    MyTypes(MyType, MyType),
 }
 
 #[derive(Copy, Clone)]
 enum SomeOtherEnum {
     SomeConst1,
     SomeConst2,
-    SomeConst3
+    SomeConst3,
 }
 
 enum SomeStructEnum {
-    EnumStruct{a:isize, b:isize},
-    EnumStruct2{f1:MyType, f2:MyType},
-    EnumStruct3{f1:MyType, f2:MyType, f3:SomeEnum<'static>}
+    EnumStruct { a: isize, b: isize },
+    EnumStruct2 { f1: MyType, f2: MyType },
+    EnumStruct3 { f1: MyType, f2: MyType, f3: SomeEnum<'static> },
 }
 
 fn matchSomeEnum(val: SomeEnum) {
     match val {
-        SomeEnum::Ints(int1, int2) => { println(&(int1+int2).to_string()); }
-        SomeEnum::Floats(float1, float2) => { println(&(float2*float1).to_string()); }
-        SomeEnum::Strings(.., s3) => { println(s3); }
-        SomeEnum::MyTypes(mt1, mt2) => { println(&(mt1.field1 - mt2.field1).to_string()); }
+        SomeEnum::Ints(int1, int2) => {
+            println(&(int1 + int2).to_string());
+        }
+        SomeEnum::Floats(float1, float2) => {
+            println(&(float2 * float1).to_string());
+        }
+        SomeEnum::Strings(.., s3) => {
+            println(s3);
+        }
+        SomeEnum::MyTypes(mt1, mt2) => {
+            println(&(mt1.field1 - mt2.field1).to_string());
+        }
     }
 }
 
 fn matchSomeStructEnum(se: SomeStructEnum) {
     match se {
-        SomeStructEnum::EnumStruct{a:a, ..} => println(&a.to_string()),
-        SomeStructEnum::EnumStruct2{f1:f1, f2:f_2} => println(&f_2.field1.to_string()),
-        SomeStructEnum::EnumStruct3{f1, ..} => println(&f1.field1.to_string()),
+        SomeStructEnum::EnumStruct { a: a, .. } => println(&a.to_string()),
+        SomeStructEnum::EnumStruct2 { f1: f1, f2: f_2 } => println(&f_2.field1.to_string()),
+        SomeStructEnum::EnumStruct3 { f1, .. } => println(&f1.field1.to_string()),
     }
 }
 
-
 fn matchSomeStructEnum2(se: SomeStructEnum) {
     use SomeStructEnum::*;
     match se {
-        EnumStruct{a: ref aaa, ..} => println(&aaa.to_string()),
-        EnumStruct2{f1, f2: f2} => println(&f1.field1.to_string()),
-        EnumStruct3{f1, f3: SomeEnum::Ints(..), f2} => println(&f1.field1.to_string()),
-        _ => {},
+        EnumStruct { a: ref aaa, .. } => println(&aaa.to_string()),
+        EnumStruct2 { f1, f2: f2 } => println(&f1.field1.to_string()),
+        EnumStruct3 { f1, f3: SomeEnum::Ints(..), f2 } => println(&f1.field1.to_string()),
+        _ => {}
     }
 }
 
 fn matchSomeOtherEnum(val: SomeOtherEnum) {
     use SomeOtherEnum::{SomeConst2, SomeConst3};
     match val {
-        SomeOtherEnum::SomeConst1 => { println("I'm const1."); }
-        SomeConst2 | SomeConst3 => { println("I'm const2 or const3."); }
+        SomeOtherEnum::SomeConst1 => {
+            println("I'm const1.");
+        }
+        SomeConst2 | SomeConst3 => {
+            println("I'm const2 or const3.");
+        }
     }
 }
 
-fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
+fn hello<X: SomeTrait>((z, a): (u32, String), ex: X) {
     SameDir2::hello(43);
 
     println(&yy.to_string());
@@ -253,8 +261,8 @@ fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
     let x = 32.0f32;
     let _ = (x + ((x * x) + 1.0).sqrt()).ln();
 
-    let s: Box<SomeTrait> = box some_fields {field1: 43};
-    let s2: Box<some_fields> =  box some_fields {field1: 43};
+    let s: Box<SomeTrait> = box some_fields { field1: 43 };
+    let s2: Box<some_fields> = box some_fields { field1: 43 };
     let s3 = box nofields;
 
     s.Method(43);
@@ -307,8 +315,9 @@ mod macro_use_test {
     }
 }
 
-fn main() { // foo
-    let s = box some_fields {field1: 43};
+fn main() {
+    // foo
+    let s = box some_fields { field1: 43 };
     hello((43, "a".to_string()), *s);
     sub::sub2::hello();
     sub2::sub3::hello();
@@ -329,26 +338,24 @@ fn main() { // foo
     let vs = variable_str!(32);
 
     let mut candidates: RefCell<HashMap<&'static str, &'static str>> = RefCell::new(HashMap::new());
-    let _ = blah {
-        used_link_args: RefCell::new([]),
-    };
+    let _ = blah { used_link_args: RefCell::new([]) };
     let s1 = nofields;
-    let s2 = SF { field1: 55};
-    let s3: some_fields = some_fields{ field1: 55};
-    let s4: msalias::nested_struct = sub::sub2::nested_struct{ field2: 55};
-    let s4: msalias::nested_struct = sub2::nested_struct{ field2: 55};
+    let s2 = SF { field1: 55 };
+    let s3: some_fields = some_fields { field1: 55 };
+    let s4: msalias::nested_struct = sub::sub2::nested_struct { field2: 55 };
+    let s4: msalias::nested_struct = sub2::nested_struct { field2: 55 };
     println(&s2.field1.to_string());
-    let s5: MyType = box some_fields{ field1: 55};
-    let s = SameDir::SameStruct{name: "Bob".to_string()};
-    let s = SubDir::SubStruct{name:"Bob".to_string()};
+    let s5: MyType = box some_fields { field1: 55 };
+    let s = SameDir::SameStruct { name: "Bob".to_string() };
+    let s = SubDir::SubStruct { name: "Bob".to_string() };
     let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5);
     let s7: SomeEnum = SomeEnum::Strings("one", "two", "three");
     matchSomeEnum(s6);
     matchSomeEnum(s7);
     let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2;
     matchSomeOtherEnum(s8);
-    let s9: SomeStructEnum = SomeStructEnum::EnumStruct2{ f1: box some_fields{ field1:10 },
-                                                          f2: box s2 };
+    let s9: SomeStructEnum =
+        SomeStructEnum::EnumStruct2 { f1: box some_fields { field1: 10 }, f2: box s2 };
     matchSomeStructEnum(s9);
 
     for x in &vec![1, 2, 3] {
@@ -409,8 +416,7 @@ impl<'a> Pattern<'a> for CharEqPattern {
 
 struct CharSearcher<'a>(<CharEqPattern as Pattern<'a>>::Searcher);
 
-pub trait Error {
-}
+pub trait Error {}
 
 impl Error + 'static {
     pub fn is<T: Error + 'static>(&self) -> bool {
@@ -437,13 +443,13 @@ fn test_format_args() {
     print!("x is {}, y is {1}, name is {n}", x, y, n = name);
 }
 
-extern {
+extern "C" {
     static EXTERN_FOO: u8;
     fn extern_foo(a: u8, b: i32) -> String;
 }
 
 struct Rls699 {
-  f: u32,
+    f: u32,
 }
 
 fn new(f: u32) -> Rls699 {
diff --git a/src/test/run-make-fulldeps/static-nobundle/bbb.rs b/src/test/run-make-fulldeps/static-nobundle/bbb.rs
index 0e10fc3dd3a..69d1668d4f6 100644
--- a/src/test/run-make-fulldeps/static-nobundle/bbb.rs
+++ b/src/test/run-make-fulldeps/static-nobundle/bbb.rs
@@ -2,7 +2,7 @@
 #![feature(static_nobundle)]
 
 #[link(name = "aaa", kind = "static-nobundle")]
-extern {
+extern "C" {
     pub fn native_func();
 }
 
diff --git a/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs b/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs
index 48ba8b7f1b7..bf48d069da9 100644
--- a/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs
+++ b/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs
@@ -1,6 +1,6 @@
 #![crate_type = "staticlib"]
 
 #[link(name = "foo", kind = "static")]
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/run-make-fulldeps/target-specs/foo.rs b/src/test/run-make-fulldeps/target-specs/foo.rs
index ee443eb0aa3..9ff33e24d04 100644
--- a/src/test/run-make-fulldeps/target-specs/foo.rs
+++ b/src/test/run-make-fulldeps/target-specs/foo.rs
@@ -1,19 +1,21 @@
 #![feature(lang_items, no_core, auto_traits)]
 #![no_core]
 
-#[lang="copy"]
-trait Copy { }
+#[lang = "copy"]
+trait Copy {}
 
-#[lang="sized"]
-trait Sized { }
+#[lang = "sized"]
+trait Sized {}
 
 #[lang = "freeze"]
 auto trait Freeze {}
 
-#[lang="start"]
-fn start(_main: *const u8, _argc: isize, _argv: *const *const u8) -> isize { 0 }
+#[lang = "start"]
+fn start(_main: *const u8, _argc: isize, _argv: *const *const u8) -> isize {
+    0
+}
 
-extern {
+extern "C" {
     fn _foo() -> [u8; 16];
 }
 
diff --git a/src/test/run-make/issue-36710/foo.rs b/src/test/run-make/issue-36710/foo.rs
index 061f07c3243..845844f427b 100644
--- a/src/test/run-make/issue-36710/foo.rs
+++ b/src/test/run-make/issue-36710/foo.rs
@@ -3,7 +3,9 @@
 // For linking libstdc++ on MinGW
 #![cfg_attr(all(windows, target_env = "gnu"), feature(static_nobundle))]
 
-extern { fn get() -> u32; }
+extern "C" {
+    fn get() -> u32;
+}
 
 fn main() {
     let i = unsafe { get() };
diff --git a/src/test/run-make/wasm-import-module/bar.rs b/src/test/run-make/wasm-import-module/bar.rs
index 206f7c63e03..1b988c78321 100644
--- a/src/test/run-make/wasm-import-module/bar.rs
+++ b/src/test/run-make/wasm-import-module/bar.rs
@@ -4,13 +4,13 @@
 extern crate foo;
 
 #[link(wasm_import_module = "./me")]
-extern {
+extern "C" {
     #[link_name = "me_in_dep"]
     fn dep();
 }
 
 #[no_mangle]
-pub extern fn foo() {
+pub extern "C" fn foo() {
     unsafe {
         foo::dep();
         dep();
diff --git a/src/test/run-make/wasm-import-module/foo.rs b/src/test/run-make/wasm-import-module/foo.rs
index b9f87f18d0a..bbeaf99bc77 100644
--- a/src/test/run-make/wasm-import-module/foo.rs
+++ b/src/test/run-make/wasm-import-module/foo.rs
@@ -2,6 +2,6 @@
 #![deny(warnings)]
 
 #[link(wasm_import_module = "./dep")]
-extern {
+extern "C" {
     pub fn dep();
 }
diff --git a/src/test/run-pass-valgrind/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs
index ea1403645a5..571621c1de7 100644
--- a/src/test/run-pass-valgrind/osx-frameworks.rs
+++ b/src/test/run-pass-valgrind/osx-frameworks.rs
@@ -6,13 +6,15 @@ extern crate libc;
 
 #[cfg(target_os = "macos")]
 #[link(name = "CoreFoundation", kind = "framework")]
-extern {
+extern "C" {
     fn CFRunLoopGetTypeID() -> libc::c_ulong;
 }
 
 #[cfg(target_os = "macos")]
 pub fn main() {
-    unsafe { CFRunLoopGetTypeID(); }
+    unsafe {
+        CFRunLoopGetTypeID();
+    }
 }
 
 #[cfg(not(target_os = "macos"))]
diff --git a/src/test/rustdoc-ui/check-doc-alias-attr-location.rs b/src/test/rustdoc-ui/check-doc-alias-attr-location.rs
index 7de2caa189d..6de1960e2e2 100644
--- a/src/test/rustdoc-ui/check-doc-alias-attr-location.rs
+++ b/src/test/rustdoc-ui/check-doc-alias-attr-location.rs
@@ -5,7 +5,7 @@ pub trait Foo {
 }
 
 #[doc(alias = "foo")] //~ ERROR
-extern {}
+extern "C" {}
 
 #[doc(alias = "bar")] //~ ERROR
 impl Bar {
@@ -17,5 +17,7 @@ impl Bar {
 impl Foo for Bar {
     #[doc(alias = "assoc")] //~ ERROR
     type X = i32;
-    fn foo() -> Self::X { 0 }
+    fn foo() -> Self::X {
+        0
+    }
 }
diff --git a/src/test/rustdoc-ui/coverage/basic.rs b/src/test/rustdoc-ui/coverage/basic.rs
index 98507f99e8d..6c26b751c5e 100644
--- a/src/test/rustdoc-ui/coverage/basic.rs
+++ b/src/test/rustdoc-ui/coverage/basic.rs
@@ -45,6 +45,6 @@ macro_rules! some_macro {
     () => {};
 }
 
-extern {
+extern "C" {
     pub type ExternType;
 }
diff --git a/src/test/rustdoc/auxiliary/issue-34274.rs b/src/test/rustdoc/auxiliary/issue-34274.rs
index b0c3b4f5629..c46660579a8 100644
--- a/src/test/rustdoc/auxiliary/issue-34274.rs
+++ b/src/test/rustdoc/auxiliary/issue-34274.rs
@@ -1,3 +1,3 @@
-extern {
+extern "C" {
     pub fn extern_c_fn();
 }
diff --git a/src/test/rustdoc/foreigntype-reexport.rs b/src/test/rustdoc/foreigntype-reexport.rs
index 616826ce7b4..1dec0ef3e0f 100644
--- a/src/test/rustdoc/foreigntype-reexport.rs
+++ b/src/test/rustdoc/foreigntype-reexport.rs
@@ -1,7 +1,7 @@
 #![feature(extern_types)]
 
 mod sub {
-    extern {
+    extern "C" {
         /// Another extern type.
         pub type C2;
         pub fn f2();
@@ -10,7 +10,7 @@ mod sub {
 }
 
 pub mod sub2 {
-    extern {
+    extern "C" {
         // @has foreigntype_reexport/sub2/foreigntype.C.html
         pub type C;
         // @has foreigntype_reexport/sub2/fn.f.html
@@ -21,7 +21,7 @@ pub mod sub2 {
 }
 
 mod sub3 {
-    extern {
+    extern "C" {
         pub type C4;
         pub fn f4();
         pub static K4: usize;
@@ -35,7 +35,7 @@ mod sub3 {
 // @has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'C2'
 // @has foreigntype_reexport/index.html '//a[@class="fn"]' 'f2'
 // @has foreigntype_reexport/index.html '//a[@class="static"]' 'K2'
-pub use self::sub::{C2, f2, K as K2};
+pub use self::sub::{f2, C2, K as K2};
 
 // @has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'C'
 // @has foreigntype_reexport/index.html '//a[@class="fn"]' 'f'
@@ -43,7 +43,7 @@ pub use self::sub::{C2, f2, K as K2};
 // @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::C as C3;'
 // @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::f as f3;'
 // @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::K3;'
-pub use self::sub2::{C as C3, f as f3, K3};
+pub use self::sub2::{f as f3, C as C3, K3};
 
 // @has foreigntype_reexport/foreigntype.C4.html
 // @has foreigntype_reexport/fn.f4.html
diff --git a/src/test/rustdoc/foreigntype.rs b/src/test/rustdoc/foreigntype.rs
index bd8766c0cf1..891cdd5fed7 100644
--- a/src/test/rustdoc/foreigntype.rs
+++ b/src/test/rustdoc/foreigntype.rs
@@ -1,6 +1,6 @@
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     // @has foreigntype/foreigntype.ExtType.html
     pub type ExtType;
 }
diff --git a/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs b/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs
index 276e4091c02..55c75dfe27b 100644
--- a/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs
+++ b/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs
@@ -3,7 +3,7 @@
 #![crate_name = "foo"]
 
 mod mod1 {
-    extern {
+    extern "C" {
         pub fn public_fn();
         fn private_fn();
     }
diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs
index a23ec3640ee..686e55de392 100644
--- a/src/test/rustdoc/inline_local/glob-extern.rs
+++ b/src/test/rustdoc/inline_local/glob-extern.rs
@@ -1,7 +1,7 @@
 #![crate_name = "foo"]
 
 mod mod1 {
-    extern {
+    extern "C" {
         pub fn public_fn();
         fn private_fn();
     }
diff --git a/src/test/rustdoc/issue-22038.rs b/src/test/rustdoc/issue-22038.rs
index 2db42b561f7..ff5813dac80 100644
--- a/src/test/rustdoc/issue-22038.rs
+++ b/src/test/rustdoc/issue-22038.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     // @has issue_22038/fn.foo1.html \
     //      '//*[@class="rust fn"]' 'pub unsafe extern "C" fn foo1()'
     pub fn foo1();
@@ -12,7 +12,7 @@ extern "system" {
 
 // @has issue_22038/fn.bar.html \
 //      '//*[@class="rust fn"]' 'pub extern "C" fn bar()'
-pub extern fn bar() {}
+pub extern "C" fn bar() {}
 
 // @has issue_22038/fn.baz.html \
 //      '//*[@class="rust fn"]' 'pub extern "system" fn baz()'
diff --git a/src/test/rustdoc/sanitizer-option.rs b/src/test/rustdoc/sanitizer-option.rs
index a79b37ee082..1abba468feb 100644
--- a/src/test/rustdoc/sanitizer-option.rs
+++ b/src/test/rustdoc/sanitizer-option.rs
@@ -7,7 +7,7 @@
 // correctly, then linking will fail.
 
 /// ```
-/// extern {
+/// extern "C" {
 ///     fn __sanitizer_print_stack_trace();
 /// }
 ///
diff --git a/src/test/rustdoc/titles.rs b/src/test/rustdoc/titles.rs
index 3b4c42d865d..2084e851799 100644
--- a/src/test/rustdoc/titles.rs
+++ b/src/test/rustdoc/titles.rs
@@ -7,7 +7,7 @@ pub mod foo_mod {
     pub struct __Thing {}
 }
 
-extern {
+extern "C" {
     // @matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo::foo_ffn'
     pub fn foo_ffn();
 }
@@ -30,7 +30,7 @@ pub type FooType = FooStruct;
 // @matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo::foo_macro'
 #[macro_export]
 macro_rules! foo_macro {
-    () => ();
+    () => {};
 }
 
 // @matches 'foo/primitive.bool.html' '//h1' 'Primitive Type bool'
@@ -40,7 +40,7 @@ mod bool {}
 // @matches 'foo/static.FOO_STATIC.html' '//h1' 'Static foo::FOO_STATIC'
 pub static FOO_STATIC: FooStruct = FooStruct;
 
-extern {
+extern "C" {
     // @matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static foo::FOO_FSTATIC'
     pub static FOO_FSTATIC: FooStruct;
 }
diff --git a/src/test/ui-fulldeps/switch-stdout.rs b/src/test/ui-fulldeps/switch-stdout.rs
index e105637c3da..e9501a80930 100644
--- a/src/test/ui-fulldeps/switch-stdout.rs
+++ b/src/test/ui-fulldeps/switch-stdout.rs
@@ -9,7 +9,7 @@ use std::path::PathBuf;
 fn switch_stdout_to(file: File) {
     use std::os::unix::prelude::*;
 
-    extern {
+    extern "C" {
         fn dup2(old: i32, new: i32) -> i32;
     }
 
@@ -29,8 +29,7 @@ fn switch_stdout_to(file: File) {
     const STD_OUTPUT_HANDLE: u32 = (-11i32) as u32;
 
     unsafe {
-        let rc = SetStdHandle(STD_OUTPUT_HANDLE,
-                              file.into_raw_handle() as *mut _);
+        let rc = SetStdHandle(STD_OUTPUT_HANDLE, file.into_raw_handle() as *mut _);
         assert!(rc != 0);
     }
 }
diff --git a/src/test/ui/abi/anon-extern-mod.rs b/src/test/ui/abi/anon-extern-mod.rs
index 37a67876c91..6c7d60d4cb0 100644
--- a/src/test/ui/abi/anon-extern-mod.rs
+++ b/src/test/ui/abi/anon-extern-mod.rs
@@ -7,7 +7,7 @@
 extern crate libc;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_get_test_int() -> libc::intptr_t;
 }
 
diff --git a/src/test/ui/abi/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/ui/abi/auxiliary/anon-extern-mod-cross-crate-1.rs
index 948b5e688eb..5cbf8093c5c 100644
--- a/src/test/ui/abi/auxiliary/anon-extern-mod-cross-crate-1.rs
+++ b/src/test/ui/abi/auxiliary/anon-extern-mod-cross-crate-1.rs
@@ -1,9 +1,9 @@
-#![crate_name="anonexternmod"]
+#![crate_name = "anonexternmod"]
 #![feature(rustc_private)]
 
 extern crate libc;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_get_test_int() -> libc::intptr_t;
 }
diff --git a/src/test/ui/abi/auxiliary/foreign_lib.rs b/src/test/ui/abi/auxiliary/foreign_lib.rs
index de6b0e2118a..3c649b778bd 100644
--- a/src/test/ui/abi/auxiliary/foreign_lib.rs
+++ b/src/test/ui/abi/auxiliary/foreign_lib.rs
@@ -1,12 +1,11 @@
-#![crate_name="foreign_lib"]
-
+#![crate_name = "foreign_lib"]
 #![feature(rustc_private)]
 
 pub mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
@@ -14,7 +13,7 @@ pub mod rustrt {
 pub mod rustrt2 {
     extern crate libc;
 
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
@@ -24,7 +23,7 @@ pub mod rustrt3 {
     // Ensures that we don't ICE or trigger LLVM asserts when
     // importing the same symbol under different types.
     // See https://github.com/rust-lang/rust/issues/32740.
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> *const u8;
     }
 }
diff --git a/src/test/ui/abi/c-stack-as-value.rs b/src/test/ui/abi/c-stack-as-value.rs
index 7595b76fb3f..5bece0ba2d1 100644
--- a/src/test/ui/abi/c-stack-as-value.rs
+++ b/src/test/ui/abi/c-stack-as-value.rs
@@ -8,7 +8,7 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
diff --git a/src/test/ui/abi/cabi-int-widening.rs b/src/test/ui/abi/cabi-int-widening.rs
index 240eaebf3d6..1dbab275225 100644
--- a/src/test/ui/abi/cabi-int-widening.rs
+++ b/src/test/ui/abi/cabi-int-widening.rs
@@ -2,7 +2,7 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_int8_to_int32(_: i8) -> i32;
 }
 
diff --git a/src/test/ui/abi/consts/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/ui/abi/consts/auxiliary/anon-extern-mod-cross-crate-1.rs
index 948b5e688eb..5cbf8093c5c 100644
--- a/src/test/ui/abi/consts/auxiliary/anon-extern-mod-cross-crate-1.rs
+++ b/src/test/ui/abi/consts/auxiliary/anon-extern-mod-cross-crate-1.rs
@@ -1,9 +1,9 @@
-#![crate_name="anonexternmod"]
+#![crate_name = "anonexternmod"]
 #![feature(rustc_private)]
 
 extern crate libc;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_get_test_int() -> libc::intptr_t;
 }
diff --git a/src/test/ui/abi/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/ui/abi/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs
index 948b5e688eb..5cbf8093c5c 100644
--- a/src/test/ui/abi/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs
+++ b/src/test/ui/abi/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs
@@ -1,9 +1,9 @@
-#![crate_name="anonexternmod"]
+#![crate_name = "anonexternmod"]
 #![feature(rustc_private)]
 
 extern crate libc;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_get_test_int() -> libc::intptr_t;
 }
diff --git a/src/test/ui/abi/extern/auxiliary/extern-crosscrate-source.rs b/src/test/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
index d4568d38e25..9c61518b941 100644
--- a/src/test/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
+++ b/src/test/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
@@ -1,4 +1,4 @@
-#![crate_name="externcallback"]
+#![crate_name = "externcallback"]
 #![crate_type = "lib"]
 #![feature(rustc_private)]
 
@@ -8,10 +8,11 @@ pub mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-                             data: libc::uintptr_t)
-                             -> libc::uintptr_t;
+    extern "C" {
+        pub fn rust_dbg_call(
+            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
+            data: libc::uintptr_t,
+        ) -> libc::uintptr_t;
     }
 }
 
@@ -22,10 +23,6 @@ pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
     }
 }
 
-pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 {
-        data
-    } else {
-        fact(data - 1) * data
-    }
+pub extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+    if data == 1 { data } else { fact(data - 1) * data }
 }
diff --git a/src/test/ui/abi/extern/extern-call-deep.rs b/src/test/ui/abi/extern/extern-call-deep.rs
index 81f884dada9..db5f2ca652f 100644
--- a/src/test/ui/abi/extern/extern-call-deep.rs
+++ b/src/test/ui/abi/extern/extern-call-deep.rs
@@ -10,19 +10,16 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-                             data: libc::uintptr_t)
-                             -> libc::uintptr_t;
+    extern "C" {
+        pub fn rust_dbg_call(
+            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
+            data: libc::uintptr_t,
+        ) -> libc::uintptr_t;
     }
 }
 
-extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 {
-        data
-    } else {
-        count(data - 1) + 1
-    }
+extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+    if data == 1 { data } else { count(data - 1) + 1 }
 }
 
 fn count(n: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/ui/abi/extern/extern-call-deep2.rs b/src/test/ui/abi/extern/extern-call-deep2.rs
index b31489b1e10..60e8db1592e 100644
--- a/src/test/ui/abi/extern/extern-call-deep2.rs
+++ b/src/test/ui/abi/extern/extern-call-deep2.rs
@@ -1,7 +1,6 @@
 // run-pass
 #![allow(unused_must_use)]
 // ignore-emscripten no threads support
-
 #![feature(rustc_private)]
 
 extern crate libc;
@@ -11,19 +10,16 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-                             data: libc::uintptr_t)
-                             -> libc::uintptr_t;
+    extern "C" {
+        pub fn rust_dbg_call(
+            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
+            data: libc::uintptr_t,
+        ) -> libc::uintptr_t;
     }
 }
 
-extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 {
-        data
-    } else {
-        count(data - 1) + 1
-    }
+extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+    if data == 1 { data } else { count(data - 1) + 1 }
 }
 
 fn count(n: libc::uintptr_t) -> libc::uintptr_t {
@@ -36,9 +32,10 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t {
 pub fn main() {
     // Make sure we're on a thread with small Rust stacks (main currently
     // has a large stack)
-    thread::spawn(move|| {
+    thread::spawn(move || {
         let result = count(1000);
         println!("result = {}", result);
         assert_eq!(result, 1000);
-    }).join();
+    })
+    .join();
 }
diff --git a/src/test/ui/abi/extern/extern-call-indirect.rs b/src/test/ui/abi/extern/extern-call-indirect.rs
index 158b54e4b8c..886e8f6be10 100644
--- a/src/test/ui/abi/extern/extern-call-indirect.rs
+++ b/src/test/ui/abi/extern/extern-call-indirect.rs
@@ -9,19 +9,16 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-                             data: libc::uintptr_t)
-                             -> libc::uintptr_t;
+    extern "C" {
+        pub fn rust_dbg_call(
+            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
+            data: libc::uintptr_t,
+        ) -> libc::uintptr_t;
     }
 }
 
-extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 {
-        data
-    } else {
-        fact(data - 1) * data
-    }
+extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+    if data == 1 { data } else { fact(data - 1) * data }
 }
 
 fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
diff --git a/src/test/ui/abi/extern/extern-call-scrub.rs b/src/test/ui/abi/extern/extern-call-scrub.rs
index a7b1065c9e1..ff33cf31af8 100644
--- a/src/test/ui/abi/extern/extern-call-scrub.rs
+++ b/src/test/ui/abi/extern/extern-call-scrub.rs
@@ -5,7 +5,6 @@
 // directions
 
 // ignore-emscripten no threads support
-
 #![feature(rustc_private)]
 
 extern crate libc;
@@ -15,19 +14,16 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-                             data: libc::uintptr_t)
-                             -> libc::uintptr_t;
+    extern "C" {
+        pub fn rust_dbg_call(
+            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
+            data: libc::uintptr_t,
+        ) -> libc::uintptr_t;
     }
 }
 
-extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 {
-        data
-    } else {
-        count(data - 1) + count(data - 1)
-    }
+extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+    if data == 1 { data } else { count(data - 1) + count(data - 1) }
 }
 
 fn count(n: libc::uintptr_t) -> libc::uintptr_t {
@@ -40,9 +36,10 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t {
 pub fn main() {
     // Make sure we're on a thread with small Rust stacks (main currently
     // has a large stack)
-    thread::spawn(move|| {
+    thread::spawn(move || {
         let result = count(12);
         println!("result = {}", result);
         assert_eq!(result, 2048);
-    }).join();
+    })
+    .join();
 }
diff --git a/src/test/ui/abi/extern/extern-pass-TwoU16s.rs b/src/test/ui/abi/extern/extern-pass-TwoU16s.rs
index 285bce2e19c..cff25511cc9 100644
--- a/src/test/ui/abi/extern/extern-pass-TwoU16s.rs
+++ b/src/test/ui/abi/extern/extern-pass-TwoU16s.rs
@@ -8,17 +8,18 @@
 
 #[derive(Copy, Clone, PartialEq, Debug)]
 pub struct TwoU16s {
-    one: u16, two: u16
+    one: u16,
+    two: u16,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s;
 }
 
 pub fn main() {
     unsafe {
-        let x = TwoU16s {one: 22, two: 23};
+        let x = TwoU16s { one: 22, two: 23 };
         let y = rust_dbg_extern_identity_TwoU16s(x);
         assert_eq!(x, y);
     }
diff --git a/src/test/ui/abi/extern/extern-pass-TwoU32s.rs b/src/test/ui/abi/extern/extern-pass-TwoU32s.rs
index fb18aa8d22f..03a8ecf241d 100644
--- a/src/test/ui/abi/extern/extern-pass-TwoU32s.rs
+++ b/src/test/ui/abi/extern/extern-pass-TwoU32s.rs
@@ -8,17 +8,18 @@
 
 #[derive(Copy, Clone, PartialEq, Debug)]
 pub struct TwoU32s {
-    one: u32, two: u32
+    one: u32,
+    two: u32,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s;
 }
 
 pub fn main() {
     unsafe {
-        let x = TwoU32s {one: 22, two: 23};
+        let x = TwoU32s { one: 22, two: 23 };
         let y = rust_dbg_extern_identity_TwoU32s(x);
         assert_eq!(x, y);
     }
diff --git a/src/test/ui/abi/extern/extern-pass-TwoU64s.rs b/src/test/ui/abi/extern/extern-pass-TwoU64s.rs
index 419648263aa..8bbc987c821 100644
--- a/src/test/ui/abi/extern/extern-pass-TwoU64s.rs
+++ b/src/test/ui/abi/extern/extern-pass-TwoU64s.rs
@@ -8,17 +8,18 @@
 
 #[derive(Copy, Clone, PartialEq, Debug)]
 pub struct TwoU64s {
-    one: u64, two: u64
+    one: u64,
+    two: u64,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s;
 }
 
 pub fn main() {
     unsafe {
-        let x = TwoU64s {one: 22, two: 23};
+        let x = TwoU64s { one: 22, two: 23 };
         let y = rust_dbg_extern_identity_TwoU64s(x);
         assert_eq!(x, y);
     }
diff --git a/src/test/ui/abi/extern/extern-pass-TwoU8s.rs b/src/test/ui/abi/extern/extern-pass-TwoU8s.rs
index 53a6a0f29f8..55a53c250bf 100644
--- a/src/test/ui/abi/extern/extern-pass-TwoU8s.rs
+++ b/src/test/ui/abi/extern/extern-pass-TwoU8s.rs
@@ -8,17 +8,18 @@
 
 #[derive(Copy, Clone, PartialEq, Debug)]
 pub struct TwoU8s {
-    one: u8, two: u8
+    one: u8,
+    two: u8,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s;
 }
 
 pub fn main() {
     unsafe {
-        let x = TwoU8s {one: 22, two: 23};
+        let x = TwoU8s { one: 22, two: 23 };
         let y = rust_dbg_extern_identity_TwoU8s(x);
         assert_eq!(x, y);
     }
diff --git a/src/test/ui/abi/extern/extern-pass-char.rs b/src/test/ui/abi/extern/extern-pass-char.rs
index 22f841b4552..2b10d26d1dd 100644
--- a/src/test/ui/abi/extern/extern-pass-char.rs
+++ b/src/test/ui/abi/extern/extern-pass-char.rs
@@ -3,9 +3,8 @@
 
 // Test a function that takes/returns a u8.
 
-
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_u8(v: u8) -> u8;
 }
 
diff --git a/src/test/ui/abi/extern/extern-pass-double.rs b/src/test/ui/abi/extern/extern-pass-double.rs
index dbd0a2dfa48..0b556c99e8d 100644
--- a/src/test/ui/abi/extern/extern-pass-double.rs
+++ b/src/test/ui/abi/extern/extern-pass-double.rs
@@ -2,7 +2,7 @@
 // ignore-wasm32-bare no libc for ffi testing
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_double(v: f64) -> f64;
 }
 
diff --git a/src/test/ui/abi/extern/extern-pass-empty.rs b/src/test/ui/abi/extern/extern-pass-empty.rs
index 07099a24204..ee974f6dbde 100644
--- a/src/test/ui/abi/extern/extern-pass-empty.rs
+++ b/src/test/ui/abi/extern/extern-pass-empty.rs
@@ -27,7 +27,7 @@ struct ManyInts {
 struct Empty;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts);
 }
 
@@ -39,7 +39,7 @@ pub fn main() {
             arg3: 4,
             arg4: 5,
             arg5: 6,
-            arg6: TwoU8s { one: 7, two: 8, }
+            arg6: TwoU8s { one: 7, two: 8 },
         };
         let y = ManyInts {
             arg1: 1,
@@ -47,7 +47,7 @@ pub fn main() {
             arg3: 3,
             arg4: 4,
             arg5: 5,
-            arg6: TwoU8s { one: 6, two: 7, }
+            arg6: TwoU8s { one: 6, two: 7 },
         };
         let empty = Empty;
         rust_dbg_extern_empty_struct(x, empty, y);
diff --git a/src/test/ui/abi/extern/extern-pass-u32.rs b/src/test/ui/abi/extern/extern-pass-u32.rs
index f2efdb7d366..c9b8d52cf5b 100644
--- a/src/test/ui/abi/extern/extern-pass-u32.rs
+++ b/src/test/ui/abi/extern/extern-pass-u32.rs
@@ -3,9 +3,8 @@
 
 // Test a function that takes/returns a u32.
 
-
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_u32(v: u32) -> u32;
 }
 
diff --git a/src/test/ui/abi/extern/extern-pass-u64.rs b/src/test/ui/abi/extern/extern-pass-u64.rs
index 975446d430c..5103129abaa 100644
--- a/src/test/ui/abi/extern/extern-pass-u64.rs
+++ b/src/test/ui/abi/extern/extern-pass-u64.rs
@@ -3,9 +3,8 @@
 
 // Test a call to a function that takes/returns a u64.
 
-
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_u64(v: u64) -> u64;
 }
 
diff --git a/src/test/ui/abi/extern/extern-return-TwoU16s.rs b/src/test/ui/abi/extern/extern-return-TwoU16s.rs
index dd884ee77fe..2551c93a765 100644
--- a/src/test/ui/abi/extern/extern-return-TwoU16s.rs
+++ b/src/test/ui/abi/extern/extern-return-TwoU16s.rs
@@ -4,11 +4,12 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 pub struct TwoU16s {
-    one: u16, two: u16
+    one: u16,
+    two: u16,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s;
 }
 
diff --git a/src/test/ui/abi/extern/extern-return-TwoU32s.rs b/src/test/ui/abi/extern/extern-return-TwoU32s.rs
index d6aaf5c9eaf..70a42895d91 100644
--- a/src/test/ui/abi/extern/extern-return-TwoU32s.rs
+++ b/src/test/ui/abi/extern/extern-return-TwoU32s.rs
@@ -4,11 +4,12 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 pub struct TwoU32s {
-    one: u32, two: u32
+    one: u32,
+    two: u32,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s;
 }
 
diff --git a/src/test/ui/abi/extern/extern-return-TwoU64s.rs b/src/test/ui/abi/extern/extern-return-TwoU64s.rs
index c5e4ebadc18..dd264fb9c19 100644
--- a/src/test/ui/abi/extern/extern-return-TwoU64s.rs
+++ b/src/test/ui/abi/extern/extern-return-TwoU64s.rs
@@ -4,11 +4,12 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 pub struct TwoU64s {
-    one: u64, two: u64
+    one: u64,
+    two: u64,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s;
 }
 
diff --git a/src/test/ui/abi/extern/extern-return-TwoU8s.rs b/src/test/ui/abi/extern/extern-return-TwoU8s.rs
index a7cd21b2073..b60387aed99 100644
--- a/src/test/ui/abi/extern/extern-return-TwoU8s.rs
+++ b/src/test/ui/abi/extern/extern-return-TwoU8s.rs
@@ -4,11 +4,12 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 pub struct TwoU8s {
-    one: u8, two: u8
+    one: u8,
+    two: u8,
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s;
 }
 
diff --git a/src/test/ui/abi/foreign/auxiliary/foreign_lib.rs b/src/test/ui/abi/foreign/auxiliary/foreign_lib.rs
index de6b0e2118a..3c649b778bd 100644
--- a/src/test/ui/abi/foreign/auxiliary/foreign_lib.rs
+++ b/src/test/ui/abi/foreign/auxiliary/foreign_lib.rs
@@ -1,12 +1,11 @@
-#![crate_name="foreign_lib"]
-
+#![crate_name = "foreign_lib"]
 #![feature(rustc_private)]
 
 pub mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
@@ -14,7 +13,7 @@ pub mod rustrt {
 pub mod rustrt2 {
     extern crate libc;
 
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
@@ -24,7 +23,7 @@ pub mod rustrt3 {
     // Ensures that we don't ICE or trigger LLVM asserts when
     // importing the same symbol under different types.
     // See https://github.com/rust-lang/rust/issues/32740.
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> *const u8;
     }
 }
diff --git a/src/test/ui/abi/foreign/foreign-call-no-runtime.rs b/src/test/ui/abi/foreign/foreign-call-no-runtime.rs
index c6afa07ad05..d5b90a3592b 100644
--- a/src/test/ui/abi/foreign/foreign-call-no-runtime.rs
+++ b/src/test/ui/abi/foreign/foreign-call-no-runtime.rs
@@ -9,45 +9,50 @@ use std::mem;
 use std::thread;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
-    fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t),
-                     data: libc::uintptr_t) -> libc::uintptr_t;
+extern "C" {
+    fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), data: libc::uintptr_t) -> libc::uintptr_t;
 }
 
 pub fn main() {
     unsafe {
-        thread::spawn(move|| {
+        thread::spawn(move || {
             let i: isize = 100;
             rust_dbg_call(callback_isize, mem::transmute(&i));
-        }).join().unwrap();
+        })
+        .join()
+        .unwrap();
 
-        thread::spawn(move|| {
+        thread::spawn(move || {
             let i: i32 = 100;
             rust_dbg_call(callback_i32, mem::transmute(&i));
-        }).join().unwrap();
+        })
+        .join()
+        .unwrap();
 
-        thread::spawn(move|| {
+        thread::spawn(move || {
             let i: i64 = 100;
             rust_dbg_call(callback_i64, mem::transmute(&i));
-        }).join().unwrap();
+        })
+        .join()
+        .unwrap();
     }
 }
 
-extern fn callback_isize(data: libc::uintptr_t) {
+extern "C" fn callback_isize(data: libc::uintptr_t) {
     unsafe {
         let data: *const isize = mem::transmute(data);
         assert_eq!(*data, 100);
     }
 }
 
-extern fn callback_i64(data: libc::uintptr_t) {
+extern "C" fn callback_i64(data: libc::uintptr_t) {
     unsafe {
         let data: *const i64 = mem::transmute(data);
         assert_eq!(*data, 100);
     }
 }
 
-extern fn callback_i32(data: libc::uintptr_t) {
+extern "C" fn callback_i32(data: libc::uintptr_t) {
     unsafe {
         let data: *const i32 = mem::transmute(data);
         assert_eq!(*data, 100);
diff --git a/src/test/ui/abi/foreign/foreign-fn-with-byval.rs b/src/test/ui/abi/foreign/foreign-fn-with-byval.rs
index 3a35599aa57..f366b6ee1bd 100644
--- a/src/test/ui/abi/foreign/foreign-fn-with-byval.rs
+++ b/src/test/ui/abi/foreign/foreign-fn-with-byval.rs
@@ -11,17 +11,15 @@ pub struct S {
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn get_x(x: S) -> u64;
     pub fn get_y(x: S) -> u64;
     pub fn get_z(x: S) -> u64;
 }
 
 #[inline(never)]
-fn indirect_call(func: unsafe extern fn(s: S) -> u64, s: S) -> u64 {
-    unsafe {
-        func(s)
-    }
+fn indirect_call(func: unsafe extern "C" fn(s: S) -> u64, s: S) -> u64 {
+    unsafe { func(s) }
 }
 
 fn main() {
diff --git a/src/test/ui/abi/foreign/foreign-no-abi.rs b/src/test/ui/abi/foreign/foreign-no-abi.rs
index 2f33fb47656..3f4f70c99e6 100644
--- a/src/test/ui/abi/foreign/foreign-no-abi.rs
+++ b/src/test/ui/abi/foreign/foreign-no-abi.rs
@@ -10,7 +10,7 @@ mod rustrt {
     extern crate libc;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
diff --git a/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs b/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs
index df819306e4a..29b2405189c 100644
--- a/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs
+++ b/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs
@@ -5,13 +5,18 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 #[derive(Copy, Clone)]
-pub struct QuadFloats { a: f32, b: f32, c: f32, d: f32 }
+pub struct QuadFloats {
+    a: f32,
+    b: f32,
+    c: f32,
+    d: f32,
+}
 
 mod rustrt {
     use super::QuadFloats;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn get_c_exhaust_sysv64_ints(
             _: *const (),
             _: *const (),
@@ -28,12 +33,7 @@ mod rustrt {
 fn test() {
     unsafe {
         let null = std::ptr::null();
-        let q = QuadFloats {
-            a: 10.2,
-            b: 20.3,
-            c: 30.4,
-            d: 40.5
-        };
+        let q = QuadFloats { a: 10.2, b: 20.3, c: 30.4, d: 40.5 };
         assert_eq!(
             rustrt::get_c_exhaust_sysv64_ints(null, null, null, null, null, null, null, q),
             q.c,
diff --git a/src/test/ui/abi/mir/mir_codegen_calls_variadic.rs b/src/test/ui/abi/mir/mir_codegen_calls_variadic.rs
index dc9fee03b77..b3392b9c607 100644
--- a/src/test/ui/abi/mir/mir_codegen_calls_variadic.rs
+++ b/src/test/ui/abi/mir/mir_codegen_calls_variadic.rs
@@ -2,21 +2,18 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_interesting_average(_: i64, ...) -> f64;
 }
 
 fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
     unsafe {
-        rust_interesting_average(6, a, a as f64,
-                                    b, b as f64,
-                                    c, c as f64,
-                                    d, d as f64,
-                                    e, e as f64,
-                                    f, g) as i64
+        rust_interesting_average(
+            6, a, a as f64, b, b as f64, c, c as f64, d, d as f64, e, e as f64, f, g,
+        ) as i64
     }
 }
 
-fn main(){
+fn main() {
     assert_eq!(test(10, 20, 30, 40, 50, 60_i64, 60.0_f64), 70);
 }
diff --git a/src/test/ui/abi/segfault-no-out-of-stack.rs b/src/test/ui/abi/segfault-no-out-of-stack.rs
index 0128e5e636d..ad4faf95a0f 100644
--- a/src/test/ui/abi/segfault-no-out-of-stack.rs
+++ b/src/test/ui/abi/segfault-no-out-of-stack.rs
@@ -3,39 +3,37 @@
 #![allow(unused_imports)]
 // ignore-emscripten can't run commands
 // ignore-sgx no processes
-
 #![feature(rustc_private)]
 
 extern crate libc;
 
-use std::process::{Command, ExitStatus};
 use std::env;
+use std::process::{Command, ExitStatus};
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_get_null_ptr() -> *mut ::libc::c_char;
 }
 
 #[cfg(unix)]
-fn check_status(status: std::process::ExitStatus)
-{
+fn check_status(status: std::process::ExitStatus) {
     use libc;
     use std::os::unix::process::ExitStatusExt;
 
-    assert!(status.signal() == Some(libc::SIGSEGV)
-            || status.signal() == Some(libc::SIGBUS));
+    assert!(status.signal() == Some(libc::SIGSEGV) || status.signal() == Some(libc::SIGBUS));
 }
 
 #[cfg(not(unix))]
-fn check_status(status: std::process::ExitStatus)
-{
+fn check_status(status: std::process::ExitStatus) {
     assert!(!status.success());
 }
 
 fn main() {
     let args: Vec<String> = env::args().collect();
     if args.len() > 1 && args[1] == "segfault" {
-        unsafe { *rust_get_null_ptr() = 1; }; // trigger a segfault
+        unsafe {
+            *rust_get_null_ptr() = 1;
+        }; // trigger a segfault
     } else {
         let segfault = Command::new(&args[0]).arg("segfault").output().unwrap();
         let stderr = String::from_utf8_lossy(&segfault.stderr);
diff --git a/src/test/ui/abi/stack-probes.rs b/src/test/ui/abi/stack-probes.rs
index 6c83e01d4cd..e998dd0f83e 100644
--- a/src/test/ui/abi/stack-probes.rs
+++ b/src/test/ui/abi/stack-probes.rs
@@ -11,13 +11,13 @@
 // ignore-emscripten no processes
 // ignore-sgx no processes
 
+use std::env;
 use std::mem::MaybeUninit;
 use std::process::Command;
 use std::thread;
-use std::env;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     #[link_name = "rust_dbg_extern_identity_u64"]
     fn black_box(u: u64);
 }
@@ -30,7 +30,7 @@ fn main() {
             "child-thread" => thread::spawn(|| recurse(&MaybeUninit::uninit())).join().unwrap(),
             _ => panic!(),
         }
-        return
+        return;
     }
 
     let me = env::current_exe().unwrap();
diff --git a/src/test/ui/abi/statics/static-mut-foreign.rs b/src/test/ui/abi/statics/static-mut-foreign.rs
index 5d6fa416b98..ecd8ee94a01 100644
--- a/src/test/ui/abi/statics/static-mut-foreign.rs
+++ b/src/test/ui/abi/statics/static-mut-foreign.rs
@@ -10,7 +10,7 @@
 extern crate libc;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     static mut rust_dbg_static_mut: libc::c_int;
     pub fn rust_dbg_static_mut_check_four();
 }
diff --git a/src/test/ui/abi/struct-enums/struct-return.rs b/src/test/ui/abi/struct-enums/struct-return.rs
index a3e70bbdb08..1a7984ea5cd 100644
--- a/src/test/ui/abi/struct-enums/struct-return.rs
+++ b/src/test/ui/abi/struct-enums/struct-return.rs
@@ -4,25 +4,42 @@
 
 #[repr(C)]
 #[derive(Copy, Clone)]
-pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
+pub struct Quad {
+    a: u64,
+    b: u64,
+    c: u64,
+    d: u64,
+}
 
 #[repr(C)]
 #[derive(Copy, Clone)]
-pub struct Floats { a: f64, b: u8, c: f64 }
+pub struct Floats {
+    a: f64,
+    b: u8,
+    c: f64,
+}
 
 #[repr(C)]
 #[derive(Copy, Clone)]
-pub struct CharCharDouble { a: u8, b: u8, c: f64 }
+pub struct CharCharDouble {
+    a: u8,
+    b: u8,
+    c: f64,
+}
 
 #[repr(C)]
 #[derive(Copy, Clone)]
-pub struct CharCharFloat { a: u8, b: u8, c: f32 }
+pub struct CharCharFloat {
+    a: u8,
+    b: u8,
+    c: f32,
+}
 
 mod rustrt {
-    use super::{Floats, Quad, CharCharDouble, CharCharFloat};
+    use super::{CharCharDouble, CharCharFloat, Floats, Quad};
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
+    extern "C" {
         pub fn rust_dbg_abi_1(q: Quad) -> Quad;
         pub fn rust_dbg_abi_2(f: Floats) -> Floats;
         pub fn rust_dbg_abi_3(a: CharCharDouble) -> CharCharDouble;
@@ -32,10 +49,12 @@ mod rustrt {
 
 fn test1() {
     unsafe {
-        let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa,
-                 b: 0xbbbb_bbbb_bbbb_bbbb,
-                 c: 0xcccc_cccc_cccc_cccc,
-                 d: 0xdddd_dddd_dddd_dddd };
+        let q = Quad {
+            a: 0xaaaa_aaaa_aaaa_aaaa,
+            b: 0xbbbb_bbbb_bbbb_bbbb,
+            c: 0xcccc_cccc_cccc_cccc,
+            d: 0xdddd_dddd_dddd_dddd,
+        };
         let qq = rustrt::rust_dbg_abi_1(q);
         println!("a: {:x}", qq.a as usize);
         println!("b: {:x}", qq.b as usize);
@@ -51,9 +70,7 @@ fn test1() {
 #[cfg(target_pointer_width = "64")]
 fn test2() {
     unsafe {
-        let f = Floats { a: 1.234567890e-15_f64,
-                 b: 0b_1010_1010,
-                 c: 1.0987654321e-15_f64 };
+        let f = Floats { a: 1.234567890e-15_f64, b: 0b_1010_1010, c: 1.0987654321e-15_f64 };
         let ff = rustrt::rust_dbg_abi_2(f);
         println!("a: {}", ff.a as f64);
         println!("b: {}", ff.b as usize);
@@ -65,17 +82,12 @@ fn test2() {
 }
 
 #[cfg(target_pointer_width = "32")]
-fn test2() {
-}
+fn test2() {}
 
 #[cfg(target_pointer_width = "64")]
 fn test3() {
     unsafe {
-        let a = CharCharDouble {
-            a: 1,
-            b: 2,
-            c: 3.,
-        };
+        let a = CharCharDouble { a: 1, b: 2, c: 3. };
         let b = rustrt::rust_dbg_abi_3(a);
         println!("a: {}", b.a);
         println!("b: {}", b.b);
@@ -91,11 +103,7 @@ fn test3() {}
 
 fn test4() {
     unsafe {
-        let a = CharCharFloat {
-            a: 1,
-            b: 2,
-            c: 3.,
-        };
+        let a = CharCharFloat { a: 1, b: 2, c: 3. };
         let b = rustrt::rust_dbg_abi_4(a);
         println!("a: {}", b.a);
         println!("b: {}", b.b);
diff --git a/src/test/ui/abi/variadic-ffi.rs b/src/test/ui/abi/variadic-ffi.rs
index 3232a11d726..a952ea07793 100644
--- a/src/test/ui/abi/variadic-ffi.rs
+++ b/src/test/ui/abi/variadic-ffi.rs
@@ -5,7 +5,7 @@
 use std::ffi::VaList;
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     fn rust_interesting_average(_: u64, ...) -> f64;
 
     // FIXME: we need to disable this lint for `VaList`,
@@ -61,7 +61,7 @@ pub fn main() {
     }
 
     // A function that takes a function pointer
-    unsafe fn call(fp: unsafe extern fn(u64, ...) -> f64) {
+    unsafe fn call(fp: unsafe extern "C" fn(u64, ...) -> f64) {
         let (x1, x2, x3, x4) = (10i64, 10.0f64, 20i64, 20.0f64);
         assert_eq!(fp(2, x1, x2, x3, x4) as i64, 30);
     }
@@ -70,7 +70,7 @@ pub fn main() {
         call(rust_interesting_average);
 
         // Make a function pointer, pass indirectly
-        let x: unsafe extern fn(u64, ...) -> f64 = rust_interesting_average;
+        let x: unsafe extern "C" fn(u64, ...) -> f64 = rust_interesting_average;
         call(x);
     }
 
diff --git a/src/test/ui/attributes/item-attributes.rs b/src/test/ui/attributes/item-attributes.rs
index a3d5933965a..c6bf6c65602 100644
--- a/src/test/ui/attributes/item-attributes.rs
+++ b/src/test/ui/attributes/item-attributes.rs
@@ -5,7 +5,6 @@
 // check-pass
 
 #![feature(rustc_attrs)]
-
 #![rustc_dummy = "val"]
 #![rustc_dummy = "val"]
 #![rustc_dummy]
@@ -21,14 +20,14 @@ mod test_single_attr_outer {
     pub static X: isize = 10;
 
     #[rustc_dummy = "val"]
-    pub fn f() { }
+    pub fn f() {}
 
     #[rustc_dummy = "val"]
     pub mod mod1 {}
 
     pub mod rustrt {
         #[rustc_dummy = "val"]
-        extern {}
+        extern "C" {}
     }
 }
 
@@ -39,7 +38,7 @@ mod test_multi_attr_outer {
 
     #[rustc_dummy = "val"]
     #[rustc_dummy = "val"]
-    pub fn f() { }
+    pub fn f() {}
 
     #[rustc_dummy = "val"]
     #[rustc_dummy = "val"]
@@ -48,12 +47,14 @@ mod test_multi_attr_outer {
     pub mod rustrt {
         #[rustc_dummy = "val"]
         #[rustc_dummy = "val"]
-        extern {}
+        extern "C" {}
     }
 
     #[rustc_dummy = "val"]
     #[rustc_dummy = "val"]
-    struct T {x: isize}
+    struct T {
+        x: isize,
+    }
 }
 
 mod test_stmt_single_attr_outer {
@@ -62,41 +63,36 @@ mod test_stmt_single_attr_outer {
         static X: isize = 10;
 
         #[rustc_dummy = "val"]
-        fn f() { }
+        fn f() {}
 
         #[rustc_dummy = "val"]
-        mod mod1 {
-        }
+        mod mod1 {}
 
         mod rustrt {
             #[rustc_dummy = "val"]
-            extern {
-            }
+            extern "C" {}
         }
     }
 }
 
 mod test_stmt_multi_attr_outer {
     pub fn f() {
-
         #[rustc_dummy = "val"]
         #[rustc_dummy = "val"]
         static X: isize = 10;
 
         #[rustc_dummy = "val"]
         #[rustc_dummy = "val"]
-        fn f() { }
+        fn f() {}
 
         #[rustc_dummy = "val"]
         #[rustc_dummy = "val"]
-        mod mod1 {
-        }
+        mod mod1 {}
 
         mod rustrt {
             #[rustc_dummy = "val"]
             #[rustc_dummy = "val"]
-            extern {
-            }
+            extern "C" {}
         }
     }
 }
@@ -114,7 +110,7 @@ mod test_attr_inner_then_outer {
         #![rustc_dummy = "val"]
         // This is an attribute of fn f
         #[rustc_dummy = "val"]
-        fn f() { }
+        fn f() {}
     }
 }
 
@@ -126,7 +122,7 @@ mod test_attr_inner_then_outer_multi {
         // This is an attribute of fn f
         #[rustc_dummy = "val"]
         #[rustc_dummy = "val"]
-        fn f() { }
+        fn f() {}
     }
 }
 
@@ -134,7 +130,7 @@ mod test_distinguish_syntax_ext {
     pub fn f() {
         format!("test{}", "s");
         #[rustc_dummy = "val"]
-        fn g() { }
+        fn g() {}
     }
 }
 
@@ -143,12 +139,12 @@ mod test_other_forms {
     #[rustc_dummy(word)]
     #[rustc_dummy(attr(word))]
     #[rustc_dummy(key1 = "val", key2 = "val", attr)]
-    pub fn f() { }
+    pub fn f() {}
 }
 
 mod test_foreign_items {
     pub mod rustrt {
-        extern {
+        extern "C" {
             #![rustc_dummy]
 
             #[rustc_dummy]
@@ -157,7 +153,6 @@ mod test_foreign_items {
     }
 }
 
-
 // FIXME(#623): - these aren't supported yet
 /*mod test_literals {
     #![str = "s"]
diff --git a/src/test/ui/attributes/obsolete-attr.rs b/src/test/ui/attributes/obsolete-attr.rs
index 42f90eda166..7019abcaffb 100644
--- a/src/test/ui/attributes/obsolete-attr.rs
+++ b/src/test/ui/attributes/obsolete-attr.rs
@@ -1,6 +1,6 @@
 // Obsolete attributes fall back to unstable custom attributes.
 
-#[ab_isize="stdcall"] extern {}
+#[ab_isize = "stdcall"] extern "C" {}
 //~^ ERROR cannot find attribute `ab_isize` in this scope
 
 #[fixed_stack_segment] fn f() {}
diff --git a/src/test/ui/attributes/obsolete-attr.stderr b/src/test/ui/attributes/obsolete-attr.stderr
index 2d7c257c620..37c1cd0c94d 100644
--- a/src/test/ui/attributes/obsolete-attr.stderr
+++ b/src/test/ui/attributes/obsolete-attr.stderr
@@ -7,7 +7,7 @@ LL | #[fixed_stack_segment] fn f() {}
 error: cannot find attribute `ab_isize` in this scope
   --> $DIR/obsolete-attr.rs:3:3
    |
-LL | #[ab_isize="stdcall"] extern {}
+LL | #[ab_isize = "stdcall"] extern "C" {}
    |   ^^^^^^^^
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/auxiliary/extern-statics.rs b/src/test/ui/auxiliary/extern-statics.rs
index 725fde518d8..c090bc79fce 100644
--- a/src/test/ui/auxiliary/extern-statics.rs
+++ b/src/test/ui/auxiliary/extern-statics.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     pub static XA: u8;
     pub static mut XB: u8;
 }
diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs b/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs
index fa4f33bcef6..0d927117d81 100644
--- a/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs
+++ b/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs
@@ -1,4 +1,4 @@
 #![feature(link_cfg)]
 
 #[link(name = "foo", cfg(foo))]
-extern {}
+extern "C" {}
diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs b/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs
index b365ed91732..0a296f0b2ef 100644
--- a/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs
+++ b/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs
@@ -4,4 +4,4 @@
 #![crate_type = "rlib"]
 
 #[link(name = "foo", cfg(foo))]
-extern {}
+extern "C" {}
diff --git a/src/test/ui/bad/bad-extern-link-attrs.rs b/src/test/ui/bad/bad-extern-link-attrs.rs
index f042832fba0..43fe8c11d7c 100644
--- a/src/test/ui/bad/bad-extern-link-attrs.rs
+++ b/src/test/ui/bad/bad-extern-link-attrs.rs
@@ -2,6 +2,6 @@
 #[link(name = "")] //~ ERROR: with empty name
 #[link(name = "foo")]
 #[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/c-stack-returning-int64.rs b/src/test/ui/c-stack-returning-int64.rs
index 388d280b831..fb3cb2083e4 100644
--- a/src/test/ui/c-stack-returning-int64.rs
+++ b/src/test/ui/c-stack-returning-int64.rs
@@ -11,7 +11,7 @@ use std::ffi::CString;
 mod mlibc {
     use libc::{c_char, c_long, c_longlong};
 
-    extern {
+    extern "C" {
         pub fn atol(x: *const c_char) -> c_long;
         pub fn atoll(x: *const c_char) -> c_longlong;
     }
@@ -29,6 +29,8 @@ fn atoll(s: String) -> i64 {
 
 pub fn main() {
     assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string()));
-    assert_eq!((atoll("11111111111111111".to_string()) * 10),
-             atoll("111111111111111110".to_string()));
+    assert_eq!(
+        (atoll("11111111111111111".to_string()) * 10),
+        atoll("111111111111111110".to_string())
+    );
 }
diff --git a/src/test/ui/c-variadic/variadic-ffi-1.rs b/src/test/ui/c-variadic/variadic-ffi-1.rs
index a7824d91967..2c02a0d3081 100644
--- a/src/test/ui/c-variadic/variadic-ffi-1.rs
+++ b/src/test/ui/c-variadic/variadic-ffi-1.rs
@@ -6,7 +6,7 @@ extern "stdcall" {
     fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling
 }
 
-extern {
+extern "C" {
     fn foo(f: isize, x: u8, ...);
 }
 
@@ -14,7 +14,7 @@ extern "C" fn bar(f: isize, x: u8) {}
 
 fn main() {
     unsafe {
-        foo();  //~ ERROR this function takes at least 2 arguments but 0 arguments were supplied
+        foo(); //~ ERROR this function takes at least 2 arguments but 0 arguments were supplied
         foo(1); //~ ERROR this function takes at least 2 arguments but 1 argument was supplied
 
         let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~ ERROR mismatched types
@@ -22,8 +22,8 @@ fn main() {
 
         foo(1, 2, 3f32); //~ ERROR can't pass
         foo(1, 2, true); //~ ERROR can't pass
-        foo(1, 2, 1i8);  //~ ERROR can't pass
-        foo(1, 2, 1u8);  //~ ERROR can't pass
+        foo(1, 2, 1i8); //~ ERROR can't pass
+        foo(1, 2, 1u8); //~ ERROR can't pass
         foo(1, 2, 1i16); //~ ERROR can't pass
         foo(1, 2, 1u16); //~ ERROR can't pass
     }
diff --git a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs
index e3b642a9d41..588c15a1829 100644
--- a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs
+++ b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs
@@ -1,6 +1,6 @@
-extern {
+extern "C" {
     fn foo(...);
-    //~^ ERROR C-variadic function must be declared with at least one named argument
+//~^ ERROR C-variadic function must be declared with at least one named argument
 }
 
 fn main() {}
diff --git a/src/test/ui/cfg/conditional-compile.rs b/src/test/ui/cfg/conditional-compile.rs
index de5bd5f07dd..69f4de43186 100644
--- a/src/test/ui/cfg/conditional-compile.rs
+++ b/src/test/ui/cfg/conditional-compile.rs
@@ -16,13 +16,13 @@ static b: bool = true;
 
 mod rustrt {
     #[cfg(bogus)]
-    extern {
+    extern "C" {
         // This symbol doesn't exist and would be a link error if this
         // module was codegened
         pub fn bogus();
     }
 
-    extern {}
+    extern "C" {}
 }
 
 #[cfg(bogus)]
@@ -31,52 +31,56 @@ type t = isize;
 type t = bool;
 
 #[cfg(bogus)]
-enum tg { foo, }
+enum tg {
+    foo,
+}
 
-enum tg { bar, }
-
-#[cfg(bogus)]
-struct r {
-  i: isize,
+enum tg {
+    bar,
 }
 
 #[cfg(bogus)]
-fn r(i:isize) -> r {
-    r {
-        i: i
-    }
+struct r {
+    i: isize,
+}
+
+#[cfg(bogus)]
+fn r(i: isize) -> r {
+    r { i: i }
 }
 
 struct r {
-  i: isize,
+    i: isize,
 }
 
-fn r(i:isize) -> r {
-    r {
-        i: i
-    }
+fn r(i: isize) -> r {
+    r { i: i }
 }
 
 #[cfg(bogus)]
 mod m {
     // This needs to parse but would fail in typeck. Since it's not in
     // the current config it should not be typechecked.
-    pub fn bogus() { return 0; }
+    pub fn bogus() {
+        return 0;
+    }
 }
 
 mod m {
     // Submodules have slightly different code paths than the top-level
     // module, so let's make sure this jazz works here as well
     #[cfg(bogus)]
-    pub fn f() { }
+    pub fn f() {}
 
-    pub fn f() { }
+    pub fn f() {}
 }
 
 // Since the bogus configuration isn't defined main will just be
 // parsed, but nothing further will be done with it
 #[cfg(bogus)]
-pub fn main() { panic!() }
+pub fn main() {
+    panic!()
+}
 
 pub fn main() {
     // Exercise some of the configured items in ways that wouldn't be possible
@@ -90,8 +94,10 @@ pub fn main() {
 
 fn test_in_fn_ctxt() {
     #[cfg(bogus)]
-    fn f() { panic!() }
-    fn f() { }
+    fn f() {
+        panic!()
+    }
+    fn f() {}
     f();
 
     #[cfg(bogus)]
@@ -102,7 +108,7 @@ fn test_in_fn_ctxt() {
 
 mod test_foreign_items {
     pub mod rustrt {
-        extern {
+        extern "C" {
             #[cfg(bogus)]
             pub fn write() -> String;
             pub fn write() -> String;
@@ -117,19 +123,19 @@ mod test_use_statements {
 
 mod test_methods {
     struct Foo {
-        bar: usize
+        bar: usize,
     }
 
     impl Fooable for Foo {
         #[cfg(bogus)]
-        fn what(&self) { }
+        fn what(&self) {}
 
-        fn what(&self) { }
+        fn what(&self) {}
 
         #[cfg(bogus)]
-        fn the(&self) { }
+        fn the(&self) {}
 
-        fn the(&self) { }
+        fn the(&self) {}
     }
 
     trait Fooable {
diff --git a/src/test/ui/check-doc-alias-attr-location.rs b/src/test/ui/check-doc-alias-attr-location.rs
index 3a0436e468d..007d2ae6506 100644
--- a/src/test/ui/check-doc-alias-attr-location.rs
+++ b/src/test/ui/check-doc-alias-attr-location.rs
@@ -7,7 +7,7 @@ pub trait Foo {
 }
 
 #[doc(alias = "foo")] //~ ERROR
-extern {}
+extern "C" {}
 
 #[doc(alias = "bar")] //~ ERROR
 impl Bar {
@@ -19,5 +19,7 @@ impl Bar {
 impl Foo for Bar {
     #[doc(alias = "assoc")] //~ ERROR
     type X = i32;
-    fn foo() -> Self::X { 0 }
+    fn foo() -> Self::X {
+        0
+    }
 }
diff --git a/src/test/ui/consts/const-eval/extern_fat_pointer.rs b/src/test/ui/consts/const-eval/extern_fat_pointer.rs
index f210d1a0a90..d91d07827dc 100644
--- a/src/test/ui/consts/const-eval/extern_fat_pointer.rs
+++ b/src/test/ui/consts/const-eval/extern_fat_pointer.rs
@@ -2,7 +2,7 @@
 
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type Opaque;
 }
 
diff --git a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs
index 96a8a8452ed..09c7d5580de 100644
--- a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs
+++ b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs
@@ -2,9 +2,9 @@
 #![feature(core_intrinsics)]
 #![feature(const_size_of_val, const_align_of_val)]
 
-use std::intrinsics::{size_of_val, min_align_of_val};
+use std::intrinsics::{min_align_of_val, size_of_val};
 
-extern {
+extern "C" {
     type Opaque;
 }
 
diff --git a/src/test/ui/empty/empty-linkname.rs b/src/test/ui/empty/empty-linkname.rs
index 79895ab5834..b64123389c2 100644
--- a/src/test/ui/empty/empty-linkname.rs
+++ b/src/test/ui/empty/empty-linkname.rs
@@ -1,5 +1,4 @@
 #[link(name = "")] //~ ERROR: given with empty name
-extern {
-}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0044.rs b/src/test/ui/error-codes/E0044.rs
index 9eee9c31d3c..d9cdaf83c69 100644
--- a/src/test/ui/error-codes/E0044.rs
+++ b/src/test/ui/error-codes/E0044.rs
@@ -1,9 +1,8 @@
-extern {
+extern "C" {
     fn sqrt<T>(f: T) -> T;
-    //~^ ERROR foreign items may not have type parameters [E0044]
-    //~| HELP replace the type parameters with concrete types
-    //~| NOTE can't have type parameters
+//~^ ERROR foreign items may not have type parameters [E0044]
+//~| HELP replace the type parameters with concrete types
+//~| NOTE can't have type parameters
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/error-codes/E0130.rs b/src/test/ui/error-codes/E0130.rs
index 1ac546b9dbe..d523507899f 100644
--- a/src/test/ui/error-codes/E0130.rs
+++ b/src/test/ui/error-codes/E0130.rs
@@ -1,7 +1,6 @@
-extern {
+extern "C" {
     fn foo((a, b): (u32, u32));
-    //~^ ERROR E0130
+//~^ ERROR E0130
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/error-codes/E0454.rs b/src/test/ui/error-codes/E0454.rs
index d62210c3f94..ff5478382cc 100644
--- a/src/test/ui/error-codes/E0454.rs
+++ b/src/test/ui/error-codes/E0454.rs
@@ -1,4 +1,4 @@
-#[link(name = "")] extern {}
+#[link(name = "")] extern "C" {}
 //~^ ERROR E0454
 
 fn main() {
diff --git a/src/test/ui/error-codes/E0454.stderr b/src/test/ui/error-codes/E0454.stderr
index 499162694e5..6b62bef112f 100644
--- a/src/test/ui/error-codes/E0454.stderr
+++ b/src/test/ui/error-codes/E0454.stderr
@@ -1,7 +1,7 @@
 error[E0454]: `#[link(name = "")]` given with empty name
   --> $DIR/E0454.rs:1:1
    |
-LL | #[link(name = "")] extern {}
+LL | #[link(name = "")] extern "C" {}
    | ^^^^^^^^^^^^^^^^^^ empty name given
 
 error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0458.rs b/src/test/ui/error-codes/E0458.rs
index 3d230358721..35e7e84d479 100644
--- a/src/test/ui/error-codes/E0458.rs
+++ b/src/test/ui/error-codes/E0458.rs
@@ -1,5 +1,5 @@
-#[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
-                                              //~| ERROR E0459
+#[link(kind = "wonderful_unicorn")] extern "C" {} //~ ERROR E0458
+                                                  //~| ERROR E0459
 
 fn main() {
 }
diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr
index 51f7764aaf2..0f2fec029e7 100644
--- a/src/test/ui/error-codes/E0458.stderr
+++ b/src/test/ui/error-codes/E0458.stderr
@@ -1,7 +1,7 @@
 error[E0458]: unknown kind: `wonderful_unicorn`
   --> $DIR/E0458.rs:1:8
    |
-LL | #[link(kind = "wonderful_unicorn")] extern {}
+LL | #[link(kind = "wonderful_unicorn")] extern "C" {}
    | -------^^^^^^^^^^^^^^^^^^^^^^^^^^--
    |        |
    |        unknown kind
@@ -9,7 +9,7 @@ LL | #[link(kind = "wonderful_unicorn")] extern {}
 error[E0459]: `#[link(...)]` specified without `name = "foo"`
   --> $DIR/E0458.rs:1:1
    |
-LL | #[link(kind = "wonderful_unicorn")] extern {}
+LL | #[link(kind = "wonderful_unicorn")] extern "C" {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/error-codes/E0459.rs b/src/test/ui/error-codes/E0459.rs
index 80a2fd35151..c56d8f0a8a8 100644
--- a/src/test/ui/error-codes/E0459.rs
+++ b/src/test/ui/error-codes/E0459.rs
@@ -1,4 +1,4 @@
-#[link(kind = "dylib")] extern {} //~ ERROR E0459
+#[link(kind = "dylib")] extern "C" {} //~ ERROR E0459
 
 fn main() {
 }
diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr
index c618fea9afc..4e0d51e8753 100644
--- a/src/test/ui/error-codes/E0459.stderr
+++ b/src/test/ui/error-codes/E0459.stderr
@@ -1,7 +1,7 @@
 error[E0459]: `#[link(...)]` specified without `name = "foo"`
   --> $DIR/E0459.rs:1:1
    |
-LL | #[link(kind = "dylib")] extern {}
+LL | #[link(kind = "dylib")] extern "C" {}
    | ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument
 
 error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs
index c832e09ac11..b71ba0ed88b 100644
--- a/src/test/ui/error-codes/E0617.rs
+++ b/src/test/ui/error-codes/E0617.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn printf(c: *const i8, ...);
 }
 
diff --git a/src/test/ui/extern/extern-pub.rs b/src/test/ui/extern/extern-pub.rs
index c97e04b0755..0b95045a03e 100644
--- a/src/test/ui/extern/extern-pub.rs
+++ b/src/test/ui/extern/extern-pub.rs
@@ -1,9 +1,8 @@
 // run-pass
 // pretty-expanded FIXME #23616
 
-extern {
+extern "C" {
     pub fn free(p: *const u8);
 }
 
-pub fn main() {
-}
+pub fn main() {}
diff --git a/src/test/ui/extern/extern-types-distinct-types.rs b/src/test/ui/extern/extern-types-distinct-types.rs
index 000ba5432e4..4da049b7882 100644
--- a/src/test/ui/extern/extern-types-distinct-types.rs
+++ b/src/test/ui/extern/extern-types-distinct-types.rs
@@ -1,6 +1,6 @@
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
     type B;
 }
@@ -9,4 +9,4 @@ fn foo(r: &A) -> &B {
     r //~ ERROR mismatched types
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/extern/extern-types-manual-sync-send.rs b/src/test/ui/extern/extern-types-manual-sync-send.rs
index ec63e5d40b9..87eb3f62240 100644
--- a/src/test/ui/extern/extern-types-manual-sync-send.rs
+++ b/src/test/ui/extern/extern-types-manual-sync-send.rs
@@ -3,15 +3,15 @@
 
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
 }
 
-unsafe impl Sync for A { }
-unsafe impl Send for A { }
+unsafe impl Sync for A {}
+unsafe impl Send for A {}
 
-fn assert_sync<T: ?Sized + Sync>() { }
-fn assert_send<T: ?Sized + Send>() { }
+fn assert_sync<T: ?Sized + Sync>() {}
+fn assert_send<T: ?Sized + Send>() {}
 
 fn main() {
     assert_sync::<A>();
diff --git a/src/test/ui/extern/extern-types-not-sync-send.rs b/src/test/ui/extern/extern-types-not-sync-send.rs
index 3af8b9bf4aa..ba82caced7a 100644
--- a/src/test/ui/extern/extern-types-not-sync-send.rs
+++ b/src/test/ui/extern/extern-types-not-sync-send.rs
@@ -2,12 +2,12 @@
 
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
 }
 
-fn assert_sync<T: ?Sized + Sync>() { }
-fn assert_send<T: ?Sized + Send>() { }
+fn assert_sync<T: ?Sized + Sync>() {}
+fn assert_send<T: ?Sized + Send>() {}
 
 fn main() {
     assert_sync::<A>();
diff --git a/src/test/ui/extern/extern-types-not-sync-send.stderr b/src/test/ui/extern/extern-types-not-sync-send.stderr
index dc9810cfcf9..547116fbbab 100644
--- a/src/test/ui/extern/extern-types-not-sync-send.stderr
+++ b/src/test/ui/extern/extern-types-not-sync-send.stderr
@@ -1,7 +1,7 @@
 error[E0277]: `A` cannot be shared between threads safely
   --> $DIR/extern-types-not-sync-send.rs:13:19
    |
-LL | fn assert_sync<T: ?Sized + Sync>() { }
+LL | fn assert_sync<T: ?Sized + Sync>() {}
    |                            ---- required by this bound in `assert_sync`
 ...
 LL |     assert_sync::<A>();
@@ -12,7 +12,7 @@ LL |     assert_sync::<A>();
 error[E0277]: `A` cannot be sent between threads safely
   --> $DIR/extern-types-not-sync-send.rs:16:19
    |
-LL | fn assert_send<T: ?Sized + Send>() { }
+LL | fn assert_send<T: ?Sized + Send>() {}
    |                            ---- required by this bound in `assert_send`
 ...
 LL |     assert_send::<A>();
diff --git a/src/test/ui/extern/extern-types-pointer-cast.rs b/src/test/ui/extern/extern-types-pointer-cast.rs
index a4ebd3cf71e..de6955bfaaa 100644
--- a/src/test/ui/extern/extern-types-pointer-cast.rs
+++ b/src/test/ui/extern/extern-types-pointer-cast.rs
@@ -2,10 +2,9 @@
 #![allow(dead_code)]
 // Test that pointers to extern types can be cast from/to usize,
 // despite being !Sized.
-
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
 }
 
diff --git a/src/test/ui/extern/extern-types-size_of_val.rs b/src/test/ui/extern/extern-types-size_of_val.rs
index 1c965609758..3b02ea28eaa 100644
--- a/src/test/ui/extern/extern-types-size_of_val.rs
+++ b/src/test/ui/extern/extern-types-size_of_val.rs
@@ -1,16 +1,14 @@
 // run-pass
 #![feature(extern_types)]
 
-use std::mem::{size_of_val, align_of_val};
+use std::mem::{align_of_val, size_of_val};
 
-extern {
+extern "C" {
     type A;
 }
 
 fn main() {
-    let x: &A = unsafe {
-        &*(1usize as *const A)
-    };
+    let x: &A = unsafe { &*(1usize as *const A) };
 
     assert_eq!(size_of_val(x), 0);
     assert_eq!(align_of_val(x), 1);
diff --git a/src/test/ui/extern/extern-types-thin-pointer.rs b/src/test/ui/extern/extern-types-thin-pointer.rs
index 83c35f7af78..b85fc4886ab 100644
--- a/src/test/ui/extern/extern-types-thin-pointer.rs
+++ b/src/test/ui/extern/extern-types-thin-pointer.rs
@@ -2,12 +2,11 @@
 #![allow(dead_code)]
 // Test that pointers and references to extern types are thin, ie they have the same size and
 // alignment as a pointer to ().
-
 #![feature(extern_types)]
 
 use std::mem::{align_of, size_of};
 
-extern {
+extern "C" {
     type A;
 }
 
diff --git a/src/test/ui/extern/extern-types-trait-impl.rs b/src/test/ui/extern/extern-types-trait-impl.rs
index 6cce6c723c5..656101ed535 100644
--- a/src/test/ui/extern/extern-types-trait-impl.rs
+++ b/src/test/ui/extern/extern-types-trait-impl.rs
@@ -1,22 +1,21 @@
 // run-pass
 #![allow(dead_code)]
 // Test that traits can be implemented for extern types.
-
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
 }
 
 trait Foo {
-    fn foo(&self) { }
+    fn foo(&self) {}
 }
 
 impl Foo for A {
-    fn foo(&self) { }
+    fn foo(&self) {}
 }
 
-fn assert_foo<T: ?Sized + Foo>() { }
+fn assert_foo<T: ?Sized + Foo>() {}
 
 fn use_foo<T: ?Sized + Foo>(x: &dyn Foo) {
     x.foo();
diff --git a/src/test/ui/extern/extern-types-unsized.rs b/src/test/ui/extern/extern-types-unsized.rs
index a296ae0739f..94a222a7e7e 100644
--- a/src/test/ui/extern/extern-types-unsized.rs
+++ b/src/test/ui/extern/extern-types-unsized.rs
@@ -2,7 +2,7 @@
 
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     type A;
 }
 
@@ -16,7 +16,7 @@ struct Bar<T: ?Sized> {
     tail: T,
 }
 
-fn assert_sized<T>() { }
+fn assert_sized<T>() {}
 
 fn main() {
     assert_sized::<A>();
diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr
index fba919ceff9..278db456557 100644
--- a/src/test/ui/extern/extern-types-unsized.stderr
+++ b/src/test/ui/extern/extern-types-unsized.stderr
@@ -1,7 +1,7 @@
 error[E0277]: the size for values of type `A` cannot be known at compilation time
   --> $DIR/extern-types-unsized.rs:22:20
    |
-LL | fn assert_sized<T>() { }
+LL | fn assert_sized<T>() {}
    |                 - required by this bound in `assert_sized`
 ...
 LL |     assert_sized::<A>();
@@ -10,13 +10,13 @@ LL |     assert_sized::<A>();
    = help: the trait `Sized` is not implemented for `A`
 help: consider relaxing the implicit `Sized` restriction
    |
-LL | fn assert_sized<T: ?Sized>() { }
+LL | fn assert_sized<T: ?Sized>() {}
    |                  ^^^^^^^^
 
 error[E0277]: the size for values of type `A` cannot be known at compilation time
   --> $DIR/extern-types-unsized.rs:25:5
    |
-LL | fn assert_sized<T>() { }
+LL | fn assert_sized<T>() {}
    |                 - required by this bound in `assert_sized`
 ...
 LL |     assert_sized::<Foo>();
@@ -26,13 +26,13 @@ LL |     assert_sized::<Foo>();
    = note: required because it appears within the type `Foo`
 help: consider relaxing the implicit `Sized` restriction
    |
-LL | fn assert_sized<T: ?Sized>() { }
+LL | fn assert_sized<T: ?Sized>() {}
    |                  ^^^^^^^^
 
 error[E0277]: the size for values of type `A` cannot be known at compilation time
   --> $DIR/extern-types-unsized.rs:28:5
    |
-LL | fn assert_sized<T>() { }
+LL | fn assert_sized<T>() {}
    |                 - required by this bound in `assert_sized`
 ...
 LL |     assert_sized::<Bar<A>>();
@@ -42,13 +42,13 @@ LL |     assert_sized::<Bar<A>>();
    = note: required because it appears within the type `Bar<A>`
 help: consider relaxing the implicit `Sized` restriction
    |
-LL | fn assert_sized<T: ?Sized>() { }
+LL | fn assert_sized<T: ?Sized>() {}
    |                  ^^^^^^^^
 
 error[E0277]: the size for values of type `A` cannot be known at compilation time
   --> $DIR/extern-types-unsized.rs:31:5
    |
-LL | fn assert_sized<T>() { }
+LL | fn assert_sized<T>() {}
    |                 - required by this bound in `assert_sized`
 ...
 LL |     assert_sized::<Bar<Bar<A>>>();
@@ -59,7 +59,7 @@ LL |     assert_sized::<Bar<Bar<A>>>();
    = note: required because it appears within the type `Bar<Bar<A>>`
 help: consider relaxing the implicit `Sized` restriction
    |
-LL | fn assert_sized<T: ?Sized>() { }
+LL | fn assert_sized<T: ?Sized>() {}
    |                  ^^^^^^^^
 
 error: aborting due to 4 previous errors
diff --git a/src/test/ui/extern/issue-36122-accessing-externed-dst.rs b/src/test/ui/extern/issue-36122-accessing-externed-dst.rs
index 22229db8000..5f886ff5737 100644
--- a/src/test/ui/extern/issue-36122-accessing-externed-dst.rs
+++ b/src/test/ui/extern/issue-36122-accessing-externed-dst.rs
@@ -1,5 +1,5 @@
 fn main() {
-    extern {
+    extern "C" {
         static symbol: [usize]; //~ ERROR: the size for values of type
     }
     println!("{}", symbol[0]);
diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs
index d44f78d4fab..b600ad23eee 100644
--- a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs
+++ b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs
@@ -5,10 +5,9 @@
 
 extern crate cfg_target_thread_local;
 
-extern {
+extern "C" {
     #[cfg_attr(target_thread_local, thread_local)]
     //~^ `cfg(target_thread_local)` is experimental and subject to change
-
     static FOO: u32;
 }
 
diff --git a/src/test/ui/feature-gates/feature-gate-extern_types.rs b/src/test/ui/feature-gates/feature-gate-extern_types.rs
index 6bdc96f55d6..103f8eed6f3 100644
--- a/src/test/ui/feature-gates/feature-gate-extern_types.rs
+++ b/src/test/ui/feature-gates/feature-gate-extern_types.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     type T; //~ ERROR extern types are experimental
 }
 
diff --git a/src/test/ui/feature-gates/feature-gate-ffi_const.rs b/src/test/ui/feature-gates/feature-gate-ffi_const.rs
index 27323b1b602..9f3d783ccd6 100644
--- a/src/test/ui/feature-gates/feature-gate-ffi_const.rs
+++ b/src/test/ui/feature-gates/feature-gate-ffi_const.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-extern {
+extern "C" {
     #[ffi_const] //~ ERROR the `#[ffi_const]` attribute is an experimental feature
     pub fn foo();
 }
diff --git a/src/test/ui/feature-gates/feature-gate-ffi_pure.rs b/src/test/ui/feature-gates/feature-gate-ffi_pure.rs
index e24a686853c..b0dfa01ff4c 100644
--- a/src/test/ui/feature-gates/feature-gate-ffi_pure.rs
+++ b/src/test/ui/feature-gates/feature-gate-ffi_pure.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-extern {
+extern "C" {
     #[ffi_pure] //~ ERROR the `#[ffi_pure]` attribute is an experimental feature
     pub fn foo();
 }
diff --git a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.rs b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.rs
index d118b7f4ff2..f354534356c 100644
--- a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.rs
+++ b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-extern {
+extern "C" {
     #[ffi_returns_twice] //~ ERROR the `#[ffi_returns_twice]` attribute is an experimental feature
     pub fn foo();
 }
diff --git a/src/test/ui/feature-gates/feature-gate-link_args.rs b/src/test/ui/feature-gates/feature-gate-link_args.rs
index 49948dab1ee..e1c651f46fb 100644
--- a/src/test/ui/feature-gates/feature-gate-link_args.rs
+++ b/src/test/ui/feature-gates/feature-gate-link_args.rs
@@ -5,13 +5,12 @@
 // sidestep warning (which is correct, but misleading for
 // purposes of this test)
 #![allow(unused_attributes)]
-
 #![link_args = "-l unexpected_use_as_inner_attr_on_mod"]
 //~^ ERROR the `link_args` attribute is experimental
 
 #[link_args = "-l expected_use_case"]
 //~^ ERROR the `link_args` attribute is experimental
-extern {}
+extern "C" {}
 
 #[link_args = "-l unexected_use_on_non_extern_item"]
 //~^ ERROR: the `link_args` attribute is experimental
diff --git a/src/test/ui/feature-gates/feature-gate-link_args.stderr b/src/test/ui/feature-gates/feature-gate-link_args.stderr
index c75f762b908..ae4918f5c9f 100644
--- a/src/test/ui/feature-gates/feature-gate-link_args.stderr
+++ b/src/test/ui/feature-gates/feature-gate-link_args.stderr
@@ -1,5 +1,5 @@
 error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead
-  --> $DIR/feature-gate-link_args.rs:12:1
+  --> $DIR/feature-gate-link_args.rs:11:1
    |
 LL | #[link_args = "-l expected_use_case"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #[link_args = "-l expected_use_case"]
    = help: add `#![feature(link_args)]` to the crate attributes to enable
 
 error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead
-  --> $DIR/feature-gate-link_args.rs:16:1
+  --> $DIR/feature-gate-link_args.rs:15:1
    |
 LL | #[link_args = "-l unexected_use_on_non_extern_item"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL | #[link_args = "-l unexected_use_on_non_extern_item"]
    = help: add `#![feature(link_args)]` to the crate attributes to enable
 
 error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead
-  --> $DIR/feature-gate-link_args.rs:9:1
+  --> $DIR/feature-gate-link_args.rs:8:1
    |
 LL | #![link_args = "-l unexpected_use_as_inner_attr_on_mod"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/feature-gates/feature-gate-link_cfg.rs b/src/test/ui/feature-gates/feature-gate-link_cfg.rs
index 27ec2e98eb6..d30ee3bcfdb 100644
--- a/src/test/ui/feature-gates/feature-gate-link_cfg.rs
+++ b/src/test/ui/feature-gates/feature-gate-link_cfg.rs
@@ -1,5 +1,5 @@
 #[link(name = "foo", cfg(foo))]
 //~^ ERROR: is unstable
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs
index 1c7f3313328..7391ea94ebc 100644
--- a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs
+++ b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs
@@ -1,8 +1,7 @@
-extern {
+extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32;
-    //~^ ERROR linking to LLVM intrinsics is experimental
+//~^ ERROR linking to LLVM intrinsics is experimental
 }
 
-fn main(){
-}
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-linkage.rs b/src/test/ui/feature-gates/feature-gate-linkage.rs
index 70f33cc0c6c..15b8d442aeb 100644
--- a/src/test/ui/feature-gates/feature-gate-linkage.rs
+++ b/src/test/ui/feature-gates/feature-gate-linkage.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     #[linkage = "extern_weak"] static foo: isize;
     //~^ ERROR: the `linkage` attribute is experimental and not portable
 }
diff --git a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs
index 11ff5405848..5cc04ad5cdf 100644
--- a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs
+++ b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs
@@ -26,7 +26,7 @@ enum Bär { //~ ERROR non-ascii idents
     }
 }
 
-extern {
+extern "C" {
     fn qüx();  //~ ERROR non-ascii idents
 }
 
diff --git a/src/test/ui/feature-gates/feature-gate-simd-ffi.rs b/src/test/ui/feature-gates/feature-gate-simd-ffi.rs
index 0425e39e677..abffa4a1001 100644
--- a/src/test/ui/feature-gates/feature-gate-simd-ffi.rs
+++ b/src/test/ui/feature-gates/feature-gate-simd-ffi.rs
@@ -5,7 +5,7 @@
 #[derive(Copy, Clone)]
 struct LocalSimd(u8, u8);
 
-extern {
+extern "C" {
     fn baz() -> LocalSimd; //~ ERROR use of SIMD type
     fn qux(x: LocalSimd); //~ ERROR use of SIMD type
 }
diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs
index 644b1f964a0..05c52f9dbea 100644
--- a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs
+++ b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs
@@ -1,5 +1,5 @@
-#[link(name="foo", kind="static-nobundle")]
+#[link(name = "foo", kind = "static-nobundle")]
 //~^ ERROR: kind="static-nobundle" is unstable
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr
index 773ad8ff217..3a3c86c3429 100644
--- a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr
+++ b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr
@@ -1,8 +1,8 @@
 error[E0658]: kind="static-nobundle" is unstable
   --> $DIR/feature-gate-static-nobundle.rs:1:1
    |
-LL | #[link(name="foo", kind="static-nobundle")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[link(name = "foo", kind = "static-nobundle")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information
    = help: add `#![feature(static_nobundle)]` to the crate attributes to enable
diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs
index 20c443b63d1..cd348ded4d7 100644
--- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs
+++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs
@@ -3,12 +3,12 @@
 
 #![crate_type = "lib"]
 
-extern {
-// CHECK: Function Attrs: nounwind
-// CHECK-NEXT: declare void @extern_fn
+extern "C" {
+    // CHECK: Function Attrs: nounwind
+    // CHECK-NEXT: declare void @extern_fn
     fn extern_fn();
-// CHECK-NOT: Function Attrs: nounwind
-// CHECK: declare void @unwinding_extern_fn
+    // CHECK-NOT: Function Attrs: nounwind
+    // CHECK: declare void @unwinding_extern_fn
     #[unwind(allowed)] //~ ERROR the `#[unwind]` attribute is an experimental feature
     fn unwinding_extern_fn();
 }
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
index aba6c08f41d..21f40524f63 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
@@ -536,7 +536,7 @@ mod link_name {
     //~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
     //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
     //~| HELP try `#[link(name = "1900")]` instead
-    extern { }
+    extern "C" { }
     //~^ NOTE not a foreign function or static
 
     mod inner { #![link_name="1900"] }
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
index 128795f50f9..c908d2589cf 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
@@ -403,8 +403,8 @@ warning: attribute should be applied to a foreign function or static
 LL |     #[link_name = "1900"]
    |     ^^^^^^^^^^^^^^^^^^^^^
 ...
-LL |     extern { }
-   |     ---------- not a foreign function or static
+LL |     extern "C" { }
+   |     -------------- not a foreign function or static
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 help: try `#[link(name = "1900")]` instead
diff --git a/src/test/ui/ffi_const2.rs b/src/test/ui/ffi_const2.rs
index 4bd9637f083..82fe8a9c91d 100644
--- a/src/test/ui/ffi_const2.rs
+++ b/src/test/ui/ffi_const2.rs
@@ -1,6 +1,6 @@
 #![feature(ffi_const, ffi_pure)]
 
-extern {
+extern "C" {
     #[ffi_pure] //~ ERROR `#[ffi_const]` function cannot be `#[ffi_pure]`
     #[ffi_const]
     pub fn baz();
diff --git a/src/test/ui/foreign-unsafe-fn-called.rs b/src/test/ui/foreign-unsafe-fn-called.rs
index 9352efaf2f0..abbe462021e 100644
--- a/src/test/ui/foreign-unsafe-fn-called.rs
+++ b/src/test/ui/foreign-unsafe-fn-called.rs
@@ -1,5 +1,5 @@
 mod test {
-    extern {
+    extern "C" {
         pub fn free();
     }
 }
diff --git a/src/test/ui/foreign/foreign-fn-linkname.rs b/src/test/ui/foreign/foreign-fn-linkname.rs
index 1f048159064..f6d820594f9 100644
--- a/src/test/ui/foreign/foreign-fn-linkname.rs
+++ b/src/test/ui/foreign/foreign-fn-linkname.rs
@@ -10,7 +10,7 @@ use std::ffi::CString;
 mod mlibc {
     use libc::{c_char, size_t};
 
-    extern {
+    extern "C" {
         #[link_name = "strlen"]
         pub fn my_strlen(str: *const c_char) -> size_t;
     }
@@ -19,9 +19,7 @@ mod mlibc {
 fn strlen(str: String) -> usize {
     // C string is terminated with a zero
     let s = CString::new(str).unwrap();
-    unsafe {
-        mlibc::my_strlen(s.as_ptr()) as usize
-    }
+    unsafe { mlibc::my_strlen(s.as_ptr()) as usize }
 }
 
 pub fn main() {
diff --git a/src/test/ui/foreign/foreign-int-types.rs b/src/test/ui/foreign/foreign-int-types.rs
index 66296574d7d..2d01d320425 100644
--- a/src/test/ui/foreign/foreign-int-types.rs
+++ b/src/test/ui/foreign/foreign-int-types.rs
@@ -3,11 +3,10 @@
 #![allow(dead_code)]
 
 mod xx {
-    extern {
+    extern "C" {
         pub fn strlen(str: *const u8) -> usize;
         pub fn foo(x: isize, y: usize);
     }
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/foreign/foreign-mod-unused-const.rs b/src/test/ui/foreign/foreign-mod-unused-const.rs
index d9efbe00e52..7d79c30f469 100644
--- a/src/test/ui/foreign/foreign-mod-unused-const.rs
+++ b/src/test/ui/foreign/foreign-mod-unused-const.rs
@@ -3,10 +3,9 @@
 // pretty-expanded FIXME #23616
 
 mod foo {
-    extern {
+    extern "C" {
         pub static errno: u32;
     }
 }
 
-pub fn main() {
-}
+pub fn main() {}
diff --git a/src/test/ui/foreign/foreign2.rs b/src/test/ui/foreign/foreign2.rs
index c1ab57776f6..df431f2999c 100644
--- a/src/test/ui/foreign/foreign2.rs
+++ b/src/test/ui/foreign/foreign2.rs
@@ -2,29 +2,28 @@
 #![allow(dead_code)]
 // ignore-wasm32-bare no libc to test ffi with
 // pretty-expanded FIXME #23616
-
 #![feature(rustc_private)]
 
 extern crate libc;
 
 mod bar {
-    extern {}
+    extern "C" {}
 }
 
 mod zed {
-    extern {}
+    extern "C" {}
 }
 
 mod mlibc {
     use libc::{c_int, c_void, size_t, ssize_t};
 
-    extern {
+    extern "C" {
         pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
     }
 }
 
 mod baz {
-    extern {}
+    extern "C" {}
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/functions-closures/fn-abi.rs b/src/test/ui/functions-closures/fn-abi.rs
index 900af9c1f66..ac3a4be3346 100644
--- a/src/test/ui/functions-closures/fn-abi.rs
+++ b/src/test/ui/functions-closures/fn-abi.rs
@@ -7,12 +7,12 @@
 
 extern crate fn_abi;
 
-extern {
+extern "C" {
     fn foo();
 }
 
 pub fn main() {
     // Will only type check if the type of _p and the decl of foo use the
     // same ABI
-    let _p: unsafe extern fn() = foo;
+    let _p: unsafe extern "C" fn() = foo;
 }
diff --git a/src/test/ui/generics/generic-extern-lifetime.rs b/src/test/ui/generics/generic-extern-lifetime.rs
index 22bcd44a14d..c42744808c3 100644
--- a/src/test/ui/generics/generic-extern-lifetime.rs
+++ b/src/test/ui/generics/generic-extern-lifetime.rs
@@ -1,15 +1,15 @@
 // Test to make sure the names of the lifetimes are correctly resolved
 // in extern blocks.
 
-extern {
-   pub fn life<'a>(x:&'a i32);
-   pub fn life2<'b>(x:&'a i32, y:&'b i32); //~ ERROR use of undeclared lifetime name `'a`
-   pub fn life3<'a>(x:&'a i32, y:&i32) -> &'a i32;
-   pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a`
-   pub fn life5<'b>(x: for<'c> fn(&'b i32));
-   pub fn life6<'b>(x: for<'c> fn(&'c i32));
-   pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a`
-   pub fn life8<'b>() -> for<'c> fn(&'b i32);
-   pub fn life9<'b>() -> for<'c> fn(&'c i32);
+extern "C" {
+    pub fn life<'a>(x: &'a i32);
+    pub fn life2<'b>(x: &'a i32, y: &'b i32); //~ ERROR use of undeclared lifetime name `'a`
+    pub fn life3<'a>(x: &'a i32, y: &i32) -> &'a i32;
+    pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a`
+    pub fn life5<'b>(x: for<'c> fn(&'b i32));
+    pub fn life6<'b>(x: for<'c> fn(&'c i32));
+    pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a`
+    pub fn life8<'b>() -> for<'c> fn(&'b i32);
+    pub fn life9<'b>() -> for<'c> fn(&'c i32);
 }
 fn main() {}
diff --git a/src/test/ui/generics/generic-extern-lifetime.stderr b/src/test/ui/generics/generic-extern-lifetime.stderr
index 72951aea4aa..3c9ed7a9dec 100644
--- a/src/test/ui/generics/generic-extern-lifetime.stderr
+++ b/src/test/ui/generics/generic-extern-lifetime.stderr
@@ -1,32 +1,32 @@
 error[E0261]: use of undeclared lifetime name `'a`
-  --> $DIR/generic-extern-lifetime.rs:6:24
+  --> $DIR/generic-extern-lifetime.rs:6:26
    |
-LL |    pub fn life2<'b>(x:&'a i32, y:&'b i32);
-   |                        ^^ undeclared lifetime
+LL |     pub fn life2<'b>(x: &'a i32, y: &'b i32);
+   |                          ^^ undeclared lifetime
 
 error[E0261]: use of undeclared lifetime name `'a`
-  --> $DIR/generic-extern-lifetime.rs:8:36
+  --> $DIR/generic-extern-lifetime.rs:8:37
    |
-LL |    pub fn life4<'b>(x: for<'c> fn(&'a i32));
-   |                                    ^^ undeclared lifetime
+LL |     pub fn life4<'b>(x: for<'c> fn(&'a i32));
+   |                                     ^^ undeclared lifetime
    |
    = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
 help: consider making the type lifetime-generic with a new `'a` lifetime
    |
-LL |    pub fn life4<'b>(x: for<'c, 'a> fn(&'a i32));
-   |                              ^^^^
+LL |     pub fn life4<'b>(x: for<'c, 'a> fn(&'a i32));
+   |                               ^^^^
 
 error[E0261]: use of undeclared lifetime name `'a`
-  --> $DIR/generic-extern-lifetime.rs:11:38
+  --> $DIR/generic-extern-lifetime.rs:11:39
    |
-LL |    pub fn life7<'b>() -> for<'c> fn(&'a i32);
-   |                                      ^^ undeclared lifetime
+LL |     pub fn life7<'b>() -> for<'c> fn(&'a i32);
+   |                                       ^^ undeclared lifetime
    |
    = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
 help: consider making the type lifetime-generic with a new `'a` lifetime
    |
-LL |    pub fn life7<'b>() -> for<'c, 'a> fn(&'a i32);
-   |                                ^^^^
+LL |     pub fn life7<'b>() -> for<'c, 'a> fn(&'a i32);
+   |                                 ^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/generics/generic-extern.rs b/src/test/ui/generics/generic-extern.rs
index e52a88592ff..3690d6fd07d 100644
--- a/src/test/ui/generics/generic-extern.rs
+++ b/src/test/ui/generics/generic-extern.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn foo<T>(); //~ ERROR foreign items may not have type parameters
 }
 
diff --git a/src/test/ui/imports/glob-resolve1.rs b/src/test/ui/imports/glob-resolve1.rs
index 32660fdb418..904b77117da 100644
--- a/src/test/ui/imports/glob-resolve1.rs
+++ b/src/test/ui/imports/glob-resolve1.rs
@@ -5,11 +5,15 @@ use bar::*;
 mod bar {
     use self::fpriv as import;
     fn fpriv() {}
-    extern {
+    extern "C" {
         fn epriv();
     }
-    enum A { A1 }
-    pub enum B { B1 }
+    enum A {
+        A1,
+    }
+    pub enum B {
+        B1,
+    }
 
     struct C;
 
diff --git a/src/test/ui/imports/glob-resolve1.stderr b/src/test/ui/imports/glob-resolve1.stderr
index cd128c1ea0b..7629cede7a4 100644
--- a/src/test/ui/imports/glob-resolve1.stderr
+++ b/src/test/ui/imports/glob-resolve1.stderr
@@ -1,5 +1,5 @@
 error[E0425]: cannot find function `fpriv` in this scope
-  --> $DIR/glob-resolve1.rs:22:5
+  --> $DIR/glob-resolve1.rs:26:5
    |
 LL |     fpriv();
    |     ^^^^^ not found in this scope
@@ -10,7 +10,7 @@ LL | use bar::fpriv;
    |
 
 error[E0425]: cannot find function `epriv` in this scope
-  --> $DIR/glob-resolve1.rs:23:5
+  --> $DIR/glob-resolve1.rs:27:5
    |
 LL |     epriv();
    |     ^^^^^ not found in this scope
@@ -21,23 +21,25 @@ LL | use bar::epriv;
    |
 
 error[E0423]: expected value, found enum `B`
-  --> $DIR/glob-resolve1.rs:24:5
+  --> $DIR/glob-resolve1.rs:28:5
    |
 LL |     B;
    |     ^
    |
 note: the enum is defined here
-  --> $DIR/glob-resolve1.rs:12:5
+  --> $DIR/glob-resolve1.rs:14:5
    |
-LL |     pub enum B { B1 }
-   |     ^^^^^^^^^^^^^^^^^
+LL | /     pub enum B {
+LL | |         B1,
+LL | |     }
+   | |_____^
 help: you might have meant to use the following enum variant
    |
 LL |     B::B1;
    |     ^^^^^
 
 error[E0425]: cannot find value `C` in this scope
-  --> $DIR/glob-resolve1.rs:25:5
+  --> $DIR/glob-resolve1.rs:29:5
    |
 LL |     C;
    |     ^ not found in this scope
@@ -48,7 +50,7 @@ LL | use bar::C;
    |
 
 error[E0425]: cannot find function `import` in this scope
-  --> $DIR/glob-resolve1.rs:26:5
+  --> $DIR/glob-resolve1.rs:30:5
    |
 LL |     import();
    |     ^^^^^^ not found in this scope
@@ -59,9 +61,9 @@ LL | use other::import;
    |
 
 error[E0412]: cannot find type `A` in this scope
-  --> $DIR/glob-resolve1.rs:28:11
+  --> $DIR/glob-resolve1.rs:32:11
    |
-LL |     pub enum B { B1 }
+LL |     pub enum B {
    |     ---------- similarly named enum `B` defined here
 ...
 LL |     foo::<A>();
@@ -77,9 +79,9 @@ LL | use bar::A;
    |
 
 error[E0412]: cannot find type `C` in this scope
-  --> $DIR/glob-resolve1.rs:29:11
+  --> $DIR/glob-resolve1.rs:33:11
    |
-LL |     pub enum B { B1 }
+LL |     pub enum B {
    |     ---------- similarly named enum `B` defined here
 ...
 LL |     foo::<C>();
@@ -95,9 +97,9 @@ LL | use bar::C;
    |
 
 error[E0412]: cannot find type `D` in this scope
-  --> $DIR/glob-resolve1.rs:30:11
+  --> $DIR/glob-resolve1.rs:34:11
    |
-LL |     pub enum B { B1 }
+LL |     pub enum B {
    |     ---------- similarly named enum `B` defined here
 ...
 LL |     foo::<D>();
diff --git a/src/test/ui/issues/auxiliary/issue-15562.rs b/src/test/ui/issues/auxiliary/issue-15562.rs
index d5afaaa5622..6ff26b47ea6 100644
--- a/src/test/ui/issues/auxiliary/issue-15562.rs
+++ b/src/test/ui/issues/auxiliary/issue-15562.rs
@@ -1,5 +1,5 @@
 #![crate_type = "lib"]
 
-extern {
+extern "C" {
     pub fn transmute();
 }
diff --git a/src/test/ui/issues/auxiliary/issue-16725.rs b/src/test/ui/issues/auxiliary/issue-16725.rs
index b75b5e2d8d7..9f9abd575bb 100644
--- a/src/test/ui/issues/auxiliary/issue-16725.rs
+++ b/src/test/ui/issues/auxiliary/issue-16725.rs
@@ -1,3 +1,3 @@
-extern {
+extern "C" {
     fn bar();
 }
diff --git a/src/test/ui/issues/auxiliary/issue-25185-1.rs b/src/test/ui/issues/auxiliary/issue-25185-1.rs
index 77a4787ba94..e957be9c1c1 100644
--- a/src/test/ui/issues/auxiliary/issue-25185-1.rs
+++ b/src/test/ui/issues/auxiliary/issue-25185-1.rs
@@ -3,6 +3,6 @@
 #![crate_type = "rlib"]
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     pub fn rust_dbg_extern_identity_u32(u: u32) -> u32;
 }
diff --git a/src/test/ui/issues/issue-10877.rs b/src/test/ui/issues/issue-10877.rs
index b57929be284..15a383175b9 100644
--- a/src/test/ui/issues/issue-10877.rs
+++ b/src/test/ui/issues/issue-10877.rs
@@ -1,12 +1,14 @@
-struct Foo { x: isize }
-extern {
+struct Foo {
+    x: isize,
+}
+extern "C" {
     fn foo(1: ());
     //~^ ERROR: patterns aren't allowed in foreign function declarations
     fn bar((): isize);
     //~^ ERROR: patterns aren't allowed in foreign function declarations
     fn baz(Foo { x }: isize);
     //~^ ERROR: patterns aren't allowed in foreign function declarations
-    fn qux((x,y): ());
+    fn qux((x, y): ());
     //~^ ERROR: patterns aren't allowed in foreign function declarations
     fn this_is_actually_ok(a: usize);
     fn and_so_is_this(_: usize);
diff --git a/src/test/ui/issues/issue-10877.stderr b/src/test/ui/issues/issue-10877.stderr
index 0f9dc211cea..bd3797cba55 100644
--- a/src/test/ui/issues/issue-10877.stderr
+++ b/src/test/ui/issues/issue-10877.stderr
@@ -1,26 +1,26 @@
 error[E0130]: patterns aren't allowed in foreign function declarations
-  --> $DIR/issue-10877.rs:3:12
+  --> $DIR/issue-10877.rs:5:12
    |
 LL |     fn foo(1: ());
    |            ^ pattern not allowed in foreign function
 
 error[E0130]: patterns aren't allowed in foreign function declarations
-  --> $DIR/issue-10877.rs:5:12
+  --> $DIR/issue-10877.rs:7:12
    |
 LL |     fn bar((): isize);
    |            ^^ pattern not allowed in foreign function
 
 error[E0130]: patterns aren't allowed in foreign function declarations
-  --> $DIR/issue-10877.rs:7:12
+  --> $DIR/issue-10877.rs:9:12
    |
 LL |     fn baz(Foo { x }: isize);
    |            ^^^^^^^^^ pattern not allowed in foreign function
 
 error[E0130]: patterns aren't allowed in foreign function declarations
-  --> $DIR/issue-10877.rs:9:12
+  --> $DIR/issue-10877.rs:11:12
    |
-LL |     fn qux((x,y): ());
-   |            ^^^^^ pattern not allowed in foreign function
+LL |     fn qux((x, y): ());
+   |            ^^^^^^ pattern not allowed in foreign function
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/issues/issue-1251.rs b/src/test/ui/issues/issue-1251.rs
index 7f25c9a787e..c2c047c7961 100644
--- a/src/test/ui/issues/issue-1251.rs
+++ b/src/test/ui/issues/issue-1251.rs
@@ -3,15 +3,14 @@
 #![allow(dead_code)]
 // pretty-expanded FIXME #23616
 // ignore-wasm32-bare no libc to test ffi with
-
 #![feature(rustc_private)]
 
 mod rustrt {
     extern crate libc;
 
-    extern {
+    extern "C" {
         pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/issues/issue-14227.rs b/src/test/ui/issues/issue-14227.rs
index d80eefc41bf..a1fde14600a 100644
--- a/src/test/ui/issues/issue-14227.rs
+++ b/src/test/ui/issues/issue-14227.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     pub static symbol: u32;
 }
 static CRASH: u32 = symbol;
diff --git a/src/test/ui/issues/issue-15487.rs b/src/test/ui/issues/issue-15487.rs
index 17b16a62a74..34ac53be5be 100644
--- a/src/test/ui/issues/issue-15487.rs
+++ b/src/test/ui/issues/issue-15487.rs
@@ -3,12 +3,11 @@
 // ignore-windows
 // ignore-wasm32-bare no libs to link
 // ignore-sgx no libs to link
-
 #![feature(link_args)]
 
-#[link_args="-lc  -lm"]
-#[link_args=" -lc"]
-#[link_args="-lc "]
-extern {}
+#[link_args = "-lc  -lm"]
+#[link_args = " -lc"]
+#[link_args = "-lc "]
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-16149.rs b/src/test/ui/issues/issue-16149.rs
index 7f0cad96a58..51b60725c5a 100644
--- a/src/test/ui/issues/issue-16149.rs
+++ b/src/test/ui/issues/issue-16149.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     static externalValue: isize;
 }
 
@@ -6,6 +6,6 @@ fn main() {
     let boolValue = match 42 {
         externalValue => true,
         //~^ ERROR match bindings cannot shadow statics
-        _ => false
+        _ => false,
     };
 }
diff --git a/src/test/ui/issues/issue-16250.rs b/src/test/ui/issues/issue-16250.rs
index a3c6751ad89..436e2a6cee3 100644
--- a/src/test/ui/issues/issue-16250.rs
+++ b/src/test/ui/issues/issue-16250.rs
@@ -2,9 +2,8 @@
 
 pub struct Foo;
 
-extern {
+extern "C" {
     pub fn foo(x: (Foo)); //~ ERROR `extern` block uses type `Foo`
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/issues/issue-16538.rs b/src/test/ui/issues/issue-16538.rs
index 54d9a732912..7d6eefa5b1e 100644
--- a/src/test/ui/issues/issue-16538.rs
+++ b/src/test/ui/issues/issue-16538.rs
@@ -1,6 +1,6 @@
 mod Y {
     pub type X = usize;
-    extern {
+    extern "C" {
         pub static x: *const usize;
     }
     pub fn foo(value: *const X) -> *const X {
diff --git a/src/test/ui/issues/issue-1866.rs b/src/test/ui/issues/issue-1866.rs
index 9f8a3a82624..caac0c50414 100644
--- a/src/test/ui/issues/issue-1866.rs
+++ b/src/test/ui/issues/issue-1866.rs
@@ -9,7 +9,7 @@ mod a {
     pub type rust_task = usize;
     pub mod rustrt {
         use super::rust_task;
-        extern {
+        extern "C" {
             pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
         }
     }
@@ -19,11 +19,11 @@ mod b {
     pub type rust_task = bool;
     pub mod rustrt {
         use super::rust_task;
-        extern {
+        extern "C" {
             pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
-            //~^ WARN `rust_task_is_unwinding` redeclared with a different signature
+        //~^ WARN `rust_task_is_unwinding` redeclared with a different signature
         }
     }
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/issues/issue-18804/auxiliary/lib.rs b/src/test/ui/issues/issue-18804/auxiliary/lib.rs
index ae27dd520e9..e29d48285d8 100644
--- a/src/test/ui/issues/issue-18804/auxiliary/lib.rs
+++ b/src/test/ui/issues/issue-18804/auxiliary/lib.rs
@@ -1,10 +1,10 @@
 #![crate_type = "rlib"]
 #![feature(linkage)]
 
-pub fn foo<T>() -> *const() {
-    extern {
+pub fn foo<T>() -> *const () {
+    extern "C" {
         #[linkage = "extern_weak"]
-        static FOO: *const();
+        static FOO: *const ();
     }
     unsafe { FOO }
 }
diff --git a/src/test/ui/issues/issue-20313-rpass.rs b/src/test/ui/issues/issue-20313-rpass.rs
index 09352044b01..591f3659e98 100644
--- a/src/test/ui/issues/issue-20313-rpass.rs
+++ b/src/test/ui/issues/issue-20313-rpass.rs
@@ -1,13 +1,11 @@
 // run-pass
 #![allow(dead_code)]
 // pretty-expanded FIXME #23616
-
 #![feature(link_llvm_intrinsics)]
 
-extern {
+extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32;
 }
 
-fn main(){
-}
+fn main() {}
diff --git a/src/test/ui/issues/issue-20313.rs b/src/test/ui/issues/issue-20313.rs
index 4149ab4a302..a72af650c70 100644
--- a/src/test/ui/issues/issue-20313.rs
+++ b/src/test/ui/issues/issue-20313.rs
@@ -1,7 +1,6 @@
-extern {
+extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental
 }
 
-fn main(){
-}
+fn main() {}
diff --git a/src/test/ui/issues/issue-2214.rs b/src/test/ui/issues/issue-2214.rs
index 52ab29f4235..1994c3515ab 100644
--- a/src/test/ui/issues/issue-2214.rs
+++ b/src/test/ui/issues/issue-2214.rs
@@ -5,13 +5,11 @@
 
 extern crate libc;
 
-use std::mem;
 use libc::{c_double, c_int};
+use std::mem;
 
 fn to_c_int(v: &mut isize) -> &mut c_int {
-    unsafe {
-        mem::transmute_copy(&v)
-    }
+    unsafe { mem::transmute_copy(&v) }
 }
 
 fn lgamma(n: c_double, value: &mut isize) -> c_double {
@@ -23,21 +21,21 @@ fn lgamma(n: c_double, value: &mut isize) -> c_double {
 mod m {
     use libc::{c_double, c_int};
 
-    extern {
+    extern "C" {
         #[cfg(all(unix, not(target_os = "vxworks")))]
         #[link_name="lgamma_r"]
         pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
         #[cfg(windows)]
-        #[link_name="lgamma"]
+        #[link_name = "lgamma"]
         pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
         #[cfg(target_os = "vxworks")]
-        #[link_name="lgamma"]
+        #[link_name = "lgamma"]
         pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
     }
 }
 
 pub fn main() {
-  let mut y: isize = 5;
-  let x: &mut isize = &mut y;
-  assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double);
+    let mut y: isize = 5;
+    let x: &mut isize = &mut y;
+    assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double);
 }
diff --git a/src/test/ui/issues/issue-28324.rs b/src/test/ui/issues/issue-28324.rs
index bb48508a4a4..f74726e8166 100644
--- a/src/test/ui/issues/issue-28324.rs
+++ b/src/test/ui/issues/issue-28324.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     static error_message_count: u32;
 }
 
diff --git a/src/test/ui/issues/issue-28472.rs b/src/test/ui/issues/issue-28472.rs
index 17d74ea0cf4..6db1f9a5bdd 100644
--- a/src/test/ui/issues/issue-28472.rs
+++ b/src/test/ui/issues/issue-28472.rs
@@ -1,6 +1,6 @@
 // Check that the visibility modifier is included in the span of foreign items.
 
-extern {
+extern "C" {
   fn foo();
 
   pub //~ ERROR the name `foo` is defined multiple times
diff --git a/src/test/ui/issues/issue-28676.rs b/src/test/ui/issues/issue-28676.rs
index 2b83478ca61..347a840296d 100644
--- a/src/test/ui/issues/issue-28676.rs
+++ b/src/test/ui/issues/issue-28676.rs
@@ -5,27 +5,32 @@
 // ignore-wasm32-bare no libc to test ffi with
 
 #[derive(Copy, Clone)]
-pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
+pub struct Quad {
+    a: u64,
+    b: u64,
+    c: u64,
+    d: u64,
+}
 
 mod rustrt {
     use super::Quad;
 
     #[link(name = "rust_test_helpers", kind = "static")]
-    extern {
-        pub fn get_c_many_params(_: *const (), _: *const (),
-                                 _: *const (), _: *const (), f: Quad) -> u64;
+    extern "C" {
+        pub fn get_c_many_params(
+            _: *const (),
+            _: *const (),
+            _: *const (),
+            _: *const (),
+            f: Quad,
+        ) -> u64;
     }
 }
 
 fn test() {
     unsafe {
         let null = std::ptr::null();
-        let q = Quad {
-            a: 1,
-            b: 2,
-            c: 3,
-            d: 4
-        };
+        let q = Quad { a: 1, b: 2, c: 3, d: 4 };
         assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c);
     }
 }
diff --git a/src/test/ui/issues/issue-32201.rs b/src/test/ui/issues/issue-32201.rs
index e22c1604165..f27bb1c2eb5 100644
--- a/src/test/ui/issues/issue-32201.rs
+++ b/src/test/ui/issues/issue-32201.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn foo(a: i32, ...);
 }
 
diff --git a/src/test/ui/issues/issue-3656.rs b/src/test/ui/issues/issue-3656.rs
index 17ff6b9f9f4..4a9f94306d5 100644
--- a/src/test/ui/issues/issue-3656.rs
+++ b/src/test/ui/issues/issue-3656.rs
@@ -1,14 +1,12 @@
 // run-pass
 #![allow(dead_code)]
 #![allow(improper_ctypes)]
-
 // Issue #3656
 // Incorrect struct size computation in the FFI, because of not taking
 // the alignment of elements into account.
 
 // pretty-expanded FIXME #23616
 // ignore-wasm32-bare no libc to test with
-
 #![feature(rustc_private)]
 
 extern crate libc;
@@ -21,10 +19,9 @@ pub struct KEYGEN {
     salt_size: u32,
 }
 
-extern {
+extern "C" {
     // Bogus signature, just need to test if it compiles.
     pub fn malloc(data: KEYGEN);
 }
 
-pub fn main() {
-}
+pub fn main() {}
diff --git a/src/test/ui/issues/issue-43925.rs b/src/test/ui/issues/issue-43925.rs
index 1f3bee38e8c..73d17928251 100644
--- a/src/test/ui/issues/issue-43925.rs
+++ b/src/test/ui/issues/issue-43925.rs
@@ -1,4 +1,4 @@
-#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
-extern {}
+#[link(name = "foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-43925.stderr b/src/test/ui/issues/issue-43925.stderr
index 739ace10aa6..7bf64dc693c 100644
--- a/src/test/ui/issues/issue-43925.stderr
+++ b/src/test/ui/issues/issue-43925.stderr
@@ -1,8 +1,8 @@
 error: invalid argument for `cfg(..)`
-  --> $DIR/issue-43925.rs:1:24
+  --> $DIR/issue-43925.rs:1:26
    |
-LL | #[link(name="foo", cfg("rlib"))]
-   |                        ^^^^^^
+LL | #[link(name = "foo", cfg("rlib"))]
+   |                          ^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-43926.rs b/src/test/ui/issues/issue-43926.rs
index c56a796187a..0171c12b1cc 100644
--- a/src/test/ui/issues/issue-43926.rs
+++ b/src/test/ui/issues/issue-43926.rs
@@ -1,4 +1,4 @@
-#[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument
-extern {}
+#[link(name = "foo", cfg())] //~ ERROR `cfg()` must have an argument
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-43926.stderr b/src/test/ui/issues/issue-43926.stderr
index d9d6b3a34fe..d83e9bd7ed4 100644
--- a/src/test/ui/issues/issue-43926.stderr
+++ b/src/test/ui/issues/issue-43926.stderr
@@ -1,8 +1,8 @@
 error: `cfg()` must have an argument
-  --> $DIR/issue-43926.rs:1:20
+  --> $DIR/issue-43926.rs:1:22
    |
-LL | #[link(name="foo", cfg())]
-   |                    ^^^^^
+LL | #[link(name = "foo", cfg())]
+   |                      ^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-5791.rs b/src/test/ui/issues/issue-5791.rs
index d9be27250cd..3544160f094 100644
--- a/src/test/ui/issues/issue-5791.rs
+++ b/src/test/ui/issues/issue-5791.rs
@@ -3,7 +3,7 @@
 #![warn(clashing_extern_declarations)]
 // pretty-expanded FIXME #23616
 
-extern {
+extern "C" {
     #[link_name = "malloc"]
     fn malloc1(len: i32) -> *const u8;
     #[link_name = "malloc"]
@@ -11,4 +11,4 @@ extern {
     fn malloc2(len: i32, foo: i32) -> *const u8;
 }
 
-pub fn main () {}
+pub fn main() {}
diff --git a/src/test/ui/issues/issue-6470.rs b/src/test/ui/issues/issue-6470.rs
index 0c86a648828..8c6192a59db 100644
--- a/src/test/ui/issues/issue-6470.rs
+++ b/src/test/ui/issues/issue-6470.rs
@@ -1,7 +1,6 @@
 // build-pass
 #![allow(dead_code)]
 #![allow(improper_ctypes)]
-
 // pretty-expanded FIXME #23616
 #![allow(non_snake_case)]
 
@@ -10,9 +9,9 @@ pub mod Bar {
         v: isize,
     }
 
-    extern {
+    extern "C" {
         pub fn foo(v: *const Foo) -> Foo;
     }
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/link-cfg-works.rs b/src/test/ui/link-cfg-works.rs
index fe1b569dff6..254091ff250 100644
--- a/src/test/ui/link-cfg-works.rs
+++ b/src/test/ui/link-cfg-works.rs
@@ -4,10 +4,10 @@
 
 #![feature(link_cfg)]
 
-extern crate link_cfg_works_transitive_rlib;
 extern crate link_cfg_works_transitive_dylib;
+extern crate link_cfg_works_transitive_rlib;
 
 #[link(name = "foo", cfg(foo))]
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs b/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs
index bbbfc485791..60b55b3e27b 100644
--- a/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs
+++ b/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs
@@ -1,7 +1,7 @@
 #![feature(linkage)]
 #![crate_type = "lib"]
 
-extern {
-    #[linkage="external"]
+extern "C" {
+    #[linkage = "external"]
     pub static collision: *const i32;
 }
diff --git a/src/test/ui/linkage-attr/invalid-link-args.rs b/src/test/ui/linkage-attr/invalid-link-args.rs
index 5eb1c637f09..7418691d014 100644
--- a/src/test/ui/linkage-attr/invalid-link-args.rs
+++ b/src/test/ui/linkage-attr/invalid-link-args.rs
@@ -9,6 +9,6 @@
 #![feature(link_args)]
 
 #[link_args = "aFdEfSeVEEE"]
-extern {}
+extern "C" {}
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs
index 1e5069612fb..b712f3225ed 100644
--- a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs
+++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs
@@ -3,8 +3,8 @@
 #![feature(linkage)]
 
 mod dep1 {
-    extern {
-        #[linkage="external"]
+    extern "C" {
+        #[linkage = "external"]
         #[no_mangle]
         pub static collision: *const i32; //~ ERROR symbol `collision` is already defined
     }
@@ -20,6 +20,6 @@ mod dep2 {
 
 fn main() {
     unsafe {
-       println!("{:p}", &dep1::collision);
+        println!("{:p}", &dep1::collision);
     }
 }
diff --git a/src/test/ui/linkage-attr/linkage2.rs b/src/test/ui/linkage-attr/linkage2.rs
index 41e7819e8cd..a7be1985286 100644
--- a/src/test/ui/linkage-attr/linkage2.rs
+++ b/src/test/ui/linkage-attr/linkage2.rs
@@ -7,9 +7,10 @@
 
 #![feature(linkage)]
 
-extern {
-    #[linkage = "extern_weak"] static foo: i32;
-    //~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
+extern "C" {
+    #[linkage = "extern_weak"]
+    static foo: i32;
+//~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
 }
 
 fn main() {
diff --git a/src/test/ui/linkage-attr/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr
index 72ee3fb62ec..6ffe07170ed 100644
--- a/src/test/ui/linkage-attr/linkage2.stderr
+++ b/src/test/ui/linkage-attr/linkage2.stderr
@@ -1,8 +1,8 @@
 error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
-  --> $DIR/linkage2.rs:11:32
+  --> $DIR/linkage2.rs:12:5
    |
-LL |     #[linkage = "extern_weak"] static foo: i32;
-   |                                ^^^^^^^^^^^^^^^^
+LL |     static foo: i32;
+   |     ^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/linkage-attr/linkage3.rs b/src/test/ui/linkage-attr/linkage3.rs
index e91dbf675d3..112eb1d3bd9 100644
--- a/src/test/ui/linkage-attr/linkage3.rs
+++ b/src/test/ui/linkage-attr/linkage3.rs
@@ -6,9 +6,10 @@
 
 #![feature(linkage)]
 
-extern {
-    #[linkage = "foo"] static foo: *const i32;
-    //~^ ERROR: invalid linkage specified
+extern "C" {
+    #[linkage = "foo"]
+    static foo: *const i32;
+//~^ ERROR: invalid linkage specified
 }
 
 fn main() {
diff --git a/src/test/ui/linkage-attr/linkage3.stderr b/src/test/ui/linkage-attr/linkage3.stderr
index 5a0833f2f74..0cbac28349d 100644
--- a/src/test/ui/linkage-attr/linkage3.stderr
+++ b/src/test/ui/linkage-attr/linkage3.stderr
@@ -1,8 +1,8 @@
 error: invalid linkage specified
-  --> $DIR/linkage3.rs:10:24
+  --> $DIR/linkage3.rs:11:5
    |
-LL |     #[linkage = "foo"] static foo: *const i32;
-   |                        ^^^^^^^^^^^^^^^^^^^^^^^
+LL |     static foo: *const i32;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/linkage1.rs b/src/test/ui/linkage1.rs
index bda4da53dbc..deab7a251cb 100644
--- a/src/test/ui/linkage1.rs
+++ b/src/test/ui/linkage1.rs
@@ -9,7 +9,7 @@
 
 extern crate linkage1 as other;
 
-extern {
+extern "C" {
     #[linkage = "extern_weak"]
     static foo: *const isize;
     #[linkage = "extern_weak"]
diff --git a/src/test/ui/lint/dead-code/leading-underscore.rs b/src/test/ui/lint/dead-code/leading-underscore.rs
index 1b6e03ab887..d3582961b3e 100644
--- a/src/test/ui/lint/dead-code/leading-underscore.rs
+++ b/src/test/ui/lint/dead-code/leading-underscore.rs
@@ -8,7 +8,7 @@ static _X: usize = 0;
 fn _foo() {}
 
 struct _Y {
-    _z: usize
+    _z: usize,
 }
 
 enum _Z {}
@@ -23,7 +23,7 @@ mod _bar {
     fn _qux() {}
 }
 
-extern {
+extern "C" {
     #[link_name = "abort"]
     fn _abort() -> !;
 }
diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs
index fe3c392ccf1..7f39f7965f2 100644
--- a/src/test/ui/lint/dead-code/lint-dead-code-3.rs
+++ b/src/test/ui/lint/dead-code/lint-dead-code-3.rs
@@ -7,7 +7,7 @@
 
 
 pub use extern_foo as x;
-extern {
+extern "C" {
     pub fn extern_foo();
 }
 
@@ -47,7 +47,7 @@ mod blah {
     // `malloc` below, which are also used.
     enum c_void {}
 
-    extern {
+    extern "C" {
         fn free(p: *const c_void);
         fn malloc(size: usize) -> *const c_void;
     }
@@ -58,7 +58,7 @@ mod blah {
 }
 
 enum c_void {} //~ ERROR: enum is never used
-extern {
+extern "C" {
     fn free(p: *const c_void); //~ ERROR: function is never used
 }
 
diff --git a/src/test/ui/lint/inline-trait-and-foreign-items.rs b/src/test/ui/lint/inline-trait-and-foreign-items.rs
index 8bdefbb36ae..6321b3c76e4 100644
--- a/src/test/ui/lint/inline-trait-and-foreign-items.rs
+++ b/src/test/ui/lint/inline-trait-and-foreign-items.rs
@@ -26,7 +26,7 @@ impl Trait for () {
     type U = impl Trait; //~ ERROR could not find defining uses
 }
 
-extern {
+extern "C" {
     #[inline] //~ ERROR attribute should be applied to function or closure
     static X: u32;
 
diff --git a/src/test/ui/lint/lint-ctypes-enum.rs b/src/test/ui/lint/lint-ctypes-enum.rs
index 17cb7053731..d7f947aa0f3 100644
--- a/src/test/ui/lint/lint-ctypes-enum.rs
+++ b/src/test/ui/lint/lint-ctypes-enum.rs
@@ -5,36 +5,57 @@
 
 use std::num;
 
-enum Z { }
-enum U { A }
-enum B { C, D }
-enum T { E, F, G }
+enum Z {}
+enum U {
+    A,
+}
+enum B {
+    C,
+    D,
+}
+enum T {
+    E,
+    F,
+    G,
+}
 
 #[repr(C)]
-enum ReprC { A, B, C }
+enum ReprC {
+    A,
+    B,
+    C,
+}
 
 #[repr(u8)]
-enum U8 { A, B, C }
+enum U8 {
+    A,
+    B,
+    C,
+}
 
 #[repr(isize)]
-enum Isize { A, B, C }
+enum Isize {
+    A,
+    B,
+    C,
+}
 
 #[repr(transparent)]
 struct TransparentStruct<T>(T, std::marker::PhantomData<Z>);
 
 #[repr(transparent)]
 enum TransparentEnum<T> {
-   Variant(T, std::marker::PhantomData<Z>),
+    Variant(T, std::marker::PhantomData<Z>),
 }
 
 #[repr(transparent)]
 union TransparentUnion<T: Copy> {
-   field: T,
+    field: T,
 }
 
 struct Rust<T>(T);
 
-extern {
+extern "C" {
    fn zf(x: Z);
    fn uf(x: U); //~ ERROR `extern` block uses type `U`
    fn bf(x: B); //~ ERROR `extern` block uses type `B`
diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr
index 3d02cda7d3e..8917d309e60 100644
--- a/src/test/ui/lint/lint-ctypes-enum.stderr
+++ b/src/test/ui/lint/lint-ctypes-enum.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `U`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:39:13
+  --> $DIR/lint-ctypes-enum.rs:60:13
    |
 LL |    fn uf(x: U);
    |             ^ not FFI-safe
@@ -14,11 +14,13 @@ LL | #![deny(improper_ctypes)]
 note: the type is defined here
   --> $DIR/lint-ctypes-enum.rs:9:1
    |
-LL | enum U { A }
-   | ^^^^^^^^^^^^
+LL | / enum U {
+LL | |     A,
+LL | | }
+   | |_^
 
 error: `extern` block uses type `B`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:40:13
+  --> $DIR/lint-ctypes-enum.rs:61:13
    |
 LL |    fn bf(x: B);
    |             ^ not FFI-safe
@@ -26,13 +28,16 @@ LL |    fn bf(x: B);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:10:1
+  --> $DIR/lint-ctypes-enum.rs:12:1
    |
-LL | enum B { C, D }
-   | ^^^^^^^^^^^^^^^
+LL | / enum B {
+LL | |     C,
+LL | |     D,
+LL | | }
+   | |_^
 
 error: `extern` block uses type `T`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:41:13
+  --> $DIR/lint-ctypes-enum.rs:62:13
    |
 LL |    fn tf(x: T);
    |             ^ not FFI-safe
@@ -40,13 +45,17 @@ LL |    fn tf(x: T);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:11:1
+  --> $DIR/lint-ctypes-enum.rs:16:1
    |
-LL | enum T { E, F, G }
-   | ^^^^^^^^^^^^^^^^^^
+LL | / enum T {
+LL | |     E,
+LL | |     F,
+LL | |     G,
+LL | | }
+   | |_^
 
 error: `extern` block uses type `Option<Unique<u8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:48:17
+  --> $DIR/lint-ctypes-enum.rs:69:17
    |
 LL |    fn unique(x: Option<std::ptr::Unique<u8>>);
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -55,7 +64,7 @@ LL |    fn unique(x: Option<std::ptr::Unique<u8>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:54:23
+  --> $DIR/lint-ctypes-enum.rs:75:23
    |
 LL |    fn nonzero_u128(x: Option<num::NonZeroU128>);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -63,7 +72,7 @@ LL |    fn nonzero_u128(x: Option<num::NonZeroU128>);
    = note: 128-bit integers don't currently have a known stable ABI
 
 error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:61:23
+  --> $DIR/lint-ctypes-enum.rs:82:23
    |
 LL |    fn nonzero_i128(x: Option<num::NonZeroI128>);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -71,7 +80,7 @@ LL |    fn nonzero_i128(x: Option<num::NonZeroI128>);
    = note: 128-bit integers don't currently have a known stable ABI
 
 error: `extern` block uses type `Option<TransparentUnion<NonZeroU8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:66:28
+  --> $DIR/lint-ctypes-enum.rs:87:28
    |
 LL |    fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -80,7 +89,7 @@ LL |    fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Option<Rust<NonZeroU8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:68:20
+  --> $DIR/lint-ctypes-enum.rs:89:20
    |
 LL |    fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -89,7 +98,7 @@ LL |    fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `std::result::Result<(), NonZeroI32>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:69:20
+  --> $DIR/lint-ctypes-enum.rs:90:20
    |
 LL |    fn no_result(x: Result<(), num::NonZeroI32>);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
diff --git a/src/test/ui/lint/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs
index e8a90bca7d3..fabbdcf6891 100644
--- a/src/test/ui/lint/lint-ctypes.rs
+++ b/src/test/ui/lint/lint-ctypes.rs
@@ -20,7 +20,7 @@ pub type I32Pair = (i32, i32);
 #[repr(C)]
 pub struct ZeroSize;
 pub type RustFn = fn();
-pub type RustBadRet = extern fn() -> Box<u32>;
+pub type RustBadRet = extern "C" fn() -> Box<u32>;
 pub type CVoidRet = ();
 pub struct Foo;
 #[repr(transparent)]
@@ -43,7 +43,7 @@ pub struct TransparentCustomZst(i32, ZeroSize);
 #[repr(C)]
 pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
 
-extern {
+extern "C" {
     pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `Foo`
     pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `Foo`
     pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]`
@@ -73,12 +73,12 @@ extern {
     pub static static_u128_type: u128; //~ ERROR: uses type `u128`
     pub static static_u128_array_type: [u128; 16]; //~ ERROR: uses type `u128`
 
-    pub fn good3(fptr: Option<extern fn()>);
+    pub fn good3(fptr: Option<extern "C" fn()>);
     pub fn good4(aptr: &[u8; 4 as usize]);
     pub fn good5(s: StructWithProjection);
     pub fn good6(s: StructWithProjectionAndLifetime);
-    pub fn good7(fptr: extern fn() -> ());
-    pub fn good8(fptr: extern fn() -> !);
+    pub fn good7(fptr: extern "C" fn() -> ());
+    pub fn good8(fptr: extern "C" fn() -> !);
     pub fn good9() -> ();
     pub fn good10() -> CVoidRet;
     pub fn good11(size: isize);
@@ -96,12 +96,12 @@ extern {
 }
 
 #[allow(improper_ctypes)]
-extern {
+extern "C" {
     pub fn good19(_: &String);
 }
 
 #[cfg(not(target_arch = "wasm32"))]
-extern {
+extern "C" {
     pub fn good1(size: *const libc::c_int);
     pub fn good2(size: *const libc::c_uint);
 }
diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs
index 94f79d69751..27c31c22311 100644
--- a/src/test/ui/lint/unreachable_pub-pub_crate.rs
+++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs
@@ -41,7 +41,7 @@ mod private_mod {
     }
     define_empty_struct_with_visibility!(pub, Fluorine);
 
-    extern {
+    extern "C" {
         pub fn catalyze() -> bool; //~ WARNING unreachable_pub
     }
 
diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs
index a4c14970139..6bfec0ec5e8 100644
--- a/src/test/ui/lint/unreachable_pub.rs
+++ b/src/test/ui/lint/unreachable_pub.rs
@@ -37,7 +37,7 @@ mod private_mod {
     }
     define_empty_struct_with_visibility!(pub, Fluorine);
 
-    extern {
+    extern "C" {
         pub fn catalyze() -> bool; //~ WARNING unreachable_pub
     }
 
diff --git a/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.rs b/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.rs
index 21097197499..4684fe14577 100644
--- a/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.rs
+++ b/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.rs
@@ -5,7 +5,7 @@ trait Trait {
     fn foo();
 }
 
-extern {
+extern "C" {
     #[inline] //~ ERROR `#[inline]` is ignored on function prototypes
     fn foo();
 }
diff --git a/src/test/ui/macros/macros-in-extern.rs b/src/test/ui/macros/macros-in-extern.rs
index 05002ed72c7..568ae3a8539 100644
--- a/src/test/ui/macros/macros-in-extern.rs
+++ b/src/test/ui/macros/macros-in-extern.rs
@@ -10,7 +10,7 @@ macro_rules! returns_isize(
 );
 
 macro takes_u32_returns_u32($ident:ident) {
-    fn $ident (arg: u32) -> u32;
+    fn $ident(arg: u32) -> u32;
 }
 
 macro_rules! emits_nothing(
@@ -25,8 +25,14 @@ macro_rules! emits_multiple(
 );
 
 mod defs {
-    #[no_mangle] extern fn f1() -> u32 { 1 }
-    #[no_mangle] extern fn f2() -> u32 { 2 }
+    #[no_mangle]
+    extern "C" fn f1() -> u32 {
+        1
+    }
+    #[no_mangle]
+    extern "C" fn f2() -> u32 {
+        2
+    }
 }
 
 fn main() {
@@ -37,7 +43,7 @@ fn main() {
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     returns_isize!(rust_get_test_int);
     takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
     emits_nothing!();
diff --git a/src/test/ui/mismatched_types/issue-26480.rs b/src/test/ui/mismatched_types/issue-26480.rs
index d140e12b04d..8bd26cebc69 100644
--- a/src/test/ui/mismatched_types/issue-26480.rs
+++ b/src/test/ui/mismatched_types/issue-26480.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
 }
 
diff --git a/src/test/ui/nil-decl-in-foreign.rs b/src/test/ui/nil-decl-in-foreign.rs
index 98422665b9c..f3be948781b 100644
--- a/src/test/ui/nil-decl-in-foreign.rs
+++ b/src/test/ui/nil-decl-in-foreign.rs
@@ -6,9 +6,9 @@
 // pretty-expanded FIXME #23616
 
 mod libc {
-    extern {
+    extern "C" {
         pub fn printf(x: ());
     }
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/no-patterns-in-args.rs b/src/test/ui/no-patterns-in-args.rs
index a774955c1e8..54836b0a3f5 100644
--- a/src/test/ui/no-patterns-in-args.rs
+++ b/src/test/ui/no-patterns-in-args.rs
@@ -1,10 +1,10 @@
-extern {
+extern "C" {
     fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
     fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations
     fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations
     fn g1(arg: u8); // OK
     fn g2(_: u8); // OK
-    // fn g3(u8); // Not yet
+// fn g3(u8); // Not yet
 }
 
 type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types
diff --git a/src/test/ui/osx-frameworks.rs b/src/test/ui/osx-frameworks.rs
index 227e07de9a8..31b853e24fe 100644
--- a/src/test/ui/osx-frameworks.rs
+++ b/src/test/ui/osx-frameworks.rs
@@ -1,8 +1,7 @@
 // ignore-macos this is supposed to succeed on osx
 
 #[link(name = "foo", kind = "framework")]
-extern {}
+extern "C" {}
 //~^^ ERROR: native frameworks are only available on macOS
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/parser/attrs-after-extern-mod.rs b/src/test/ui/parser/attrs-after-extern-mod.rs
index ea899dca7b2..e3f0fa0fc46 100644
--- a/src/test/ui/parser/attrs-after-extern-mod.rs
+++ b/src/test/ui/parser/attrs-after-extern-mod.rs
@@ -2,6 +2,6 @@
 
 fn main() {}
 
-extern {
+extern "C" {
     #[cfg(stage37)] //~ ERROR expected item after attributes
 }
diff --git a/src/test/ui/parser/attrs-after-extern-mod.stderr b/src/test/ui/parser/attrs-after-extern-mod.stderr
index 3862f5c379f..135d98457e1 100644
--- a/src/test/ui/parser/attrs-after-extern-mod.stderr
+++ b/src/test/ui/parser/attrs-after-extern-mod.stderr
@@ -1,8 +1,8 @@
 error: expected item after attributes
   --> $DIR/attrs-after-extern-mod.rs:6:5
    |
-LL | extern {
-   |        - while parsing this item list starting here
+LL | extern "C" {
+   |            - while parsing this item list starting here
 LL |     #[cfg(stage37)]
    |     ^^^^^^^^^^^^^^^
 LL | }
diff --git a/src/test/ui/parser/bad-lit-suffixes.stderr b/src/test/ui/parser/bad-lit-suffixes.stderr
index 9b596571481..8c433961408 100644
--- a/src/test/ui/parser/bad-lit-suffixes.stderr
+++ b/src/test/ui/parser/bad-lit-suffixes.stderr
@@ -110,5 +110,16 @@ LL |     1.0e10suffix;
    |
    = help: valid suffixes are `f32` and `f64`
 
-error: aborting due to 16 previous errors
+error: extern declarations without an explicit ABI are deprecated
+  --> $DIR/bad-lit-suffixes.rs:5:1
+   |
+LL | / extern
+LL | |     "C"suffix
+LL | | {}
+   | |__^ ABI should be specified here
+   |
+   = note: `#[deny(missing_abi)]` on by default
+   = help: the default ABI is C
+
+error: aborting due to 17 previous errors
 
diff --git a/src/test/ui/parser/doc-before-extern-rbrace.rs b/src/test/ui/parser/doc-before-extern-rbrace.rs
index 040206b80ff..515c90ed48c 100644
--- a/src/test/ui/parser/doc-before-extern-rbrace.rs
+++ b/src/test/ui/parser/doc-before-extern-rbrace.rs
@@ -1,6 +1,6 @@
 fn main() {}
 
-extern {
+extern "C" {
     /// hi
     //~^ ERROR found a documentation comment that doesn't document anything
 }
diff --git a/src/test/ui/parser/duplicate-visibility.rs b/src/test/ui/parser/duplicate-visibility.rs
index 31318ae3a09..547329cfb1b 100644
--- a/src/test/ui/parser/duplicate-visibility.rs
+++ b/src/test/ui/parser/duplicate-visibility.rs
@@ -1,6 +1,6 @@
 fn main() {}
 
-extern {
+extern "C" {
     pub pub fn foo();
     //~^ ERROR visibility `pub` is not followed by an item
     //~| ERROR non-item in item list
diff --git a/src/test/ui/parser/duplicate-visibility.stderr b/src/test/ui/parser/duplicate-visibility.stderr
index 36b9efd9dca..8d8122292ae 100644
--- a/src/test/ui/parser/duplicate-visibility.stderr
+++ b/src/test/ui/parser/duplicate-visibility.stderr
@@ -9,8 +9,8 @@ LL |     pub pub fn foo();
 error: non-item in item list
   --> $DIR/duplicate-visibility.rs:4:9
    |
-LL | extern {
-   |        - item list starts here
+LL | extern "C" {
+   |            - item list starts here
 LL |     pub pub fn foo();
    |         ^^^ non-item starts here
 ...
diff --git a/src/test/ui/parser/extern-no-fn.rs b/src/test/ui/parser/extern-no-fn.rs
index d9f35e0eb5c..73568609cdf 100644
--- a/src/test/ui/parser/extern-no-fn.rs
+++ b/src/test/ui/parser/extern-no-fn.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     f(); //~ ERROR expected one of `!` or `::`, found `(`
 }
 
diff --git a/src/test/ui/parser/extern-no-fn.stderr b/src/test/ui/parser/extern-no-fn.stderr
index 0151cb4235b..d9183d56463 100644
--- a/src/test/ui/parser/extern-no-fn.stderr
+++ b/src/test/ui/parser/extern-no-fn.stderr
@@ -1,8 +1,8 @@
 error: expected one of `!` or `::`, found `(`
   --> $DIR/extern-no-fn.rs:2:6
    |
-LL | extern {
-   |        - while parsing this item list starting here
+LL | extern "C" {
+   |            - while parsing this item list starting here
 LL |     f();
    |      ^ expected one of `!` or `::`
 LL | }
diff --git a/src/test/ui/parser/fn-body-eq-expr-semi.rs b/src/test/ui/parser/fn-body-eq-expr-semi.rs
index 09444079365..7127ba8da61 100644
--- a/src/test/ui/parser/fn-body-eq-expr-semi.rs
+++ b/src/test/ui/parser/fn-body-eq-expr-semi.rs
@@ -5,7 +5,7 @@ fn syntax() {
     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
 }
 
-extern {
+extern "C" {
     fn foo() = 42; //~ ERROR function body cannot be `= expression;`
     //~^ ERROR incorrect function inside `extern` block
     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
diff --git a/src/test/ui/parser/fn-body-eq-expr-semi.stderr b/src/test/ui/parser/fn-body-eq-expr-semi.stderr
index 739133e0b40..fdc7a9409d7 100644
--- a/src/test/ui/parser/fn-body-eq-expr-semi.stderr
+++ b/src/test/ui/parser/fn-body-eq-expr-semi.stderr
@@ -89,8 +89,8 @@ LL |     fn bar() -> u8 { 42 }
 error: incorrect function inside `extern` block
   --> $DIR/fn-body-eq-expr-semi.rs:9:8
    |
-LL | extern {
-   | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
 LL |     fn foo() = 42;
    |        ^^^   ----- help: remove the invalid body: `;`
    |        |
@@ -102,8 +102,8 @@ LL |     fn foo() = 42;
 error: incorrect function inside `extern` block
   --> $DIR/fn-body-eq-expr-semi.rs:11:8
    |
-LL | extern {
-   | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
 ...
 LL |     fn bar() -> u8 = 42;
    |        ^^^         ----- help: remove the invalid body: `;`
diff --git a/src/test/ui/parser/fn-body-optional-semantic-fail.rs b/src/test/ui/parser/fn-body-optional-semantic-fail.rs
index 38def05e8f2..12df488802e 100644
--- a/src/test/ui/parser/fn-body-optional-semantic-fail.rs
+++ b/src/test/ui/parser/fn-body-optional-semantic-fail.rs
@@ -20,7 +20,7 @@ fn main() {
         fn f4() {} // OK.
     }
 
-    extern {
+    extern "C" {
         fn f5(); // OK.
         fn f6() {} //~ ERROR incorrect function inside `extern` block
     }
diff --git a/src/test/ui/parser/fn-body-optional-semantic-fail.stderr b/src/test/ui/parser/fn-body-optional-semantic-fail.stderr
index 23ce98fb5d7..14bcd7c16fa 100644
--- a/src/test/ui/parser/fn-body-optional-semantic-fail.stderr
+++ b/src/test/ui/parser/fn-body-optional-semantic-fail.stderr
@@ -25,8 +25,8 @@ LL |         fn f3();
 error: incorrect function inside `extern` block
   --> $DIR/fn-body-optional-semantic-fail.rs:25:12
    |
-LL |     extern {
-   |     ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+LL |     extern "C" {
+   |     ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
 LL |         fn f5(); // OK.
 LL |         fn f6() {}
    |            ^^   -- help: remove the invalid body: `;`
diff --git a/src/test/ui/parser/fn-body-optional-syntactic-pass.rs b/src/test/ui/parser/fn-body-optional-syntactic-pass.rs
index e7991c73b4b..f9dbebf0bea 100644
--- a/src/test/ui/parser/fn-body-optional-syntactic-pass.rs
+++ b/src/test/ui/parser/fn-body-optional-syntactic-pass.rs
@@ -24,8 +24,8 @@ fn syntax() {
         fn f() {}
     }
 
-    extern {
+    extern "C" {
+        fn f();
         fn f();
-        fn f() {}
     }
 }
diff --git a/src/test/ui/parser/fn-header-semantic-fail.rs b/src/test/ui/parser/fn-header-semantic-fail.rs
index c327667f4cd..0bbaeec0c7f 100644
--- a/src/test/ui/parser/fn-header-semantic-fail.rs
+++ b/src/test/ui/parser/fn-header-semantic-fail.rs
@@ -47,7 +47,7 @@ fn main() {
         //~^ ERROR functions cannot be both `const` and `async`
     }
 
-    extern {
+    extern "C" {
         async fn fe1(); //~ ERROR functions in `extern` blocks cannot have qualifiers
         unsafe fn fe2(); //~ ERROR functions in `extern` blocks cannot have qualifiers
         const fn fe3(); //~ ERROR functions in `extern` blocks cannot have qualifiers
diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr
index 2f11f95bf4a..4fde243b2f8 100644
--- a/src/test/ui/parser/fn-header-semantic-fail.stderr
+++ b/src/test/ui/parser/fn-header-semantic-fail.stderr
@@ -105,8 +105,8 @@ LL |         const async unsafe extern "C" fn fi5() {}
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:51:18
    |
-LL |     extern {
-   |     ------ in this `extern` block
+LL |     extern "C" {
+   |     ---------- in this `extern` block
 LL |         async fn fe1();
    |                  ^^^
    |
@@ -118,8 +118,8 @@ LL |         fn fe1();
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:52:19
    |
-LL |     extern {
-   |     ------ in this `extern` block
+LL |     extern "C" {
+   |     ---------- in this `extern` block
 LL |         async fn fe1();
 LL |         unsafe fn fe2();
    |                   ^^^
@@ -132,8 +132,8 @@ LL |         fn fe2();
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:53:18
    |
-LL |     extern {
-   |     ------ in this `extern` block
+LL |     extern "C" {
+   |     ---------- in this `extern` block
 ...
 LL |         const fn fe3();
    |                  ^^^
@@ -146,8 +146,8 @@ LL |         fn fe3();
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:54:23
    |
-LL |     extern {
-   |     ------ in this `extern` block
+LL |     extern "C" {
+   |     ---------- in this `extern` block
 ...
 LL |         extern "C" fn fe4();
    |                       ^^^
@@ -160,8 +160,8 @@ LL |         fn fe4();
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:55:42
    |
-LL |     extern {
-   |     ------ in this `extern` block
+LL |     extern "C" {
+   |     ---------- in this `extern` block
 ...
 LL |         const async unsafe extern "C" fn fe5();
    |                                          ^^^
diff --git a/src/test/ui/parser/fn-header-syntactic-pass.rs b/src/test/ui/parser/fn-header-syntactic-pass.rs
index 9e44541993d..68f1f7901bb 100644
--- a/src/test/ui/parser/fn-header-syntactic-pass.rs
+++ b/src/test/ui/parser/fn-header-syntactic-pass.rs
@@ -37,11 +37,11 @@ fn syntax() {
         const async unsafe extern "C" fn f();
     }
 
-    extern {
-        async fn f();
-        unsafe fn f();
-        const fn f();
-        extern "C" fn f();
-        const async unsafe extern "C" fn f();
+    extern "C" {
+        fn f();
+        fn f();
+        fn f();
+        fn f();
+        fn f();
     }
 }
diff --git a/src/test/ui/parser/foreign-const-semantic-fail.rs b/src/test/ui/parser/foreign-const-semantic-fail.rs
index 82978e655ba..c9940b74aa2 100644
--- a/src/test/ui/parser/foreign-const-semantic-fail.rs
+++ b/src/test/ui/parser/foreign-const-semantic-fail.rs
@@ -1,6 +1,6 @@
 fn main() {}
 
-extern {
+extern "C" {
     const A: isize;
     //~^ ERROR extern items cannot be `const`
     const B: isize = 42;
diff --git a/src/test/ui/parser/foreign-const-semantic-fail.stderr b/src/test/ui/parser/foreign-const-semantic-fail.stderr
index f529b3ad87b..8dc66c0d012 100644
--- a/src/test/ui/parser/foreign-const-semantic-fail.stderr
+++ b/src/test/ui/parser/foreign-const-semantic-fail.stderr
@@ -21,8 +21,8 @@ LL |     const B: isize = 42;
 error: incorrect `static` inside `extern` block
   --> $DIR/foreign-const-semantic-fail.rs:6:11
    |
-LL | extern {
-   | ------ `extern` blocks define existing foreign statics and statics inside of them cannot have a body
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign statics and statics inside of them cannot have a body
 ...
 LL |     const B: isize = 42;
    |           ^          -- the invalid body
diff --git a/src/test/ui/parser/foreign-const-syntactic-fail.rs b/src/test/ui/parser/foreign-const-syntactic-fail.rs
index a78f8b1623a..a6e77f84663 100644
--- a/src/test/ui/parser/foreign-const-syntactic-fail.rs
+++ b/src/test/ui/parser/foreign-const-syntactic-fail.rs
@@ -3,7 +3,7 @@
 fn main() {}
 
 #[cfg(FALSE)]
-extern {
+extern "C" {
     const A: isize; //~ ERROR extern items cannot be `const`
     const B: isize = 42; //~ ERROR extern items cannot be `const`
 }
diff --git a/src/test/ui/parser/foreign-static-semantic-fail.rs b/src/test/ui/parser/foreign-static-semantic-fail.rs
index 9abdf33df9c..3d427ed0efd 100644
--- a/src/test/ui/parser/foreign-static-semantic-fail.rs
+++ b/src/test/ui/parser/foreign-static-semantic-fail.rs
@@ -2,7 +2,7 @@
 
 fn main() {}
 
-extern {
+extern "C" {
     static X: u8 = 0; //~ ERROR incorrect `static` inside `extern` block
     static mut Y: u8 = 0; //~ ERROR incorrect `static` inside `extern` block
 }
diff --git a/src/test/ui/parser/foreign-static-semantic-fail.stderr b/src/test/ui/parser/foreign-static-semantic-fail.stderr
index 5942e3a9449..105508cfefa 100644
--- a/src/test/ui/parser/foreign-static-semantic-fail.stderr
+++ b/src/test/ui/parser/foreign-static-semantic-fail.stderr
@@ -1,8 +1,8 @@
 error: incorrect `static` inside `extern` block
   --> $DIR/foreign-static-semantic-fail.rs:6:12
    |
-LL | extern {
-   | ------ `extern` blocks define existing foreign statics and statics inside of them cannot have a body
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign statics and statics inside of them cannot have a body
 LL |     static X: u8 = 0;
    |            ^       - the invalid body
    |            |
@@ -13,8 +13,8 @@ LL |     static X: u8 = 0;
 error: incorrect `static` inside `extern` block
   --> $DIR/foreign-static-semantic-fail.rs:7:16
    |
-LL | extern {
-   | ------ `extern` blocks define existing foreign statics and statics inside of them cannot have a body
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign statics and statics inside of them cannot have a body
 LL |     static X: u8 = 0;
 LL |     static mut Y: u8 = 0;
    |                ^       - the invalid body
diff --git a/src/test/ui/parser/foreign-static-syntactic-pass.rs b/src/test/ui/parser/foreign-static-syntactic-pass.rs
index 2c805e8a0b7..59949634617 100644
--- a/src/test/ui/parser/foreign-static-syntactic-pass.rs
+++ b/src/test/ui/parser/foreign-static-syntactic-pass.rs
@@ -5,7 +5,7 @@
 fn main() {}
 
 #[cfg(FALSE)]
-extern {
-    static X: u8 = 0;
-    static mut Y: u8 = 0;
+extern "C" {
+    static X: u8;
+    static mut Y: u8;
 }
diff --git a/src/test/ui/parser/no-const-fn-in-extern-block.rs b/src/test/ui/parser/no-const-fn-in-extern-block.rs
index 4cae703a163..1993124edc3 100644
--- a/src/test/ui/parser/no-const-fn-in-extern-block.rs
+++ b/src/test/ui/parser/no-const-fn-in-extern-block.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     const fn foo();
     //~^ ERROR functions in `extern` blocks cannot have qualifiers
     const unsafe fn bar();
diff --git a/src/test/ui/parser/no-const-fn-in-extern-block.stderr b/src/test/ui/parser/no-const-fn-in-extern-block.stderr
index af92f2d94f2..04fc8c85e4f 100644
--- a/src/test/ui/parser/no-const-fn-in-extern-block.stderr
+++ b/src/test/ui/parser/no-const-fn-in-extern-block.stderr
@@ -1,8 +1,8 @@
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/no-const-fn-in-extern-block.rs:2:14
    |
-LL | extern {
-   | ------ in this `extern` block
+LL | extern "C" {
+   | ---------- in this `extern` block
 LL |     const fn foo();
    |              ^^^
    |
@@ -14,8 +14,8 @@ LL |     fn foo();
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/no-const-fn-in-extern-block.rs:4:21
    |
-LL | extern {
-   | ------ in this `extern` block
+LL | extern "C" {
+   | ---------- in this `extern` block
 ...
 LL |     const unsafe fn bar();
    |                     ^^^
diff --git a/src/test/ui/parser/self-param-semantic-fail.rs b/src/test/ui/parser/self-param-semantic-fail.rs
index 5676971b01a..621aab279aa 100644
--- a/src/test/ui/parser/self-param-semantic-fail.rs
+++ b/src/test/ui/parser/self-param-semantic-fail.rs
@@ -23,7 +23,7 @@ fn free() {
     //~^ ERROR `self` parameter is only allowed in associated functions
 }
 
-extern {
+extern "C" {
     fn f1(self);
     //~^ ERROR `self` parameter is only allowed in associated functions
     fn f2(mut self);
@@ -40,8 +40,8 @@ extern {
     fn f7(self: u8);
     //~^ ERROR `self` parameter is only allowed in associated functions
     fn f8(mut self: u8);
-    //~^ ERROR `self` parameter is only allowed in associated functions
-    //~| ERROR patterns aren't allowed in
+//~^ ERROR `self` parameter is only allowed in associated functions
+//~| ERROR patterns aren't allowed in
 }
 
 type X1 = fn(self);
diff --git a/src/test/ui/parser/self-param-syntactic-pass.rs b/src/test/ui/parser/self-param-syntactic-pass.rs
index 9e215e6cdd4..d7bb7863c07 100644
--- a/src/test/ui/parser/self-param-syntactic-pass.rs
+++ b/src/test/ui/parser/self-param-syntactic-pass.rs
@@ -18,7 +18,7 @@ fn free() {
 }
 
 #[cfg(FALSE)]
-extern {
+extern "C" {
     fn f(self);
     fn f(mut self);
     fn f(&self);
diff --git a/src/test/ui/parser/unsafe-foreign-mod.rs b/src/test/ui/parser/unsafe-foreign-mod.rs
index 872af95bd22..eab134a4a4d 100644
--- a/src/test/ui/parser/unsafe-foreign-mod.rs
+++ b/src/test/ui/parser/unsafe-foreign-mod.rs
@@ -1,7 +1,3 @@
-unsafe extern {
-    //~^ ERROR extern block cannot be declared unsafe
-}
-
 unsafe extern "C" {
     //~^ ERROR extern block cannot be declared unsafe
 }
diff --git a/src/test/ui/parser/unsafe-foreign-mod.stderr b/src/test/ui/parser/unsafe-foreign-mod.stderr
index 5e10988051e..4acf72c5dae 100644
--- a/src/test/ui/parser/unsafe-foreign-mod.stderr
+++ b/src/test/ui/parser/unsafe-foreign-mod.stderr
@@ -1,14 +1,8 @@
 error: extern block cannot be declared unsafe
   --> $DIR/unsafe-foreign-mod.rs:1:1
    |
-LL | unsafe extern {
-   | ^^^^^^
-
-error: extern block cannot be declared unsafe
-  --> $DIR/unsafe-foreign-mod.rs:5:1
-   |
 LL | unsafe extern "C" {
    | ^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs
index aa85f6d6b52..404f4090755 100644
--- a/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs
+++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs
@@ -20,22 +20,22 @@ extern "C" fn f2_3(..., x: isize) {}
 //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
 //~| ERROR `...` must be the last argument of a C-variadic function
 
-extern fn f3_1(x: isize, ...) {}
+extern "C" fn f3_1(x: isize, ...) {}
 //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
 
-extern fn f3_2(...) {}
+extern "C" fn f3_2(...) {}
 //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
 //~| ERROR C-variadic function must be declared with at least one named argument
 
-extern fn f3_3(..., x: isize) {}
+extern "C" fn f3_3(..., x: isize) {}
 //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
 //~| ERROR `...` must be the last argument of a C-variadic function
 
-extern {
+extern "C" {
     fn e_f1(...);
     //~^ ERROR C-variadic function must be declared with at least one named argument
     fn e_f2(..., x: isize);
-    //~^ ERROR `...` must be the last argument of a C-variadic function
+//~^ ERROR `...` must be the last argument of a C-variadic function
 }
 
 struct X;
diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
index 3f3ddfed14a..ebfe4979fb6 100644
--- a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
+++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
@@ -47,34 +47,34 @@ LL | extern "C" fn f2_3(..., x: isize) {}
    |                    ^^^
 
 error: only foreign or `unsafe extern "C" functions may be C-variadic
-  --> $DIR/variadic-ffi-semantic-restrictions.rs:23:26
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:23:30
    |
-LL | extern fn f3_1(x: isize, ...) {}
-   |                          ^^^
+LL | extern "C" fn f3_1(x: isize, ...) {}
+   |                              ^^^
 
 error: C-variadic function must be declared with at least one named argument
-  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:20
    |
-LL | extern fn f3_2(...) {}
-   |                ^^^
+LL | extern "C" fn f3_2(...) {}
+   |                    ^^^
 
 error: only foreign or `unsafe extern "C" functions may be C-variadic
-  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:20
    |
-LL | extern fn f3_2(...) {}
-   |                ^^^
+LL | extern "C" fn f3_2(...) {}
+   |                    ^^^
 
 error: `...` must be the last argument of a C-variadic function
-  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:20
    |
-LL | extern fn f3_3(..., x: isize) {}
-   |                ^^^
+LL | extern "C" fn f3_3(..., x: isize) {}
+   |                    ^^^
 
 error: only foreign or `unsafe extern "C" functions may be C-variadic
-  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:20
    |
-LL | extern fn f3_3(..., x: isize) {}
-   |                ^^^
+LL | extern "C" fn f3_3(..., x: isize) {}
+   |                    ^^^
 
 error: C-variadic function must be declared with at least one named argument
   --> $DIR/variadic-ffi-semantic-restrictions.rs:35:13
diff --git a/src/test/ui/priv-in-bad-locations.rs b/src/test/ui/priv-in-bad-locations.rs
index b9f5d4c3586..76af8c6cde8 100644
--- a/src/test/ui/priv-in-bad-locations.rs
+++ b/src/test/ui/priv-in-bad-locations.rs
@@ -1,4 +1,4 @@
-pub extern { //~ ERROR unnecessary visibility qualifier
+pub extern "C" { //~ ERROR unnecessary visibility qualifier
     pub fn bar();
 }
 
diff --git a/src/test/ui/priv-in-bad-locations.stderr b/src/test/ui/priv-in-bad-locations.stderr
index 713568f879d..75bd2fe47b7 100644
--- a/src/test/ui/priv-in-bad-locations.stderr
+++ b/src/test/ui/priv-in-bad-locations.stderr
@@ -1,7 +1,7 @@
 error[E0449]: unnecessary visibility qualifier
   --> $DIR/priv-in-bad-locations.rs:1:1
    |
-LL | pub extern {
+LL | pub extern "C" {
    | ^^^ `pub` not permitted here because it's implied
    |
    = note: place qualifiers on individual foreign items instead
diff --git a/src/test/ui/privacy/privacy1.rs b/src/test/ui/privacy/privacy1.rs
index e28fd13b97f..3c9fa983dfd 100644
--- a/src/test/ui/privacy/privacy1.rs
+++ b/src/test/ui/privacy/privacy1.rs
@@ -61,7 +61,7 @@ mod bar {
         pub fn bar() {}
     }
 
-    extern {
+    extern "C" {
         fn epriv();
         pub fn epub();
     }
diff --git a/src/test/ui/privacy/private-in-public-warn.rs b/src/test/ui/privacy/private-in-public-warn.rs
index 1c8706d8ad2..09afa04501e 100644
--- a/src/test/ui/privacy/private-in-public-warn.rs
+++ b/src/test/ui/privacy/private-in-public-warn.rs
@@ -29,7 +29,7 @@ mod types {
         fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
         //~^ WARNING hard error
     }
-    extern {
+    extern "C" {
         pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface
         //~^ WARNING hard error
         pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface
diff --git a/src/test/ui/privacy/pub-extern-privacy.rs b/src/test/ui/privacy/pub-extern-privacy.rs
index 832acfbadcb..dbbbe4e3b7d 100644
--- a/src/test/ui/privacy/pub-extern-privacy.rs
+++ b/src/test/ui/privacy/pub-extern-privacy.rs
@@ -6,7 +6,7 @@
 use std::mem::transmute;
 
 mod a {
-    extern {
+    extern "C" {
         pub fn free(x: *const u8);
     }
 }
diff --git a/src/test/ui/proc-macro/macros-in-extern-derive.rs b/src/test/ui/proc-macro/macros-in-extern-derive.rs
index d2751a353bd..e52bf435a12 100644
--- a/src/test/ui/proc-macro/macros-in-extern-derive.rs
+++ b/src/test/ui/proc-macro/macros-in-extern-derive.rs
@@ -1,4 +1,4 @@
-extern {
+extern "C" {
     #[derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
     fn f();
 }
diff --git a/src/test/ui/proc-macro/macros-in-extern.rs b/src/test/ui/proc-macro/macros-in-extern.rs
index e2b1d55aedc..57e2066d83c 100644
--- a/src/test/ui/proc-macro/macros-in-extern.rs
+++ b/src/test/ui/proc-macro/macros-in-extern.rs
@@ -11,12 +11,14 @@ fn main() {
 }
 
 #[link(name = "rust_test_helpers", kind = "static")]
-extern {
+extern "C" {
     #[empty_attr]
     fn some_definitely_unknown_symbol_which_should_be_removed();
 
     #[identity_attr]
     fn rust_get_test_int() -> isize;
 
-    identity!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
+    identity!(
+        fn rust_dbg_extern_identity_u32(arg: u32) -> u32;
+    );
 }
diff --git a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
index 5feb9c98e96..15c0c695fca 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
@@ -6,9 +6,9 @@ extern crate types;
 // This test checks that non-exhaustive types with `#[repr(C)]` from an extern crate are considered
 // improper.
 
-use types::{NonExhaustiveEnum, NormalStruct, UnitStruct, TupleStruct, NonExhaustiveVariants};
+use types::{NonExhaustiveEnum, NonExhaustiveVariants, NormalStruct, TupleStruct, UnitStruct};
 
-extern {
+extern "C" {
     pub fn non_exhaustive_enum(_: NonExhaustiveEnum);
     //~^ ERROR `extern` block uses type `NonExhaustiveEnum`, which is not FFI-safe
     pub fn non_exhaustive_normal_struct(_: NormalStruct);
@@ -21,4 +21,4 @@ extern {
     //~^ ERROR `extern` block uses type `NonExhaustiveVariants`, which is not FFI-safe
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs
index c09aa256e0e..fe4ae345d85 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs
@@ -9,7 +9,7 @@
 pub enum NonExhaustiveEnum {
     Unit,
     Tuple(u32),
-    Struct { field: u32 }
+    Struct { field: u32 },
 }
 
 #[non_exhaustive]
@@ -25,16 +25,19 @@ pub struct UnitStruct;
 
 #[non_exhaustive]
 #[repr(C)]
-pub struct TupleStruct (pub u16, pub u16);
+pub struct TupleStruct(pub u16, pub u16);
 
 #[repr(C)]
 pub enum NonExhaustiveVariants {
-    #[non_exhaustive] Unit,
-    #[non_exhaustive] Tuple(u32),
-    #[non_exhaustive] Struct { field: u32 }
+    #[non_exhaustive]
+    Unit,
+    #[non_exhaustive]
+    Tuple(u32),
+    #[non_exhaustive]
+    Struct { field: u32 },
 }
 
-extern {
+extern "C" {
     // Unit structs aren't tested here because they will trigger `improper_ctypes` anyway.
     pub fn non_exhaustive_enum(_: NonExhaustiveEnum);
     pub fn non_exhaustive_normal_struct(_: NormalStruct);
@@ -42,4 +45,4 @@ extern {
     pub fn non_exhaustive_variant(_: NonExhaustiveVariants);
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib-2.rs b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib-2.rs
index 14345bad6e5..518aa20dd68 100644
--- a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib-2.rs
+++ b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib-2.rs
@@ -1,5 +1,5 @@
-#[link(name="foo")]
-extern {
+#[link(name = "foo")]
+extern "C" {
     #[link_ordinal(42)]
     //~^ ERROR: the `#[link_ordinal]` attribute is an experimental feature
     fn foo();
diff --git a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.rs b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.rs
index f0f83e0426d..29edd0f9ef9 100644
--- a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.rs
+++ b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.rs
@@ -1,5 +1,5 @@
-#[link(name="foo", kind="raw-dylib")]
+#[link(name = "foo", kind = "raw-dylib")]
 //~^ ERROR: kind="raw-dylib" is unstable
-extern {}
+extern "C" {}
 
 fn main() {}
diff --git a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.stderr b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.stderr
index a69f6779541..a670b6c6c2a 100644
--- a/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.stderr
+++ b/src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.stderr
@@ -1,8 +1,8 @@
 error[E0658]: kind="raw-dylib" is unstable
   --> $DIR/feature-gate-raw-dylib.rs:1:1
    |
-LL | #[link(name="foo", kind="raw-dylib")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[link(name = "foo", kind = "raw-dylib")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
    = help: add `#![feature(raw_dylib)]` to the crate attributes to enable
diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
index bf082932bd6..42685cad948 100644
--- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
+++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
@@ -2,7 +2,7 @@
 //~^ WARN the feature `raw_dylib` is incomplete
 
 #[link(name="foo")]
-extern {
+extern "C" {
     #[link_name="foo"]
     #[link_ordinal(42)]
     //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]`
diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
index ea633c5bcce..135f5909ea1 100644
--- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
+++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
@@ -1,8 +1,8 @@
 #![feature(raw_dylib)]
 //~^ WARN the feature `raw_dylib` is incomplete
 
-#[link(name="foo")]
-extern {
+#[link(name = "foo")]
+extern "C" {
     #[link_ordinal("JustMonika")]
     //~^ ERROR illegal ordinal format in `link_ordinal`
     fn foo();
diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs
index 55cc329dc59..10db4972970 100644
--- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs
+++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs
@@ -1,8 +1,8 @@
 #![feature(raw_dylib)]
 //~^ WARN the feature `raw_dylib` is incomplete
 
-#[link(name="foo")]
-extern {
+#[link(name = "foo")]
+extern "C" {
     #[link_ordinal(18446744073709551616)]
     //~^ ERROR ordinal value in `link_ordinal` is too large: `18446744073709551616`
     fn foo();
diff --git a/src/test/ui/safe-extern-statics-mut.rs b/src/test/ui/safe-extern-statics-mut.rs
index dbf0f523a9a..324fa443aa5 100644
--- a/src/test/ui/safe-extern-statics-mut.rs
+++ b/src/test/ui/safe-extern-statics-mut.rs
@@ -3,7 +3,7 @@
 extern crate extern_statics;
 use extern_statics::*;
 
-extern {
+extern "C" {
     static mut B: u8;
 }
 
diff --git a/src/test/ui/safe-extern-statics.rs b/src/test/ui/safe-extern-statics.rs
index 0535a078d2c..6fa4c4aaca5 100644
--- a/src/test/ui/safe-extern-statics.rs
+++ b/src/test/ui/safe-extern-statics.rs
@@ -3,7 +3,7 @@
 extern crate extern_statics;
 use extern_statics::*;
 
-extern {
+extern "C" {
     static A: u8;
 }
 
diff --git a/src/test/ui/sepcomp/sepcomp-extern.rs b/src/test/ui/sepcomp/sepcomp-extern.rs
index c4ccf23c47a..6323bf664fc 100644
--- a/src/test/ui/sepcomp/sepcomp-extern.rs
+++ b/src/test/ui/sepcomp/sepcomp-extern.rs
@@ -6,7 +6,7 @@
 
 extern crate sepcomp_extern_lib;
 
-extern {
+extern "C" {
     fn foo() -> usize;
 }
 
diff --git a/src/test/ui/simple_global_asm.rs b/src/test/ui/simple_global_asm.rs
index d95fefebc0f..75b4788b56f 100644
--- a/src/test/ui/simple_global_asm.rs
+++ b/src/test/ui/simple_global_asm.rs
@@ -5,20 +5,26 @@
 #![allow(dead_code)]
 
 #[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
-global_asm!(r#"
+global_asm!(
+    r#"
     .global foo
     .global _foo
 foo:
 _foo:
     ret
-"#);
+"#
+);
 
-extern {
+extern "C" {
     fn foo();
 }
 
 #[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
-fn main() { unsafe { foo(); } }
+fn main() {
+    unsafe {
+        foo();
+    }
+}
 
 #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
 fn main() {}
diff --git a/src/test/ui/span/lint-unused-unsafe.rs b/src/test/ui/span/lint-unused-unsafe.rs
index 338fbb994c5..b6c4894d918 100644
--- a/src/test/ui/span/lint-unused-unsafe.rs
+++ b/src/test/ui/span/lint-unused-unsafe.rs
@@ -5,7 +5,7 @@
 
 
 mod foo {
-    extern {
+    extern "C" {
         pub fn bar();
     }
 }
diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs
index 535f6bc3226..90aa2537a82 100644
--- a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs
+++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs
@@ -1,9 +1,9 @@
-extern {
+extern "C" {
     static mut a: i32;
 }
 
 fn main() {
-    a += 3;     //~ ERROR: requires unsafe
-    a = 4;      //~ ERROR: requires unsafe
+    a += 3; //~ ERROR: requires unsafe
+    a = 4; //~ ERROR: requires unsafe
     let _b = a; //~ ERROR: requires unsafe
 }
diff --git a/src/test/ui/static_sized_requirement.rs b/src/test/ui/static_sized_requirement.rs
index 074280b7b66..3943b260854 100644
--- a/src/test/ui/static_sized_requirement.rs
+++ b/src/test/ui/static_sized_requirement.rs
@@ -7,6 +7,6 @@
 #[lang = "sized"]
 trait Sized {}
 
-extern {
+extern "C" {
     pub static A: u32;
 }
diff --git a/src/test/ui/stmt_expr_attrs_no_feature.rs b/src/test/ui/stmt_expr_attrs_no_feature.rs
index 674a5ed18ce..627c97da008 100644
--- a/src/test/ui/stmt_expr_attrs_no_feature.rs
+++ b/src/test/ui/stmt_expr_attrs_no_feature.rs
@@ -89,7 +89,7 @@ item_mac!(e);
 
 // check that the gate visitor works right:
 
-extern {
+extern "C" {
     #[cfg(unset)]
     fn x(a: [u8; #[rustc_dummy] 5]);
     fn y(a: [u8; #[rustc_dummy] 5]); //~ ERROR attributes on expressions are experimental
diff --git a/src/test/ui/structs-enums/foreign-struct.rs b/src/test/ui/structs-enums/foreign-struct.rs
index ce02c8fb5c3..00a23b354a9 100644
--- a/src/test/ui/structs-enums/foreign-struct.rs
+++ b/src/test/ui/structs-enums/foreign-struct.rs
@@ -6,14 +6,14 @@
 
 // pretty-expanded FIXME #23616
 
-pub enum void { }
+pub enum void {}
 
 mod bindgen {
     use super::void;
 
-    extern {
+    extern "C" {
         pub fn printf(v: void);
     }
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/ui/threads-sendsync/thread-local-extern-static.rs b/src/test/ui/threads-sendsync/thread-local-extern-static.rs
index e10f5174b12..a2dda31aa55 100644
--- a/src/test/ui/threads-sendsync/thread-local-extern-static.rs
+++ b/src/test/ui/threads-sendsync/thread-local-extern-static.rs
@@ -11,7 +11,7 @@ extern crate thread_local_extern_static;
 use std::cell::Cell;
 
 #[cfg(target_thread_local)]
-extern {
+extern "C" {
     #[thread_local]
     static FOO: Cell<u32>;
 }
diff --git a/src/test/ui/warn-ctypes-inhibit.rs b/src/test/ui/warn-ctypes-inhibit.rs
index ab9634df65c..15d8b09d2ec 100644
--- a/src/test/ui/warn-ctypes-inhibit.rs
+++ b/src/test/ui/warn-ctypes-inhibit.rs
@@ -4,14 +4,12 @@
 // compile-flags:-D improper-ctypes
 
 // pretty-expanded FIXME #23616
-
 #![allow(improper_ctypes)]
 
 mod libc {
-    extern {
+    extern "C" {
         pub fn malloc(size: isize) -> *const u8;
     }
 }
 
-pub fn main() {
-}
+pub fn main() {}
diff --git a/src/test/ui/wasm-import-module.rs b/src/test/ui/wasm-import-module.rs
index 16d628a6187..4152a1065ca 100644
--- a/src/test/ui/wasm-import-module.rs
+++ b/src/test/ui/wasm-import-module.rs
@@ -1,10 +1,10 @@
 #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form
-extern {}
+extern "C" {}
 
 #[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form
-extern {}
+extern "C" {}
 
 #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form
-extern {}
+extern "C" {}
 
 fn main() {}