about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock28
-rw-r--r--compiler/rustc_codegen_cranelift/.gitattributes1
-rw-r--r--compiler/rustc_codegen_cranelift/Cargo.lock104
-rw-r--r--compiler/rustc_codegen_cranelift/Cargo.toml4
-rw-r--r--compiler/rustc_codegen_cranelift/Readme.md6
-rwxr-xr-xcompiler/rustc_codegen_cranelift/build.sh25
-rw-r--r--compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock20
-rwxr-xr-xcompiler/rustc_codegen_cranelift/build_sysroot/build_sysroot.sh13
-rwxr-xr-xcompiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh12
-rw-r--r--compiler/rustc_codegen_cranelift/example/std_example.rs1
-rw-r--r--compiler/rustc_codegen_cranelift/patches/0022-core-Disable-not-compiling-tests.patch8
-rwxr-xr-xcompiler/rustc_codegen_cranelift/prepare.sh1
-rw-r--r--compiler/rustc_codegen_cranelift/rust-toolchain2
-rwxr-xr-xcompiler/rustc_codegen_cranelift/scripts/cargo.sh8
-rw-r--r--compiler/rustc_codegen_cranelift/scripts/config.sh19
-rwxr-xr-xcompiler/rustc_codegen_cranelift/scripts/rustup.sh38
-rwxr-xr-xcompiler/rustc_codegen_cranelift/scripts/test_bootstrap.sh6
-rwxr-xr-xcompiler/rustc_codegen_cranelift/scripts/tests.sh30
-rw-r--r--compiler/rustc_codegen_cranelift/src/abi/mod.rs6
-rw-r--r--compiler/rustc_codegen_cranelift/src/archive.rs6
-rw-r--r--compiler/rustc_codegen_cranelift/src/atomic_shim.rs3
-rw-r--r--compiler/rustc_codegen_cranelift/src/base.rs31
-rw-r--r--compiler/rustc_codegen_cranelift/src/bin/cg_clif.rs18
-rw-r--r--compiler/rustc_codegen_cranelift/src/common.rs4
-rw-r--r--compiler/rustc_codegen_cranelift/src/constant.rs9
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs7
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs4
-rw-r--r--compiler/rustc_codegen_cranelift/src/discriminant.rs31
-rw-r--r--compiler/rustc_codegen_cranelift/src/driver/aot.rs6
-rw-r--r--compiler/rustc_codegen_cranelift/src/driver/jit.rs16
-rw-r--r--compiler/rustc_codegen_cranelift/src/driver/mod.rs26
-rw-r--r--compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs80
-rw-r--r--compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs65
-rw-r--r--compiler/rustc_codegen_cranelift/src/trap.rs12
-rw-r--r--compiler/rustc_codegen_llvm/src/intrinsic.rs105
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0591.md20
-rw-r--r--compiler/rustc_lint/src/nonstandard_style.rs4
-rw-r--r--compiler/rustc_middle/src/hir/map/collector.rs8
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs109
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs29
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs3
-rw-r--r--compiler/rustc_passes/src/hir_id_validator.rs7
-rw-r--r--compiler/rustc_span/src/symbol.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs12
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs3
-rw-r--r--compiler/rustc_traits/src/normalize_erasing_regions.rs12
-rw-r--r--compiler/rustc_typeck/src/astconv/mod.rs19
-rw-r--r--compiler/rustc_typeck/src/check/check.rs4
-rw-r--r--library/alloc/src/boxed.rs32
-rw-r--r--library/alloc/src/collections/btree/map/entry.rs2
-rw-r--r--library/alloc/src/collections/btree/navigate.rs9
-rw-r--r--library/alloc/src/collections/btree/node.rs168
-rw-r--r--library/alloc/src/collections/btree/remove.rs2
-rw-r--r--library/alloc/src/collections/btree/search.rs20
-rw-r--r--library/alloc/src/collections/btree/set.rs2
-rw-r--r--library/alloc/src/collections/btree/split.rs4
-rw-r--r--library/core/src/intrinsics.rs68
-rw-r--r--library/core/src/iter/adapters/peekable.rs14
-rw-r--r--library/core/tests/num/nan.rs1
-rw-r--r--library/std/src/keyword_docs.rs21
-rw-r--r--library/test/src/console.rs12
-rw-r--r--library/test/src/formatters/json.rs15
-rw-r--r--library/test/src/formatters/pretty.rs11
-rw-r--r--library/test/src/formatters/terse.rs11
-rw-r--r--library/test/src/tests.rs1
-rw-r--r--library/test/src/time.rs15
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/dist.rs6
-rw-r--r--src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile7
-rw-r--r--src/etc/gdb_providers.py2
-rw-r--r--src/etc/lldb_providers.py2
-rw-r--r--src/librustdoc/clean/mod.rs79
-rw-r--r--src/librustdoc/doctree.rs11
-rw-r--r--src/librustdoc/html/render/mod.rs74
-rw-r--r--src/librustdoc/html/static/main.js17
-rw-r--r--src/librustdoc/html/static/rustdoc.css18
-rw-r--r--src/librustdoc/html/static/themes/ayu.css4
-rw-r--r--src/librustdoc/html/static/themes/dark.css4
-rw-r--r--src/librustdoc/html/static/themes/light.css4
-rw-r--r--src/librustdoc/visit_ast.rs21
-rw-r--r--src/test/codegen/enum-discriminant-value.rs8
-rw-r--r--src/test/codegen/issue-56927.rs1
-rw-r--r--src/test/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs47
-rw-r--r--src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs44
-rw-r--r--src/test/compile-fail/consts/issue-55878.rs2
-rw-r--r--src/test/run-make-fulldeps/libtest-json/Makefile6
-rw-r--r--src/test/run-make-fulldeps/libtest-json/output-default.json2
-rw-r--r--src/test/run-make-fulldeps/libtest-json/output-stdout-success.json2
-rw-r--r--src/test/rustdoc-ui/cfg-test.rs1
-rw-r--r--src/test/rustdoc-ui/cfg-test.stdout6
-rw-r--r--src/test/rustdoc-ui/doc-test-doctest-feature.rs1
-rw-r--r--src/test/rustdoc-ui/doc-test-doctest-feature.stdout4
-rw-r--r--src/test/rustdoc-ui/doc-test-rustdoc-feature.rs1
-rw-r--r--src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout4
-rw-r--r--src/test/rustdoc-ui/doctest-output.rs1
-rw-r--r--src/test/rustdoc-ui/doctest-output.stdout8
-rw-r--r--src/test/rustdoc-ui/failed-doctest-compile-fail.rs1
-rw-r--r--src/test/rustdoc-ui/failed-doctest-compile-fail.stdout8
-rw-r--r--src/test/rustdoc-ui/failed-doctest-missing-codes.rs1
-rw-r--r--src/test/rustdoc-ui/failed-doctest-missing-codes.stdout10
-rw-r--r--src/test/rustdoc-ui/failed-doctest-output.rs1
-rw-r--r--src/test/rustdoc-ui/failed-doctest-output.stdout16
-rw-r--r--src/test/rustdoc-ui/failed-doctest-should-panic.rs1
-rw-r--r--src/test/rustdoc-ui/failed-doctest-should-panic.stdout8
-rw-r--r--src/test/rustdoc-ui/invalid-keyword.rs4
-rw-r--r--src/test/rustdoc-ui/invalid-keyword.stderr8
-rw-r--r--src/test/rustdoc-ui/test-no_std.rs1
-rw-r--r--src/test/rustdoc-ui/test-no_std.stdout4
-rw-r--r--src/test/rustdoc-ui/unparseable-doc-test.rs1
-rw-r--r--src/test/rustdoc-ui/unparseable-doc-test.stdout10
-rw-r--r--src/test/rustdoc/decl_macro.rs39
-rw-r--r--src/test/rustdoc/decl_macro_priv.rs14
-rw-r--r--src/test/rustdoc/doc-cfg.rs12
-rw-r--r--src/test/rustdoc/keyword.rs5
-rw-r--r--src/test/rustdoc/reexport-check.rs1
-rw-r--r--src/test/rustdoc/show-const-contents.rs1
-rw-r--r--src/test/rustdoc/stability.rs2
-rw-r--r--src/test/ui/array-slice-vec/bounds-check-no-overflow.rs1
-rw-r--r--src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr16
-rw-r--r--src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr16
-rw-r--r--src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr16
-rw-r--r--src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs2
-rw-r--r--src/test/ui/associated-type-bounds/order-dependent-bounds-issue-54121.rs47
-rw-r--r--src/test/ui/big-literals.rs8
-rw-r--r--src/test/ui/const-generics/const_evaluatable_checked/fn_call.rs2
-rw-r--r--src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.full.stderr6
-rw-r--r--src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr2
-rw-r--r--src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs4
-rw-r--r--src/test/ui/const-generics/issues/issue-73260.rs4
-rw-r--r--src/test/ui/const-generics/issues/issue-73260.stderr16
-rw-r--r--src/test/ui/consts/const-err-early.rs2
-rw-r--r--src/test/ui/consts/const-err-early.stderr4
-rw-r--r--src/test/ui/consts/const-err-multi.rs2
-rw-r--r--src/test/ui/consts/const-err-multi.stderr4
-rw-r--r--src/test/ui/consts/const-err2.noopt.stderr12
-rw-r--r--src/test/ui/consts/const-err2.opt.stderr12
-rw-r--r--src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr12
-rw-r--r--src/test/ui/consts/const-err2.rs6
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-3.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-3.stderr2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-3b.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr4
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-4.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-4.stderr2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-4b.rs3
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr6
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2.stderr16
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2b.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2b.stderr16
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2c.rs2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow2c.stderr16
-rw-r--r--src/test/ui/consts/const-eval/dangling.rs2
-rw-r--r--src/test/ui/consts/const-int-arithmetic.rs2
-rw-r--r--src/test/ui/consts/const-int-overflowing-rpass.rs2
-rw-r--r--src/test/ui/consts/const-negation.rs10
-rw-r--r--src/test/ui/consts/issue-63952.rs2
-rw-r--r--src/test/ui/consts/issue-63952.stderr2
-rw-r--r--src/test/ui/consts/promote_fn_calls_std.rs1
-rw-r--r--src/test/ui/consts/promotion.rs2
-rw-r--r--src/test/ui/discrim/discrim-ill-typed.rs2
-rw-r--r--src/test/ui/discrim/discrim-ill-typed.stderr16
-rw-r--r--src/test/ui/discrim/discrim-overflow-2.rs2
-rw-r--r--src/test/ui/discrim/discrim-overflow-2.stderr16
-rw-r--r--src/test/ui/discrim/discrim-overflow.rs2
-rw-r--r--src/test/ui/discrim/discrim-overflow.stderr16
-rw-r--r--src/test/ui/drop/dynamic-drop-async.rs1
-rw-r--r--src/test/ui/drop/dynamic-drop.rs1
-rw-r--r--src/test/ui/error-codes/E0077.stderr2
-rw-r--r--src/test/ui/explain.stdout18
-rw-r--r--src/test/ui/expr/if-bot.rs (renamed from src/test/ui/if-bot.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/bad-cfg.rs (renamed from src/test/ui/if-attrs/bad-cfg.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/bad-cfg.stderr (renamed from src/test/ui/if-attrs/bad-cfg.stderr)0
-rw-r--r--src/test/ui/expr/if/attrs/builtin-if-attr.rs (renamed from src/test/ui/if-attrs/builtin-if-attr.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/cfg-false-if-attr.rs (renamed from src/test/ui/if-attrs/cfg-false-if-attr.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/else-attrs.rs (renamed from src/test/ui/if-attrs/else-attrs.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/else-attrs.stderr (renamed from src/test/ui/if-attrs/else-attrs.stderr)0
-rw-r--r--src/test/ui/expr/if/attrs/gate-whole-expr.rs (renamed from src/test/ui/if-attrs/gate-whole-expr.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/let-chains-attr.rs (renamed from src/test/ui/if-attrs/let-chains-attr.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/let-chains-attr.stderr (renamed from src/test/ui/if-attrs/let-chains-attr.stderr)0
-rw-r--r--src/test/ui/expr/if/attrs/stmt-expr-gated.rs (renamed from src/test/ui/if-attrs/stmt-expr-gated.rs)0
-rw-r--r--src/test/ui/expr/if/attrs/stmt-expr-gated.stderr (renamed from src/test/ui/if-attrs/stmt-expr-gated.stderr)0
-rw-r--r--src/test/ui/expr/if/expr-if-panic-fn.rs (renamed from src/test/ui/if/expr-if-panic-fn.rs)0
-rw-r--r--src/test/ui/expr/if/expr-if-panic.rs (renamed from src/test/ui/if/expr-if-panic.rs)0
-rw-r--r--src/test/ui/expr/if/if-branch-types.rs (renamed from src/test/ui/if/if-branch-types.rs)0
-rw-r--r--src/test/ui/expr/if/if-branch-types.stderr (renamed from src/test/ui/if/if-branch-types.stderr)0
-rw-r--r--src/test/ui/expr/if/if-check-panic.rs (renamed from src/test/ui/if/if-check-panic.rs)0
-rw-r--r--src/test/ui/expr/if/if-check.rs (renamed from src/test/ui/if-check.rs)0
-rw-r--r--src/test/ui/expr/if/if-cond-bot.rs (renamed from src/test/ui/if/if-cond-bot.rs)0
-rw-r--r--src/test/ui/expr/if/if-else-type-mismatch.rs (renamed from src/test/ui/if-else-type-mismatch.rs)0
-rw-r--r--src/test/ui/expr/if/if-else-type-mismatch.stderr (renamed from src/test/ui/if-else-type-mismatch.stderr)0
-rw-r--r--src/test/ui/expr/if/if-let-arm-types.rs (renamed from src/test/ui/if/if-let-arm-types.rs)0
-rw-r--r--src/test/ui/expr/if/if-let-arm-types.stderr (renamed from src/test/ui/if/if-let-arm-types.stderr)0
-rw-r--r--src/test/ui/expr/if/if-let.rs (renamed from src/test/ui/if/if-let.rs)0
-rw-r--r--src/test/ui/expr/if/if-let.stderr (renamed from src/test/ui/if/if-let.stderr)0
-rw-r--r--src/test/ui/expr/if/if-loop.rs (renamed from src/test/ui/if/if-loop.rs)0
-rw-r--r--src/test/ui/expr/if/if-no-match-bindings.rs (renamed from src/test/ui/if/if-no-match-bindings.rs)0
-rw-r--r--src/test/ui/expr/if/if-no-match-bindings.stderr (renamed from src/test/ui/if/if-no-match-bindings.stderr)0
-rw-r--r--src/test/ui/expr/if/if-ret.rs (renamed from src/test/ui/if-ret.rs)0
-rw-r--r--src/test/ui/expr/if/if-ret.stderr (renamed from src/test/ui/if-ret.stderr)0
-rw-r--r--src/test/ui/expr/if/if-typeck.rs (renamed from src/test/ui/if/if-typeck.rs)0
-rw-r--r--src/test/ui/expr/if/if-typeck.stderr (renamed from src/test/ui/if/if-typeck.stderr)0
-rw-r--r--src/test/ui/expr/if/if-without-block.rs (renamed from src/test/ui/if/if-without-block.rs)0
-rw-r--r--src/test/ui/expr/if/if-without-block.stderr (renamed from src/test/ui/if/if-without-block.stderr)0
-rw-r--r--src/test/ui/expr/if/if-without-else-as-fn-expr.rs (renamed from src/test/ui/if/if-without-else-as-fn-expr.rs)0
-rw-r--r--src/test/ui/expr/if/if-without-else-as-fn-expr.stderr (renamed from src/test/ui/if/if-without-else-as-fn-expr.stderr)0
-rw-r--r--src/test/ui/expr/if/if-without-else-result.rs (renamed from src/test/ui/if/if-without-else-result.rs)0
-rw-r--r--src/test/ui/expr/if/if-without-else-result.stderr (renamed from src/test/ui/if/if-without-else-result.stderr)0
-rw-r--r--src/test/ui/expr/if/ifmt-bad-arg.rs (renamed from src/test/ui/if/ifmt-bad-arg.rs)0
-rw-r--r--src/test/ui/expr/if/ifmt-bad-arg.stderr (renamed from src/test/ui/if/ifmt-bad-arg.stderr)0
-rw-r--r--src/test/ui/expr/if/ifmt-bad-format-args.rs (renamed from src/test/ui/if/ifmt-bad-format-args.rs)0
-rw-r--r--src/test/ui/expr/if/ifmt-bad-format-args.stderr (renamed from src/test/ui/if/ifmt-bad-format-args.stderr)0
-rw-r--r--src/test/ui/expr/if/ifmt-unimpl.rs (renamed from src/test/ui/if/ifmt-unimpl.rs)0
-rw-r--r--src/test/ui/expr/if/ifmt-unimpl.stderr (renamed from src/test/ui/if/ifmt-unimpl.stderr)0
-rw-r--r--src/test/ui/expr/if/ifmt-unknown-trait.rs (renamed from src/test/ui/if/ifmt-unknown-trait.rs)0
-rw-r--r--src/test/ui/expr/if/ifmt-unknown-trait.stderr (renamed from src/test/ui/if/ifmt-unknown-trait.stderr)0
-rw-r--r--src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr4
-rw-r--r--src/test/ui/foreign/foreign-pub-super.rs12
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs64
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr24
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs20
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-semantics.rs82
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs24
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr96
-rw-r--r--src/test/ui/hashmap/hashmap-capacity-overflow.rs1
-rw-r--r--src/test/ui/issues/issue-20427.rs1
-rw-r--r--src/test/ui/issues/issue-23833.rs2
-rw-r--r--src/test/ui/issues/issue-37686.rs2
-rw-r--r--src/test/ui/issues/issue-41880.rs2
-rw-r--r--src/test/ui/issues/issue-48006.rs4
-rw-r--r--src/test/ui/issues/issue-50811.rs9
-rw-r--r--src/test/ui/issues/issue-68010-large-zst-consts.rs2
-rw-r--r--src/test/ui/issues/issue-6804.rs2
-rw-r--r--src/test/ui/issues/issue-8460-const.noopt.stderr48
-rw-r--r--src/test/ui/issues/issue-8460-const.opt.stderr48
-rw-r--r--src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr48
-rw-r--r--src/test/ui/issues/issue-8460-const.rs1
-rw-r--r--src/test/ui/iterators/iter-count-overflow-debug.rs5
-rw-r--r--src/test/ui/iterators/iter-count-overflow-ndebug.rs6
-rw-r--r--src/test/ui/iterators/iter-position-overflow-debug.rs5
-rw-r--r--src/test/ui/iterators/iter-position-overflow-ndebug.rs6
-rw-r--r--src/test/ui/macros/macro-first-set.rs2
-rw-r--r--src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs2
-rw-r--r--src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr2
-rw-r--r--src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs2
-rw-r--r--src/test/ui/numbers-arithmetic/float-nan.rs1
-rw-r--r--src/test/ui/numbers-arithmetic/num-wrapping.rs3
-rw-r--r--src/test/ui/numbers-arithmetic/overflowing-neg.rs2
-rw-r--r--src/test/ui/numbers-arithmetic/saturating-float-casts-impl.rs4
-rw-r--r--src/test/ui/numbers-arithmetic/shift-near-oflo.rs20
-rw-r--r--src/test/ui/numbers-arithmetic/u128-as-f32.rs2
-rw-r--r--src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr6
-rw-r--r--src/test/ui/regions/regions-addr-of-upvar-self.rs2
-rw-r--r--src/test/ui/regions/regions-addr-of-upvar-self.stderr10
-rw-r--r--src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs2
-rw-r--r--src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr6
-rw-r--r--src/test/ui/simd-type-generic-monomorphisation.rs4
-rw-r--r--src/test/ui/simd-type-generic-monomorphisation.stderr2
-rw-r--r--src/test/ui/simd-type.rs10
-rw-r--r--src/test/ui/simd-type.stderr20
-rw-r--r--src/test/ui/simd/simd-array-trait.rs41
-rw-r--r--src/test/ui/simd/simd-array-trait.stderr10
-rw-r--r--src/test/ui/simd/simd-array-type.rs42
-rw-r--r--src/test/ui/simd/simd-generics.rs28
-rw-r--r--src/test/ui/simd/simd-intrinsic-float-minmax.rs4
-rw-r--r--src/test/ui/simd/simd-intrinsic-generic-arithmetic-saturating.rs66
-rw-r--r--src/test/ui/simd/simd-intrinsic-generic-arithmetic.rs61
-rw-r--r--src/test/ui/simd/simd-intrinsic-generic-comparison.rs4
-rw-r--r--src/test/ui/sleep.rs1
-rw-r--r--src/test/ui/structs-enums/discrim-explicit-23030.rs2
-rw-r--r--src/test/ui/symbol-names/const-generics.rs12
-rw-r--r--src/test/ui/test-panic-abort-nocapture.rs1
-rw-r--r--src/test/ui/test-panic-abort-nocapture.run.stderr4
-rw-r--r--src/test/ui/test-panic-abort-nocapture.run.stdout2
-rw-r--r--src/test/ui/test-panic-abort.rs1
-rw-r--r--src/test/ui/test-panic-abort.run.stdout4
-rw-r--r--src/test/ui/test-passed-wasm.rs20
-rw-r--r--src/test/ui/test-passed-wasm.run.stdout7
-rw-r--r--src/test/ui/test-passed.rs21
-rw-r--r--src/test/ui/test-passed.run.stdout7
-rw-r--r--src/test/ui/test-thread-capture.rs1
-rw-r--r--src/test/ui/test-thread-capture.run.stdout4
-rw-r--r--src/test/ui/test-thread-nocapture.rs1
-rw-r--r--src/test/ui/test-thread-nocapture.run.stderr2
-rw-r--r--src/test/ui/test-thread-nocapture.run.stdout2
-rw-r--r--src/test/ui/union/union-transmute.rs3
-rw-r--r--src/test/ui/use-module-level-int-consts.rs1
-rw-r--r--src/test/ui/wrapping-int-api.rs3
-rw-r--r--src/tools/clippy/tests/ui/float_cmp_const.rs2
-rw-r--r--src/tools/rustdoc-js/tester.js31
291 files changed, 2067 insertions, 1248 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b3e6e7bae7c..18dfe890a0c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -329,7 +329,7 @@ dependencies = [
  "libgit2-sys",
  "log",
  "memchr",
- "miow 0.3.5",
+ "miow 0.3.6",
  "num_cpus",
  "opener",
  "openssl",
@@ -653,7 +653,7 @@ dependencies = [
  "glob",
  "lazy_static",
  "libc",
- "miow 0.3.5",
+ "miow 0.3.6",
  "regex",
  "rustfix",
  "serde",
@@ -675,7 +675,7 @@ dependencies = [
  "getopts",
  "libc",
  "log",
- "miow 0.3.5",
+ "miow 0.3.6",
  "regex",
  "rustfix",
  "serde",
@@ -2065,7 +2065,7 @@ dependencies = [
  "kernel32-sys",
  "libc",
  "log",
- "miow 0.2.1",
+ "miow 0.2.2",
  "net2",
  "slab",
  "winapi 0.2.8",
@@ -2079,7 +2079,7 @@ checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
 dependencies = [
  "log",
  "mio",
- "miow 0.3.5",
+ "miow 0.3.6",
  "winapi 0.3.9",
 ]
 
@@ -2096,9 +2096,9 @@ dependencies = [
 
 [[package]]
 name = "miow"
-version = "0.2.1"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
+checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
 dependencies = [
  "kernel32-sys",
  "net2",
@@ -2108,9 +2108,9 @@ dependencies = [
 
 [[package]]
 name = "miow"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
+checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
 dependencies = [
  "socket2",
  "winapi 0.3.9",
@@ -2135,9 +2135,9 @@ dependencies = [
 
 [[package]]
 name = "net2"
-version = "0.2.34"
+version = "0.2.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
+checksum = "d7cf75f38f16cb05ea017784dc6dbfd354f76c223dba37701734c4f5a9337d02"
 dependencies = [
  "cfg-if 0.1.10",
  "libc",
@@ -2325,7 +2325,7 @@ dependencies = [
  "futures",
  "log",
  "mio-named-pipes",
- "miow 0.3.5",
+ "miow 0.3.6",
  "rand",
  "tokio",
  "tokio-named-pipes",
@@ -4618,9 +4618,9 @@ checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e"
 
 [[package]]
 name = "socket2"
-version = "0.3.12"
+version = "0.3.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
+checksum = "7fd8b795c389288baa5f355489c65e71fd48a02104600d15c4cfbc561e9e429d"
 dependencies = [
  "cfg-if 0.1.10",
  "libc",
diff --git a/compiler/rustc_codegen_cranelift/.gitattributes b/compiler/rustc_codegen_cranelift/.gitattributes
index 6313b56c578..0ceb3fe646c 100644
--- a/compiler/rustc_codegen_cranelift/.gitattributes
+++ b/compiler/rustc_codegen_cranelift/.gitattributes
@@ -1 +1,2 @@
 * text=auto eol=lf
+*.rs diff=rust
diff --git a/compiler/rustc_codegen_cranelift/Cargo.lock b/compiler/rustc_codegen_cranelift/Cargo.lock
index 2889fac77f6..67ed41e7652 100644
--- a/compiler/rustc_codegen_cranelift/Cargo.lock
+++ b/compiler/rustc_codegen_cranelift/Cargo.lock
@@ -2,9 +2,9 @@
 # It is not intended for manual editing.
 [[package]]
 name = "anyhow"
-version = "1.0.33"
+version = "1.0.34"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c"
+checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7"
 
 [[package]]
 name = "ar"
@@ -31,9 +31,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
 
 [[package]]
 name = "cc"
-version = "1.0.61"
+version = "1.0.62"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
+checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40"
 
 [[package]]
 name = "cfg-if"
@@ -42,17 +42,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
 [[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
 name = "cranelift-bforest"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-entity",
 ]
 
 [[package]]
 name = "cranelift-codegen"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "byteorder",
  "cranelift-bforest",
@@ -69,8 +75,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-meta"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen-shared",
  "cranelift-entity",
@@ -78,18 +84,18 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-shared"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 
 [[package]]
 name = "cranelift-entity"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 
 [[package]]
 name = "cranelift-frontend"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "log",
@@ -99,8 +105,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-module"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -111,8 +117,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-native"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "raw-cpuid",
@@ -121,8 +127,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-object"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -134,8 +140,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-simplejit"
-version = "0.67.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
+version = "0.68.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#19640367dbf0da7093e61add3306c8d092644fb3"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
@@ -151,18 +157,18 @@ dependencies = [
 
 [[package]]
 name = "crc32fast"
-version = "1.2.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
+checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
 ]
 
 [[package]]
 name = "errno"
-version = "0.2.6"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6eab5ee3df98a279d9b316b1af6ac95422127b1290317e6d18c1743c99418b01"
+checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe"
 dependencies = [
  "errno-dragonfly",
  "libc",
@@ -187,9 +193,9 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
 
 [[package]]
 name = "gimli"
-version = "0.22.0"
+version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
+checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
 dependencies = [
  "indexmap",
 ]
@@ -212,17 +218,17 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.79"
+version = "0.2.80"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
+checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
 
 [[package]]
 name = "libloading"
-version = "0.6.4"
+version = "0.6.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3557c9384f7f757f6d139cd3a4c62ef4e850696c16bf27924a5538c8a09717a1"
+checksum = "1090080fe06ec2648d0da3881d9453d97e71a45f00eb179af7fdd7e3f686fdb0"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
  "winapi",
 ]
 
@@ -232,7 +238,7 @@ version = "0.4.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
 ]
 
 [[package]]
@@ -246,9 +252,9 @@ dependencies = [
 
 [[package]]
 name = "object"
-version = "0.21.1"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
+checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
 dependencies = [
  "crc32fast",
  "indexmap",
@@ -274,9 +280,9 @@ dependencies = [
 
 [[package]]
 name = "raw-cpuid"
-version = "7.0.3"
+version = "8.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
+checksum = "1fdf7d9dbd43f3d81d94a49c1c3df73cc2b3827995147e6cf7f89d4ec5483e73"
 dependencies = [
  "bitflags",
  "cc",
@@ -361,9 +367,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
 
 [[package]]
 name = "syn"
-version = "1.0.44"
+version = "1.0.48"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd"
+checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -372,24 +378,24 @@ dependencies = [
 
 [[package]]
 name = "target-lexicon"
-version = "0.11.0"
+version = "0.11.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe2635952a442a01fd4cb53d98858b5e4bb461b02c0d111f22f31772e3e7a8b2"
+checksum = "4ee5a98e506fb7231a304c3a1bd7c132a55016cf65001e0282480665870dfcb9"
 
 [[package]]
 name = "thiserror"
-version = "1.0.21"
+version = "1.0.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42"
+checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e"
 dependencies = [
  "thiserror-impl",
 ]
 
 [[package]]
 name = "thiserror-impl"
-version = "1.0.21"
+version = "1.0.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab"
+checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
 dependencies = [
  "proc-macro2",
  "quote",
diff --git a/compiler/rustc_codegen_cranelift/Cargo.toml b/compiler/rustc_codegen_cranelift/Cargo.toml
index 1c8e350d242..cbff06749d3 100644
--- a/compiler/rustc_codegen_cranelift/Cargo.toml
+++ b/compiler/rustc_codegen_cranelift/Cargo.toml
@@ -15,8 +15,8 @@ cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", bran
 cranelift-simplejit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
 cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
 target-lexicon = "0.11.0"
-gimli = { version = "0.22.0", default-features = false, features = ["write"]}
-object = { version = "0.21.1", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
+gimli = { version = "0.23.0", default-features = false, features = ["write"]}
+object = { version = "0.22.0", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
 
 ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
 indexmap = "1.0.2"
diff --git a/compiler/rustc_codegen_cranelift/Readme.md b/compiler/rustc_codegen_cranelift/Readme.md
index f8a5e13ed54..de54bf67f4a 100644
--- a/compiler/rustc_codegen_cranelift/Readme.md
+++ b/compiler/rustc_codegen_cranelift/Readme.md
@@ -51,7 +51,7 @@ This should build and run your project with rustc_codegen_cranelift instead of t
 > You should prefer using the Cargo method.
 
 ```bash
-$ $cg_clif_dir/build/cg_clif my_crate.rs
+$ $cg_clif_dir/build/bin/cg_clif my_crate.rs
 ```
 
 ### Jit mode
@@ -68,7 +68,7 @@ $ $cg_clif_dir/build/cargo.sh jit
 or
 
 ```bash
-$ $cg_clif_dir/build/cg_clif --jit my_crate.rs
+$ $cg_clif_dir/build/bin/cg_clif --jit my_crate.rs
 ```
 
 ### Shell
@@ -77,7 +77,7 @@ These are a few functions that allow you to easily run rust code from the shell
 
 ```bash
 function jit_naked() {
-    echo "$@" | $cg_clif_dir/build/cg_clif - --jit
+    echo "$@" | $cg_clif_dir/build/bin/cg_clif - --jit
 }
 
 function jit() {
diff --git a/compiler/rustc_codegen_cranelift/build.sh b/compiler/rustc_codegen_cranelift/build.sh
index f9a87e68a04..26041b59cca 100755
--- a/compiler/rustc_codegen_cranelift/build.sh
+++ b/compiler/rustc_codegen_cranelift/build.sh
@@ -26,22 +26,35 @@ while [[ $# != 0 ]]; do
 done
 
 # Build cg_clif
+unset CARGO_TARGET_DIR
 export RUSTFLAGS="-Zrun_dsymutil=no"
+unamestr=$(uname)
+if [[ "$unamestr" == 'Linux' ]]; then
+   export RUSTFLAGS='-Clink-arg=-Wl,-rpath=$ORIGIN/../lib '$RUSTFLAGS
+elif [[ "$unamestr" == 'Darwin' ]]; then
+   export RUSTFLAGS='-Clink-arg=-Wl,-rpath,@loader_path/../lib -Zosx-rpath-install-name '$RUSTFLAGS
+   dylib_ext='dylib'
+else
+   echo "Unsupported os"
+   exit 1
+fi
 if [[ "$CHANNEL" == "release" ]]; then
     cargo build --release
 else
     cargo build
 fi
 
-rm -rf $target_dir
-mkdir $target_dir
-cp -a target/$CHANNEL/cg_clif{,_build_sysroot} target/$CHANNEL/*rustc_codegen_cranelift* $target_dir/
-cp -a rust-toolchain scripts/config.sh scripts/cargo.sh $target_dir
+rm -rf "$target_dir"
+mkdir "$target_dir"
+mkdir "$target_dir"/bin "$target_dir"/lib
+ln target/$CHANNEL/cg_clif{,_build_sysroot} "$target_dir"/bin
+ln target/$CHANNEL/*rustc_codegen_cranelift* "$target_dir"/lib
+ln rust-toolchain scripts/config.sh scripts/cargo.sh "$target_dir"
 
 if [[ "$build_sysroot" == "1" ]]; then
     echo "[BUILD] sysroot"
     export CG_CLIF_INCR_CACHE_DISABLED=1
     dir=$(pwd)
-    cd $target_dir
-    time $dir/build_sysroot/build_sysroot.sh
+    cd "$target_dir"
+    time "$dir/build_sysroot/build_sysroot.sh"
 fi
diff --git a/compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock b/compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock
index 03ba5b53d2e..a2b8f449f00 100644
--- a/compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock
+++ b/compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock
@@ -2,9 +2,9 @@
 # It is not intended for manual editing.
 [[package]]
 name = "addr2line"
-version = "0.13.0"
+version = "0.14.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
+checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423"
 dependencies = [
  "compiler_builtins",
  "gimli",
@@ -47,9 +47,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
 
 [[package]]
 name = "cc"
-version = "1.0.61"
+version = "1.0.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
+checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15"
 
 [[package]]
 name = "cfg-if"
@@ -76,9 +76,9 @@ version = "0.0.0"
 
 [[package]]
 name = "dlmalloc"
-version = "0.1.4"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35055b1021724f4eb5262eb49130eebff23fc59fc5a14160e05faad8eeb36673"
+checksum = "332570860c2edf2d57914987bf9e24835425f75825086b6ba7d1e6a3e4f1f254"
 dependencies = [
  "compiler_builtins",
  "libc",
@@ -108,9 +108,9 @@ dependencies = [
 
 [[package]]
 name = "gimli"
-version = "0.22.0"
+version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
+checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
 dependencies = [
  "compiler_builtins",
  "rustc-std-workspace-alloc",
@@ -163,9 +163,9 @@ dependencies = [
 
 [[package]]
 name = "object"
-version = "0.20.0"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
+checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
 dependencies = [
  "compiler_builtins",
  "rustc-std-workspace-alloc",
diff --git a/compiler/rustc_codegen_cranelift/build_sysroot/build_sysroot.sh b/compiler/rustc_codegen_cranelift/build_sysroot/build_sysroot.sh
index eba15c0dd43..d7a72df2eb2 100755
--- a/compiler/rustc_codegen_cranelift/build_sysroot/build_sysroot.sh
+++ b/compiler/rustc_codegen_cranelift/build_sysroot/build_sysroot.sh
@@ -10,10 +10,10 @@ dir=$(pwd)
 
 # Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that
 # build scripts are still compiled using cg_llvm.
-export RUSTC=$dir"/cg_clif_build_sysroot"
+export RUSTC=$dir"/bin/cg_clif_build_sysroot"
 export RUSTFLAGS=$RUSTFLAGS" --clif"
 
-cd $(dirname "$0")
+cd "$(dirname "$0")"
 
 # Cleanup for previous run
 #     v Clean target dir except for build scripts and incremental cache
@@ -28,12 +28,13 @@ if [[ "$1" != "--debug" ]]; then
     sysroot_channel='release'
     # FIXME Enable incremental again once rust-lang/rust#74946 is fixed
     # FIXME Enable -Zmir-opt-level=2 again once it doesn't ice anymore
-    CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target $TARGET_TRIPLE --release
+    CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target "$TARGET_TRIPLE" --release
 else
     sysroot_channel='debug'
-    cargo build --target $TARGET_TRIPLE
+    cargo build --target "$TARGET_TRIPLE"
 fi
 
 # Copy files to sysroot
-mkdir -p $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
-cp -a target/$TARGET_TRIPLE/$sysroot_channel/deps/* $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+mkdir -p "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
+ln "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
+rm "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"*.{rmeta,d}
diff --git a/compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh b/compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh
index d0fb09ce745..40fbaf646a2 100755
--- a/compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh
+++ b/compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh
@@ -1,18 +1,18 @@
 #!/bin/bash
 set -e
-cd $(dirname "$0")
+cd "$(dirname "$0")"
 
-SRC_DIR=$(dirname $(rustup which rustc))"/../lib/rustlib/src/rust/"
+SRC_DIR="$(dirname "$(rustup which rustc)")/../lib/rustlib/src/rust/"
 DST_DIR="sysroot_src"
 
-if [ ! -e $SRC_DIR ]; then
+if [ ! -e "$SRC_DIR" ]; then
     echo "Please install rust-src component"
     exit 1
 fi
 
 rm -rf $DST_DIR
 mkdir -p $DST_DIR/library
-cp -a $SRC_DIR/library $DST_DIR/
+cp -a "$SRC_DIR/library" $DST_DIR/
 
 pushd $DST_DIR
 echo "[GIT] init"
@@ -22,8 +22,8 @@ git add .
 echo "[GIT] commit"
 git commit -m "Initial commit" -q
 for file in $(ls ../../patches/ | grep -v patcha); do
-echo "[GIT] apply" $file
-git apply ../../patches/$file
+echo "[GIT] apply" "$file"
+git apply ../../patches/"$file"
 git add -A
 git commit --no-gpg-sign -m "Patch $file"
 done
diff --git a/compiler/rustc_codegen_cranelift/example/std_example.rs b/compiler/rustc_codegen_cranelift/example/std_example.rs
index cb512a4aa33..b38e25328a4 100644
--- a/compiler/rustc_codegen_cranelift/example/std_example.rs
+++ b/compiler/rustc_codegen_cranelift/example/std_example.rs
@@ -53,6 +53,7 @@ fn main() {
 
     assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
     assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
+    assert_eq!(core::intrinsics::saturating_sub(0, -170141183460469231731687303715884105728i128), 170141183460469231731687303715884105727i128);
 
     let _d = 0i128.checked_div(2i128);
     let _d = 0u128.checked_div(2u128);
diff --git a/compiler/rustc_codegen_cranelift/patches/0022-core-Disable-not-compiling-tests.patch b/compiler/rustc_codegen_cranelift/patches/0022-core-Disable-not-compiling-tests.patch
index ee8548783de..8cfffe580a1 100644
--- a/compiler/rustc_codegen_cranelift/patches/0022-core-Disable-not-compiling-tests.patch
+++ b/compiler/rustc_codegen_cranelift/patches/0022-core-Disable-not-compiling-tests.patch
@@ -52,8 +52,8 @@ index 0475aeb..9558198 100644
              fn test_rotate() {
                  assert_eq!(A.rotate_left(6).rotate_right(2).rotate_right(4), A);
 @@ -112,6 +113,7 @@ mod tests {
-                 assert_eq!(B.rotate_left(64), B);
-                 assert_eq!(C.rotate_left(64), C);
+                 assert_eq!(B.rotate_left(128), B);
+                 assert_eq!(C.rotate_left(128), C);
              }
 +            */
  
@@ -72,8 +72,8 @@ index 04ed14f..a6e372e 100644
              fn test_rotate() {
                  assert_eq!(A.rotate_left(6).rotate_right(2).rotate_right(4), A);
 @@ -76,6 +77,7 @@ mod tests {
-                 assert_eq!(B.rotate_left(64), B);
-                 assert_eq!(C.rotate_left(64), C);
+                 assert_eq!(B.rotate_left(128), B);
+                 assert_eq!(C.rotate_left(128), C);
              }
 +            */
  
diff --git a/compiler/rustc_codegen_cranelift/prepare.sh b/compiler/rustc_codegen_cranelift/prepare.sh
index 87f96f5dcf4..08e7cb18029 100755
--- a/compiler/rustc_codegen_cranelift/prepare.sh
+++ b/compiler/rustc_codegen_cranelift/prepare.sh
@@ -24,6 +24,7 @@ git checkout -- .
 git checkout 804a7a21b9e673a482797aa289a18ed480e4d813
 
 # build with cg_llvm for perf comparison
+unset CARGO_TARGET_DIR
 cargo build
 mv target/debug/main raytracer_cg_llvm
 popd
diff --git a/compiler/rustc_codegen_cranelift/rust-toolchain b/compiler/rustc_codegen_cranelift/rust-toolchain
index 0ca96be9ae7..ed1e64f45db 100644
--- a/compiler/rustc_codegen_cranelift/rust-toolchain
+++ b/compiler/rustc_codegen_cranelift/rust-toolchain
@@ -1 +1 @@
-nightly-2020-10-31
+nightly-2020-11-27
diff --git a/compiler/rustc_codegen_cranelift/scripts/cargo.sh b/compiler/rustc_codegen_cranelift/scripts/cargo.sh
index 947b4a28798..dcd40acc02a 100755
--- a/compiler/rustc_codegen_cranelift/scripts/cargo.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/cargo.sh
@@ -1,16 +1,16 @@
 #!/bin/bash
 
 dir=$(dirname "$0")
-source $dir/config.sh
+source "$dir/config.sh"
 
 # read nightly compiler from rust-toolchain file
-TOOLCHAIN=$(cat $dir/rust-toolchain)
+TOOLCHAIN=$(cat "$dir/rust-toolchain")
 
 cmd=$1
 shift || true
 
 if [[ "$cmd" = "jit" ]]; then
-cargo +${TOOLCHAIN} rustc "$@" -- --jit
+cargo "+${TOOLCHAIN}" rustc "$@" -- --jit
 else
-cargo +${TOOLCHAIN} $cmd "$@"
+cargo "+${TOOLCHAIN}" "$cmd" "$@"
 fi
diff --git a/compiler/rustc_codegen_cranelift/scripts/config.sh b/compiler/rustc_codegen_cranelift/scripts/config.sh
index 6120a550a27..dea037e2bc0 100644
--- a/compiler/rustc_codegen_cranelift/scripts/config.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/config.sh
@@ -1,7 +1,8 @@
-#!/usr/bin/env bash
+# Note to people running shellcheck: this file should only be sourced, not executed directly.
+
 set -e
 
-unamestr=`uname`
+unamestr=$(uname)
 if [[ "$unamestr" == 'Linux' ]]; then
    dylib_ext='so'
 elif [[ "$unamestr" == 'Darwin' ]]; then
@@ -40,19 +41,19 @@ echo
 export RUSTC_WRAPPER=
 fi
 
-dir=$(cd $(dirname "$BASH_SOURCE"); pwd)
+dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
 
-export RUSTC=$dir"/cg_clif"
-export RUSTFLAGS=$linker
-export RUSTDOCFLAGS=$linker' -Ztrim-diagnostic-paths=no -Cpanic=abort -Zpanic-abort-tests '\
-'-Zcodegen-backend='$dir'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir'/sysroot'
+export RUSTC=$dir"/bin/cg_clif"
+export RUSTFLAGS=$linker" "$RUSTFLAGS
+export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\
+'-Zcodegen-backend='$dir'/lib/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir
 
 # FIXME remove once the atomic shim is gone
-if [[ `uname` == 'Darwin' ]]; then
+if [[ $(uname) == 'Darwin' ]]; then
    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
 fi
 
-export LD_LIBRARY_PATH="$dir:$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/"$TARGET_TRIPLE"/lib"
+export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
 export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
 
 export CG_CLIF_DISPLAY_CG_TIME=1
diff --git a/compiler/rustc_codegen_cranelift/scripts/rustup.sh b/compiler/rustc_codegen_cranelift/scripts/rustup.sh
index 541b3c6563b..430f5c469b4 100755
--- a/compiler/rustc_codegen_cranelift/scripts/rustup.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/rustup.sh
@@ -7,13 +7,13 @@ case $1 in
         TOOLCHAIN=$(date +%Y-%m-%d)
 
         echo "=> Installing new nightly"
-        rustup toolchain install --profile minimal nightly-${TOOLCHAIN} # Sanity check to see if the nightly exists
-        echo nightly-${TOOLCHAIN} > rust-toolchain
+        rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
+        echo "nightly-${TOOLCHAIN}" > rust-toolchain
         rustup component add rustfmt || true
 
         echo "=> Uninstalling all old nighlies"
-        for nightly in $(rustup toolchain list | grep nightly | grep -v $TOOLCHAIN | grep -v nightly-x86_64); do
-            rustup toolchain uninstall $nightly
+        for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do
+            rustup toolchain uninstall "$nightly"
         done
 
         ./clean_all.sh
@@ -27,14 +27,30 @@ case $1 in
         git commit -m "Rustup to $(rustc -V)"
         ;;
     "push")
-	cg_clif=$(pwd)
-	pushd ../rust
-	branch=update_cg_clif-$(date +%Y-%m-%d)
-	git checkout -b $branch
-	git subtree pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/bjorn3/rustc_codegen_cranelift.git master
-	git push -u my $branch
-	popd
+        cg_clif=$(pwd)
+        pushd ../rust
+        git pull origin master
+        branch=sync_cg_clif-$(date +%Y-%m-%d)
+        git checkout -b "$branch"
+        git subtree pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/bjorn3/rustc_codegen_cranelift.git master
+        git push -u my "$branch"
+
+        # immediately merge the merge commit into cg_clif to prevent merge conflicts when syncing
+        # from rust-lang/rust later
+        git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
+        popd
+        git merge sync_from_rust
 	;;
+    "pull")
+        cg_clif=$(pwd)
+        pushd ../rust
+        git pull origin master
+        rust_vers="$(git rev-parse HEAD)"
+        git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
+        popd
+        git merge sync_from_rust -m "Sync from rust $rust_vers"
+        git branch -d sync_from_rust
+        ;;
     *)
         echo "Unknown command '$1'"
         echo "Usage: ./rustup.sh prepare|commit"
diff --git a/compiler/rustc_codegen_cranelift/scripts/test_bootstrap.sh b/compiler/rustc_codegen_cranelift/scripts/test_bootstrap.sh
index 7f43f81a6cd..db69541b226 100755
--- a/compiler/rustc_codegen_cranelift/scripts/test_bootstrap.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/test_bootstrap.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 
-cd $(dirname "$0")/../
+cd "$(dirname "$0")/../"
 
 ./build.sh
 source build/config.sh
@@ -11,7 +11,7 @@ git clone https://github.com/rust-lang/rust.git || true
 pushd rust
 git fetch
 git checkout -- .
-git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
+git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
 
 git apply - <<EOF
 diff --git a/.gitmodules b/.gitmodules
@@ -48,7 +48,7 @@ cat > config.toml <<EOF
 ninja = false
 
 [build]
-rustc = "$(pwd)/../build/cg_clif"
+rustc = "$(pwd)/../build/bin/cg_clif"
 cargo = "$(rustup which cargo)"
 full-bootstrap = true
 local-rebuild = true
diff --git a/compiler/rustc_codegen_cranelift/scripts/tests.sh b/compiler/rustc_codegen_cranelift/scripts/tests.sh
index d941b73c81b..114b6f30a4a 100755
--- a/compiler/rustc_codegen_cranelift/scripts/tests.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/tests.sh
@@ -4,63 +4,63 @@ set -e
 
 source build/config.sh
 export CG_CLIF_INCR_CACHE_DISABLED=1
-MY_RUSTC=$RUSTC" "$RUSTFLAGS" -L crate=target/out --out-dir target/out -Cdebuginfo=2"
+MY_RUSTC="$RUSTC $RUSTFLAGS -L crate=target/out --out-dir target/out -Cdebuginfo=2"
 
 function no_sysroot_tests() {
     echo "[BUILD] mini_core"
-    $MY_RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
+    $MY_RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target "$TARGET_TRIPLE"
 
     echo "[BUILD] example"
-    $MY_RUSTC example/example.rs --crate-type lib --target $TARGET_TRIPLE
+    $MY_RUSTC example/example.rs --crate-type lib --target "$TARGET_TRIPLE"
 
     if [[ "$JIT_SUPPORTED" = "1" ]]; then
         echo "[JIT] mini_core_hello_world"
-        CG_CLIF_JIT_ARGS="abc bcd" $MY_RUSTC --jit example/mini_core_hello_world.rs --cfg jit --target $HOST_TRIPLE
+        CG_CLIF_JIT_ARGS="abc bcd" $MY_RUSTC --jit example/mini_core_hello_world.rs --cfg jit --target "$HOST_TRIPLE"
     else
         echo "[JIT] mini_core_hello_world (skipped)"
     fi
 
     echo "[AOT] mini_core_hello_world"
-    $MY_RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target $TARGET_TRIPLE
+    $MY_RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/mini_core_hello_world abc bcd
     # (echo "break set -n main"; echo "run"; sleep 1; echo "si -c 10"; sleep 1; echo "frame variable") | lldb -- ./target/out/mini_core_hello_world abc bcd
 
     echo "[AOT] arbitrary_self_types_pointers_and_wrappers"
-    $MY_RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target $TARGET_TRIPLE
+    $MY_RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/arbitrary_self_types_pointers_and_wrappers
 }
 
 function base_sysroot_tests() {
     echo "[AOT] alloc_example"
-    $MY_RUSTC example/alloc_example.rs --crate-type bin --target $TARGET_TRIPLE
+    $MY_RUSTC example/alloc_example.rs --crate-type bin --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/alloc_example
 
     if [[ "$JIT_SUPPORTED" = "1" ]]; then
         echo "[JIT] std_example"
-        $MY_RUSTC --jit example/std_example.rs --target $HOST_TRIPLE
+        $MY_RUSTC --jit example/std_example.rs --target "$HOST_TRIPLE"
     else
         echo "[JIT] std_example (skipped)"
     fi
 
     echo "[AOT] dst_field_align"
     # FIXME Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
-    $MY_RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target $TARGET_TRIPLE
+    $MY_RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/dst_field_align || (echo $?; false)
 
     echo "[AOT] std_example"
-    $MY_RUSTC example/std_example.rs --crate-type bin --target $TARGET_TRIPLE
+    $MY_RUSTC example/std_example.rs --crate-type bin --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/std_example arg
 
     echo "[AOT] subslice-patterns-const-eval"
-    $MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
+    $MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
 
     echo "[AOT] track-caller-attribute"
-    $MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
+    $MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/track-caller-attribute
 
     echo "[AOT] mod_bench"
-    $MY_RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
+    $MY_RUSTC example/mod_bench.rs --crate-type bin --target "$TARGET_TRIPLE"
     $RUN_WRAPPER ./target/out/mod_bench
 
     pushd rand
@@ -73,13 +73,13 @@ function extended_sysroot_tests() {
     pushd simple-raytracer
     if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
         echo "[BENCH COMPILE] ebobby/simple-raytracer"
-        hyperfine --runs ${RUN_RUNS:-10} --warmup 1 --prepare "cargo clean" \
+        hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "cargo clean" \
         "RUSTC=rustc RUSTFLAGS='' cargo build" \
         "../build/cargo.sh build"
 
         echo "[BENCH RUN] ebobby/simple-raytracer"
         cp ./target/debug/main ./raytracer_cg_clif
-        hyperfine --runs ${RUN_RUNS:-10} ./raytracer_cg_llvm ./raytracer_cg_clif
+        hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
     else
         echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
         echo "[COMPILE] ebobby/simple-raytracer"
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
index ac076789f2e..aee274ab4a8 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -214,10 +214,8 @@ pub(crate) fn get_function_name_and_sig<'tcx>(
     support_vararg: bool,
 ) -> (String, Signature) {
     assert!(!inst.substs.needs_infer());
-    let fn_sig = tcx.normalize_erasing_late_bound_regions(
-        ParamEnv::reveal_all(),
-        fn_sig_for_fn_abi(tcx, inst),
-    );
+    let fn_sig = tcx
+        .normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), fn_sig_for_fn_abi(tcx, inst));
     if fn_sig.c_variadic && !support_vararg {
         tcx.sess.span_fatal(
             tcx.def_span(inst.def_id()),
diff --git a/compiler/rustc_codegen_cranelift/src/archive.rs b/compiler/rustc_codegen_cranelift/src/archive.rs
index daf9fa6158f..96579054389 100644
--- a/compiler/rustc_codegen_cranelift/src/archive.rs
+++ b/compiler/rustc_codegen_cranelift/src/archive.rs
@@ -8,7 +8,7 @@ use rustc_codegen_ssa::back::archive::{find_library, ArchiveBuilder};
 use rustc_codegen_ssa::METADATA_FILENAME;
 use rustc_session::Session;
 
-use object::{Object, SymbolKind};
+use object::{Object, ObjectSymbol, SymbolKind};
 
 #[derive(Debug)]
 enum ArchiveEntry {
@@ -184,7 +184,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
                             entry_name.as_bytes().to_vec(),
                             object
                                 .symbols()
-                                .filter_map(|(_index, symbol)| {
+                                .filter_map(|symbol| {
                                     if symbol.is_undefined()
                                         || symbol.is_local()
                                         || symbol.kind() != SymbolKind::Data
@@ -193,7 +193,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
                                     {
                                         None
                                     } else {
-                                        symbol.name().map(|name| name.as_bytes().to_vec())
+                                        symbol.name().map(|name| name.as_bytes().to_vec()).ok()
                                     }
                                 })
                                 .collect::<Vec<_>>(),
diff --git a/compiler/rustc_codegen_cranelift/src/atomic_shim.rs b/compiler/rustc_codegen_cranelift/src/atomic_shim.rs
index 2f0157c257b..674e6d90751 100644
--- a/compiler/rustc_codegen_cranelift/src/atomic_shim.rs
+++ b/compiler/rustc_codegen_cranelift/src/atomic_shim.rs
@@ -7,8 +7,7 @@ use crate::prelude::*;
 
 #[cfg(all(feature = "jit", unix))]
 #[no_mangle]
-static mut __cg_clif_global_atomic_mutex: libc::pthread_mutex_t =
-    libc::PTHREAD_MUTEX_INITIALIZER;
+static mut __cg_clif_global_atomic_mutex: libc::pthread_mutex_t = libc::PTHREAD_MUTEX_INITIALIZER;
 
 pub(crate) fn init_global_lock(
     module: &mut impl Module,
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index a4df371c88a..72073896a72 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -12,6 +12,10 @@ pub(crate) fn codegen_fn<'tcx>(
 ) {
     let tcx = cx.tcx;
 
+    let _inst_guard =
+        crate::PrintOnPanic(|| format!("{:?} {}", instance, tcx.symbol_name(instance).name));
+    debug_assert!(!instance.substs.needs_infer());
+
     let mir = tcx.instance_mir(instance.def);
 
     // Declare function
@@ -499,7 +503,8 @@ fn codegen_stmt<'tcx>(
                         UnOp::Neg => match layout.ty.kind() {
                             ty::Int(IntTy::I128) => {
                                 // FIXME remove this case once ineg.i128 works
-                                let zero = CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size));
+                                let zero =
+                                    CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size));
                                 crate::num::codegen_int_binop(fx, BinOp::Sub, zero, operand)
                             }
                             ty::Int(_) => CValue::by_val(fx.bcx.ins().ineg(val), layout),
@@ -509,7 +514,11 @@ fn codegen_stmt<'tcx>(
                     };
                     lval.write_cvalue(fx, res);
                 }
-                Rvalue::Cast(CastKind::Pointer(PointerCast::ReifyFnPointer), ref operand, to_ty) => {
+                Rvalue::Cast(
+                    CastKind::Pointer(PointerCast::ReifyFnPointer),
+                    ref operand,
+                    to_ty,
+                ) => {
                     let from_ty = fx.monomorphize(operand.ty(&fx.mir.local_decls, fx.tcx));
                     let to_layout = fx.layout_of(fx.monomorphize(to_ty));
                     match *from_ty.kind() {
@@ -530,9 +539,21 @@ fn codegen_stmt<'tcx>(
                         _ => bug!("Trying to ReifyFnPointer on non FnDef {:?}", from_ty),
                     }
                 }
-                Rvalue::Cast(CastKind::Pointer(PointerCast::UnsafeFnPointer), ref operand, to_ty)
-                | Rvalue::Cast(CastKind::Pointer(PointerCast::MutToConstPointer), ref operand, to_ty)
-                | Rvalue::Cast(CastKind::Pointer(PointerCast::ArrayToPointer), ref operand, to_ty) => {
+                Rvalue::Cast(
+                    CastKind::Pointer(PointerCast::UnsafeFnPointer),
+                    ref operand,
+                    to_ty,
+                )
+                | Rvalue::Cast(
+                    CastKind::Pointer(PointerCast::MutToConstPointer),
+                    ref operand,
+                    to_ty,
+                )
+                | Rvalue::Cast(
+                    CastKind::Pointer(PointerCast::ArrayToPointer),
+                    ref operand,
+                    to_ty,
+                ) => {
                     let to_layout = fx.layout_of(fx.monomorphize(to_ty));
                     let operand = codegen_operand(fx, operand);
                     lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
diff --git a/compiler/rustc_codegen_cranelift/src/bin/cg_clif.rs b/compiler/rustc_codegen_cranelift/src/bin/cg_clif.rs
index cd01acc9a83..f4d23ebcf4e 100644
--- a/compiler/rustc_codegen_cranelift/src/bin/cg_clif.rs
+++ b/compiler/rustc_codegen_cranelift/src/bin/cg_clif.rs
@@ -26,15 +26,15 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
 
         config.opts.cg.panic = Some(PanicStrategy::Abort);
         config.opts.debugging_opts.panic_abort_tests = true;
-        config.opts.maybe_sysroot = Some(
-            config.opts.maybe_sysroot.clone().unwrap_or_else(
-                || std::env::current_exe()
-                    .unwrap()
-                    .parent()
-                    .unwrap()
-                    .join("sysroot"),
-            ),
-        );
+        config.opts.maybe_sysroot = Some(config.opts.maybe_sysroot.clone().unwrap_or_else(|| {
+            std::env::current_exe()
+                .unwrap()
+                .parent()
+                .unwrap()
+                .parent()
+                .unwrap()
+                .to_owned()
+        }));
     }
 }
 
diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs
index d7d6c3e1677..1485d4451b8 100644
--- a/compiler/rustc_codegen_cranelift/src/common.rs
+++ b/compiler/rustc_codegen_cranelift/src/common.rs
@@ -233,7 +233,7 @@ pub(crate) fn type_min_max_value(
             let min_msb = bcx.ins().iconst(types::I64, (min >> 64) as u64 as i64);
             let min = bcx.ins().iconcat(min_lsb, min_msb);
 
-            let max = i128::MIN as u128;
+            let max = i128::MAX as u128;
             let max_lsb = bcx.ins().iconst(types::I64, max as u64 as i64);
             let max_msb = bcx.ins().iconst(types::I64, (max >> 64) as u64 as i64);
             let max = bcx.ins().iconcat(max_lsb, max_msb);
@@ -364,7 +364,7 @@ impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
         self.instance.subst_mir_and_normalize_erasing_regions(
             self.tcx,
             ty::ParamEnv::reveal_all(),
-            value
+            value,
         )
     }
 
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs
index 351bb6ecd23..544b020b711 100644
--- a/compiler/rustc_codegen_cranelift/src/constant.rs
+++ b/compiler/rustc_codegen_cranelift/src/constant.rs
@@ -163,10 +163,7 @@ pub(crate) fn codegen_const_value<'tcx>(
     assert!(!layout.is_unsized(), "sized const value");
 
     if layout.is_zst() {
-        return CValue::by_ref(
-            crate::Pointer::dangling(layout.align.pref),
-            layout,
-        );
+        return CValue::by_ref(crate::Pointer::dangling(layout.align.pref), layout);
     }
 
     match const_val {
@@ -186,9 +183,7 @@ pub(crate) fn codegen_const_value<'tcx>(
             }
 
             match x {
-                Scalar::Int(int) => {
-                    CValue::const_val(fx, layout, int)
-                }
+                Scalar::Int(int) => CValue::const_val(fx, layout, int),
                 Scalar::Ptr(ptr) => {
                     let alloc_kind = fx.tcx.get_global_alloc(ptr.alloc_id);
                     let base_addr = match alloc_kind {
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs
index f6f795e4561..c21835b1fc3 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs
@@ -76,7 +76,7 @@ impl WriterRelocate {
     #[cfg(feature = "jit")]
     pub(super) fn relocate_for_jit(
         mut self,
-        jit_product: &cranelift_simplejit::SimpleJITProduct,
+        jit_module: &cranelift_simplejit::SimpleJITModule,
     ) -> Vec<u8> {
         use std::convert::TryInto;
 
@@ -84,8 +84,9 @@ impl WriterRelocate {
             match reloc.name {
                 super::DebugRelocName::Section(_) => unreachable!(),
                 super::DebugRelocName::Symbol(sym) => {
-                    let addr = jit_product
-                        .lookup_func(cranelift_module::FuncId::from_u32(sym.try_into().unwrap()));
+                    let addr = jit_module.get_finalized_function(
+                        cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
+                    );
                     let val = (addr as u64 as i64 + reloc.addend) as u64;
                     self.writer
                         .write_udata_at(reloc.offset as usize, val, reloc.size)
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
index 68138404c24..e0f62b64e6b 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
@@ -80,7 +80,7 @@ impl<'tcx> UnwindContext<'tcx> {
     #[cfg(feature = "jit")]
     pub(crate) unsafe fn register_jit(
         self,
-        jit_product: &cranelift_simplejit::SimpleJITProduct,
+        jit_module: &cranelift_simplejit::SimpleJITModule,
     ) -> Option<UnwindRegistry> {
         let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(super::target_endian(
             self.tcx,
@@ -91,7 +91,7 @@ impl<'tcx> UnwindContext<'tcx> {
             return None;
         }
 
-        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_product);
+        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_module);
 
         // GCC expects a terminating "empty" length, so write a 0 length at the end of the table.
         eh_frame.extend(&[0, 0, 0, 0]);
diff --git a/compiler/rustc_codegen_cranelift/src/discriminant.rs b/compiler/rustc_codegen_cranelift/src/discriminant.rs
index 1e8e86add1a..ad635016a91 100644
--- a/compiler/rustc_codegen_cranelift/src/discriminant.rs
+++ b/compiler/rustc_codegen_cranelift/src/discriminant.rs
@@ -30,8 +30,16 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
                 .ty
                 .discriminant_for_variant(fx.tcx, variant_index)
                 .unwrap()
-                .val
-                .into();
+                .val;
+            let to = if ptr.layout().abi.is_signed() {
+                ty::ScalarInt::try_from_int(
+                    ptr.layout().size.sign_extend(to) as i128,
+                    ptr.layout().size,
+                )
+                .unwrap()
+            } else {
+                ty::ScalarInt::try_from_uint(to, ptr.layout().size).unwrap()
+            };
             let discr = CValue::const_val(fx, ptr.layout(), to);
             ptr.write_cvalue(fx, discr);
         }
@@ -49,8 +57,12 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
             if variant_index != dataful_variant {
                 let niche = place.place_field(fx, mir::Field::new(tag_field));
                 let niche_value = variant_index.as_u32() - niche_variants.start().as_u32();
-                let niche_value = u128::from(niche_value).wrapping_add(niche_start);
-                let niche_llval = CValue::const_val(fx, niche.layout(), niche_value.into());
+                let niche_value = ty::ScalarInt::try_from_uint(
+                    u128::from(niche_value).wrapping_add(niche_start),
+                    niche.layout().size,
+                )
+                .unwrap();
+                let niche_llval = CValue::const_val(fx, niche.layout(), niche_value);
                 niche.write_cvalue(fx, niche_llval);
             }
         }
@@ -78,7 +90,16 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
                 .ty
                 .discriminant_for_variant(fx.tcx, *index)
                 .map_or(u128::from(index.as_u32()), |discr| discr.val);
-            return CValue::const_val(fx, dest_layout, discr_val.into());
+            let discr_val = if dest_layout.abi.is_signed() {
+                ty::ScalarInt::try_from_int(
+                    dest_layout.size.sign_extend(discr_val) as i128,
+                    dest_layout.size,
+                )
+                .unwrap()
+            } else {
+                ty::ScalarInt::try_from_uint(discr_val, dest_layout.size).unwrap()
+            };
+            return CValue::const_val(fx, dest_layout, discr_val);
         }
         Variants::Multiple {
             tag,
diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs
index c0245aa1e02..491d6cbbf79 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs
@@ -145,7 +145,11 @@ fn module_codegen(tcx: TyCtxt<'_>, cgu_name: rustc_span::Symbol) -> ModuleCodege
     }
 
     let mut cx = crate::CodegenCx::new(tcx, module, tcx.sess.opts.debuginfo != DebugInfo::None);
-    super::codegen_mono_items(&mut cx, mono_items);
+    super::predefine_mono_items(&mut cx, &mono_items);
+    for (mono_item, (linkage, visibility)) in mono_items {
+        let linkage = crate::linkage::get_clif_linkage(mono_item, linkage, visibility);
+        super::codegen_mono_item(&mut cx, mono_item, linkage);
+    }
     let (mut module, global_asm, debug, mut unwind_context) =
         tcx.sess.time("finalize CodegenCx", || cx.finalize());
     crate::main_shim::maybe_create_entry_wrapper(tcx, &mut module, &mut unwind_context, false);
diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
index 3f47df7d844..5a844841c2c 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
@@ -70,7 +70,11 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
 
     let (mut jit_module, global_asm, _debug, mut unwind_context) =
         super::time(tcx, "codegen mono items", || {
-            super::codegen_mono_items(&mut cx, mono_items);
+            super::predefine_mono_items(&mut cx, &mono_items);
+            for (mono_item, (linkage, visibility)) in mono_items {
+                let linkage = crate::linkage::get_clif_linkage(mono_item, linkage, visibility);
+                super::codegen_mono_item(&mut cx, mono_item, linkage);
+            }
             tcx.sess.time("finalize CodegenCx", || cx.finalize())
         });
     if !global_asm.is_empty() {
@@ -81,11 +85,11 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
 
     tcx.sess.abort_if_errors();
 
-    let jit_product = jit_module.finish();
+    jit_module.finalize_definitions();
 
-    let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_product) };
+    let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_module) };
 
-    let finalized_main: *const u8 = jit_product.lookup_func(main_func_id);
+    let finalized_main: *const u8 = jit_module.get_finalized_function(main_func_id);
 
     println!("Rustc codegen cranelift will JIT run the executable, because --jit was passed");
 
@@ -140,11 +144,11 @@ fn load_imported_symbols_for_jit(tcx: TyCtxt<'_>) -> Vec<(String, *const u8)> {
 
     let mut imported_symbols = Vec::new();
     for path in dylib_paths {
-        use object::Object;
+        use object::{Object, ObjectSymbol};
         let lib = libloading::Library::new(&path).unwrap();
         let obj = std::fs::read(path).unwrap();
         let obj = object::File::parse(&obj).unwrap();
-        imported_symbols.extend(obj.dynamic_symbols().filter_map(|(_idx, symbol)| {
+        imported_symbols.extend(obj.dynamic_symbols().filter_map(|symbol| {
             let name = symbol.name().unwrap().to_string();
             if name.is_empty() || !symbol.is_global() || symbol.is_undefined() {
                 return None;
diff --git a/compiler/rustc_codegen_cranelift/src/driver/mod.rs b/compiler/rustc_codegen_cranelift/src/driver/mod.rs
index a11dc57ee64..7b8cc2ddd48 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/mod.rs
@@ -1,4 +1,4 @@
-//! Drivers are responsible for calling [`codegen_mono_items`] and performing any further actions
+//! Drivers are responsible for calling [`codegen_mono_item`] and performing any further actions
 //! like JIT executing or writing object files.
 
 use std::any::Any;
@@ -40,12 +40,12 @@ pub(crate) fn codegen_crate(
     aot::run_aot(tcx, metadata, need_metadata_module)
 }
 
-fn codegen_mono_items<'tcx>(
+fn predefine_mono_items<'tcx>(
     cx: &mut crate::CodegenCx<'tcx, impl Module>,
-    mono_items: Vec<(MonoItem<'tcx>, (RLinkage, Visibility))>,
+    mono_items: &[(MonoItem<'tcx>, (RLinkage, Visibility))],
 ) {
     cx.tcx.sess.time("predefine functions", || {
-        for &(mono_item, (linkage, visibility)) in &mono_items {
+        for &(mono_item, (linkage, visibility)) in mono_items {
             match mono_item {
                 MonoItem::Fn(instance) => {
                     let (name, sig) = get_function_name_and_sig(
@@ -61,11 +61,6 @@ fn codegen_mono_items<'tcx>(
             }
         }
     });
-
-    for (mono_item, (linkage, visibility)) in mono_items {
-        let linkage = crate::linkage::get_clif_linkage(mono_item, linkage, visibility);
-        codegen_mono_item(cx, mono_item, linkage);
-    }
 }
 
 fn codegen_mono_item<'tcx, M: Module>(
@@ -73,20 +68,15 @@ fn codegen_mono_item<'tcx, M: Module>(
     mono_item: MonoItem<'tcx>,
     linkage: Linkage,
 ) {
-    let tcx = cx.tcx;
     match mono_item {
         MonoItem::Fn(inst) => {
-            let _inst_guard =
-                crate::PrintOnPanic(|| format!("{:?} {}", inst, tcx.symbol_name(inst).name));
-            debug_assert!(!inst.substs.needs_infer());
-            tcx.sess
+            cx.tcx
+                .sess
                 .time("codegen fn", || crate::base::codegen_fn(cx, inst, linkage));
         }
-        MonoItem::Static(def_id) => {
-            crate::constant::codegen_static(&mut cx.constants_cx, def_id);
-        }
+        MonoItem::Static(def_id) => crate::constant::codegen_static(&mut cx.constants_cx, def_id),
         MonoItem::GlobalAsm(hir_id) => {
-            let item = tcx.hir().expect_item(hir_id);
+            let item = cx.tcx.hir().expect_item(hir_id);
             if let rustc_hir::ItemKind::GlobalAsm(rustc_hir::GlobalAsm { asm }) = item.kind {
                 cx.global_asm.push_str(&*asm.as_str());
                 cx.global_asm.push_str("\n\n");
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
index ab16fabd348..3563aa250a9 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
@@ -263,6 +263,48 @@ fn simd_pair_for_each_lane<'tcx, M: Module>(
     }
 }
 
+fn simd_reduce<'tcx, M: Module>(
+    fx: &mut FunctionCx<'_, 'tcx, M>,
+    val: CValue<'tcx>,
+    ret: CPlace<'tcx>,
+    f: impl Fn(&mut FunctionCx<'_, 'tcx, M>, TyAndLayout<'tcx>, Value, Value) -> Value,
+) {
+    let (lane_layout, lane_count) = lane_type_and_count(fx.tcx, val.layout());
+    assert_eq!(lane_layout, ret.layout());
+
+    let mut res_val = val.value_field(fx, mir::Field::new(0)).load_scalar(fx);
+    for lane_idx in 1..lane_count {
+        let lane = val
+            .value_field(fx, mir::Field::new(lane_idx.into()))
+            .load_scalar(fx);
+        res_val = f(fx, lane_layout, res_val, lane);
+    }
+    let res = CValue::by_val(res_val, lane_layout);
+    ret.write_cvalue(fx, res);
+}
+
+fn simd_reduce_bool<'tcx, M: Module>(
+    fx: &mut FunctionCx<'_, 'tcx, M>,
+    val: CValue<'tcx>,
+    ret: CPlace<'tcx>,
+    f: impl Fn(&mut FunctionCx<'_, 'tcx, M>, Value, Value) -> Value,
+) {
+    let (_lane_layout, lane_count) = lane_type_and_count(fx.tcx, val.layout());
+    assert!(ret.layout().ty.is_bool());
+
+    let res_val = val.value_field(fx, mir::Field::new(0)).load_scalar(fx);
+    let mut res_val = fx.bcx.ins().band_imm(res_val, 1); // mask to boolean
+    for lane_idx in 1..lane_count {
+        let lane = val
+            .value_field(fx, mir::Field::new(lane_idx.into()))
+            .load_scalar(fx);
+        let lane = fx.bcx.ins().band_imm(lane, 1); // mask to boolean
+        res_val = f(fx, res_val, lane);
+    }
+    let res = CValue::by_val(res_val, ret.layout());
+    ret.write_cvalue(fx, res);
+}
+
 fn bool_to_zero_or_max_uint<'tcx>(
     fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     layout: TyAndLayout<'tcx>,
@@ -287,7 +329,7 @@ fn bool_to_zero_or_max_uint<'tcx>(
 }
 
 macro simd_cmp {
-    ($fx:expr, $cc:ident($x:ident, $y:ident) -> $ret:ident) => {
+    ($fx:expr, $cc:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => {
         let vector_ty = clif_vector_type($fx.tcx, $x.layout());
 
         if let Some(vector_ty) = vector_ty {
@@ -308,6 +350,7 @@ macro simd_cmp {
                 |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
                     let res_lane = match lane_layout.ty.kind() {
                         ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane),
+                        ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane),
                         _ => unreachable!("{:?}", lane_layout.ty),
                     };
                     bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane)
@@ -315,7 +358,7 @@ macro simd_cmp {
             );
         }
     },
-    ($fx:expr, $cc_u:ident|$cc_s:ident($x:ident, $y:ident) -> $ret:ident) => {
+    ($fx:expr, $cc_u:ident|$cc_s:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => {
         // FIXME use vector icmp when possible
         simd_pair_for_each_lane(
             $fx,
@@ -326,6 +369,7 @@ macro simd_cmp {
                 let res_lane = match lane_layout.ty.kind() {
                     ty::Uint(_) => fx.bcx.ins().icmp(IntCC::$cc_u, x_lane, y_lane),
                     ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc_s, x_lane, y_lane),
+                    ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane),
                     _ => unreachable!("{:?}", lane_layout.ty),
                 };
                 bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane)
@@ -497,12 +541,12 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
         };
         copy | copy_nonoverlapping, <elem_ty> (v src, v dst, v count) {
             let elem_size: u64 = fx.layout_of(elem_ty).size.bytes();
-            let elem_size = fx
-                .bcx
-                .ins()
-                .iconst(fx.pointer_type, elem_size as i64);
             assert_eq!(args.len(), 3);
-            let byte_amount = fx.bcx.ins().imul(count, elem_size);
+            let byte_amount = if elem_size != 1 {
+                fx.bcx.ins().imul_imm(count, elem_size as i64)
+            } else {
+                count
+            };
 
             if intrinsic.contains("nonoverlapping") {
                 // FIXME emit_small_memcpy
@@ -515,12 +559,12 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
         // NOTE: the volatile variants have src and dst swapped
         volatile_copy_memory | volatile_copy_nonoverlapping_memory, <elem_ty> (v dst, v src, v count) {
             let elem_size: u64 = fx.layout_of(elem_ty).size.bytes();
-            let elem_size = fx
-                .bcx
-                .ins()
-                .iconst(fx.pointer_type, elem_size as i64);
             assert_eq!(args.len(), 3);
-            let byte_amount = fx.bcx.ins().imul(count, elem_size);
+            let byte_amount = if elem_size != 1 {
+                fx.bcx.ins().imul_imm(count, elem_size as i64)
+            } else {
+                count
+            };
 
             // FIXME make the copy actually volatile when using emit_small_mem{cpy,move}
             if intrinsic.contains("nonoverlapping") {
@@ -676,7 +720,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
         offset | arith_offset, (c base, v offset) {
             let pointee_ty = base.layout().ty.builtin_deref(true).unwrap().ty;
             let pointee_size = fx.layout_of(pointee_ty).size.bytes();
-            let ptr_diff = fx.bcx.ins().imul_imm(offset, pointee_size as i64);
+            let ptr_diff = if pointee_size != 1 {
+                fx.bcx.ins().imul_imm(offset, pointee_size as i64)
+            } else {
+                offset
+            };
             let base_val = base.load_scalar(fx);
             let res = fx.bcx.ins().iadd(base_val, ptr_diff);
             ret.write_cvalue(fx, CValue::by_val(res, base.layout()));
@@ -688,7 +736,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
         write_bytes | volatile_set_memory, (c dst, v val, v count) {
             let pointee_ty = dst.layout().ty.builtin_deref(true).unwrap().ty;
             let pointee_size = fx.layout_of(pointee_ty).size.bytes();
-            let count = fx.bcx.ins().imul_imm(count, pointee_size as i64);
+            let count = if pointee_size != 1 {
+                fx.bcx.ins().imul_imm(count, pointee_size as i64)
+            } else {
+                count
+            };
             let dst_ptr = dst.load_scalar(fx);
             // FIXME make the memset actually volatile when switching to emit_small_memset
             // FIXME use emit_small_memset
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
index 2e31c4669e2..2b32e866e5e 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
@@ -35,30 +35,33 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             });
         };
 
-        // FIXME support float comparisons
         simd_eq, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, Equal(x, y) -> ret);
+            simd_cmp!(fx, Equal|Equal(x, y) -> ret);
         };
         simd_ne, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, NotEqual(x, y) -> ret);
+            simd_cmp!(fx, NotEqual|NotEqual(x, y) -> ret);
         };
         simd_lt, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, UnsignedLessThan|SignedLessThan(x, y) -> ret);
+            simd_cmp!(fx, UnsignedLessThan|SignedLessThan|LessThan(x, y) -> ret);
         };
         simd_le, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, UnsignedLessThanOrEqual|SignedLessThanOrEqual(x, y) -> ret);
+            simd_cmp!(fx, UnsignedLessThanOrEqual|SignedLessThanOrEqual|LessThanOrEqual(x, y) -> ret);
         };
         simd_gt, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, UnsignedGreaterThan|SignedGreaterThan(x, y) -> ret);
+            simd_cmp!(fx, UnsignedGreaterThan|SignedGreaterThan|GreaterThan(x, y) -> ret);
         };
         simd_ge, (c x, c y) {
             validate_simd_type!(fx, intrinsic, span, x.layout().ty);
-            simd_cmp!(fx, UnsignedGreaterThanOrEqual|SignedGreaterThanOrEqual(x, y) -> ret);
+            simd_cmp!(
+                fx,
+                UnsignedGreaterThanOrEqual|SignedGreaterThanOrEqual|GreaterThanOrEqual
+                (x, y) -> ret
+            );
         };
 
         // simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U
@@ -107,9 +110,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
 
             for (out_idx, in_idx) in indexes.into_iter().enumerate() {
                 let in_lane = if in_idx < lane_count {
-                    x.value_field(fx, mir::Field::new(in_idx.try_into().unwrap()))
+                    x.value_field(fx, mir::Field::new(in_idx.into()))
                 } else {
-                    y.value_field(fx, mir::Field::new((in_idx - lane_count).try_into().unwrap()))
+                    y.value_field(fx, mir::Field::new((in_idx - lane_count).into()))
                 };
                 let out_lane = ret.place_field(fx, mir::Field::new(out_idx));
                 out_lane.write_cvalue(fx, in_lane);
@@ -143,10 +146,17 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             let idx_const = if let Some(idx_const) = crate::constant::mir_operand_get_const_val(fx, idx) {
                 idx_const
             } else {
-                fx.tcx.sess.span_fatal(
+                fx.tcx.sess.span_warn(
                     span,
                     "Index argument for `simd_extract` is not a constant",
                 );
+                let res = crate::trap::trap_unimplemented_ret_value(
+                    fx,
+                    ret.layout(),
+                    "Index argument for `simd_extract` is not a constant",
+                );
+                ret.write_cvalue(fx, res);
+                return;
             };
 
             let idx = idx_const.val.try_to_bits(Size::from_bytes(4 /* u32*/)).unwrap_or_else(|| panic!("kind not scalar: {:?}", idx_const));
@@ -207,7 +217,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             assert_eq!(lane_count, ret_lane_count);
 
             for lane in 0..lane_count {
-                let lane = mir::Field::new(lane.try_into().unwrap());
+                let lane = mir::Field::new(lane.into());
                 let a_lane = a.value_field(fx, lane).load_scalar(fx);
                 let b_lane = b.value_field(fx, lane).load_scalar(fx);
                 let c_lane = c.value_field(fx, lane).load_scalar(fx);
@@ -228,11 +238,42 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             simd_flt_binop!(fx, fmax(x, y) -> ret);
         };
 
+        simd_reduce_add_ordered | simd_reduce_add_unordered, (c v) {
+            validate_simd_type!(fx, intrinsic, span, v.layout().ty);
+            simd_reduce(fx, v, ret, |fx, lane_layout, a, b| {
+                if lane_layout.ty.is_floating_point() {
+                    fx.bcx.ins().fadd(a, b)
+                } else {
+                    fx.bcx.ins().iadd(a, b)
+                }
+            });
+        };
+
+        simd_reduce_mul_ordered | simd_reduce_mul_unordered, (c v) {
+            validate_simd_type!(fx, intrinsic, span, v.layout().ty);
+            simd_reduce(fx, v, ret, |fx, lane_layout, a, b| {
+                if lane_layout.ty.is_floating_point() {
+                    fx.bcx.ins().fmul(a, b)
+                } else {
+                    fx.bcx.ins().imul(a, b)
+                }
+            });
+        };
+
+        simd_reduce_all, (c v) {
+            validate_simd_type!(fx, intrinsic, span, v.layout().ty);
+            simd_reduce_bool(fx, v, ret, |fx, a, b| fx.bcx.ins().band(a, b));
+        };
+
+        simd_reduce_any, (c v) {
+            validate_simd_type!(fx, intrinsic, span, v.layout().ty);
+            simd_reduce_bool(fx, v, ret, |fx, a, b| fx.bcx.ins().bor(a, b));
+        };
+
         // simd_fabs
         // simd_saturating_add
         // simd_bitmask
         // simd_select
-        // simd_reduce_add_{,un}ordered
         // simd_rem
     }
 }
diff --git a/compiler/rustc_codegen_cranelift/src/trap.rs b/compiler/rustc_codegen_cranelift/src/trap.rs
index 690d96764a8..67495c74148 100644
--- a/compiler/rustc_codegen_cranelift/src/trap.rs
+++ b/compiler/rustc_codegen_cranelift/src/trap.rs
@@ -67,3 +67,15 @@ pub(crate) fn trap_unimplemented(fx: &mut FunctionCx<'_, '_, impl Module>, msg:
     let true_ = fx.bcx.ins().iconst(types::I32, 1);
     fx.bcx.ins().trapnz(true_, TrapCode::User(!0));
 }
+
+/// Like `trap_unimplemented` but returns a fake value of the specified type.
+///
+/// Trap code: user65535
+pub(crate) fn trap_unimplemented_ret_value<'tcx>(
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
+    dest_layout: TyAndLayout<'tcx>,
+    msg: impl AsRef<str>,
+) -> CValue<'tcx> {
+    trap_unimplemented(fx, msg);
+    CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
+}
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index ac423d01bf1..ec557b7a682 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -792,7 +792,7 @@ fn generic_simd_intrinsic(
             _ => return_error!("`{}` is not an integral type", in_ty),
         };
         require_simd!(arg_tys[1], "argument");
-        let v_len = arg_tys[1].simd_size(tcx);
+        let (v_len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
         require!(
             // Allow masks for vectors with fewer than 8 elements to be
             // represented with a u8 or i8.
@@ -812,8 +812,6 @@ fn generic_simd_intrinsic(
     // every intrinsic below takes a SIMD vector as its first argument
     require_simd!(arg_tys[0], "input");
     let in_ty = arg_tys[0];
-    let in_elem = arg_tys[0].simd_type(tcx);
-    let in_len = arg_tys[0].simd_size(tcx);
 
     let comparison = match name {
         sym::simd_eq => Some(hir::BinOpKind::Eq),
@@ -825,14 +823,15 @@ fn generic_simd_intrinsic(
         _ => None,
     };
 
+    let (in_len, in_elem) = arg_tys[0].simd_size_and_type(bx.tcx());
     if let Some(cmp_op) = comparison {
         require_simd!(ret_ty, "return");
 
-        let out_len = ret_ty.simd_size(tcx);
+        let (out_len, out_ty) = ret_ty.simd_size_and_type(bx.tcx());
         require!(
             in_len == out_len,
             "expected return type with length {} (same as input type `{}`), \
-                  found `{}` with length {}",
+             found `{}` with length {}",
             in_len,
             in_ty,
             ret_ty,
@@ -842,7 +841,7 @@ fn generic_simd_intrinsic(
             bx.type_kind(bx.element_type(llret_ty)) == TypeKind::Integer,
             "expected return type with integer elements, found `{}` with non-integer `{}`",
             ret_ty,
-            ret_ty.simd_type(tcx)
+            out_ty
         );
 
         return Ok(compare_simd_types(
@@ -862,7 +861,7 @@ fn generic_simd_intrinsic(
 
         require_simd!(ret_ty, "return");
 
-        let out_len = ret_ty.simd_size(tcx);
+        let (out_len, out_ty) = ret_ty.simd_size_and_type(bx.tcx());
         require!(
             out_len == n,
             "expected return type of length {}, found `{}` with length {}",
@@ -871,13 +870,13 @@ fn generic_simd_intrinsic(
             out_len
         );
         require!(
-            in_elem == ret_ty.simd_type(tcx),
+            in_elem == out_ty,
             "expected return element type `{}` (element of input `{}`), \
-                  found `{}` with element type `{}`",
+             found `{}` with element type `{}`",
             in_elem,
             in_ty,
             ret_ty,
-            ret_ty.simd_type(tcx)
+            out_ty
         );
 
         let total_len = u128::from(in_len) * 2;
@@ -946,7 +945,7 @@ fn generic_simd_intrinsic(
         let m_elem_ty = in_elem;
         let m_len = in_len;
         require_simd!(arg_tys[1], "argument");
-        let v_len = arg_tys[1].simd_size(tcx);
+        let (v_len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
         require!(
             m_len == v_len,
             "mismatched lengths: mask length `{}` != other vector length `{}`",
@@ -1173,25 +1172,27 @@ fn generic_simd_intrinsic(
         require_simd!(ret_ty, "return");
 
         // Of the same length:
+        let (out_len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
+        let (out_len2, _) = arg_tys[2].simd_size_and_type(bx.tcx());
         require!(
-            in_len == arg_tys[1].simd_size(tcx),
+            in_len == out_len,
             "expected {} argument with length {} (same as input type `{}`), \
-                  found `{}` with length {}",
+             found `{}` with length {}",
             "second",
             in_len,
             in_ty,
             arg_tys[1],
-            arg_tys[1].simd_size(tcx)
+            out_len
         );
         require!(
-            in_len == arg_tys[2].simd_size(tcx),
+            in_len == out_len2,
             "expected {} argument with length {} (same as input type `{}`), \
-                  found `{}` with length {}",
+             found `{}` with length {}",
             "third",
             in_len,
             in_ty,
             arg_tys[2],
-            arg_tys[2].simd_size(tcx)
+            out_len2
         );
 
         // The return type must match the first argument type
@@ -1215,39 +1216,40 @@ fn generic_simd_intrinsic(
 
         // The second argument must be a simd vector with an element type that's a pointer
         // to the element type of the first argument
-        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind() {
-            ty::RawPtr(p) if p.ty == in_elem => {
-                (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx)))
-            }
+        let (_, element_ty0) = arg_tys[0].simd_size_and_type(bx.tcx());
+        let (_, element_ty1) = arg_tys[1].simd_size_and_type(bx.tcx());
+        let (pointer_count, underlying_ty) = match element_ty1.kind() {
+            ty::RawPtr(p) if p.ty == in_elem => (ptr_count(element_ty1), non_ptr(element_ty1)),
             _ => {
                 require!(
                     false,
                     "expected element type `{}` of second argument `{}` \
-                                 to be a pointer to the element type `{}` of the first \
-                                 argument `{}`, found `{}` != `*_ {}`",
-                    arg_tys[1].simd_type(tcx),
+                        to be a pointer to the element type `{}` of the first \
+                        argument `{}`, found `{}` != `*_ {}`",
+                    element_ty1,
                     arg_tys[1],
                     in_elem,
                     in_ty,
-                    arg_tys[1].simd_type(tcx),
+                    element_ty1,
                     in_elem
                 );
                 unreachable!();
             }
         };
         assert!(pointer_count > 0);
-        assert_eq!(pointer_count - 1, ptr_count(arg_tys[0].simd_type(tcx)));
-        assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
+        assert_eq!(pointer_count - 1, ptr_count(element_ty0));
+        assert_eq!(underlying_ty, non_ptr(element_ty0));
 
         // The element type of the third argument must be a signed integer type of any width:
-        match arg_tys[2].simd_type(tcx).kind() {
+        let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx());
+        match element_ty2.kind() {
             ty::Int(_) => (),
             _ => {
                 require!(
                     false,
                     "expected element type `{}` of third argument `{}` \
                                  to be a signed integer type",
-                    arg_tys[2].simd_type(tcx),
+                    element_ty2,
                     arg_tys[2]
                 );
             }
@@ -1299,25 +1301,27 @@ fn generic_simd_intrinsic(
         require_simd!(arg_tys[2], "third");
 
         // Of the same length:
+        let (element_len1, _) = arg_tys[1].simd_size_and_type(bx.tcx());
+        let (element_len2, _) = arg_tys[2].simd_size_and_type(bx.tcx());
         require!(
-            in_len == arg_tys[1].simd_size(tcx),
+            in_len == element_len1,
             "expected {} argument with length {} (same as input type `{}`), \
-                  found `{}` with length {}",
+            found `{}` with length {}",
             "second",
             in_len,
             in_ty,
             arg_tys[1],
-            arg_tys[1].simd_size(tcx)
+            element_len1
         );
         require!(
-            in_len == arg_tys[2].simd_size(tcx),
+            in_len == element_len2,
             "expected {} argument with length {} (same as input type `{}`), \
-                  found `{}` with length {}",
+            found `{}` with length {}",
             "third",
             in_len,
             in_ty,
             arg_tys[2],
-            arg_tys[2].simd_size(tcx)
+            element_len2
         );
 
         // This counts how many pointers
@@ -1338,39 +1342,42 @@ fn generic_simd_intrinsic(
 
         // The second argument must be a simd vector with an element type that's a pointer
         // to the element type of the first argument
-        let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind() {
+        let (_, element_ty0) = arg_tys[0].simd_size_and_type(bx.tcx());
+        let (_, element_ty1) = arg_tys[1].simd_size_and_type(bx.tcx());
+        let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx());
+        let (pointer_count, underlying_ty) = match element_ty1.kind() {
             ty::RawPtr(p) if p.ty == in_elem && p.mutbl == hir::Mutability::Mut => {
-                (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx)))
+                (ptr_count(element_ty1), non_ptr(element_ty1))
             }
             _ => {
                 require!(
                     false,
                     "expected element type `{}` of second argument `{}` \
-                                 to be a pointer to the element type `{}` of the first \
-                                 argument `{}`, found `{}` != `*mut {}`",
-                    arg_tys[1].simd_type(tcx),
+                        to be a pointer to the element type `{}` of the first \
+                        argument `{}`, found `{}` != `*mut {}`",
+                    element_ty1,
                     arg_tys[1],
                     in_elem,
                     in_ty,
-                    arg_tys[1].simd_type(tcx),
+                    element_ty1,
                     in_elem
                 );
                 unreachable!();
             }
         };
         assert!(pointer_count > 0);
-        assert_eq!(pointer_count - 1, ptr_count(arg_tys[0].simd_type(tcx)));
-        assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
+        assert_eq!(pointer_count - 1, ptr_count(element_ty0));
+        assert_eq!(underlying_ty, non_ptr(element_ty0));
 
         // The element type of the third argument must be a signed integer type of any width:
-        match arg_tys[2].simd_type(tcx).kind() {
+        match element_ty2.kind() {
             ty::Int(_) => (),
             _ => {
                 require!(
                     false,
                     "expected element type `{}` of third argument `{}` \
-                                 to be a signed integer type",
-                    arg_tys[2].simd_type(tcx),
+                         be a signed integer type",
+                    element_ty2,
                     arg_tys[2]
                 );
             }
@@ -1567,7 +1574,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
 
     if name == sym::simd_cast {
         require_simd!(ret_ty, "return");
-        let out_len = ret_ty.simd_size(tcx);
+        let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
         require!(
             in_len == out_len,
             "expected return type with length {} (same as input type `{}`), \
@@ -1578,8 +1585,6 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
             out_len
         );
         // casting cares about nominal type, not just structural type
-        let out_elem = ret_ty.simd_type(tcx);
-
         if in_elem == out_elem {
             return Ok(args[0].immediate());
         }
@@ -1695,7 +1700,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
                 return_error!(
                     "expected element type `{}` of vector type `{}` \
                      to be a signed or unsigned integer type",
-                    arg_tys[0].simd_type(tcx),
+                    arg_tys[0].simd_size_and_type(bx.tcx()).1,
                     arg_tys[0]
                 );
             }
diff --git a/compiler/rustc_error_codes/src/error_codes/E0591.md b/compiler/rustc_error_codes/src/error_codes/E0591.md
index 7f68815b1c2..f49805d9b4e 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0591.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0591.md
@@ -1,14 +1,20 @@
 Per [RFC 401][rfc401], if you have a function declaration `foo`:
 
 ```
+struct S;
+
 // For the purposes of this explanation, all of these
 // different kinds of `fn` declarations are equivalent:
-struct S;
+
 fn foo(x: S) { /* ... */ }
 # #[cfg(for_demonstration_only)]
-extern "C" { fn foo(x: S); }
+extern "C" {
+    fn foo(x: S);
+}
 # #[cfg(for_demonstration_only)]
-impl S { fn foo(self) { /* ... */ } }
+impl S {
+    fn foo(self) { /* ... */ }
+}
 ```
 
 the type of `foo` is **not** `fn(S)`, as one might expect.
@@ -40,10 +46,10 @@ extern "C" fn foo(userdata: Box<i32>) {
 
 # fn callback(_: extern "C" fn(*mut i32)) {}
 # use std::mem::transmute;
-# unsafe {
-let f: extern "C" fn(*mut i32) = transmute(foo);
-callback(f);
-# }
+unsafe {
+    let f: extern "C" fn(*mut i32) = transmute(foo);
+    callback(f);
+}
 ```
 
 Here, transmute is being used to convert the types of the fn arguments.
diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs
index dd2627f7bc1..2720c376774 100644
--- a/compiler/rustc_lint/src/nonstandard_style.rs
+++ b/compiler/rustc_lint/src/nonstandard_style.rs
@@ -94,9 +94,9 @@ fn to_camel_case(s: &str) -> String {
                 }
 
                 if new_word {
-                    camel_cased_component.push_str(&c.to_uppercase().to_string());
+                    camel_cased_component.extend(c.to_uppercase());
                 } else {
-                    camel_cased_component.push_str(&c.to_lowercase().to_string());
+                    camel_cased_component.extend(c.to_lowercase());
                 }
 
                 prev_is_lower_case = c.is_lowercase();
diff --git a/compiler/rustc_middle/src/hir/map/collector.rs b/compiler/rustc_middle/src/hir/map/collector.rs
index 912e9672c94..82cfca4f171 100644
--- a/compiler/rustc_middle/src/hir/map/collector.rs
+++ b/compiler/rustc_middle/src/hir/map/collector.rs
@@ -572,6 +572,14 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
 
         self.visit_nested_impl_item(id);
     }
+
+    fn visit_foreign_item_ref(&mut self, fi: &'hir ForeignItemRef<'hir>) {
+        // Do not visit the duplicate information in ForeignItemRef. We want to
+        // map the actual nodes, not the duplicate ones in the *Ref.
+        let ForeignItemRef { id, ident: _, span: _, vis: _ } = *fi;
+
+        self.visit_nested_foreign_item(id);
+    }
 }
 
 struct HirItemLike<T> {
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index fa0711193df..8bdc7efa0bb 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -631,30 +631,106 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
             }
 
             // SIMD vector types.
-            ty::Adt(def, ..) if def.repr.simd() => {
-                let element = self.layout_of(ty.simd_type(tcx))?;
-                let count = ty.simd_size(tcx);
-                assert!(count > 0);
-                let scalar = match element.abi {
-                    Abi::Scalar(ref scalar) => scalar.clone(),
-                    _ => {
+            ty::Adt(def, substs) if def.repr.simd() => {
+                // Supported SIMD vectors are homogeneous ADTs with at least one field:
+                //
+                // * #[repr(simd)] struct S(T, T, T, T);
+                // * #[repr(simd)] struct S { x: T, y: T, z: T, w: T }
+                // * #[repr(simd)] struct S([T; 4])
+                //
+                // where T is a primitive scalar (integer/float/pointer).
+
+                // SIMD vectors with zero fields are not supported.
+                // (should be caught by typeck)
+                if def.non_enum_variant().fields.is_empty() {
+                    tcx.sess.fatal(&format!("monomorphising SIMD type `{}` of zero length", ty));
+                }
+
+                // Type of the first ADT field:
+                let f0_ty = def.non_enum_variant().fields[0].ty(tcx, substs);
+
+                // Heterogeneous SIMD vectors are not supported:
+                // (should be caught by typeck)
+                for fi in &def.non_enum_variant().fields {
+                    if fi.ty(tcx, substs) != f0_ty {
+                        tcx.sess.fatal(&format!("monomorphising heterogeneous SIMD type `{}`", ty));
+                    }
+                }
+
+                // The element type and number of elements of the SIMD vector
+                // are obtained from:
+                //
+                // * the element type and length of the single array field, if
+                // the first field is of array type, or
+                //
+                // * the homogenous field type and the number of fields.
+                let (e_ty, e_len, is_array) = if let ty::Array(e_ty, _) = f0_ty.kind() {
+                    // First ADT field is an array:
+
+                    // SIMD vectors with multiple array fields are not supported:
+                    // (should be caught by typeck)
+                    if def.non_enum_variant().fields.len() != 1 {
                         tcx.sess.fatal(&format!(
-                            "monomorphising SIMD type `{}` with \
-                                                 a non-machine element type `{}`",
-                            ty, element.ty
+                            "monomorphising SIMD type `{}` with more than one array field",
+                            ty
                         ));
                     }
+
+                    // Extract the number of elements from the layout of the array field:
+                    let len = if let Ok(TyAndLayout {
+                        layout: Layout { fields: FieldsShape::Array { count, .. }, .. },
+                        ..
+                    }) = self.layout_of(f0_ty)
+                    {
+                        count
+                    } else {
+                        return Err(LayoutError::Unknown(ty));
+                    };
+
+                    (*e_ty, *len, true)
+                } else {
+                    // First ADT field is not an array:
+                    (f0_ty, def.non_enum_variant().fields.len() as _, false)
                 };
-                let size =
-                    element.size.checked_mul(count, dl).ok_or(LayoutError::SizeOverflow(ty))?;
+
+                // SIMD vectors of zero length are not supported.
+                //
+                // Can't be caught in typeck if the array length is generic.
+                if e_len == 0 {
+                    tcx.sess.fatal(&format!("monomorphising SIMD type `{}` of zero length", ty));
+                }
+
+                // Compute the ABI of the element type:
+                let e_ly = self.layout_of(e_ty)?;
+                let e_abi = if let Abi::Scalar(ref scalar) = e_ly.abi {
+                    scalar.clone()
+                } else {
+                    // This error isn't caught in typeck, e.g., if
+                    // the element type of the vector is generic.
+                    tcx.sess.fatal(&format!(
+                        "monomorphising SIMD type `{}` with a non-primitive-scalar \
+                        (integer/float/pointer) element type `{}`",
+                        ty, e_ty
+                    ))
+                };
+
+                // Compute the size and alignment of the vector:
+                let size = e_ly.size.checked_mul(e_len, dl).ok_or(LayoutError::SizeOverflow(ty))?;
                 let align = dl.vector_align(size);
                 let size = size.align_to(align.abi);
 
+                // Compute the placement of the vector fields:
+                let fields = if is_array {
+                    FieldsShape::Arbitrary { offsets: vec![Size::ZERO], memory_index: vec![0] }
+                } else {
+                    FieldsShape::Array { stride: e_ly.size, count: e_len }
+                };
+
                 tcx.intern_layout(Layout {
                     variants: Variants::Single { index: VariantIdx::new(0) },
-                    fields: FieldsShape::Array { stride: element.size, count },
-                    abi: Abi::Vector { element: scalar, count },
-                    largest_niche: element.largest_niche.clone(),
+                    fields,
+                    abi: Abi::Vector { element: e_abi, count: e_len },
+                    largest_niche: e_ly.largest_niche.clone(),
                     size,
                     align,
                 })
@@ -2121,9 +2197,6 @@ where
 
             ty::Tuple(tys) => tys[i].expect_ty(),
 
-            // SIMD vector types.
-            ty::Adt(def, ..) if def.repr.simd() => this.ty.simd_type(tcx),
-
             // ADTs.
             ty::Adt(def, substs) => {
                 match this.variants {
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index c906b8ac901..78994c6e1c7 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -1956,27 +1956,22 @@ impl<'tcx> TyS<'tcx> {
         }
     }
 
-    pub fn simd_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
-        match self.kind() {
-            Adt(def, substs) => def.non_enum_variant().fields[0].ty(tcx, substs),
-            _ => bug!("`simd_type` called on invalid type"),
-        }
-    }
-
-    pub fn simd_size(&self, _tcx: TyCtxt<'tcx>) -> u64 {
-        // Parameter currently unused, but probably needed in the future to
-        // allow `#[repr(simd)] struct Simd<T, const N: usize>([T; N]);`.
-        match self.kind() {
-            Adt(def, _) => def.non_enum_variant().fields.len() as u64,
-            _ => bug!("`simd_size` called on invalid type"),
-        }
-    }
-
     pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) {
         match self.kind() {
             Adt(def, substs) => {
                 let variant = def.non_enum_variant();
-                (variant.fields.len() as u64, variant.fields[0].ty(tcx, substs))
+                let f0_ty = variant.fields[0].ty(tcx, substs);
+
+                match f0_ty.kind() {
+                    Array(f0_elem_ty, f0_len) => {
+                        // FIXME(repr_simd): https://github.com/rust-lang/rust/pull/78863#discussion_r522784112
+                        // The way we evaluate the `N` in `[T; N]` here only works since we use
+                        // `simd_size_and_type` post-monomorphization. It will probably start to ICE
+                        // if we use it in generic code. See the `simd-array-trait` ui test.
+                        (f0_len.eval_usize(tcx, ParamEnv::empty()) as u64, f0_elem_ty)
+                    }
+                    _ => (variant.fields.len() as u64, f0_ty),
+                }
             }
             _ => bug!("`simd_size_and_type` called on invalid type"),
         }
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 2a779c37b89..b746256f5fe 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -873,7 +873,8 @@ impl<'a> Parser<'a> {
             id: DUMMY_NODE_ID,
             value: self.mk_expr(blk.span, ExprKind::Block(blk, None), AttrVec::new()),
         };
-        Ok(self.mk_expr(span, ExprKind::ConstBlock(anon_const), AttrVec::new()))
+        let blk_span = anon_const.value.span;
+        Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::new()))
     }
 
     /// Parses mutability (`mut` or nothing).
diff --git a/compiler/rustc_passes/src/hir_id_validator.rs b/compiler/rustc_passes/src/hir_id_validator.rs
index c7e057927ab..fdd6c238055 100644
--- a/compiler/rustc_passes/src/hir_id_validator.rs
+++ b/compiler/rustc_passes/src/hir_id_validator.rs
@@ -169,6 +169,13 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
         // different owner.
     }
 
+    fn visit_foreign_item_ref(&mut self, _: &'hir hir::ForeignItemRef<'hir>) {
+        // Explicitly do nothing here. ForeignItemRefs contain hir::Visibility
+        // values that actually belong to an ForeignItem instead of the ItemKind::ForeignMod
+        // we are currently in. So for those it's correct that they have a
+        // different owner.
+    }
+
     fn visit_generic_param(&mut self, param: &'hir hir::GenericParam<'hir>) {
         if let hir::GenericParamKind::Type {
             synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index d5fccdeb189..523628b7058 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1590,11 +1590,6 @@ impl Symbol {
         self == kw::Try
     }
 
-    /// Used for sanity checking rustdoc keyword sections.
-    pub fn is_doc_keyword(self) -> bool {
-        self <= kw::Union
-    }
-
     /// A keyword or reserved identifier that can be used as a path segment.
     pub fn is_path_segment_keyword(self) -> bool {
         self == kw::Super
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index 2d7df2ddd11..2fb9b3cd5d3 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -97,13 +97,13 @@ impl Default for SkipLeakCheck {
 /// The mode that trait queries run in.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum TraitQueryMode {
-    // Standard/un-canonicalized queries get accurate
-    // spans etc. passed in and hence can do reasonable
-    // error reporting on their own.
+    /// Standard/un-canonicalized queries get accurate
+    /// spans etc. passed in and hence can do reasonable
+    /// error reporting on their own.
     Standard,
-    // Canonicalized queries get dummy spans and hence
-    // must generally propagate errors to
-    // pre-canonicalization callsites.
+    /// Canonicalized queries get dummy spans and hence
+    /// must generally propagate errors to
+    /// pre-canonicalization callsites.
     Canonical,
 }
 
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 5b31998b7d3..74b6652981a 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -833,11 +833,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
     /// - it also appears in the backtrace at some position `X`,
     /// - all the predicates at positions `X..` between `X` and the top are
     ///   also defaulted traits.
-    pub fn coinductive_match<I>(&mut self, cycle: I) -> bool
+    pub fn coinductive_match<I>(&mut self, mut cycle: I) -> bool
     where
         I: Iterator<Item = ty::Predicate<'tcx>>,
     {
-        let mut cycle = cycle;
         cycle.all(|predicate| self.coinductive_predicate(predicate))
     }
 
diff --git a/compiler/rustc_traits/src/normalize_erasing_regions.rs b/compiler/rustc_traits/src/normalize_erasing_regions.rs
index 750a0922be4..4841e4286a9 100644
--- a/compiler/rustc_traits/src/normalize_erasing_regions.rs
+++ b/compiler/rustc_traits/src/normalize_erasing_regions.rs
@@ -2,7 +2,7 @@ use rustc_infer::infer::TyCtxtInferExt;
 use rustc_middle::traits::query::NoSolution;
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::subst::GenericArg;
-use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
+use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt, TypeFoldable};
 use rustc_trait_selection::traits::query::normalize::AtExt;
 use rustc_trait_selection::traits::{Normalized, ObligationCause};
 use std::sync::atomic::Ordering;
@@ -31,8 +31,14 @@ fn normalize_generic_arg_after_erasing_regions<'tcx>(
                     None,
                 );
 
-                let normalized_value = infcx.resolve_vars_if_possible(normalized_value);
-                infcx.tcx.erase_regions(normalized_value)
+                let resolved_value = infcx.resolve_vars_if_possible(normalized_value);
+                // It's unclear when `resolve_vars` would have an effect in a
+                // fresh `InferCtxt`. If this assert does trigger, it will give
+                // us a test case.
+                debug_assert_eq!(normalized_value, resolved_value);
+                let erased = infcx.tcx.erase_regions(resolved_value);
+                debug_assert!(!erased.needs_infer(), "{:?}", erased);
+                erased
             }
             Err(NoSolution) => bug!("could not fully normalize `{:?}`", value),
         }
diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs
index 2f64597a510..7888cb1b9f5 100644
--- a/compiler/rustc_typeck/src/astconv/mod.rs
+++ b/compiler/rustc_typeck/src/astconv/mod.rs
@@ -823,34 +823,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         ast_bounds: &[hir::GenericBound<'_>],
         bounds: &mut Bounds<'tcx>,
     ) {
-        let mut trait_bounds = Vec::new();
-        let mut region_bounds = Vec::new();
-
         let constness = self.default_constness_for_trait_bounds();
         for ast_bound in ast_bounds {
             match *ast_bound {
                 hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::None) => {
-                    trait_bounds.push((b, constness))
+                    self.instantiate_poly_trait_ref(b, constness, param_ty, bounds);
                 }
                 hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::MaybeConst) => {
-                    trait_bounds.push((b, Constness::NotConst))
+                    self.instantiate_poly_trait_ref(b, Constness::NotConst, param_ty, bounds);
                 }
                 hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => {}
                 hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => self
                     .instantiate_lang_item_trait_ref(
                         lang_item, span, hir_id, args, param_ty, bounds,
                     ),
-                hir::GenericBound::Outlives(ref l) => region_bounds.push(l),
+                hir::GenericBound::Outlives(ref l) => {
+                    bounds.region_bounds.push((self.ast_region_to_region(l, None), l.span))
+                }
             }
         }
-
-        for (bound, constness) in trait_bounds {
-            let _ = self.instantiate_poly_trait_ref(bound, constness, param_ty, bounds);
-        }
-
-        bounds.region_bounds.extend(
-            region_bounds.into_iter().map(|r| (self.ast_region_to_region(r, None), r.span)),
-        );
     }
 
     /// Translates a list of bounds from the HIR into the `Bounds` data structure.
diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs
index 55c815b21ad..489d836298f 100644
--- a/compiler/rustc_typeck/src/check/check.rs
+++ b/compiler/rustc_typeck/src/check/check.rs
@@ -1098,12 +1098,14 @@ pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) {
             match e.kind() {
                 ty::Param(_) => { /* struct<T>(T, T, T, T) is ok */ }
                 _ if e.is_machine() => { /* struct(u8, u8, u8, u8) is ok */ }
+                ty::Array(ty, _c) if ty.is_machine() => { /* struct([f32; 4]) */ }
                 _ => {
                     struct_span_err!(
                         tcx.sess,
                         sp,
                         E0077,
-                        "SIMD vector element type should be machine type"
+                        "SIMD vector element type should be a \
+                         primitive scalar (integer/float/pointer) type"
                     )
                     .emit();
                     return;
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index f56e3af4ff2..d814c525ceb 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -327,7 +327,10 @@ impl<T, A: AllocRef> Box<T, A> {
     /// `x` will be pinned in memory and unable to be moved.
     #[unstable(feature = "allocator_api", issue = "32838")]
     #[inline(always)]
-    pub fn pin_in(x: T, alloc: A) -> Pin<Self> {
+    pub fn pin_in(x: T, alloc: A) -> Pin<Self>
+    where
+        A: 'static,
+    {
         Self::new_in(x, alloc).into()
     }
 
@@ -802,7 +805,10 @@ impl<T: ?Sized, A: AllocRef> Box<T, A> {
     ///
     /// This is also available via [`From`].
     #[unstable(feature = "box_into_pin", issue = "62370")]
-    pub fn into_pin(boxed: Self) -> Pin<Self> {
+    pub fn into_pin(boxed: Self) -> Pin<Self>
+    where
+        A: 'static,
+    {
         // It's not possible to move or replace the insides of a `Pin<Box<T>>`
         // when `T: !Unpin`,  so it's safe to pin it directly without any
         // additional requirements.
@@ -1010,7 +1016,10 @@ impl<T> From<T> for Box<T> {
 }
 
 #[stable(feature = "pin", since = "1.33.0")]
-impl<T: ?Sized, A: AllocRef> From<Box<T, A>> for Pin<Box<T, A>> {
+impl<T: ?Sized, A: AllocRef> From<Box<T, A>> for Pin<Box<T, A>>
+where
+    A: 'static,
+{
     /// Converts a `Box<T>` into a `Pin<Box<T>>`
     ///
     /// This conversion does not allocate on the heap and happens in place.
@@ -1413,10 +1422,13 @@ impl<T: ?Sized, A: AllocRef> AsMut<T> for Box<T, A> {
  *  could have a method to project a Pin<T> from it.
  */
 #[stable(feature = "pin", since = "1.33.0")]
-impl<T: ?Sized, A: AllocRef> Unpin for Box<T, A> {}
+impl<T: ?Sized, A: AllocRef> Unpin for Box<T, A> where A: 'static {}
 
 #[unstable(feature = "generator_trait", issue = "43122")]
-impl<G: ?Sized + Generator<R> + Unpin, R, A: AllocRef> Generator<R> for Box<G, A> {
+impl<G: ?Sized + Generator<R> + Unpin, R, A: AllocRef> Generator<R> for Box<G, A>
+where
+    A: 'static,
+{
     type Yield = G::Yield;
     type Return = G::Return;
 
@@ -1426,7 +1438,10 @@ impl<G: ?Sized + Generator<R> + Unpin, R, A: AllocRef> Generator<R> for Box<G, A
 }
 
 #[unstable(feature = "generator_trait", issue = "43122")]
-impl<G: ?Sized + Generator<R>, R, A: AllocRef> Generator<R> for Pin<Box<G, A>> {
+impl<G: ?Sized + Generator<R>, R, A: AllocRef> Generator<R> for Pin<Box<G, A>>
+where
+    A: 'static,
+{
     type Yield = G::Yield;
     type Return = G::Return;
 
@@ -1436,7 +1451,10 @@ impl<G: ?Sized + Generator<R>, R, A: AllocRef> Generator<R> for Pin<Box<G, A>> {
 }
 
 #[stable(feature = "futures_api", since = "1.36.0")]
-impl<F: ?Sized + Future + Unpin, A: AllocRef> Future for Box<F, A> {
+impl<F: ?Sized + Future + Unpin, A: AllocRef> Future for Box<F, A>
+where
+    A: 'static,
+{
     type Output = F::Output;
 
     fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
diff --git a/library/alloc/src/collections/btree/map/entry.rs b/library/alloc/src/collections/btree/map/entry.rs
index 69926ac2aff..c92888cb897 100644
--- a/library/alloc/src/collections/btree/map/entry.rs
+++ b/library/alloc/src/collections/btree/map/entry.rs
@@ -459,7 +459,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
         self.remove_kv().1
     }
 
-    // Body of `remove_entry`, separate to keep the above implementations short.
+    // Body of `remove_entry`, probably separate because the name reflects the returned pair.
     pub(super) fn remove_kv(self) -> (K, V) {
         let mut emptied_internal_root = false;
         let (old_kv, _) = self.handle.remove_kv_tracking(|| emptied_internal_root = true);
diff --git a/library/alloc/src/collections/btree/navigate.rs b/library/alloc/src/collections/btree/navigate.rs
index ef6f888693f..cce8b21a2bc 100644
--- a/library/alloc/src/collections/btree/navigate.rs
+++ b/library/alloc/src/collections/btree/navigate.rs
@@ -9,6 +9,9 @@ use super::search::{self, SearchResult};
 use super::unwrap_unchecked;
 
 /// Finds the leaf edges delimiting a specified range in or underneath a node.
+///
+/// The result is meaningful only if the tree is ordered by key, like the tree
+/// in a `BTreeMap` is.
 fn range_search<BorrowType, K, V, Q, R>(
     root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
     root2: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
@@ -122,6 +125,9 @@ fn full_range<BorrowType, K, V>(
 
 impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
     /// Creates a pair of leaf edges delimiting a specified range in or underneath a node.
+    ///
+    /// The result is meaningful only if the tree is ordered by key, like the tree
+    /// in a `BTreeMap` is.
     pub fn range_search<Q, R>(
         self,
         range: R,
@@ -152,6 +158,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::ValMut<'a>, K, V, marker::LeafOrInternal>
     /// Splits a unique reference into a pair of leaf edges delimiting a specified range.
     /// The result are non-unique references allowing (some) mutation, which must be used
     /// carefully.
+    ///
+    /// The result is meaningful only if the tree is ordered by key, like the tree
+    /// in a `BTreeMap` is.
     pub fn range_search<Q, R>(
         self,
         range: R,
diff --git a/library/alloc/src/collections/btree/node.rs b/library/alloc/src/collections/btree/node.rs
index 6a8be441513..78be070a983 100644
--- a/library/alloc/src/collections/btree/node.rs
+++ b/library/alloc/src/collections/btree/node.rs
@@ -27,6 +27,9 @@
 //   given node has exactly the same length.
 // - A node of length `n` has `n` keys, `n` values, and `n + 1` edges.
 //   This implies that even an empty node has at least one edge.
+//   For a leaf node, "having an edge" only means we can identify a position in the node,
+//   since leaf edges are empty and need no data representation. In an internal node,
+//   an edge both identifies a position and contains a pointer to a child node.
 
 use core::cmp::Ordering;
 use core::marker::PhantomData;
@@ -215,6 +218,8 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
 ///      although insert methods allow a mutable pointer to a value to coexist.
 ///    - When this is `Owned`, the `NodeRef` acts roughly like `Box<Node>`,
 ///      but does not have a destructor, and must be cleaned up manually.
+///   Since any `NodeRef` allows navigating through the tree, `BorrowType`
+///   effectively applies to the entire tree, not just the node itself.
 /// - `K` and `V`: These are the types of keys and values stored in the nodes.
 /// - `Type`: This can be `Leaf`, `Internal`, or `LeafOrInternal`. When this is
 ///   `Leaf`, the `NodeRef` points to a leaf node, when this is `Internal` the
@@ -227,9 +232,9 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
 /// such restrictions:
 /// - For each type parameter, we can only define a method either generically
 ///   or for one particular type. For example, we cannot define a method like
-///   `key_at` generically for all `BorrowType`, because we want to return
+///   `key_at` generically for all `BorrowType`, because we want it to return
 ///   `&'a K` for most choices of `BorrowType`, but plain `K` for `Owned`.
-///   We cannot define `key_at` once for all types that have a lifetime.
+///   We cannot define `key_at` once for all types that carry a lifetime.
 ///   Therefore, we define it only for the least powerful type `Immut<'a>`.
 /// - We cannot get implicit coercion from say `Mut<'a>` to `Immut<'a>`.
 ///   Therefore, we have to explicitly call `reborrow` on a more powerfull
@@ -240,16 +245,17 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
 ///   That is irrelevant when `BorrowType` is `Immut<'a>`, but the rule does
 ///   no harm because we make those `NodeRef` implicitly `Copy`.
 ///   The rule also avoids implicitly returning the lifetime of `&self`,
-///   instead of the lifetime contained in `BorrowType`.
+///   instead of the lifetime carried by `BorrowType`.
 ///   An exception to this rule are the insert functions.
 /// - Given the above, we need a `reborrow_mut` to explicitly copy a `Mut<'a>`
 ///   `NodeRef` whenever we want to invoke a method returning an extra reference
 ///   somewhere in the tree.
 pub struct NodeRef<BorrowType, K, V, Type> {
-    /// The number of levels below the node, a property of the node that cannot be
-    /// entirely described by `Type` and that the node does not store itself either.
-    /// Unconstrained if `Type` is `LeafOrInternal`, must be zero if `Type` is `Leaf`,
-    /// and must be non-zero if `Type` is `Internal`.
+    /// The number of levels that the node and the level of leaves are apart, a
+    /// constant of the node that cannot be entirely described by `Type`, and that
+    /// the node itself does not store. We only need to store the height of the root
+    /// node, and derive every other node's height from it.
+    /// Must be zero if `Type` is `Leaf` and non-zero if `Type` is `Internal`.
     height: usize,
     /// The pointer to the leaf or internal node. The definition of `InternalNode`
     /// ensures that the pointer is valid either way.
@@ -317,8 +323,11 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
         unsafe { usize::from((*Self::as_leaf_ptr(self)).len) }
     }
 
-    /// Returns the height of this node with respect to the leaf level. Zero height means the
-    /// node is a leaf itself.
+    /// Returns the number of levels that the node and leaves are apart. Zero
+    /// height means the node is a leaf itself. If you picture trees with the
+    /// root on top, the number says at which elevation the node appears.
+    /// If you picture trees with leaves on top, the number says how high
+    /// the tree extends above the node.
     pub fn height(&self) -> usize {
         self.height
     }
@@ -376,6 +385,8 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
     /// that points to the current node. Returns `Err(self)` if the current node has
     /// no parent, giving back the original `NodeRef`.
     ///
+    /// The method name assumes you picture trees with the root node on top.
+    ///
     /// `edge.descend().ascend().unwrap()` and `node.ascend().unwrap().descend()` should
     /// both, upon success, do nothing.
     pub fn ascend(
@@ -576,7 +587,6 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
 impl<'a, K, V, Type> NodeRef<marker::ValMut<'a>, K, V, Type> {
     /// # Safety
     /// - The node has more than `idx` initialized elements.
-    /// - The keys and values of the node must be initialized up to its current length.
     unsafe fn into_key_val_mut_at(mut self, idx: usize) -> (&'a K, &'a mut V) {
         // We only create a reference to the one element we are interested in,
         // to avoid aliasing with outstanding references to other elements,
@@ -609,7 +619,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
         unsafe { (*leaf).parent_idx.write(parent_idx as u16) };
     }
 
-    /// Clear the node's link to its parent edge, freeing it from its tree.
+    /// Clear the node's link to its parent edge.
     /// This only makes sense when there are no other references to the node.
     fn clear_parent_link(&mut self) {
         let leaf = Self::as_leaf_mut(self);
@@ -618,7 +628,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
 }
 
 impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Leaf> {
-    /// Adds a key/value pair to the end of the node.
+    /// Adds a key-value pair to the end of the node.
     pub fn push(&mut self, key: K, val: V) {
         let len = unsafe { self.reborrow_mut().into_len_mut() };
         let idx = usize::from(*len);
@@ -630,7 +640,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Leaf> {
         }
     }
 
-    /// Adds a key/value pair to the beginning of the node.
+    /// Adds a key-value pair to the beginning of the node.
     fn push_front(&mut self, key: K, val: V) {
         assert!(self.len() < CAPACITY);
 
@@ -659,7 +669,7 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
 }
 
 impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
-    /// Adds a key/value pair, and an edge to go to the right of that pair,
+    /// Adds a key-value pair, and an edge to go to the right of that pair,
     /// to the end of the node.
     pub fn push(&mut self, key: K, val: V, edge: Root<K, V>) {
         assert!(edge.height == self.height - 1);
@@ -676,7 +686,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
         }
     }
 
-    /// Adds a key/value pair, and an edge to go to the left of that pair,
+    /// Adds a key-value pair, and an edge to go to the left of that pair,
     /// to the beginning of the node.
     fn push_front(&mut self, key: K, val: V, edge: Root<K, V>) {
         assert!(edge.height == self.height - 1);
@@ -694,7 +704,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
 }
 
 impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
-    /// Removes a key/value pair from the end of the node and returns the pair.
+    /// Removes a key-value pair from the end of the node and returns the pair.
     /// Also removes the edge that was to the right of that pair and, if the node
     /// is internal, returns the orphaned subtree that this edge owned.
     fn pop(&mut self) -> (K, V, Option<Root<K, V>>) {
@@ -722,7 +732,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
         }
     }
 
-    /// Removes a key/value pair from the beginning of the node and returns the pair.
+    /// Removes a key-value pair from the beginning of the node and returns the pair.
     /// Also removes the edge that was to the left of that pair and, if the node is
     /// internal, returns the orphaned subtree that this edge owned.
     fn pop_front(&mut self) -> (K, V, Option<Root<K, V>>) {
@@ -786,12 +796,12 @@ impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
     }
 }
 
-/// A reference to a specific key/value pair or edge within a node. The `Node` parameter
-/// must be a `NodeRef`, while the `Type` can either be `KV` (signifying a handle on a key/value
+/// A reference to a specific key-value pair or edge within a node. The `Node` parameter
+/// must be a `NodeRef`, while the `Type` can either be `KV` (signifying a handle on a key-value
 /// pair) or `Edge` (signifying a handle on an edge).
 ///
 /// Note that even `Leaf` nodes can have `Edge` handles. Instead of representing a pointer to
-/// a child node, these represent the spaces where child pointers would go between the key/value
+/// a child node, these represent the spaces where child pointers would go between the key-value
 /// pairs. For example, in a node with length 2, there would be 3 possible edge locations - one
 /// to the left of the node, one between the two pairs, and one at the right of the node.
 pub struct Handle<Node, Type> {
@@ -810,7 +820,7 @@ impl<Node: Copy, Type> Clone for Handle<Node, Type> {
 }
 
 impl<Node, Type> Handle<Node, Type> {
-    /// Retrieves the node that contains the edge or key/value pair this handle points to.
+    /// Retrieves the node that contains the edge or key-value pair this handle points to.
     pub fn into_node(self) -> Node {
         self.node
     }
@@ -822,7 +832,7 @@ impl<Node, Type> Handle<Node, Type> {
 }
 
 impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, marker::KV> {
-    /// Creates a new handle to a key/value pair in `node`.
+    /// Creates a new handle to a key-value pair in `node`.
     /// Unsafe because the caller must ensure that `idx < node.len()`.
     pub unsafe fn new_kv(node: NodeRef<BorrowType, K, V, NodeType>, idx: usize) -> Self {
         debug_assert!(idx < node.len());
@@ -842,7 +852,7 @@ impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, mar
 impl<BorrowType, K, V, NodeType> NodeRef<BorrowType, K, V, NodeType> {
     /// Could be a public implementation of PartialEq, but only used in this module.
     fn eq(&self, other: &Self) -> bool {
-        let Self { node, height, _marker: _ } = self;
+        let Self { node, height, _marker } = self;
         if node.eq(&other.node) {
             debug_assert_eq!(*height, other.height);
             true
@@ -856,7 +866,7 @@ impl<BorrowType, K, V, NodeType, HandleType> PartialEq
     for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
 {
     fn eq(&self, other: &Self) -> bool {
-        let Self { node, idx, _marker: _ } = self;
+        let Self { node, idx, _marker } = self;
         node.eq(&other.node) && *idx == other.idx
     }
 }
@@ -865,7 +875,7 @@ impl<BorrowType, K, V, NodeType, HandleType> PartialOrd
     for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
 {
     fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        let Self { node, idx, _marker: _ } = self;
+        let Self { node, idx, _marker } = self;
         if node.eq(&other.node) { Some(idx.cmp(&other.idx)) } else { None }
     }
 }
@@ -950,7 +960,7 @@ fn splitpoint(edge_idx: usize) -> (usize, LeftOrRight<usize>) {
 }
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge> {
-    /// Inserts a new key/value pair between the key/value pairs to the right and left of
+    /// Inserts a new key-value pair between the key-value pairs to the right and left of
     /// this edge. This method assumes that there is enough space in the node for the new
     /// pair to fit.
     ///
@@ -969,7 +979,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
 }
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge> {
-    /// Inserts a new key/value pair between the key/value pairs to the right and left of
+    /// Inserts a new key-value pair between the key-value pairs to the right and left of
     /// this edge. This method splits the node if there isn't enough room.
     ///
     /// The returned pointer points to the inserted value.
@@ -997,8 +1007,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
 }
 
 impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> {
-    /// Fixes the parent pointer and index in the child node below this edge. This is useful
-    /// when the ordering of edges has been changed, such as in the various `insert` methods.
+    /// Fixes the parent pointer and index in the child node that this edge
+    /// links to. This is useful when the ordering of edges has been changed,
     fn correct_parent_link(self) {
         // Create backpointer without invalidating other references to the node.
         let ptr = unsafe { NonNull::new_unchecked(NodeRef::as_internal_ptr(&self.node)) };
@@ -1009,8 +1019,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
 }
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> {
-    /// Inserts a new key/value pair and an edge that will go to the right of that new pair
-    /// between this edge and the key/value pair to the right of this edge. This method assumes
+    /// Inserts a new key-value pair and an edge that will go to the right of that new pair
+    /// between this edge and the key-value pair to the right of this edge. This method assumes
     /// that there is enough space in the node for the new pair to fit.
     fn insert_fit(&mut self, key: K, val: V, edge: Root<K, V>) {
         debug_assert!(self.node.len() < CAPACITY);
@@ -1026,8 +1036,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
         }
     }
 
-    /// Inserts a new key/value pair and an edge that will go to the right of that new pair
-    /// between this edge and the key/value pair to the right of this edge. This method splits
+    /// Inserts a new key-value pair and an edge that will go to the right of that new pair
+    /// between this edge and the key-value pair to the right of this edge. This method splits
     /// the node if there isn't enough room.
     fn insert(
         mut self,
@@ -1060,7 +1070,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
 }
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge> {
-    /// Inserts a new key/value pair between the key/value pairs to the right and left of
+    /// Inserts a new key-value pair between the key-value pairs to the right and left of
     /// this edge. This method splits the node if there isn't enough room, and tries to
     /// insert the split off portion into the parent node recursively, until the root is reached.
     ///
@@ -1098,6 +1108,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
 impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::Edge> {
     /// Finds the node pointed to by this edge.
     ///
+    /// The method name assumes you picture trees with the root node on top.
+    ///
     /// `edge.descend().ascend().unwrap()` and `node.ascend().unwrap().descend()` should
     /// both, upon success, do nothing.
     pub fn descend(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
@@ -1186,10 +1198,10 @@ impl<'a, K: 'a, V: 'a, NodeType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::KV> {
     /// Splits the underlying node into three parts:
     ///
-    /// - The node is truncated to only contain the key/value pairs to the left of
+    /// - The node is truncated to only contain the key-value pairs to the left of
     ///   this handle.
     /// - The key and value pointed to by this handle are extracted.
-    /// - All the key/value pairs to the right of this handle are put into a newly
+    /// - All the key-value pairs to the right of this handle are put into a newly
     ///   allocated node.
     pub fn split(mut self) -> SplitResult<'a, K, V, marker::Leaf> {
         unsafe {
@@ -1202,8 +1214,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
         }
     }
 
-    /// Removes the key/value pair pointed to by this handle and returns it, along with the edge
-    /// that the key/value pair collapsed into.
+    /// Removes the key-value pair pointed to by this handle and returns it, along with the edge
+    /// that the key-value pair collapsed into.
     pub fn remove(
         mut self,
     ) -> ((K, V), Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>) {
@@ -1219,10 +1231,10 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::KV> {
     /// Splits the underlying node into three parts:
     ///
-    /// - The node is truncated to only contain the edges and key/value pairs to the
+    /// - The node is truncated to only contain the edges and key-value pairs to the
     ///   left of this handle.
     /// - The key and value pointed to by this handle are extracted.
-    /// - All the edges and key/value pairs to the right of this handle are put into
+    /// - All the edges and key-value pairs to the right of this handle are put into
     ///   a newly allocated node.
     pub fn split(mut self) -> SplitResult<'a, K, V, marker::Internal> {
         unsafe {
@@ -1247,7 +1259,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
 }
 
 /// Represents a session for evaluating and performing a balancing operation
-/// around an internal key/value pair.
+/// around an internal key-value pair.
 pub struct BalancingContext<'a, K, V> {
     parent: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::KV>,
     left_child: NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>,
@@ -1320,14 +1332,14 @@ impl<'a, K, V> BalancingContext<'a, K, V> {
 
     /// Returns `true` if it is valid to call `.merge()` in the balancing context,
     /// i.e., whether there is enough room in a node to hold the combination of
-    /// both adjacent child nodes, along with the key/value pair in the parent.
+    /// both adjacent child nodes, along with the key-value pair in the parent.
     pub fn can_merge(&self) -> bool {
         self.left_child.len() + 1 + self.right_child.len() <= CAPACITY
     }
 }
 
 impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
-    /// Merges the parent's key/value pair and both adjacent child nodes into
+    /// Merges the parent's key-value pair and both adjacent child nodes into
     /// the left node and returns an edge handle in that expanded left node.
     /// If `track_edge_idx` is given some value, the returned edge corresponds
     /// to where the edge in that child node ended up,
@@ -1409,8 +1421,8 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
         }
     }
 
-    /// Removes a key/value pair from the left child and places it in the key/value storage
-    /// of the parent, while pushing the old parent key/value pair into the right child.
+    /// Removes a key-value pair from the left child and places it in the key-value storage
+    /// of the parent, while pushing the old parent key-value pair into the right child.
     /// Returns a handle to the edge in the right child corresponding to where the original
     /// edge specified by `track_right_edge_idx` ended up.
     pub fn steal_left(
@@ -1432,8 +1444,8 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
         }
     }
 
-    /// Removes a key/value pair from the right child and places it in the key/value storage
-    /// of the parent, while pushing the old parent key/value pair onto the left child.
+    /// Removes a key-value pair from the right child and places it in the key-value storage
+    /// of the parent, while pushing the old parent key-value pair onto the left child.
     /// Returns a handle to the edge in the left child specified by `track_left_edge_idx`,
     /// which didn't move.
     pub fn steal_right(
@@ -1459,17 +1471,17 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
     pub fn bulk_steal_left(&mut self, count: usize) {
         unsafe {
             let left_node = &mut self.left_child;
-            let left_len = left_node.len();
+            let old_left_len = left_node.len();
             let right_node = &mut self.right_child;
-            let right_len = right_node.len();
+            let old_right_len = right_node.len();
 
             // Make sure that we may steal safely.
-            assert!(right_len + count <= CAPACITY);
-            assert!(left_len >= count);
+            assert!(old_right_len + count <= CAPACITY);
+            assert!(old_left_len >= count);
 
-            let new_left_len = left_len - count;
+            let new_left_len = old_left_len - count;
 
-            // Move data.
+            // Move leaf data.
             {
                 let left_kv = left_node.reborrow_mut().into_kv_pointers_mut();
                 let right_kv = right_node.reborrow_mut().into_kv_pointers_mut();
@@ -1479,13 +1491,13 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
                 };
 
                 // Make room for stolen elements in the right child.
-                ptr::copy(right_kv.0, right_kv.0.add(count), right_len);
-                ptr::copy(right_kv.1, right_kv.1.add(count), right_len);
+                ptr::copy(right_kv.0, right_kv.0.add(count), old_right_len);
+                ptr::copy(right_kv.1, right_kv.1.add(count), old_right_len);
 
                 // Move elements from the left child to the right one.
                 move_kv(left_kv, new_left_len + 1, right_kv, 0, count - 1);
 
-                // Move parent's key/value pair to the right child.
+                // Move parent's key-value pair to the right child.
                 move_kv(parent_kv, 0, right_kv, count - 1, 1);
 
                 // Move the left-most stolen pair to the parent.
@@ -1500,9 +1512,10 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
                     // Make room for stolen edges.
                     let left = left.reborrow();
                     let right_edges = right.reborrow_mut().into_edge_area_slice().as_mut_ptr();
-                    ptr::copy(right_edges, right_edges.add(count), right_len + 1);
-                    right.correct_childrens_parent_links(count..count + right_len + 1);
+                    ptr::copy(right_edges, right_edges.add(count), old_right_len + 1);
+                    right.correct_childrens_parent_links(count..count + old_right_len + 1);
 
+                    // Steal edges.
                     move_edges(left, new_left_len + 1, right, 0, count);
                 }
                 (ForceResult::Leaf(_), ForceResult::Leaf(_)) => {}
@@ -1515,17 +1528,17 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
     pub fn bulk_steal_right(&mut self, count: usize) {
         unsafe {
             let left_node = &mut self.left_child;
-            let left_len = left_node.len();
+            let old_left_len = left_node.len();
             let right_node = &mut self.right_child;
-            let right_len = right_node.len();
+            let old_right_len = right_node.len();
 
             // Make sure that we may steal safely.
-            assert!(left_len + count <= CAPACITY);
-            assert!(right_len >= count);
+            assert!(old_left_len + count <= CAPACITY);
+            assert!(old_right_len >= count);
 
-            let new_right_len = right_len - count;
+            let new_right_len = old_right_len - count;
 
-            // Move data.
+            // Move leaf data.
             {
                 let left_kv = left_node.reborrow_mut().into_kv_pointers_mut();
                 let right_kv = right_node.reborrow_mut().into_kv_pointers_mut();
@@ -1534,16 +1547,16 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
                     (kv.0 as *mut K, kv.1 as *mut V)
                 };
 
-                // Move parent's key/value pair to the left child.
-                move_kv(parent_kv, 0, left_kv, left_len, 1);
+                // Move parent's key-value pair to the left child.
+                move_kv(parent_kv, 0, left_kv, old_left_len, 1);
 
                 // Move elements from the right child to the left one.
-                move_kv(right_kv, 0, left_kv, left_len + 1, count - 1);
+                move_kv(right_kv, 0, left_kv, old_left_len + 1, count - 1);
 
                 // Move the right-most stolen pair to the parent.
                 move_kv(right_kv, count - 1, parent_kv, 0, 1);
 
-                // Fix right indexing
+                // Fill gap where stolen elements used to be.
                 ptr::copy(right_kv.0.add(count), right_kv.0, new_right_len);
                 ptr::copy(right_kv.1.add(count), right_kv.1, new_right_len);
             }
@@ -1553,9 +1566,10 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
 
             match (left_node.reborrow_mut().force(), right_node.reborrow_mut().force()) {
                 (ForceResult::Internal(left), ForceResult::Internal(mut right)) => {
-                    move_edges(right.reborrow(), 0, left, left_len + 1, count);
+                    // Steal edges.
+                    move_edges(right.reborrow(), 0, left, old_left_len + 1, count);
 
-                    // Fix right indexing.
+                    // Fill gap where stolen edges used to be.
                     let right_edges = right.reborrow_mut().into_edge_area_slice().as_mut_ptr();
                     ptr::copy(right_edges.add(count), right_edges, new_right_len + 1);
                     right.correct_childrens_parent_links(0..=new_right_len);
@@ -1671,28 +1685,28 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, ma
         right: &mut NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>,
     ) {
         unsafe {
-            let left_new_len = self.idx;
+            let new_left_len = self.idx;
             let mut left_node = self.reborrow_mut().into_node();
 
-            let right_new_len = left_node.len() - left_new_len;
+            let new_right_len = left_node.len() - new_left_len;
             let mut right_node = right.reborrow_mut();
 
             assert!(right_node.len() == 0);
             assert!(left_node.height == right_node.height);
 
-            if right_new_len > 0 {
+            if new_right_len > 0 {
                 let left_kv = left_node.reborrow_mut().into_kv_pointers_mut();
                 let right_kv = right_node.reborrow_mut().into_kv_pointers_mut();
 
-                move_kv(left_kv, left_new_len, right_kv, 0, right_new_len);
+                move_kv(left_kv, new_left_len, right_kv, 0, new_right_len);
 
-                *left_node.reborrow_mut().into_len_mut() = left_new_len as u16;
-                *right_node.reborrow_mut().into_len_mut() = right_new_len as u16;
+                *left_node.reborrow_mut().into_len_mut() = new_left_len as u16;
+                *right_node.reborrow_mut().into_len_mut() = new_right_len as u16;
 
                 match (left_node.force(), right_node.force()) {
                     (ForceResult::Internal(left), ForceResult::Internal(right)) => {
                         let left = left.reborrow();
-                        move_edges(left, left_new_len + 1, right, 1, right_new_len);
+                        move_edges(left, new_left_len + 1, right, 1, new_right_len);
                     }
                     (ForceResult::Leaf(_), ForceResult::Leaf(_)) => {}
                     _ => unreachable!(),
diff --git a/library/alloc/src/collections/btree/remove.rs b/library/alloc/src/collections/btree/remove.rs
index c4253d4221b..5ae1c1fcab8 100644
--- a/library/alloc/src/collections/btree/remove.rs
+++ b/library/alloc/src/collections/btree/remove.rs
@@ -4,7 +4,7 @@ use super::unwrap_unchecked;
 use core::mem;
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
-    /// Removes a key/value-pair from the tree, and returns that pair, as well as
+    /// Removes a key-value pair from the tree, and returns that pair, as well as
     /// the leaf edge corresponding to that former pair. It's possible this empties
     /// a root node that is internal, which the caller should pop from the map
     /// holding the tree. The caller should also decrement the map's length.
diff --git a/library/alloc/src/collections/btree/search.rs b/library/alloc/src/collections/btree/search.rs
index 93de2d829ac..ed7f95fe632 100644
--- a/library/alloc/src/collections/btree/search.rs
+++ b/library/alloc/src/collections/btree/search.rs
@@ -14,6 +14,9 @@ pub enum SearchResult<BorrowType, K, V, FoundType, GoDownType> {
 /// Returns a `Found` with the handle of the matching KV, if any. Otherwise,
 /// returns a `GoDown` with the handle of the possible leaf edge where the key
 /// belongs.
+///
+/// The result is meaningful only if the tree is ordered by key, like the tree
+/// in a `BTreeMap` is.
 pub fn search_tree<BorrowType, K, V, Q: ?Sized>(
     mut node: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
     key: &Q,
@@ -38,8 +41,11 @@ where
 
 /// Looks up a given key in a given node, without recursion.
 /// Returns a `Found` with the handle of the matching KV, if any. Otherwise,
-/// returns a `GoDown` with the handle of the edge where the key might be found.
-/// If the node is a leaf, a `GoDown` edge is not an actual edge but a possible edge.
+/// returns a `GoDown` with the handle of the edge where the key might be found
+/// (if the node is internal) or where the key can be inserted.
+///
+/// The result is meaningful only if the tree is ordered by key, like the tree
+/// in a `BTreeMap` is.
 pub fn search_node<BorrowType, K, V, Type, Q: ?Sized>(
     node: NodeRef<BorrowType, K, V, Type>,
     key: &Q,
@@ -54,11 +60,11 @@ where
     }
 }
 
-/// Returns the index in the node at which the key (or an equivalent) exists
-/// or could exist, and whether it exists in the node itself. If it doesn't
-/// exist in the node itself, it may exist in the subtree with that index
-/// (if the node has subtrees). If the key doesn't exist in node or subtree,
-/// the returned index is the position or subtree where the key belongs.
+/// Returns either the KV index in the node at which the key (or an equivalent)
+/// exists and `true`, or the edge index where the key belongs and `false`.
+///
+/// The result is meaningful only if the tree is ordered by key, like the tree
+/// in a `BTreeMap` is.
 fn search_linear<BorrowType, K, V, Type, Q: ?Sized>(
     node: &NodeRef<BorrowType, K, V, Type>,
     key: &Q,
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index f4046e87b99..d8ce47ed77d 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -214,7 +214,7 @@ impl<T: fmt::Debug> fmt::Debug for Union<'_, T> {
 // This constant is used by functions that compare two sets.
 // It estimates the relative size at which searching performs better
 // than iterating, based on the benchmarks in
-// https://github.com/ssomers/rust_bench_btreeset_intersection;
+// https://github.com/ssomers/rust_bench_btreeset_intersection.
 // It's used to divide rather than multiply sizes, to rule out overflow,
 // and it's a power of two to make that division cheap.
 const ITER_PERFORMANCE_TIPPING_SIZE_DIFF: usize = 16;
diff --git a/library/alloc/src/collections/btree/split.rs b/library/alloc/src/collections/btree/split.rs
index 701f36c37ee..6108c139bb3 100644
--- a/library/alloc/src/collections/btree/split.rs
+++ b/library/alloc/src/collections/btree/split.rs
@@ -23,8 +23,8 @@ impl<K, V> Root<K, V> {
             loop {
                 let mut split_edge = match search_node(left_node, key) {
                     // key is going to the right tree
-                    Found(handle) => handle.left_edge(),
-                    GoDown(handle) => handle,
+                    Found(kv) => kv.left_edge(),
+                    GoDown(edge) => edge,
                 };
 
                 split_edge.move_suffix(&mut right_node);
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index 5a5aa76a076..1a588b314c4 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -1173,133 +1173,133 @@ extern "rust-intrinsic" {
     /// Returns the square root of an `f32`
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::sqrt`](../../std/primitive.f32.html#method.sqrt)
+    /// [`f32::sqrt`](../../std/primitive.f32.html#method.sqrt)
     pub fn sqrtf32(x: f32) -> f32;
     /// Returns the square root of an `f64`
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::sqrt`](../../std/primitive.f64.html#method.sqrt)
+    /// [`f64::sqrt`](../../std/primitive.f64.html#method.sqrt)
     pub fn sqrtf64(x: f64) -> f64;
 
     /// Raises an `f32` to an integer power.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::powi`](../../std/primitive.f32.html#method.powi)
+    /// [`f32::powi`](../../std/primitive.f32.html#method.powi)
     pub fn powif32(a: f32, x: i32) -> f32;
     /// Raises an `f64` to an integer power.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::powi`](../../std/primitive.f64.html#method.powi)
+    /// [`f64::powi`](../../std/primitive.f64.html#method.powi)
     pub fn powif64(a: f64, x: i32) -> f64;
 
     /// Returns the sine of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::sin`](../../std/primitive.f32.html#method.sin)
+    /// [`f32::sin`](../../std/primitive.f32.html#method.sin)
     pub fn sinf32(x: f32) -> f32;
     /// Returns the sine of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::sin`](../../std/primitive.f64.html#method.sin)
+    /// [`f64::sin`](../../std/primitive.f64.html#method.sin)
     pub fn sinf64(x: f64) -> f64;
 
     /// Returns the cosine of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::cos`](../../std/primitive.f32.html#method.cos)
+    /// [`f32::cos`](../../std/primitive.f32.html#method.cos)
     pub fn cosf32(x: f32) -> f32;
     /// Returns the cosine of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::cos`](../../std/primitive.f64.html#method.cos)
+    /// [`f64::cos`](../../std/primitive.f64.html#method.cos)
     pub fn cosf64(x: f64) -> f64;
 
     /// Raises an `f32` to an `f32` power.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::powf`](../../std/primitive.f32.html#method.powf)
+    /// [`f32::powf`](../../std/primitive.f32.html#method.powf)
     pub fn powf32(a: f32, x: f32) -> f32;
     /// Raises an `f64` to an `f64` power.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::powf`](../../std/primitive.f64.html#method.powf)
+    /// [`f64::powf`](../../std/primitive.f64.html#method.powf)
     pub fn powf64(a: f64, x: f64) -> f64;
 
     /// Returns the exponential of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::exp`](../../std/primitive.f32.html#method.exp)
+    /// [`f32::exp`](../../std/primitive.f32.html#method.exp)
     pub fn expf32(x: f32) -> f32;
     /// Returns the exponential of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::exp`](../../std/primitive.f64.html#method.exp)
+    /// [`f64::exp`](../../std/primitive.f64.html#method.exp)
     pub fn expf64(x: f64) -> f64;
 
     /// Returns 2 raised to the power of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::exp2`](../../std/primitive.f32.html#method.exp2)
+    /// [`f32::exp2`](../../std/primitive.f32.html#method.exp2)
     pub fn exp2f32(x: f32) -> f32;
     /// Returns 2 raised to the power of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::exp2`](../../std/primitive.f64.html#method.exp2)
+    /// [`f64::exp2`](../../std/primitive.f64.html#method.exp2)
     pub fn exp2f64(x: f64) -> f64;
 
     /// Returns the natural logarithm of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::ln`](../../std/primitive.f32.html#method.ln)
+    /// [`f32::ln`](../../std/primitive.f32.html#method.ln)
     pub fn logf32(x: f32) -> f32;
     /// Returns the natural logarithm of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::ln`](../../std/primitive.f64.html#method.ln)
+    /// [`f64::ln`](../../std/primitive.f64.html#method.ln)
     pub fn logf64(x: f64) -> f64;
 
     /// Returns the base 10 logarithm of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::log10`](../../std/primitive.f32.html#method.log10)
+    /// [`f32::log10`](../../std/primitive.f32.html#method.log10)
     pub fn log10f32(x: f32) -> f32;
     /// Returns the base 10 logarithm of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::log10`](../../std/primitive.f64.html#method.log10)
+    /// [`f64::log10`](../../std/primitive.f64.html#method.log10)
     pub fn log10f64(x: f64) -> f64;
 
     /// Returns the base 2 logarithm of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::log2`](../../std/primitive.f32.html#method.log2)
+    /// [`f32::log2`](../../std/primitive.f32.html#method.log2)
     pub fn log2f32(x: f32) -> f32;
     /// Returns the base 2 logarithm of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::log2`](../../std/primitive.f64.html#method.log2)
+    /// [`f64::log2`](../../std/primitive.f64.html#method.log2)
     pub fn log2f64(x: f64) -> f64;
 
     /// Returns `a * b + c` for `f32` values.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::mul_add`](../../std/primitive.f32.html#method.mul_add)
+    /// [`f32::mul_add`](../../std/primitive.f32.html#method.mul_add)
     pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
     /// Returns `a * b + c` for `f64` values.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::mul_add`](../../std/primitive.f64.html#method.mul_add)
+    /// [`f64::mul_add`](../../std/primitive.f64.html#method.mul_add)
     pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
 
     /// Returns the absolute value of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::abs`](../../std/primitive.f32.html#method.abs)
+    /// [`f32::abs`](../../std/primitive.f32.html#method.abs)
     pub fn fabsf32(x: f32) -> f32;
     /// Returns the absolute value of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::abs`](../../std/primitive.f64.html#method.abs)
+    /// [`f64::abs`](../../std/primitive.f64.html#method.abs)
     pub fn fabsf64(x: f64) -> f64;
 
     /// Returns the minimum of two `f32` values.
@@ -1326,45 +1326,45 @@ extern "rust-intrinsic" {
     /// Copies the sign from `y` to `x` for `f32` values.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::copysign`](../../std/primitive.f32.html#method.copysign)
+    /// [`f32::copysign`](../../std/primitive.f32.html#method.copysign)
     pub fn copysignf32(x: f32, y: f32) -> f32;
     /// Copies the sign from `y` to `x` for `f64` values.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::copysign`](../../std/primitive.f64.html#method.copysign)
+    /// [`f64::copysign`](../../std/primitive.f64.html#method.copysign)
     pub fn copysignf64(x: f64, y: f64) -> f64;
 
     /// Returns the largest integer less than or equal to an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::floor`](../../std/primitive.f32.html#method.floor)
+    /// [`f32::floor`](../../std/primitive.f32.html#method.floor)
     pub fn floorf32(x: f32) -> f32;
     /// Returns the largest integer less than or equal to an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::floor`](../../std/primitive.f64.html#method.floor)
+    /// [`f64::floor`](../../std/primitive.f64.html#method.floor)
     pub fn floorf64(x: f64) -> f64;
 
     /// Returns the smallest integer greater than or equal to an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::ceil`](../../std/primitive.f32.html#method.ceil)
+    /// [`f32::ceil`](../../std/primitive.f32.html#method.ceil)
     pub fn ceilf32(x: f32) -> f32;
     /// Returns the smallest integer greater than or equal to an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::ceil`](../../std/primitive.f64.html#method.ceil)
+    /// [`f64::ceil`](../../std/primitive.f64.html#method.ceil)
     pub fn ceilf64(x: f64) -> f64;
 
     /// Returns the integer part of an `f32`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::trunc`](../../std/primitive.f32.html#method.trunc)
+    /// [`f32::trunc`](../../std/primitive.f32.html#method.trunc)
     pub fn truncf32(x: f32) -> f32;
     /// Returns the integer part of an `f64`.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::trunc`](../../std/primitive.f64.html#method.trunc)
+    /// [`f64::trunc`](../../std/primitive.f64.html#method.trunc)
     pub fn truncf64(x: f64) -> f64;
 
     /// Returns the nearest integer to an `f32`. May raise an inexact floating-point exception
@@ -1386,12 +1386,12 @@ extern "rust-intrinsic" {
     /// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f32::round`](../../std/primitive.f32.html#method.round)
+    /// [`f32::round`](../../std/primitive.f32.html#method.round)
     pub fn roundf32(x: f32) -> f32;
     /// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
     ///
     /// The stabilized version of this intrinsic is
-    /// [`std::f64::round`](../../std/primitive.f64.html#method.round)
+    /// [`f64::round`](../../std/primitive.f64.html#method.round)
     pub fn roundf64(x: f64) -> f64;
 
     /// Float addition that allows optimizations based on algebraic rules.
diff --git a/library/core/src/iter/adapters/peekable.rs b/library/core/src/iter/adapters/peekable.rs
index ebdc2555db2..2f8b9653c59 100644
--- a/library/core/src/iter/adapters/peekable.rs
+++ b/library/core/src/iter/adapters/peekable.rs
@@ -230,20 +230,24 @@ impl<I: Iterator> Peekable<I> {
     ///
     /// # Examples
     ///
+    /// Basic usage:
+    ///
     /// ```
     /// #![feature(peekable_peek_mut)]
     /// let mut iter = [1, 2, 3].iter().peekable();
     ///
+    /// // Like with `peek()`, we can see into the future without advancing the iterator.
+    /// assert_eq!(iter.peek_mut(), Some(&mut &1));
     /// assert_eq!(iter.peek_mut(), Some(&mut &1));
     /// assert_eq!(iter.next(), Some(&1));
     ///
-    /// // Peek into the iterator and modify the value which will be returned next
-    /// if let Some(mut p) = iter.peek_mut() {
-    ///     if *p == &2 {
-    ///         *p = &5;
-    ///     }
+    /// // Peek into the iterator and set the value behind the mutable reference.
+    /// if let Some(p) = iter.peek_mut() {
+    ///     assert_eq!(*p, &2);
+    ///     *p = &5;
     /// }
     ///
+    /// // The value we put in reappears as the iterator continues.
     /// assert_eq!(iter.collect::<Vec<_>>(), vec![&5, &3]);
     /// ```
     #[inline]
diff --git a/library/core/tests/num/nan.rs b/library/core/tests/num/nan.rs
index 011ffa790be..ef81988c961 100644
--- a/library/core/tests/num/nan.rs
+++ b/library/core/tests/num/nan.rs
@@ -1,6 +1,5 @@
 #[test]
 fn test_nan() {
-    use core::f64;
     let x = "NaN".to_string();
     assert_eq!(format!("{}", f64::NAN), x);
     assert_eq!(format!("{:e}", f64::NAN), x);
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 80b74a9ba9b..dad3add5c55 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -20,19 +20,30 @@
 /// explicitly using `as` allows a few more coercions that aren't allowed implicitly, such as
 /// changing the type of a raw pointer or turning closures into raw pointers.
 ///
-/// `as` is also used to rename imports in [`use`] and [`extern crate`] statements:
+/// `as` can be seen as the primitive for `From` and `Into`: `as` only works  with primitives
+/// (`u8`, `bool`, `str`, pointers, ...) whereas `From` and `Into`  also works with types like
+/// `String` or `Vec`.
+///
+/// `as` can also be used with the `_` placeholder when the destination type can be inferred. Note
+/// that this can cause inference breakage and usually such code should use an explicit type for
+/// both clarity and stability. This is most useful when converting pointers using `as *const _` or
+/// `as *mut _` though the [`cast`][const-cast] method is recommended over `as *const _` and it is
+/// [the same][mut-cast] for `as *mut _`: those methods make the intent clearer.
+///
+/// `as` is also used to rename imports in [`use`] and [`extern crate`][`crate`] statements:
 ///
 /// ```
 /// # #[allow(unused_imports)]
 /// use std::{mem as memory, net as network};
 /// // Now you can use the names `memory` and `network` to refer to `std::mem` and `std::net`.
 /// ```
-///
 /// For more information on what `as` is capable of, see the [Reference].
 ///
 /// [Reference]: ../reference/expressions/operator-expr.html#type-cast-expressions
+/// [`crate`]: keyword.crate.html
 /// [`use`]: keyword.use.html
-/// [`extern crate`]: keyword.crate.html
+/// [const-cast]: primitive.pointer.html#method.cast
+/// [mut-cast]: primitive.pointer.html#method.cast-1
 mod as_keyword {}
 
 #[doc(keyword = "break")]
@@ -707,8 +718,8 @@ mod impl_keyword {}
 ///
 /// ## Literal Examples:
 ///
-///    * `for _ **in** 1..3 {}` - Iterate over an exclusive range up to but excluding 3.
-///    * `for _ **in** 1..=3 {}` - Iterate over an inclusive range up to and including 3.
+///    * `for _ in 1..3 {}` - Iterate over an exclusive range up to but excluding 3.
+///    * `for _ in 1..=3 {}` - Iterate over an inclusive range up to and including 3.
 ///
 /// (Read more about [range patterns])
 ///
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index ff741e3bd53..1721c3c14f9 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -3,6 +3,7 @@
 use std::fs::File;
 use std::io;
 use std::io::prelude::Write;
+use std::time::Instant;
 
 use super::{
     bench::fmt_bench_samples,
@@ -14,7 +15,7 @@ use super::{
     options::{Options, OutputFormat},
     run_tests,
     test_result::TestResult,
-    time::TestExecTime,
+    time::{TestExecTime, TestSuiteExecTime},
     types::{NamePadding, TestDesc, TestDescAndFn},
 };
 
@@ -49,6 +50,7 @@ pub struct ConsoleTestState {
     pub allowed_fail: usize,
     pub filtered_out: usize,
     pub measured: usize,
+    pub exec_time: Option<TestSuiteExecTime>,
     pub metrics: MetricMap,
     pub failures: Vec<(TestDesc, Vec<u8>)>,
     pub not_failures: Vec<(TestDesc, Vec<u8>)>,
@@ -72,6 +74,7 @@ impl ConsoleTestState {
             allowed_fail: 0,
             filtered_out: 0,
             measured: 0,
+            exec_time: None,
             metrics: MetricMap::new(),
             failures: Vec::new(),
             not_failures: Vec::new(),
@@ -277,7 +280,14 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
     };
     let mut st = ConsoleTestState::new(opts)?;
 
+    // Prevent the usage of `Instant` in some cases:
+    // - It's currently not supported for wasm targets.
+    // - We disable it for miri because it's not available when isolation is enabled.
+    let is_instant_supported = !cfg!(target_arch = "wasm32") && !cfg!(miri);
+
+    let start_time = is_instant_supported.then(Instant::now);
     run_tests(opts, tests, |x| on_test_event(&x, &mut st, &mut *out))?;
+    st.exec_time = start_time.map(|t| TestSuiteExecTime(t.elapsed()));
 
     assert!(st.current_test_count() == st.total);
 
diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs
index 4dc4162700c..57b6d1a0202 100644
--- a/library/test/src/formatters/json.rs
+++ b/library/test/src/formatters/json.rs
@@ -47,7 +47,7 @@ impl<T: Write> JsonFormatter<T> {
             evt
         ))?;
         if let Some(exec_time) = exec_time {
-            self.write_message(&*format!(r#", "exec_time": "{}""#, exec_time))?;
+            self.write_message(&*format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64()))?;
         }
         if let Some(stdout) = stdout {
             self.write_message(&*format!(r#", "stdout": "{}""#, EscapedString(stdout)))?;
@@ -162,7 +162,7 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
     }
 
     fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
-        self.writeln_message(&*format!(
+        self.write_message(&*format!(
             "{{ \"type\": \"suite\", \
              \"event\": \"{}\", \
              \"passed\": {}, \
@@ -170,16 +170,23 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
              \"allowed_fail\": {}, \
              \"ignored\": {}, \
              \"measured\": {}, \
-             \"filtered_out\": {} }}",
+             \"filtered_out\": {}",
             if state.failed == 0 { "ok" } else { "failed" },
             state.passed,
             state.failed + state.allowed_fail,
             state.allowed_fail,
             state.ignored,
             state.measured,
-            state.filtered_out
+            state.filtered_out,
         ))?;
 
+        if let Some(ref exec_time) = state.exec_time {
+            let time_str = format!(", \"exec_time\": {}", exec_time.0.as_secs_f64());
+            self.write_message(&time_str)?;
+        }
+
+        self.writeln_message(" }")?;
+
         Ok(state.failed == 0)
     }
 }
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs
index 8c90b57b3ba..6fa36929841 100644
--- a/library/test/src/formatters/pretty.rs
+++ b/library/test/src/formatters/pretty.rs
@@ -259,7 +259,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
 
         let s = if state.allowed_fail > 0 {
             format!(
-                ". {} passed; {} failed ({} allowed); {} ignored; {} measured; {} filtered out\n\n",
+                ". {} passed; {} failed ({} allowed); {} ignored; {} measured; {} filtered out",
                 state.passed,
                 state.failed + state.allowed_fail,
                 state.allowed_fail,
@@ -269,13 +269,20 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
             )
         } else {
             format!(
-                ". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
+                ". {} passed; {} failed; {} ignored; {} measured; {} filtered out",
                 state.passed, state.failed, state.ignored, state.measured, state.filtered_out
             )
         };
 
         self.write_plain(&s)?;
 
+        if let Some(ref exec_time) = state.exec_time {
+            let time_str = format!("; finished in {}", exec_time);
+            self.write_plain(&time_str)?;
+        }
+
+        self.write_plain("\n\n")?;
+
         Ok(success)
     }
 }
diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs
index 1ae7846a99e..6f46f7255a4 100644
--- a/library/test/src/formatters/terse.rs
+++ b/library/test/src/formatters/terse.rs
@@ -236,7 +236,7 @@ impl<T: Write> OutputFormatter for TerseFormatter<T> {
 
         let s = if state.allowed_fail > 0 {
             format!(
-                ". {} passed; {} failed ({} allowed); {} ignored; {} measured; {} filtered out\n\n",
+                ". {} passed; {} failed ({} allowed); {} ignored; {} measured; {} filtered out",
                 state.passed,
                 state.failed + state.allowed_fail,
                 state.allowed_fail,
@@ -246,13 +246,20 @@ impl<T: Write> OutputFormatter for TerseFormatter<T> {
             )
         } else {
             format!(
-                ". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
+                ". {} passed; {} failed; {} ignored; {} measured; {} filtered out",
                 state.passed, state.failed, state.ignored, state.measured, state.filtered_out
             )
         };
 
         self.write_plain(&s)?;
 
+        if let Some(ref exec_time) = state.exec_time {
+            let time_str = format!("; finished in {}", exec_time);
+            self.write_plain(&time_str)?;
+        }
+
+        self.write_plain("\n\n")?;
+
         Ok(success)
     }
 }
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 85a0705f69c..74313cc4438 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -669,6 +669,7 @@ fn should_sort_failures_before_printing_them() {
         allowed_fail: 0,
         filtered_out: 0,
         measured: 0,
+        exec_time: None,
         metrics: MetricMap::new(),
         failures: vec![(test_b, Vec::new()), (test_a, Vec::new())],
         options: Options::new(),
diff --git a/library/test/src/time.rs b/library/test/src/time.rs
index 96c090f9b01..130792fa5d7 100644
--- a/library/test/src/time.rs
+++ b/library/test/src/time.rs
@@ -1,8 +1,9 @@
 //! Module `time` contains everything related to the time measurement of unit tests
 //! execution.
-//! Two main purposes of this module:
+//! The purposes of this module:
 //! - Check whether test is timed out.
 //! - Provide helpers for `report-time` and `measure-time` options.
+//! - Provide newtypes for executions times.
 
 use std::env;
 use std::fmt;
@@ -60,7 +61,7 @@ pub fn get_default_test_timeout() -> Instant {
     Instant::now() + Duration::from_secs(TEST_WARN_TIMEOUT_S)
 }
 
-/// The meassured execution time of a unit test.
+/// The measured execution time of a unit test.
 #[derive(Debug, Clone, PartialEq)]
 pub struct TestExecTime(pub Duration);
 
@@ -70,6 +71,16 @@ impl fmt::Display for TestExecTime {
     }
 }
 
+/// The measured execution time of the whole test suite.
+#[derive(Debug, Clone, Default, PartialEq)]
+pub struct TestSuiteExecTime(pub Duration);
+
+impl fmt::Display for TestSuiteExecTime {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{:.2}s", self.0.as_secs_f64())
+    }
+}
+
 /// Structure denoting time limits for test execution.
 #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
 pub struct TimeThreshold {
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 9fcbe8e1e35..fb2c6d1f92a 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -551,7 +551,7 @@ impl Config {
         config.deny_warnings = true;
         config.missing_tools = false;
 
-        // set by bootstrap.py
+        // set by build.rs
         config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
         let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
         // Undo `src/bootstrap`
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 9b77e38a847..354be109cf2 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -1183,7 +1183,11 @@ impl Step for PlainSourceTarball {
 // characters and on `C:\` paths, so normalize both of them away.
 pub fn sanitize_sh(path: &Path) -> String {
     let path = path.to_str().unwrap().replace("\\", "/");
-    return change_drive(&path).unwrap_or(path);
+    return change_drive(unc_to_lfs(&path)).unwrap_or(path);
+
+    fn unc_to_lfs(s: &str) -> &str {
+        if s.starts_with("//?/") { &s[4..] } else { s }
+    }
 
     fn change_drive(s: &str) -> Option<String> {
         let mut ch = s.chars();
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile
index 1075947c9cf..8413d775ac4 100644
--- a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile
@@ -30,5 +30,10 @@ ENV \
 
 ENV HOSTS=x86_64-unknown-freebsd
 
-ENV RUST_CONFIGURE_ARGS --enable-extended --enable-profiler --enable-sanitizers --disable-docs
+ENV RUST_CONFIGURE_ARGS \
+    --enable-full-tools \
+    --enable-extended \
+    --enable-profiler \
+    --enable-sanitizers \
+    --disable-docs
 ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py
index b74d47a8002..cabf5dccbfe 100644
--- a/src/etc/gdb_providers.py
+++ b/src/etc/gdb_providers.py
@@ -352,7 +352,7 @@ class StdHashMapProvider:
         ctrl = table["ctrl"]["pointer"]
 
         self.size = int(table["items"])
-        self.pair_type = table.type.template_argument(0)
+        self.pair_type = table.type.template_argument(0).strip_typedefs()
 
         self.new_layout = not table.type.has_key("data")
         if self.new_layout:
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index 64cb9837943..9c7b07efbaa 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -531,7 +531,7 @@ class StdHashMapSyntheticProvider:
         ctrl = table.GetChildMemberWithName("ctrl").GetChildAtIndex(0)
 
         self.size = table.GetChildMemberWithName("items").GetValueAsUnsigned()
-        self.pair_type = table.type.template_args[0]
+        self.pair_type = table.type.template_args[0].GetTypedefedType()
         self.pair_type_size = self.pair_type.GetByteSize()
 
         self.new_layout = not table.GetChildMemberWithName("data").IsValid()
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 13643fbf3d3..9e8ce452924 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -162,18 +162,30 @@ impl Clean<ExternalCrate> for CrateNum {
                 .collect()
         };
 
+        let get_span =
+            |attr: &ast::NestedMetaItem| Some(attr.meta_item()?.name_value_literal()?.span);
+
         let as_keyword = |res: Res| {
             if let Res::Def(DefKind::Mod, def_id) = res {
                 let attrs = cx.tcx.get_attrs(def_id).clean(cx);
                 let mut keyword = None;
                 for attr in attrs.lists(sym::doc) {
-                    if let Some(v) = attr.value_str() {
-                        if attr.has_name(sym::keyword) {
-                            if v.is_doc_keyword() {
-                                keyword = Some(v.to_string());
-                                break;
+                    if attr.has_name(sym::keyword) {
+                        if let Some(v) = attr.value_str() {
+                            let k = v.to_string();
+                            if !rustc_lexer::is_ident(&k) {
+                                let sp = get_span(&attr).unwrap_or_else(|| attr.span());
+                                cx.tcx
+                                    .sess
+                                    .struct_span_err(
+                                        sp,
+                                        &format!("`{}` is not a valid identifier", v),
+                                    )
+                                    .emit();
+                            } else {
+                                keyword = Some(k);
                             }
-                            // FIXME: should warn on unknown keywords?
+                            break;
                         }
                     }
                 }
@@ -2315,22 +2327,49 @@ impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Ident>) {
     }
 }
 
-impl Clean<Item> for doctree::Macro {
+impl Clean<Item> for (&hir::MacroDef<'_>, Option<Ident>) {
     fn clean(&self, cx: &DocContext<'_>) -> Item {
-        Item::from_def_id_and_parts(
-            self.def_id,
-            Some(self.name.clean(cx)),
-            MacroItem(Macro {
-                source: format!(
-                    "macro_rules! {} {{\n{}}}",
-                    self.name,
-                    self.matchers
+        let (item, renamed) = self;
+        let name = renamed.unwrap_or(item.ident).name;
+        let tts = item.ast.body.inner_tokens().trees().collect::<Vec<_>>();
+        // Extract the spans of all matchers. They represent the "interface" of the macro.
+        let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect::<Vec<_>>();
+        let source = if item.ast.macro_rules {
+            format!(
+                "macro_rules! {} {{\n{}}}",
+                name,
+                matchers
+                    .iter()
+                    .map(|span| { format!("    {} => {{ ... }};\n", span.to_src(cx)) })
+                    .collect::<String>(),
+            )
+        } else {
+            let vis = item.vis.clean(cx);
+
+            if matchers.len() <= 1 {
+                format!(
+                    "{}macro {}{} {{\n    ...\n}}",
+                    vis.print_with_space(),
+                    name,
+                    matchers.iter().map(|span| span.to_src(cx)).collect::<String>(),
+                )
+            } else {
+                format!(
+                    "{}macro {} {{\n{}}}",
+                    vis.print_with_space(),
+                    name,
+                    matchers
                         .iter()
-                        .map(|span| { format!("    {} => {{ ... }};\n", span.to_src(cx)) })
-                        .collect::<String>()
-                ),
-                imported_from: self.imported_from.clean(cx),
-            }),
+                        .map(|span| { format!("    {} => {{ ... }},\n", span.to_src(cx)) })
+                        .collect::<String>(),
+                )
+            }
+        };
+
+        Item::from_hir_id_and_parts(
+            item.hir_id,
+            Some(name),
+            MacroItem(Macro { source, imported_from: None }),
             cx,
         )
     }
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index 20f747e2014..3961870a1bf 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -18,7 +18,7 @@ crate struct Module<'hir> {
     // (item, renamed)
     crate items: Vec<(&'hir hir::Item<'hir>, Option<Ident>)>,
     crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Ident>)>,
-    crate macros: Vec<Macro>,
+    crate macros: Vec<(&'hir hir::MacroDef<'hir>, Option<Ident>)>,
     crate is_crate: bool,
 }
 
@@ -56,15 +56,6 @@ crate struct Variant<'hir> {
     crate def: &'hir hir::VariantData<'hir>,
 }
 
-// For Macro we store the DefId instead of the NodeId, since we also create
-// these imported macro_rules (which only have a DUMMY_NODE_ID).
-crate struct Macro {
-    crate name: Symbol,
-    crate def_id: hir::def_id::DefId,
-    crate matchers: Vec<Span>,
-    crate imported_from: Option<Symbol>,
-}
-
 #[derive(Debug)]
 crate struct Import<'hir> {
     crate name: Symbol,
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 147a8d33765..bbd4be88e6a 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1844,7 +1844,7 @@ fn document(w: &mut Buffer, cx: &Context, item: &clean::Item, parent: Option<&cl
     if let Some(ref name) = item.name {
         info!("Documenting {}", name);
     }
-    document_stability(w, cx, item, false, parent);
+    document_item_info(w, cx, item, false, parent);
     document_full(w, item, cx, "", false);
 }
 
@@ -1880,10 +1880,17 @@ fn render_markdown(
 fn document_short(
     w: &mut Buffer,
     item: &clean::Item,
+    cx: &Context,
     link: AssocItemLink<'_>,
     prefix: &str,
     is_hidden: bool,
+    parent: Option<&clean::Item>,
+    show_def_docs: bool,
 ) {
+    document_item_info(w, cx, item, is_hidden, parent);
+    if !show_def_docs {
+        return;
+    }
     if let Some(s) = item.doc_value() {
         let mut summary_html = MarkdownSummaryLine(s, &item.links()).into_string();
 
@@ -1928,18 +1935,23 @@ fn document_full(w: &mut Buffer, item: &clean::Item, cx: &Context, prefix: &str,
     }
 }
 
-fn document_stability(
+/// Add extra information about an item such as:
+///
+/// * Stability
+/// * Deprecated
+/// * Required features (through the `doc_cfg` feature)
+fn document_item_info(
     w: &mut Buffer,
     cx: &Context,
     item: &clean::Item,
     is_hidden: bool,
     parent: Option<&clean::Item>,
 ) {
-    let stabilities = short_stability(item, cx, parent);
-    if !stabilities.is_empty() {
-        write!(w, "<div class=\"stability{}\">", if is_hidden { " hidden" } else { "" });
-        for stability in stabilities {
-            write!(w, "{}", stability);
+    let item_infos = short_item_info(item, cx, parent);
+    if !item_infos.is_empty() {
+        write!(w, "<div class=\"item-info{}\">", if is_hidden { " hidden" } else { "" });
+        for info in item_infos {
+            write!(w, "{}", info);
         }
         write!(w, "</div>");
     }
@@ -2194,7 +2206,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
                          <td class=\"docblock-short\">{stab_tags}{docs}</td>\
                      </tr>",
                     name = *myitem.name.as_ref().unwrap(),
-                    stab_tags = stability_tags(myitem, item),
+                    stab_tags = extra_info_tags(myitem, item),
                     docs = MarkdownSummaryLine(doc_value, &myitem.links()).into_string(),
                     class = myitem.type_(),
                     add = add,
@@ -2216,9 +2228,9 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
     }
 }
 
-/// Render the stability and deprecation tags that are displayed in the item's summary at the
-/// module level.
-fn stability_tags(item: &clean::Item, parent: &clean::Item) -> String {
+/// Render the stability, deprecation and portability tags that are displayed in the item's summary
+/// at the module level.
+fn extra_info_tags(item: &clean::Item, parent: &clean::Item) -> String {
     let mut tags = String::new();
 
     fn tag_html(class: &str, title: &str, contents: &str) -> String {
@@ -2271,10 +2283,10 @@ fn portability(item: &clean::Item, parent: Option<&clean::Item>) -> Option<Strin
     Some(format!("<div class=\"stab portability\">{}</div>", cfg?.render_long_html()))
 }
 
-/// Render the stability and/or deprecation warning that is displayed at the top of the item's
-/// documentation.
-fn short_stability(item: &clean::Item, cx: &Context, parent: Option<&clean::Item>) -> Vec<String> {
-    let mut stability = vec![];
+/// Render the stability, deprecation and portability information that is displayed at the top of
+/// the item's documentation.
+fn short_item_info(item: &clean::Item, cx: &Context, parent: Option<&clean::Item>) -> Vec<String> {
+    let mut extra_info = vec![];
     let error_codes = cx.shared.codes;
 
     if let Some(Deprecation { ref note, ref since, is_since_rustc_version }) = item.deprecation {
@@ -2301,7 +2313,7 @@ fn short_stability(item: &clean::Item, cx: &Context, parent: Option<&clean::Item
             );
             message.push_str(&format!(": {}", html.into_string()));
         }
-        stability.push(format!(
+        extra_info.push(format!(
             "<div class=\"stab deprecated\"><span class=\"emoji\">👎</span> {}</div>",
             message,
         ));
@@ -2345,14 +2357,14 @@ fn short_stability(item: &clean::Item, cx: &Context, parent: Option<&clean::Item
             );
         }
 
-        stability.push(format!("<div class=\"stab unstable\">{}</div>", message));
+        extra_info.push(format!("<div class=\"stab unstable\">{}</div>", message));
     }
 
     if let Some(portability) = portability(item, parent) {
-        stability.push(portability);
+        extra_info.push(portability);
     }
 
-    stability
+    extra_info
 }
 
 fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Constant) {
@@ -3703,7 +3715,7 @@ fn render_impl(
 
         if trait_.is_some() {
             if let Some(portability) = portability(&i.impl_item, Some(parent)) {
-                write!(w, "<div class=\"stability\">{}</div>", portability);
+                write!(w, "<div class=\"item-info\">{}</div>", portability);
             }
         }
 
@@ -3801,26 +3813,32 @@ fn render_impl(
                     if let Some(it) = t.items.iter().find(|i| i.name == item.name) {
                         // We need the stability of the item from the trait
                         // because impls can't have a stability.
-                        document_stability(w, cx, it, is_hidden, Some(parent));
                         if item.doc_value().is_some() {
+                            document_item_info(w, cx, it, is_hidden, Some(parent));
                             document_full(w, item, cx, "", is_hidden);
-                        } else if show_def_docs {
+                        } else {
                             // In case the item isn't documented,
                             // provide short documentation from the trait.
-                            document_short(w, it, link, "", is_hidden);
+                            document_short(
+                                w,
+                                it,
+                                cx,
+                                link,
+                                "",
+                                is_hidden,
+                                Some(parent),
+                                show_def_docs,
+                            );
                         }
                     }
                 } else {
-                    document_stability(w, cx, item, is_hidden, Some(parent));
+                    document_item_info(w, cx, item, is_hidden, Some(parent));
                     if show_def_docs {
                         document_full(w, item, cx, "", is_hidden);
                     }
                 }
             } else {
-                document_stability(w, cx, item, is_hidden, Some(parent));
-                if show_def_docs {
-                    document_short(w, item, link, "", is_hidden);
-                }
+                document_short(w, item, cx, link, "", is_hidden, Some(parent), show_def_docs);
             }
         }
     }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index b11bd667093..7ca43684dce 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2266,7 +2266,7 @@ function defocusSearchBar() {
                         }
                     }
                     var ns = n.nextElementSibling;
-                    while (ns && (hasClass(ns, "docblock") || hasClass(ns, "stability"))) {
+                    while (ns && (hasClass(ns, "docblock") || hasClass(ns, "item-info"))) {
                         if (addOrRemove) {
                             addClass(ns, "hidden-by-impl-hider");
                         } else {
@@ -2282,7 +2282,7 @@ function defocusSearchBar() {
         var action = mode;
         if (hasClass(toggle.parentNode, "impl") === false) {
             relatedDoc = toggle.parentNode.nextElementSibling;
-            if (hasClass(relatedDoc, "stability")) {
+            if (hasClass(relatedDoc, "item-info")) {
                 relatedDoc = relatedDoc.nextElementSibling;
             }
             if (hasClass(relatedDoc, "docblock") || hasClass(relatedDoc, "sub-variant")) {
@@ -2332,16 +2332,17 @@ function defocusSearchBar() {
             var dontApplyBlockRule = toggle.parentNode.parentNode.id !== "main";
             if (action === "show") {
                 removeClass(relatedDoc, "fns-now-collapsed");
-                // Stability information is never hidden.
-                if (hasClass(docblock, "stability") === false) {
+                // Stability/deprecation/portability information is never hidden.
+                if (hasClass(docblock, "item-info") === false) {
                     removeClass(docblock, "hidden-by-usual-hider");
                 }
                 onEachLazy(toggle.childNodes, adjustToggle(false, dontApplyBlockRule));
                 onEachLazy(relatedDoc.childNodes, implHider(false, dontApplyBlockRule));
             } else if (action === "hide") {
                 addClass(relatedDoc, "fns-now-collapsed");
-                // Stability information should be shown even when detailed info is hidden.
-                if (hasClass(docblock, "stability") === false) {
+                // Stability/deprecation/portability information should be shown even when detailed
+                // info is hidden.
+                if (hasClass(docblock, "item-info") === false) {
                     addClass(docblock, "hidden-by-usual-hider");
                 }
                 onEachLazy(toggle.childNodes, adjustToggle(true, dontApplyBlockRule));
@@ -2445,7 +2446,7 @@ function defocusSearchBar() {
 
         var func = function(e) {
             var next = e.nextElementSibling;
-            if (next && hasClass(next, "stability")) {
+            if (next && hasClass(next, "item-info")) {
               next = next.nextElementSibling;
             }
             if (!next) {
@@ -2462,7 +2463,7 @@ function defocusSearchBar() {
 
         var funcImpl = function(e) {
             var next = e.nextElementSibling;
-            if (next && hasClass(next, "stability")) {
+            if (next && hasClass(next, "item-info")) {
                 next = next.nextElementSibling;
             }
             if (next && hasClass(next, "docblock")) {
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 7d22913b99d..8eef65a231d 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -553,21 +553,21 @@ h4 > code, h3 > code, .invisible > code {
 	border: none;
 }
 
-.content .stability code {
+.content .item-info code {
 	font-size: 90%;
 }
 
-.content .stability {
+.content .item-info {
 	position: relative;
 	margin-left: 33px;
 	margin-top: -13px;
 }
 
-.sub-variant > div > .stability {
+.sub-variant > div > .item-info {
 	margin-top: initial;
 }
 
-.content .stability::before {
+.content .item-info::before {
 	content: '⬑';
 	font-size: 25px;
 	position: absolute;
@@ -579,15 +579,15 @@ h4 > code, h3 > code, .invisible > code {
 	margin-left: 20px;
 }
 
-.content .impl-items .docblock, .content .impl-items .stability {
+.content .impl-items .docblock, .content .impl-items .item-info {
 	margin-bottom: .6em;
 }
 
-.content .impl-items > .stability {
+.content .impl-items > .item-info {
 	margin-left: 40px;
 }
 
-.methods > .stability, .content .impl-items > .stability {
+.methods > .item-info, .content .impl-items > .item-info {
 	margin-top: -8px;
 }
 
@@ -595,7 +595,7 @@ h4 > code, h3 > code, .invisible > code {
 	flex-basis: 100%;
 }
 
-#main > .stability {
+#main > .item-info {
 	margin-top: 0;
 }
 
@@ -655,7 +655,7 @@ a {
 }
 
 .docblock a:not(.srclink):not(.test-arrow):hover,
-.docblock-short a:not(.srclink):not(.test-arrow):hover, .stability a {
+.docblock-short a:not(.srclink):not(.test-arrow):hover, .item-info a {
 	text-decoration: underline;
 }
 
diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css
index d1cddf0d656..c1f796f09e8 100644
--- a/src/librustdoc/html/static/themes/ayu.css
+++ b/src/librustdoc/html/static/themes/ayu.css
@@ -166,7 +166,7 @@ pre {
 	color: #c5c5c5;
 }
 
-.content .stability::before { color: #ccc; }
+.content .item-info::before { color: #ccc; }
 
 .content span.foreigntype, .content a.foreigntype { color: #ef57ff; }
 .content span.union, .content a.union { color: #98a01c; }
@@ -219,7 +219,7 @@ a {
 }
 
 .docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
+.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
 #help a {
 	color: #39AFD7;
 }
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index 3545943b3fd..946ca0a40c9 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -136,7 +136,7 @@ pre {
 .content .highlighted.primitive { background-color: #00708a; }
 .content .highlighted.keyword { background-color: #884719; }
 
-.content .stability::before { color: #ccc; }
+.content .item-info::before { color: #ccc; }
 
 .content span.enum, .content a.enum, .block a.current.enum { color: #82b089; }
 .content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
@@ -177,7 +177,7 @@ a {
 }
 
 .docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
+.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
 #help a {
 	color: #D2991D;
 }
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index 4ce4b63e2c6..e0b9a04921a 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -134,7 +134,7 @@ pre {
 .content .highlighted.primitive { background-color: #9aecff; }
 .content .highlighted.keyword { background-color: #f99650; }
 
-.content .stability::before { color: #ccc; }
+.content .item-info::before { color: #ccc; }
 
 .content span.enum, .content a.enum, .block a.current.enum { color: #508157; }
 .content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; }
@@ -175,7 +175,7 @@ a {
 }
 
 .docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
+.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
 #help a {
 	color: #3873AD;
 }
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 02152edbbc2..4028293076d 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -71,9 +71,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             None,
         );
         // Attach the crate's exported macros to the top-level module:
-        module
-            .macros
-            .extend(krate.exported_macros.iter().map(|def| self.visit_local_macro(def, None)));
+        module.macros.extend(krate.exported_macros.iter().map(|def| (def, None)));
         module.is_crate = true;
 
         self.cx.renderinfo.get_mut().exact_paths = self.exact_paths;
@@ -216,7 +214,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
                 true
             }
             Node::MacroDef(def) if !glob => {
-                om.macros.push(self.visit_local_macro(def, renamed.map(|i| i.name)));
+                om.macros.push((def, renamed));
                 true
             }
             _ => false,
@@ -339,19 +337,4 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             om.foreigns.push((item, renamed));
         }
     }
-
-    // Convert each `exported_macro` into a doc item.
-    fn visit_local_macro(&self, def: &'tcx hir::MacroDef<'_>, renamed: Option<Symbol>) -> Macro {
-        debug!("visit_local_macro: {}", def.ident);
-        let tts = def.ast.body.inner_tokens().trees().collect::<Vec<_>>();
-        // Extract the spans of all matchers. They represent the "interface" of the macro.
-        let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect();
-
-        Macro {
-            def_id: self.cx.tcx.hir().local_def_id(def.hir_id).to_def_id(),
-            name: renamed.unwrap_or(def.ident.name),
-            matchers,
-            imported_from: None,
-        }
-    }
 }
diff --git a/src/test/codegen/enum-discriminant-value.rs b/src/test/codegen/enum-discriminant-value.rs
index f9da987765f..cc14c212002 100644
--- a/src/test/codegen/enum-discriminant-value.rs
+++ b/src/test/codegen/enum-discriminant-value.rs
@@ -4,14 +4,14 @@
 
 #[repr(i64)]
 pub enum I64 {
-    I64Min = std::i64::MIN,
-    I64Max = std::i64::MAX,
+    I64Min = i64::MIN,
+    I64Max = i64::MAX,
 }
 
 #[repr(u64)]
 pub enum U64 {
-    U64Min = std::u64::MIN,
-    U64Max = std::u64::MAX,
+    U64Min = u64::MIN,
+    U64Max = u64::MAX,
 }
 
 fn main() {
diff --git a/src/test/codegen/issue-56927.rs b/src/test/codegen/issue-56927.rs
index d502673e2f8..2c84015d5e2 100644
--- a/src/test/codegen/issue-56927.rs
+++ b/src/test/codegen/issue-56927.rs
@@ -1,7 +1,6 @@
 // compile-flags: -C no-prepopulate-passes
 
 #![crate_type="rlib"]
-use std::usize;
 
 #[repr(align(16))]
 pub struct S {
diff --git a/src/test/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs b/src/test/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs
new file mode 100644
index 00000000000..b5b0b1330a6
--- /dev/null
+++ b/src/test/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs
@@ -0,0 +1,47 @@
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "lib"]
+
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
+#![allow(non_camel_case_types)]
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct M(pub f32, pub f32, pub f32, pub f32);
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct S<const N: usize>([f32; N]);
+
+extern "platform-intrinsic" {
+    fn simd_extract<T, U>(x: T, idx: u32) -> U;
+    fn simd_insert<T, U>(x: T, idx: u32, b: U) -> T;
+}
+
+// CHECK-LABEL: @extract_m
+#[no_mangle]
+pub unsafe fn extract_m(v: M, i: u32) -> f32  {
+    // CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
+    simd_extract(v, i)
+}
+
+// CHECK-LABEL: @extract_s
+#[no_mangle]
+pub unsafe fn extract_s(v: S<4>, i: u32) -> f32  {
+    // CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
+    simd_extract(v, i)
+}
+
+// CHECK-LABEL: @insert_m
+#[no_mangle]
+pub unsafe fn insert_m(v: M, i: u32, j: f32) -> M  {
+    // CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i
+    simd_insert(v, i, j)
+}
+
+// CHECK-LABEL: @insert_s
+#[no_mangle]
+pub unsafe fn insert_s(v: S<4>, i: u32, j: f32) -> S<4>  {
+    // CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i
+    simd_insert(v, i, j)
+}
diff --git a/src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs
new file mode 100644
index 00000000000..56466a78d5a
--- /dev/null
+++ b/src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs
@@ -0,0 +1,44 @@
+// ignore-tidy-linelength
+// compile-flags: -C no-prepopulate-passes
+// min-llvm-version 8.0
+
+#![crate_type = "lib"]
+
+#![allow(non_camel_case_types)]
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct S<const N: usize>([f32; N]);
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct T([f32; 4]);
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct U(f32, f32, f32, f32);
+
+// CHECK-LABEL: @build_array_s
+#[no_mangle]
+pub fn build_array_s(x: [f32; 4]) -> S<4> {
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    S::<4>(x)
+}
+
+// CHECK-LABEL: @build_array_t
+#[no_mangle]
+pub fn build_array_t(x: [f32; 4]) -> T {
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    T(x)
+}
+
+// CHECK-LABEL: @build_array_u
+#[no_mangle]
+pub fn build_array_u(x: [f32; 4]) -> U {
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{[0-9]+}}(i8* {{.*}} %{{[0-9]+}}, i8* {{.*}} %{{[0-9]+}}, i{{[0-9]+}} 16, i1 false)
+    unsafe { std::mem::transmute(x) }
+}
diff --git a/src/test/compile-fail/consts/issue-55878.rs b/src/test/compile-fail/consts/issue-55878.rs
index 541befa7b13..fee664caa17 100644
--- a/src/test/compile-fail/consts/issue-55878.rs
+++ b/src/test/compile-fail/consts/issue-55878.rs
@@ -3,5 +3,5 @@
 
 // error-pattern: are too big for the current architecture
 fn main() {
-    println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
+    println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
 }
diff --git a/src/test/run-make-fulldeps/libtest-json/Makefile b/src/test/run-make-fulldeps/libtest-json/Makefile
index 8339e230bbe..f61a1aa8410 100644
--- a/src/test/run-make-fulldeps/libtest-json/Makefile
+++ b/src/test/run-make-fulldeps/libtest-json/Makefile
@@ -13,6 +13,6 @@ all:
 	cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py
 	cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py
 
-	# Compare to output file
-	diff output-default.json $(OUTPUT_FILE_DEFAULT)
-	diff output-stdout-success.json $(OUTPUT_FILE_STDOUT_SUCCESS)
+	# Normalize the actual output and compare to expected output file
+	cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json -
+	cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json -
diff --git a/src/test/run-make-fulldeps/libtest-json/output-default.json b/src/test/run-make-fulldeps/libtest-json/output-default.json
index 0cd9ab79e32..099b65a23ca 100644
--- a/src/test/run-make-fulldeps/libtest-json/output-default.json
+++ b/src/test/run-make-fulldeps/libtest-json/output-default.json
@@ -7,4 +7,4 @@
 { "type": "test", "name": "c", "event": "ok" }
 { "type": "test", "event": "started", "name": "d" }
 { "type": "test", "name": "d", "event": "ignored" }
-{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0 }
+{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME }
diff --git a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json
index dfaf005052e..fd676799a76 100644
--- a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json
+++ b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json
@@ -7,4 +7,4 @@
 { "type": "test", "name": "c", "event": "ok", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:15:5\n" }
 { "type": "test", "event": "started", "name": "d" }
 { "type": "test", "name": "d", "event": "ignored" }
-{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0 }
+{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME }
diff --git a/src/test/rustdoc-ui/cfg-test.rs b/src/test/rustdoc-ui/cfg-test.rs
index 597c86a1f19..d4ca9258587 100644
--- a/src/test/rustdoc-ui/cfg-test.rs
+++ b/src/test/rustdoc-ui/cfg-test.rs
@@ -1,6 +1,7 @@
 // check-pass
 // compile-flags:--test --test-args --test-threads=1
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // Crates like core have doctests gated on `cfg(not(test))` so we need to make
 // sure `cfg(test)` is not active when running `rustdoc --test`.
diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout
index 474f13cfa98..2960ff8d3b4 100644
--- a/src/test/rustdoc-ui/cfg-test.stdout
+++ b/src/test/rustdoc-ui/cfg-test.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test $DIR/cfg-test.rs - Bar (line 26) ... ok
-test $DIR/cfg-test.rs - Foo (line 18) ... ok
+test $DIR/cfg-test.rs - Bar (line 27) ... ok
+test $DIR/cfg-test.rs - Foo (line 19) ... ok
 
-test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doc-test-doctest-feature.rs b/src/test/rustdoc-ui/doc-test-doctest-feature.rs
index 2798804880a..0b79aaece8a 100644
--- a/src/test/rustdoc-ui/doc-test-doctest-feature.rs
+++ b/src/test/rustdoc-ui/doc-test-doctest-feature.rs
@@ -1,6 +1,7 @@
 // check-pass
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // Make sure `cfg(doctest)` is set when finding doctests but not inside
 // the doctests.
diff --git a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
index b1cd74bf852..d7de1f10522 100644
--- a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
+++ b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/doc-test-doctest-feature.rs - Foo (line 8) ... ok
+test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok
 
-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs b/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs
index 2af5782453e..bf334c67eca 100644
--- a/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs
+++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs
@@ -1,6 +1,7 @@
 // check-pass
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 #![feature(doc_cfg)]
 
diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
index f2525c2dbec..5b07fc4c87a 100644
--- a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
+++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/doc-test-rustdoc-feature.rs - Foo (line 9) ... ok
+test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok
 
-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doctest-output.rs b/src/test/rustdoc-ui/doctest-output.rs
index e0e1e061ac7..2670fa57201 100644
--- a/src/test/rustdoc-ui/doctest-output.rs
+++ b/src/test/rustdoc-ui/doctest-output.rs
@@ -2,6 +2,7 @@
 // aux-build:extern_macros.rs
 // compile-flags:--test --test-args=--test-threads=1
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
 //! ```
diff --git a/src/test/rustdoc-ui/doctest-output.stdout b/src/test/rustdoc-ui/doctest-output.stdout
index c72bd91d1dd..35b0e366fb5 100644
--- a/src/test/rustdoc-ui/doctest-output.stdout
+++ b/src/test/rustdoc-ui/doctest-output.stdout
@@ -1,8 +1,8 @@
 
 running 3 tests
-test $DIR/doctest-output.rs - (line 7) ... ok
-test $DIR/doctest-output.rs - ExpandedStruct (line 23) ... ok
-test $DIR/doctest-output.rs - foo::bar (line 17) ... ok
+test $DIR/doctest-output.rs - (line 8) ... ok
+test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok
+test $DIR/doctest-output.rs - foo::bar (line 18) ... ok
 
-test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/failed-doctest-compile-fail.rs b/src/test/rustdoc-ui/failed-doctest-compile-fail.rs
index 297d6efd45f..6f2ff5d703a 100644
--- a/src/test/rustdoc-ui/failed-doctest-compile-fail.rs
+++ b/src/test/rustdoc-ui/failed-doctest-compile-fail.rs
@@ -3,6 +3,7 @@
 
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
 /// ```compile_fail
diff --git a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
index 74e33d7beeb..b8bb5ccb403 100644
--- a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
@@ -1,14 +1,14 @@
 
 running 1 test
-test $DIR/failed-doctest-compile-fail.rs - Foo (line 8) ... FAILED
+test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) ... FAILED
 
 failures:
 
----- $DIR/failed-doctest-compile-fail.rs - Foo (line 8) stdout ----
+---- $DIR/failed-doctest-compile-fail.rs - Foo (line 9) stdout ----
 Test compiled successfully, but it's marked `compile_fail`.
 
 failures:
-    $DIR/failed-doctest-compile-fail.rs - Foo (line 8)
+    $DIR/failed-doctest-compile-fail.rs - Foo (line 9)
 
-test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/failed-doctest-missing-codes.rs b/src/test/rustdoc-ui/failed-doctest-missing-codes.rs
index 62102062d49..57b70b478e6 100644
--- a/src/test/rustdoc-ui/failed-doctest-missing-codes.rs
+++ b/src/test/rustdoc-ui/failed-doctest-missing-codes.rs
@@ -3,6 +3,7 @@
 
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
 /// ```compile_fail,E0004
diff --git a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
index e4ed4622322..7367a7d6519 100644
--- a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
@@ -1,12 +1,12 @@
 
 running 1 test
-test $DIR/failed-doctest-missing-codes.rs - Foo (line 8) ... FAILED
+test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) ... FAILED
 
 failures:
 
----- $DIR/failed-doctest-missing-codes.rs - Foo (line 8) stdout ----
+---- $DIR/failed-doctest-missing-codes.rs - Foo (line 9) stdout ----
 error[E0308]: mismatched types
-  --> $DIR/failed-doctest-missing-codes.rs:9:13
+  --> $DIR/failed-doctest-missing-codes.rs:10:13
    |
 LL | let x: () = 5i32;
    |        --   ^^^^ expected `()`, found `i32`
@@ -19,7 +19,7 @@ For more information about this error, try `rustc --explain E0308`.
 Some expected error codes were not found: ["E0004"]
 
 failures:
-    $DIR/failed-doctest-missing-codes.rs - Foo (line 8)
+    $DIR/failed-doctest-missing-codes.rs - Foo (line 9)
 
-test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/failed-doctest-output.rs b/src/test/rustdoc-ui/failed-doctest-output.rs
index 90cdb5127be..92473b49e14 100644
--- a/src/test/rustdoc-ui/failed-doctest-output.rs
+++ b/src/test/rustdoc-ui/failed-doctest-output.rs
@@ -5,6 +5,7 @@
 // compile-flags:--test --test-args --test-threads=1
 // rustc-env:RUST_BACKTRACE=0
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
 // doctest fails at runtime
diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout
index ee79ae1a690..6dfe648f854 100644
--- a/src/test/rustdoc-ui/failed-doctest-output.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-output.stdout
@@ -1,13 +1,13 @@
 
 running 2 tests
-test $DIR/failed-doctest-output.rs - OtherStruct (line 21) ... FAILED
-test $DIR/failed-doctest-output.rs - SomeStruct (line 11) ... FAILED
+test $DIR/failed-doctest-output.rs - OtherStruct (line 22) ... FAILED
+test $DIR/failed-doctest-output.rs - SomeStruct (line 12) ... FAILED
 
 failures:
 
----- $DIR/failed-doctest-output.rs - OtherStruct (line 21) stdout ----
+---- $DIR/failed-doctest-output.rs - OtherStruct (line 22) stdout ----
 error[E0425]: cannot find value `no` in this scope
-  --> $DIR/failed-doctest-output.rs:22:1
+  --> $DIR/failed-doctest-output.rs:23:1
    |
 LL | no
    | ^^ not found in this scope
@@ -16,7 +16,7 @@ error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0425`.
 Couldn't compile the test.
----- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ----
+---- $DIR/failed-doctest-output.rs - SomeStruct (line 12) stdout ----
 Test executable failed (exit code 101).
 
 stdout:
@@ -32,8 +32,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 
 failures:
-    $DIR/failed-doctest-output.rs - OtherStruct (line 21)
-    $DIR/failed-doctest-output.rs - SomeStruct (line 11)
+    $DIR/failed-doctest-output.rs - OtherStruct (line 22)
+    $DIR/failed-doctest-output.rs - SomeStruct (line 12)
 
-test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/failed-doctest-should-panic.rs b/src/test/rustdoc-ui/failed-doctest-should-panic.rs
index 400fb97804a..2b8bb31686f 100644
--- a/src/test/rustdoc-ui/failed-doctest-should-panic.rs
+++ b/src/test/rustdoc-ui/failed-doctest-should-panic.rs
@@ -3,6 +3,7 @@
 
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
 /// ```should_panic
diff --git a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
index 081b64b50af..57a20092a5d 100644
--- a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
@@ -1,14 +1,14 @@
 
 running 1 test
-test $DIR/failed-doctest-should-panic.rs - Foo (line 8) ... FAILED
+test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED
 
 failures:
 
----- $DIR/failed-doctest-should-panic.rs - Foo (line 8) stdout ----
+---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ----
 Test executable succeeded, but it's marked `should_panic`.
 
 failures:
-    $DIR/failed-doctest-should-panic.rs - Foo (line 8)
+    $DIR/failed-doctest-should-panic.rs - Foo (line 9)
 
-test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/invalid-keyword.rs b/src/test/rustdoc-ui/invalid-keyword.rs
new file mode 100644
index 00000000000..ce2abc69bbd
--- /dev/null
+++ b/src/test/rustdoc-ui/invalid-keyword.rs
@@ -0,0 +1,4 @@
+#![feature(doc_keyword)]
+
+#[doc(keyword = "foo df")] //~ ERROR
+mod foo {}
diff --git a/src/test/rustdoc-ui/invalid-keyword.stderr b/src/test/rustdoc-ui/invalid-keyword.stderr
new file mode 100644
index 00000000000..8658e382578
--- /dev/null
+++ b/src/test/rustdoc-ui/invalid-keyword.stderr
@@ -0,0 +1,8 @@
+error: `foo df` is not a valid identifier
+  --> $DIR/invalid-keyword.rs:3:17
+   |
+LL | #[doc(keyword = "foo df")]
+   |                 ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/rustdoc-ui/test-no_std.rs b/src/test/rustdoc-ui/test-no_std.rs
index af4843ad324..ee919985e7a 100644
--- a/src/test/rustdoc-ui/test-no_std.rs
+++ b/src/test/rustdoc-ui/test-no_std.rs
@@ -1,5 +1,6 @@
 // compile-flags:--test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
 #![no_std]
diff --git a/src/test/rustdoc-ui/test-no_std.stdout b/src/test/rustdoc-ui/test-no_std.stdout
index 9cdcac2a483..8d5a30804c1 100644
--- a/src/test/rustdoc-ui/test-no_std.stdout
+++ b/src/test/rustdoc-ui/test-no_std.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/test-no_std.rs - f (line 9) ... ok
+test $DIR/test-no_std.rs - f (line 10) ... ok
 
-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/unparseable-doc-test.rs b/src/test/rustdoc-ui/unparseable-doc-test.rs
index 18d6b32bf40..0cff8cd9a33 100644
--- a/src/test/rustdoc-ui/unparseable-doc-test.rs
+++ b/src/test/rustdoc-ui/unparseable-doc-test.rs
@@ -1,5 +1,6 @@
 // compile-flags: --test
 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 // rustc-env: RUST_BACKTRACE=0
 
diff --git a/src/test/rustdoc-ui/unparseable-doc-test.stdout b/src/test/rustdoc-ui/unparseable-doc-test.stdout
index 29cb22e2e4b..2641c66f25e 100644
--- a/src/test/rustdoc-ui/unparseable-doc-test.stdout
+++ b/src/test/rustdoc-ui/unparseable-doc-test.stdout
@@ -1,12 +1,12 @@
 
 running 1 test
-test $DIR/unparseable-doc-test.rs - foo (line 6) ... FAILED
+test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED
 
 failures:
 
----- $DIR/unparseable-doc-test.rs - foo (line 6) stdout ----
+---- $DIR/unparseable-doc-test.rs - foo (line 7) stdout ----
 error[E0765]: unterminated double quote string
-  --> $DIR/unparseable-doc-test.rs:8:1
+  --> $DIR/unparseable-doc-test.rs:9:1
    |
 LL | "unterminated
    | ^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ For more information about this error, try `rustc --explain E0765`.
 Couldn't compile the test.
 
 failures:
-    $DIR/unparseable-doc-test.rs - foo (line 6)
+    $DIR/unparseable-doc-test.rs - foo (line 7)
 
-test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc/decl_macro.rs b/src/test/rustdoc/decl_macro.rs
new file mode 100644
index 00000000000..e48a56f906c
--- /dev/null
+++ b/src/test/rustdoc/decl_macro.rs
@@ -0,0 +1,39 @@
+#![feature(decl_macro)]
+
+// @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
+// @has - //pre '...'
+// @has - //pre '}'
+pub macro my_macro() {
+
+}
+
+// @has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
+// @has - //pre '...'
+// @has - //pre '}'
+pub macro my_macro_2($($tok:tt)*) {
+
+}
+
+// @has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {'
+// @has - //pre '(_) => { ... },'
+// @has - //pre '($foo:ident . $bar:expr) => { ... },'
+// @has - //pre '($($foo:literal),+) => { ... }'
+// @has - //pre '}'
+pub macro my_macro_multi {
+    (_) => {
+
+    },
+    ($foo:ident . $bar:expr) => {
+
+    },
+    ($($foo:literal),+) => {
+
+    }
+}
+
+// @has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {'
+// @has - //pre '...'
+// @has - //pre '}'
+pub macro by_example_single {
+    ($foo:expr) => {}
+}
diff --git a/src/test/rustdoc/decl_macro_priv.rs b/src/test/rustdoc/decl_macro_priv.rs
new file mode 100644
index 00000000000..4e1279e34d9
--- /dev/null
+++ b/src/test/rustdoc/decl_macro_priv.rs
@@ -0,0 +1,14 @@
+// compile-flags: --document-private-items
+
+#![feature(decl_macro)]
+
+// @has decl_macro_priv/macro.crate_macro.html //pre 'pub(crate) macro crate_macro() {'
+// @has - //pre '...'
+// @has - //pre '}'
+pub(crate) macro crate_macro() {}
+
+// @has decl_macro_priv/macro.priv_macro.html //pre 'macro priv_macro() {'
+// @!has - //pre 'pub macro priv_macro() {'
+// @has - //pre '...'
+// @has - //pre '}'
+macro priv_macro() {}
diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs
index d7041ee2f1a..f86541cd118 100644
--- a/src/test/rustdoc/doc-cfg.rs
+++ b/src/test/rustdoc/doc-cfg.rs
@@ -2,20 +2,20 @@
 #![feature(target_feature, cfg_target_feature)]
 
 // @has doc_cfg/struct.Portable.html
-// @!has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' ''
+// @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' ''
 // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
 // @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
 pub struct Portable;
 
 // @has doc_cfg/unix_only/index.html \
-//  '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
+//  '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
 //  'This is supported on Unix only.'
 // @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AARM\Z'
 // @count - '//*[@class="stab portability"]' 2
 #[doc(cfg(unix))]
 pub mod unix_only {
     // @has doc_cfg/unix_only/fn.unix_only_function.html \
-    //  '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
+    //  '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
     //  'This is supported on Unix only.'
     // @count - '//*[@class="stab portability"]' 1
     pub fn unix_only_function() {
@@ -23,7 +23,7 @@ pub mod unix_only {
     }
 
     // @has doc_cfg/unix_only/trait.ArmOnly.html \
-    //  '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
+    //  '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
     //  'This is supported on Unix and ARM only.'
     // @count - '//*[@class="stab portability"]' 2
     #[doc(cfg(target_arch = "arm"))]
@@ -44,7 +44,7 @@ pub mod unix_only {
 // @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\Aavx\Z'
 
 // @has doc_cfg/fn.uses_target_feature.html
-// @has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
+// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
 //        'This is supported with target feature avx only.'
 #[target_feature(enable = "avx")]
 pub unsafe fn uses_target_feature() {
@@ -52,7 +52,7 @@ pub unsafe fn uses_target_feature() {
 }
 
 // @has doc_cfg/fn.uses_cfg_target_feature.html
-// @has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
+// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
 //        'This is supported with target feature avx only.'
 #[doc(cfg(target_feature = "avx"))]
 pub fn uses_cfg_target_feature() {
diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs
index db5d115c6da..25e8b7912e7 100644
--- a/src/test/rustdoc/keyword.rs
+++ b/src/test/rustdoc/keyword.rs
@@ -14,3 +14,8 @@
 #[doc(keyword = "match")]
 /// this is a test!
 mod foo{}
+
+// @has foo/keyword.foo.html '//section[@id="main"]//div[@class="docblock"]//p' 'hello'
+#[doc(keyword = "foo")]
+/// hello
+mod bar {}
diff --git a/src/test/rustdoc/reexport-check.rs b/src/test/rustdoc/reexport-check.rs
index 066b0cfe5e8..841702987ef 100644
--- a/src/test/rustdoc/reexport-check.rs
+++ b/src/test/rustdoc/reexport-check.rs
@@ -6,6 +6,7 @@ extern crate reexport_check;
 // @!has 'foo/index.html' '//code' 'pub use self::i32;'
 // @has 'foo/index.html' '//tr[@class="module-item"]' 'i32'
 // @has 'foo/i32/index.html'
+#[allow(deprecated, deprecated_in_future)]
 pub use std::i32;
 // @!has 'foo/index.html' '//code' 'pub use self::string::String;'
 // @has 'foo/index.html' '//tr[@class="module-item"]' 'String'
diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs
index 814339e198f..f5a356bcae6 100644
--- a/src/test/rustdoc/show-const-contents.rs
+++ b/src/test/rustdoc/show-const-contents.rs
@@ -52,6 +52,7 @@ pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this");
 pub use std::f32::consts::PI;
 
 // @has show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32'
+#[allow(deprecated, deprecated_in_future)]
 pub use std::i32::MAX;
 
 macro_rules! int_module {
diff --git a/src/test/rustdoc/stability.rs b/src/test/rustdoc/stability.rs
index b1b97fe134e..4ff06d9c995 100644
--- a/src/test/rustdoc/stability.rs
+++ b/src/test/rustdoc/stability.rs
@@ -4,7 +4,7 @@
 
 pub struct Unstable {
     // @has stability/struct.Unstable.html \
-    //      '//div[@class="stability"]//div[@class="stab unstable"]' \
+    //      '//div[@class="item-info"]//div[@class="stab unstable"]' \
     //      'This is a nightly-only experimental API'
     // @count stability/struct.Unstable.html '//span[@class="stab unstable"]' 0
     pub foo: u32,
diff --git a/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
index 3caf5f44995..577853a4e91 100644
--- a/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
+++ b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
@@ -2,7 +2,6 @@
 // error-pattern:index out of bounds
 // ignore-emscripten no processes
 
-use std::usize;
 use std::mem::size_of;
 
 fn main() {
diff --git a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr
index f59287bce73..0c35819007b 100644
--- a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr
+++ b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:27:22
    |
 LL |     const NEG: i32 = -i32::MIN + T::NEG;
    |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
@@ -7,25 +7,25 @@ LL |     const NEG: i32 = -i32::MIN + T::NEG;
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:35
    |
 LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
    |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:32:22
    |
 LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
    |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:36
    |
 LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
    |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:37:22
    |
 LL |     const DIV: i32 = (1/0) + T::DIV;
    |                      ^^^^^ attempt to divide `1_i32` by zero
@@ -33,19 +33,19 @@ LL |     const DIV: i32 = (1/0) + T::DIV;
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:35
    |
 LL |     const DIV_REV: i32 = T::DIV + (1/0);
    |                                   ^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
    |
 LL |     const OOB: i32 = [1][1] + T::OOB;
    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
    |
 LL |     const OOB_REV: i32 = T::OOB + [1][1];
    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
diff --git a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr
index f59287bce73..0c35819007b 100644
--- a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr
+++ b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:27:22
    |
 LL |     const NEG: i32 = -i32::MIN + T::NEG;
    |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
@@ -7,25 +7,25 @@ LL |     const NEG: i32 = -i32::MIN + T::NEG;
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:35
    |
 LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
    |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:32:22
    |
 LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
    |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:36
    |
 LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
    |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:37:22
    |
 LL |     const DIV: i32 = (1/0) + T::DIV;
    |                      ^^^^^ attempt to divide `1_i32` by zero
@@ -33,19 +33,19 @@ LL |     const DIV: i32 = (1/0) + T::DIV;
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:35
    |
 LL |     const DIV_REV: i32 = T::DIV + (1/0);
    |                                   ^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
    |
 LL |     const OOB: i32 = [1][1] + T::OOB;
    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
    |
 LL |     const OOB_REV: i32 = T::OOB + [1][1];
    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
diff --git a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr
index f59287bce73..0c35819007b 100644
--- a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr
+++ b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:27:22
    |
 LL |     const NEG: i32 = -i32::MIN + T::NEG;
    |                      ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
@@ -7,25 +7,25 @@ LL |     const NEG: i32 = -i32::MIN + T::NEG;
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:35
    |
 LL |     const NEG_REV: i32 = T::NEG + (-i32::MIN);
    |                                   ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:32:22
    |
 LL |     const ADD: i32 = (i32::MAX+1) + T::ADD;
    |                      ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:36
    |
 LL |     const ADD_REV: i32 =  T::ADD + (i32::MAX+1);
    |                                    ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:37:22
    |
 LL |     const DIV: i32 = (1/0) + T::DIV;
    |                      ^^^^^ attempt to divide `1_i32` by zero
@@ -33,19 +33,19 @@ LL |     const DIV: i32 = (1/0) + T::DIV;
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:35
    |
 LL |     const DIV_REV: i32 = T::DIV + (1/0);
    |                                   ^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:42:22
    |
 LL |     const OOB: i32 = [1][1] + T::OOB;
    |                      ^^^^^^ index out of bounds: the length is 1 but the index is 1
 
 error: this operation will panic at runtime
-  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
+  --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:35
    |
 LL |     const OOB_REV: i32 = T::OOB + [1][1];
    |                                   ^^^^^^ index out of bounds: the length is 1 but the index is 1
diff --git a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs
index 850f65ae9d1..d4af6e86414 100644
--- a/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs
+++ b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs
@@ -5,8 +5,6 @@
 
 #![crate_type="lib"]
 
-use std::i32;
-
 pub trait Foo {
     const NEG: i32;
     const NEG_REV: i32;
diff --git a/src/test/ui/associated-type-bounds/order-dependent-bounds-issue-54121.rs b/src/test/ui/associated-type-bounds/order-dependent-bounds-issue-54121.rs
new file mode 100644
index 00000000000..77e4bd4d6f5
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/order-dependent-bounds-issue-54121.rs
@@ -0,0 +1,47 @@
+// check-pass
+
+// From https://github.com/rust-lang/rust/issues/54121/
+//
+// Whether the code compiled depended on the order of the trait bounds in
+// `type T: Tr<u8, u8> + Tr<u16, u16>`
+// But both should compile as order shouldn't matter.
+
+trait Tr<A, B> {
+    fn exec(a: A, b: B);
+}
+
+trait P {
+    // This compiled successfully
+    type T: Tr<u16, u16> + Tr<u8, u8>;
+}
+
+trait Q {
+    // This didn't compile
+    type T: Tr<u8, u8> + Tr<u16, u16>;
+}
+
+#[allow(dead_code)]
+fn f<S: P>() {
+    <S as P>::T::exec(0u8, 0u8)
+}
+
+#[allow(dead_code)]
+fn g<S: Q>() {
+    // A mismatched types error was emitted on this line.
+    <S as Q>::T::exec(0u8, 0u8)
+}
+
+// Another reproduction of the same issue
+trait Trait {
+    type Type: Into<Self::Type1> + Into<Self::Type2> + Copy;
+    type Type1;
+    type Type2;
+}
+
+#[allow(dead_code)]
+fn foo<T: Trait>(x: T::Type) {
+    let _1: T::Type1 = x.into();
+    let _2: T::Type2 = x.into();
+}
+
+fn main() { }
diff --git a/src/test/ui/big-literals.rs b/src/test/ui/big-literals.rs
index 131de5439b7..96ea115c877 100644
--- a/src/test/ui/big-literals.rs
+++ b/src/test/ui/big-literals.rs
@@ -10,8 +10,8 @@ pub fn main() {
 
     assert_eq!((-2147483648i32).wrapping_sub(1), 2147483647);
 
-    assert_eq!(-3.40282356e+38_f32, ::std::f32::MIN);
-    assert_eq!(3.40282356e+38_f32, ::std::f32::MAX);
-    assert_eq!(-1.7976931348623158e+308_f64, ::std::f64::MIN);
-    assert_eq!(1.7976931348623158e+308_f64, ::std::f64::MAX);
+    assert_eq!(-3.40282356e+38_f32, f32::MIN);
+    assert_eq!(3.40282356e+38_f32, f32::MAX);
+    assert_eq!(-1.7976931348623158e+308_f64, f64::MIN);
+    assert_eq!(1.7976931348623158e+308_f64, f64::MAX);
 }
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/fn_call.rs b/src/test/ui/const-generics/const_evaluatable_checked/fn_call.rs
index 1b9ec0108b1..c182f5ef81b 100644
--- a/src/test/ui/const-generics/const_evaluatable_checked/fn_call.rs
+++ b/src/test/ui/const-generics/const_evaluatable_checked/fn_call.rs
@@ -6,7 +6,7 @@ const fn test_me<T>(a: usize, b: usize) -> usize {
     if a < b {
         std::mem::size_of::<T>()
     } else {
-        std::usize::MAX
+        usize::MAX
     }
 }
 
diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.full.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.full.stderr
index e4105a3df1c..b4994004721 100644
--- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.full.stderr
+++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.full.stderr
@@ -1,8 +1,8 @@
 error: constant expression depends on a generic parameter
-  --> $DIR/issue-72819-generic-in-const-eval.rs:9:47
+  --> $DIR/issue-72819-generic-in-const-eval.rs:9:39
    |
-LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
-   |                                               ^^^^^^
+LL | where Assert::<{N < usize::MAX / 2}>: IsTrue,
+   |                                       ^^^^^^
    |
    = note: this may fail depending on what value the parameter takes
 
diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr
index 2394b23d799..8df3c85ec1f 100644
--- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr
+++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr
@@ -1,7 +1,7 @@
 error: generic parameters may not be used in const operations
   --> $DIR/issue-72819-generic-in-const-eval.rs:9:17
    |
-LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
+LL | where Assert::<{N < usize::MAX / 2}>: IsTrue,
    |                 ^ cannot perform const operation using `N`
    |
    = help: const parameters may only be used as standalone arguments, i.e. `N`
diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs
index 6182042bde7..4c0004795f0 100644
--- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs
+++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs
@@ -6,7 +6,7 @@
 #![cfg_attr(min, feature(min_const_generics))]
 
 struct Arr<const N: usize>
-where Assert::<{N < usize::max_value() / 2}>: IsTrue,
+where Assert::<{N < usize::MAX / 2}>: IsTrue,
 //[full]~^ ERROR constant expression depends on a generic parameter
 //[min]~^^ ERROR generic parameters may not be used in const operations
 {
@@ -19,5 +19,5 @@ trait IsTrue {}
 impl IsTrue for Assert<true> {}
 
 fn main() {
-    let x: Arr<{usize::max_value()}> = Arr {};
+    let x: Arr<{usize::MAX}> = Arr {};
 }
diff --git a/src/test/ui/const-generics/issues/issue-73260.rs b/src/test/ui/const-generics/issues/issue-73260.rs
index 351d6849af5..04e4e9cd52b 100644
--- a/src/test/ui/const-generics/issues/issue-73260.rs
+++ b/src/test/ui/const-generics/issues/issue-73260.rs
@@ -3,7 +3,7 @@
 #![feature(const_generics)]
 #![allow(incomplete_features)]
 struct Arr<const N: usize>
-where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~ ERROR constant expression
+where Assert::<{N < usize::MAX / 2}>: IsTrue, //~ ERROR constant expression
 {
 }
 
@@ -14,7 +14,7 @@ trait IsTrue {}
 impl IsTrue for Assert<true> {}
 
 fn main() {
-    let x: Arr<{usize::max_value()}> = Arr {};
+    let x: Arr<{usize::MAX}> = Arr {};
     //~^ ERROR mismatched types
     //~| ERROR mismatched types
 }
diff --git a/src/test/ui/const-generics/issues/issue-73260.stderr b/src/test/ui/const-generics/issues/issue-73260.stderr
index e22612ed5ea..6a912ffc3c0 100644
--- a/src/test/ui/const-generics/issues/issue-73260.stderr
+++ b/src/test/ui/const-generics/issues/issue-73260.stderr
@@ -1,25 +1,25 @@
 error: constant expression depends on a generic parameter
-  --> $DIR/issue-73260.rs:6:47
+  --> $DIR/issue-73260.rs:6:39
    |
-LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
-   |                                               ^^^^^^
+LL | where Assert::<{N < usize::MAX / 2}>: IsTrue,
+   |                                       ^^^^^^
    |
    = note: this may fail depending on what value the parameter takes
 
 error[E0308]: mismatched types
   --> $DIR/issue-73260.rs:17:12
    |
-LL |     let x: Arr<{usize::max_value()}> = Arr {};
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true`
+LL |     let x: Arr<{usize::MAX}> = Arr {};
+   |            ^^^^^^^^^^^^^^^^^ expected `false`, found `true`
    |
    = note: expected type `false`
               found type `true`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-73260.rs:17:40
+  --> $DIR/issue-73260.rs:17:32
    |
-LL |     let x: Arr<{usize::max_value()}> = Arr {};
-   |                                        ^^^ expected `false`, found `true`
+LL |     let x: Arr<{usize::MAX}> = Arr {};
+   |                                ^^^ expected `false`, found `true`
    |
    = note: expected type `false`
               found type `true`
diff --git a/src/test/ui/consts/const-err-early.rs b/src/test/ui/consts/const-err-early.rs
index bae2cd286e1..13dfe7fac99 100644
--- a/src/test/ui/consts/const-err-early.rs
+++ b/src/test/ui/consts/const-err-early.rs
@@ -1,6 +1,6 @@
 #![deny(const_err)]
 
-pub const A: i8 = -std::i8::MIN; //~ ERROR const_err
+pub const A: i8 = -i8::MIN; //~ ERROR const_err
 pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
 pub const C: u8 = 200u8 * 4; //~ ERROR const_err
 pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr
index 36b36db7c18..ec55139f173 100644
--- a/src/test/ui/consts/const-err-early.stderr
+++ b/src/test/ui/consts/const-err-early.stderr
@@ -1,8 +1,8 @@
 error: any use of this value will cause an error
   --> $DIR/const-err-early.rs:3:19
    |
-LL | pub const A: i8 = -std::i8::MIN;
-   | ------------------^^^^^^^^^^^^^-
+LL | pub const A: i8 = -i8::MIN;
+   | ------------------^^^^^^^^-
    |                   |
    |                   attempt to negate `i8::MIN`, which would overflow
    |
diff --git a/src/test/ui/consts/const-err-multi.rs b/src/test/ui/consts/const-err-multi.rs
index fa3ad832c60..ce74fae9816 100644
--- a/src/test/ui/consts/const-err-multi.rs
+++ b/src/test/ui/consts/const-err-multi.rs
@@ -1,6 +1,6 @@
 #![deny(const_err)]
 
-pub const A: i8 = -std::i8::MIN;
+pub const A: i8 = -i8::MIN;
 //~^ ERROR const_err
 pub const B: i8 = A;
 //~^ ERROR const_err
diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr
index 5b688d4c6d8..b3123b4e359 100644
--- a/src/test/ui/consts/const-err-multi.stderr
+++ b/src/test/ui/consts/const-err-multi.stderr
@@ -1,8 +1,8 @@
 error: any use of this value will cause an error
   --> $DIR/const-err-multi.rs:3:19
    |
-LL | pub const A: i8 = -std::i8::MIN;
-   | ------------------^^^^^^^^^^^^^-
+LL | pub const A: i8 = -i8::MIN;
+   | ------------------^^^^^^^^-
    |                   |
    |                   attempt to negate `i8::MIN`, which would overflow
    |
diff --git a/src/test/ui/consts/const-err2.noopt.stderr b/src/test/ui/consts/const-err2.noopt.stderr
index 2473632cbc8..8b1688c4a89 100644
--- a/src/test/ui/consts/const-err2.noopt.stderr
+++ b/src/test/ui/consts/const-err2.noopt.stderr
@@ -1,16 +1,16 @@
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:19:13
    |
-LL |     let a = -std::i8::MIN;
-   |             ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
+LL |     let a = -i8::MIN;
+   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
    |
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:21:18
    |
-LL |     let a_i128 = -std::i128::MIN;
-   |                  ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
+LL |     let a_i128 = -i128::MIN;
+   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:23:13
@@ -21,8 +21,8 @@ LL |     let b = 200u8 + 200u8 + 200u8;
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:25:18
    |
-LL |     let b_i128 = std::i128::MIN - std::i128::MAX;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
+LL |     let b_i128 = i128::MIN - i128::MAX;
+   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:27:13
diff --git a/src/test/ui/consts/const-err2.opt.stderr b/src/test/ui/consts/const-err2.opt.stderr
index 2473632cbc8..8b1688c4a89 100644
--- a/src/test/ui/consts/const-err2.opt.stderr
+++ b/src/test/ui/consts/const-err2.opt.stderr
@@ -1,16 +1,16 @@
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:19:13
    |
-LL |     let a = -std::i8::MIN;
-   |             ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
+LL |     let a = -i8::MIN;
+   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
    |
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:21:18
    |
-LL |     let a_i128 = -std::i128::MIN;
-   |                  ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
+LL |     let a_i128 = -i128::MIN;
+   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:23:13
@@ -21,8 +21,8 @@ LL |     let b = 200u8 + 200u8 + 200u8;
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:25:18
    |
-LL |     let b_i128 = std::i128::MIN - std::i128::MAX;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
+LL |     let b_i128 = i128::MIN - i128::MAX;
+   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:27:13
diff --git a/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr
index 2473632cbc8..8b1688c4a89 100644
--- a/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr
+++ b/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr
@@ -1,16 +1,16 @@
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:19:13
    |
-LL |     let a = -std::i8::MIN;
-   |             ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
+LL |     let a = -i8::MIN;
+   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
    |
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:21:18
    |
-LL |     let a_i128 = -std::i128::MIN;
-   |                  ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
+LL |     let a_i128 = -i128::MIN;
+   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:23:13
@@ -21,8 +21,8 @@ LL |     let b = 200u8 + 200u8 + 200u8;
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:25:18
    |
-LL |     let b_i128 = std::i128::MIN - std::i128::MAX;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
+LL |     let b_i128 = i128::MIN - i128::MAX;
+   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
 
 error: this arithmetic operation will overflow
   --> $DIR/const-err2.rs:27:13
diff --git a/src/test/ui/consts/const-err2.rs b/src/test/ui/consts/const-err2.rs
index 2c6a987180b..db49ec25aaa 100644
--- a/src/test/ui/consts/const-err2.rs
+++ b/src/test/ui/consts/const-err2.rs
@@ -16,13 +16,13 @@ fn black_box<T>(_: T) {
 }
 
 fn main() {
-    let a = -std::i8::MIN;
+    let a = -i8::MIN;
     //~^ ERROR arithmetic operation will overflow
-    let a_i128 = -std::i128::MIN;
+    let a_i128 = -i128::MIN;
     //~^ ERROR arithmetic operation will overflow
     let b = 200u8 + 200u8 + 200u8;
     //~^ ERROR arithmetic operation will overflow
-    let b_i128 = std::i128::MIN - std::i128::MAX;
+    let b_i128 = i128::MIN - i128::MAX;
     //~^ ERROR arithmetic operation will overflow
     let c = 200u8 * 4;
     //~^ ERROR arithmetic operation will overflow
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs
index 6fd8e9cbc80..bcc966dc962 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs
@@ -12,8 +12,6 @@
 #![allow(unused_imports)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const A_I8_I
     : [u32; (i8::MAX as usize) + 1]
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
index 0ae51786b36..73f421b5b14 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
@@ -1,5 +1,5 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-eval-overflow-3.rs:20:11
+  --> $DIR/const-eval-overflow-3.rs:18:11
    |
 LL |     = [0; (i8::MAX + 1) as usize];
    |           ^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
index db6f17a671a..480069e67fa 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
@@ -10,8 +10,6 @@
 #![allow(unused_imports)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const A_I8_I
     : [u32; (i8::MAX as usize) + 1]
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
index 2696d5a0b32..2b96b668192 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
@@ -1,11 +1,11 @@
 error[E0308]: mismatched types
-  --> $DIR/const-eval-overflow-3b.rs:18:22
+  --> $DIR/const-eval-overflow-3b.rs:16:22
    |
 LL |     = [0; (i8::MAX + 1u8) as usize];
    |                      ^^^ expected `i8`, found `u8`
 
 error[E0277]: cannot add `u8` to `i8`
-  --> $DIR/const-eval-overflow-3b.rs:18:20
+  --> $DIR/const-eval-overflow-3b.rs:16:20
    |
 LL |     = [0; (i8::MAX + 1u8) as usize];
    |                    ^ no implementation for `i8 + u8`
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4.rs
index 0b12a438f96..762c7a968a8 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4.rs
@@ -6,8 +6,6 @@
 #![allow(unused_imports)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const A_I8_T
     : [u32; (i8::MAX as i8 + 1i8) as usize]
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
index e548fc266c2..94f4193195c 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
@@ -1,5 +1,5 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-eval-overflow-4.rs:13:13
+  --> $DIR/const-eval-overflow-4.rs:11:13
    |
 LL |     : [u32; (i8::MAX as i8 + 1i8) as usize]
    |             ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
index 2a4585faf14..ce9c980de0d 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
@@ -5,9 +5,6 @@
 
 #![allow(unused_imports)]
 
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
-
 const A_I8_T
     : [u32; (i8::MAX as i8 + 1u8) as usize]
     //~^ ERROR mismatched types
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
index e695e9f75fe..1e181c465db 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
@@ -1,11 +1,11 @@
 error[E0308]: mismatched types
-  --> $DIR/const-eval-overflow-4b.rs:12:30
+  --> $DIR/const-eval-overflow-4b.rs:9:30
    |
 LL |     : [u32; (i8::MAX as i8 + 1u8) as usize]
    |                              ^^^ expected `i8`, found `u8`
 
 error[E0277]: cannot add `u8` to `i8`
-  --> $DIR/const-eval-overflow-4b.rs:12:28
+  --> $DIR/const-eval-overflow-4b.rs:9:28
    |
 LL |     : [u32; (i8::MAX as i8 + 1u8) as usize]
    |                            ^ no implementation for `i8 + u8`
@@ -13,7 +13,7 @@ LL |     : [u32; (i8::MAX as i8 + 1u8) as usize]
    = help: the trait `Add<u8>` is not implemented for `i8`
 
 error[E0604]: only `u8` can be cast as `char`, not `i8`
-  --> $DIR/const-eval-overflow-4b.rs:25:13
+  --> $DIR/const-eval-overflow-4b.rs:22:13
    |
 LL |     : [u32; 5i8 as char as usize]
    |             ^^^^^^^^^^^ invalid cast
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.rs b/src/test/ui/consts/const-eval/const-eval-overflow2.rs
index a0dbcc88cea..57a9dd55c8b 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2.rs
@@ -8,8 +8,6 @@
 #![deny(const_err)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const VALS_I8: (i8,) =
     (
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
index 51a810b8f3b..8864bc170f2 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
@@ -1,5 +1,5 @@
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:16:6
+  --> $DIR/const-eval-overflow2.rs:14:6
    |
 LL | / const VALS_I8: (i8,) =
 LL | |     (
@@ -15,7 +15,7 @@ LL | #![deny(const_err)]
    |         ^^^^^^^^^
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:22:6
+  --> $DIR/const-eval-overflow2.rs:20:6
    |
 LL | / const VALS_I16: (i16,) =
 LL | |     (
@@ -25,7 +25,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:28:6
+  --> $DIR/const-eval-overflow2.rs:26:6
    |
 LL | / const VALS_I32: (i32,) =
 LL | |     (
@@ -35,7 +35,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:34:6
+  --> $DIR/const-eval-overflow2.rs:32:6
    |
 LL | / const VALS_I64: (i64,) =
 LL | |     (
@@ -45,7 +45,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:40:6
+  --> $DIR/const-eval-overflow2.rs:38:6
    |
 LL | / const VALS_U8: (u8,) =
 LL | |     (
@@ -55,7 +55,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:45:6
+  --> $DIR/const-eval-overflow2.rs:43:6
    |
 LL | / const VALS_U16: (u16,) = (
 LL | |      u16::MIN - 1,
@@ -64,7 +64,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:50:6
+  --> $DIR/const-eval-overflow2.rs:48:6
    |
 LL | / const VALS_U32: (u32,) = (
 LL | |      u32::MIN - 1,
@@ -73,7 +73,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2.rs:56:6
+  --> $DIR/const-eval-overflow2.rs:54:6
    |
 LL | / const VALS_U64: (u64,) =
 LL | |     (
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
index da883671a60..e87952ab0f4 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
@@ -8,8 +8,6 @@
 #![deny(const_err)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const VALS_I8: (i8,) =
     (
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
index eec440fcb76..e66e80c8f19 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
@@ -1,5 +1,5 @@
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:16:6
+  --> $DIR/const-eval-overflow2b.rs:14:6
    |
 LL | / const VALS_I8: (i8,) =
 LL | |     (
@@ -15,7 +15,7 @@ LL | #![deny(const_err)]
    |         ^^^^^^^^^
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:22:6
+  --> $DIR/const-eval-overflow2b.rs:20:6
    |
 LL | / const VALS_I16: (i16,) =
 LL | |     (
@@ -25,7 +25,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:28:6
+  --> $DIR/const-eval-overflow2b.rs:26:6
    |
 LL | / const VALS_I32: (i32,) =
 LL | |     (
@@ -35,7 +35,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:34:6
+  --> $DIR/const-eval-overflow2b.rs:32:6
    |
 LL | / const VALS_I64: (i64,) =
 LL | |     (
@@ -45,7 +45,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:40:6
+  --> $DIR/const-eval-overflow2b.rs:38:6
    |
 LL | / const VALS_U8: (u8,) =
 LL | |     (
@@ -55,7 +55,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:45:6
+  --> $DIR/const-eval-overflow2b.rs:43:6
    |
 LL | / const VALS_U16: (u16,) = (
 LL | |      u16::MAX + 1,
@@ -64,7 +64,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:50:6
+  --> $DIR/const-eval-overflow2b.rs:48:6
    |
 LL | / const VALS_U32: (u32,) = (
 LL | |      u32::MAX + 1,
@@ -73,7 +73,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2b.rs:56:6
+  --> $DIR/const-eval-overflow2b.rs:54:6
    |
 LL | / const VALS_U64: (u64,) =
 LL | |     (
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs
index e87344405a1..84d3dd20a92 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs
@@ -8,8 +8,6 @@
 #![deny(const_err)]
 
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const VALS_I8: (i8,) =
     (
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
index e44f94c2021..10e308938f3 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
@@ -1,5 +1,5 @@
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:16:6
+  --> $DIR/const-eval-overflow2c.rs:14:6
    |
 LL | / const VALS_I8: (i8,) =
 LL | |     (
@@ -15,7 +15,7 @@ LL | #![deny(const_err)]
    |         ^^^^^^^^^
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:22:6
+  --> $DIR/const-eval-overflow2c.rs:20:6
    |
 LL | / const VALS_I16: (i16,) =
 LL | |     (
@@ -25,7 +25,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:28:6
+  --> $DIR/const-eval-overflow2c.rs:26:6
    |
 LL | / const VALS_I32: (i32,) =
 LL | |     (
@@ -35,7 +35,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:34:6
+  --> $DIR/const-eval-overflow2c.rs:32:6
    |
 LL | / const VALS_I64: (i64,) =
 LL | |     (
@@ -45,7 +45,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:40:6
+  --> $DIR/const-eval-overflow2c.rs:38:6
    |
 LL | / const VALS_U8: (u8,) =
 LL | |     (
@@ -55,7 +55,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:45:6
+  --> $DIR/const-eval-overflow2c.rs:43:6
    |
 LL | / const VALS_U16: (u16,) = (
 LL | |      u16::MAX * 2,
@@ -64,7 +64,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:50:6
+  --> $DIR/const-eval-overflow2c.rs:48:6
    |
 LL | / const VALS_U32: (u32,) = (
 LL | |      u32::MAX * 2,
@@ -73,7 +73,7 @@ LL | |      );
    | |_______-
 
 error: any use of this value will cause an error
-  --> $DIR/const-eval-overflow2c.rs:56:6
+  --> $DIR/const-eval-overflow2c.rs:54:6
    |
 LL | / const VALS_U64: (u64,) =
 LL | |     (
diff --git a/src/test/ui/consts/const-eval/dangling.rs b/src/test/ui/consts/const-eval/dangling.rs
index 78cf000db03..72e97c03220 100644
--- a/src/test/ui/consts/const-eval/dangling.rs
+++ b/src/test/ui/consts/const-eval/dangling.rs
@@ -1,6 +1,6 @@
 #![feature(const_raw_ptr_deref)]
 
-use std::{mem, usize};
+use std::mem;
 
 // Make sure we error with the right kind of error on a too large slice.
 const TEST: () = { unsafe { //~ NOTE
diff --git a/src/test/ui/consts/const-int-arithmetic.rs b/src/test/ui/consts/const-int-arithmetic.rs
index 9b2e30961aa..e0d722ede94 100644
--- a/src/test/ui/consts/const-int-arithmetic.rs
+++ b/src/test/ui/consts/const-int-arithmetic.rs
@@ -5,8 +5,6 @@
 #![feature(const_overflowing_int_methods)]
 #![feature(const_wrapping_int_methods)]
 
-use std::{i8, i128};
-
 macro_rules! suite {
     ($(
         $fn:ident -> $ty:ty { $( $label:ident : $expr:expr, $result:expr; )* }
diff --git a/src/test/ui/consts/const-int-overflowing-rpass.rs b/src/test/ui/consts/const-int-overflowing-rpass.rs
index eecb88becab..75e77fdf1be 100644
--- a/src/test/ui/consts/const-int-overflowing-rpass.rs
+++ b/src/test/ui/consts/const-int-overflowing-rpass.rs
@@ -16,7 +16,7 @@ const SHR_A: (u32, bool) = 0x10u32.overflowing_shr(4);
 const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
 
 const NEG_A: (u32, bool) = 0u32.overflowing_neg();
-const NEG_B: (u32, bool) = core::u32::MAX.overflowing_neg();
+const NEG_B: (u32, bool) = u32::MAX.overflowing_neg();
 
 const ABS_POS: (i32, bool) = 10i32.overflowing_abs();
 const ABS_NEG: (i32, bool) = (-10i32).overflowing_abs();
diff --git a/src/test/ui/consts/const-negation.rs b/src/test/ui/consts/const-negation.rs
index 1c8e27ae617..26c3c0b836b 100644
--- a/src/test/ui/consts/const-negation.rs
+++ b/src/test/ui/consts/const-negation.rs
@@ -8,19 +8,19 @@ fn main() {
     const I: isize = -2147483648isize;
     #[cfg(target_pointer_width = "64")]
     const I: isize = -9223372036854775808isize;
-    assert_eq!(::std::i32::MIN as u64, 0xffffffff80000000);
+    assert_eq!(i32::MIN as u64, 0xffffffff80000000);
     assert_eq!(-2147483648isize as u64, 0xffffffff80000000);
     assert_eq!(-2147483648i32 as u64, 0xffffffff80000000);
-    assert_eq!(::std::i64::MIN as u64, 0x8000000000000000);
+    assert_eq!(i64::MIN as u64, 0x8000000000000000);
     #[cfg(target_pointer_width = "64")]
     assert_eq!(-9223372036854775808isize as u64, 0x8000000000000000);
     #[cfg(target_pointer_width = "32")]
     assert_eq!(-9223372036854775808isize as u64, 0);
     assert_eq!(-9223372036854775808i32 as u64, 0);
-    const J: usize = ::std::i32::MAX as usize;
+    const J: usize = i32::MAX as usize;
     const K: usize = -1i32 as u32 as usize;
-    const L: usize = ::std::i32::MIN as usize;
-    const M: usize = ::std::i64::MIN as usize;
+    const L: usize = i32::MIN as usize;
+    const M: usize = i64::MIN as usize;
     match 5 {
         J => {},
         K => {},
diff --git a/src/test/ui/consts/issue-63952.rs b/src/test/ui/consts/issue-63952.rs
index 35cbc7003f0..f50e1e51f61 100644
--- a/src/test/ui/consts/issue-63952.rs
+++ b/src/test/ui/consts/issue-63952.rs
@@ -1,7 +1,5 @@
 // Regression test for #63952, shouldn't hang.
 
-use std::usize;
-
 #[repr(C)]
 #[derive(Copy, Clone)]
 struct SliceRepr {
diff --git a/src/test/ui/consts/issue-63952.stderr b/src/test/ui/consts/issue-63952.stderr
index 5e85be45b16..503c5706fa2 100644
--- a/src/test/ui/consts/issue-63952.stderr
+++ b/src/test/ui/consts/issue-63952.stderr
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/issue-63952.rs:18:1
+  --> $DIR/issue-63952.rs:16:1
    |
 LL | / const SLICE_WAY_TOO_LONG: &[u8] = unsafe {
 LL | |     SliceTransmute {
diff --git a/src/test/ui/consts/promote_fn_calls_std.rs b/src/test/ui/consts/promote_fn_calls_std.rs
index bdb472f3a9c..557f6a434f4 100644
--- a/src/test/ui/consts/promote_fn_calls_std.rs
+++ b/src/test/ui/consts/promote_fn_calls_std.rs
@@ -1,3 +1,4 @@
+#![allow(deprecated, deprecated_in_future)] // can be removed if different fns are chosen
 // build-pass (FIXME(62277): could be check-pass?)
 
 fn main() {
diff --git a/src/test/ui/consts/promotion.rs b/src/test/ui/consts/promotion.rs
index 5f84030a9e9..e6f5c3d27ca 100644
--- a/src/test/ui/consts/promotion.rs
+++ b/src/test/ui/consts/promotion.rs
@@ -13,5 +13,5 @@ fn main() {
 
     // make sure that these do not cause trouble despite overflowing
     baz_u32(&(0-1));
-    baz_i32(&-std::i32::MIN);
+    baz_i32(&-i32::MIN);
 }
diff --git a/src/test/ui/discrim/discrim-ill-typed.rs b/src/test/ui/discrim/discrim-ill-typed.rs
index 98c90f0ea68..3cf0ea0e6b9 100644
--- a/src/test/ui/discrim/discrim-ill-typed.rs
+++ b/src/test/ui/discrim/discrim-ill-typed.rs
@@ -7,8 +7,6 @@
 
 #![allow(dead_code, unused_variables, unused_imports)]
 
-use std::{i8,u8,i16,u16,i32,u32,i64, u64};
-
 fn f_i8() {
     #[repr(i8)]
     enum A {
diff --git a/src/test/ui/discrim/discrim-ill-typed.stderr b/src/test/ui/discrim/discrim-ill-typed.stderr
index 7b9f086151a..9a695a8987a 100644
--- a/src/test/ui/discrim/discrim-ill-typed.stderr
+++ b/src/test/ui/discrim/discrim-ill-typed.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:17:16
+  --> $DIR/discrim-ill-typed.rs:15:16
    |
 LL |         OhNo = 0_u8,
    |                ^^^^ expected `i8`, found `u8`
@@ -10,7 +10,7 @@ LL |         OhNo = 0_i8,
    |                ^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:30:16
+  --> $DIR/discrim-ill-typed.rs:28:16
    |
 LL |         OhNo = 0_i8,
    |                ^^^^ expected `u8`, found `i8`
@@ -21,7 +21,7 @@ LL |         OhNo = 0_u8,
    |                ^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:43:16
+  --> $DIR/discrim-ill-typed.rs:41:16
    |
 LL |         OhNo = 0_u16,
    |                ^^^^^ expected `i16`, found `u16`
@@ -32,7 +32,7 @@ LL |         OhNo = 0_i16,
    |                ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:56:16
+  --> $DIR/discrim-ill-typed.rs:54:16
    |
 LL |         OhNo = 0_i16,
    |                ^^^^^ expected `u16`, found `i16`
@@ -43,7 +43,7 @@ LL |         OhNo = 0_u16,
    |                ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:69:16
+  --> $DIR/discrim-ill-typed.rs:67:16
    |
 LL |         OhNo = 0_u32,
    |                ^^^^^ expected `i32`, found `u32`
@@ -54,7 +54,7 @@ LL |         OhNo = 0_i32,
    |                ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:82:16
+  --> $DIR/discrim-ill-typed.rs:80:16
    |
 LL |         OhNo = 0_i32,
    |                ^^^^^ expected `u32`, found `i32`
@@ -65,7 +65,7 @@ LL |         OhNo = 0_u32,
    |                ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:95:16
+  --> $DIR/discrim-ill-typed.rs:93:16
    |
 LL |         OhNo = 0_u64,
    |                ^^^^^ expected `i64`, found `u64`
@@ -76,7 +76,7 @@ LL |         OhNo = 0_i64,
    |                ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/discrim-ill-typed.rs:108:16
+  --> $DIR/discrim-ill-typed.rs:106:16
    |
 LL |         OhNo = 0_i64,
    |                ^^^^^ expected `u64`, found `i64`
diff --git a/src/test/ui/discrim/discrim-overflow-2.rs b/src/test/ui/discrim/discrim-overflow-2.rs
index f8f565f4d9c..ca24317c54d 100644
--- a/src/test/ui/discrim/discrim-overflow-2.rs
+++ b/src/test/ui/discrim/discrim-overflow-2.rs
@@ -5,8 +5,6 @@
 // See also run-pass/discrim-explicit-23030.rs where the suggested
 // workaround is tested.
 
-use std::{i8,u8,i16,u16,i32,u32,i64, u64};
-
 fn f_i8() {
     #[repr(i8)]
     enum A {
diff --git a/src/test/ui/discrim/discrim-overflow-2.stderr b/src/test/ui/discrim/discrim-overflow-2.stderr
index 198ebe9eb51..3ca84c66753 100644
--- a/src/test/ui/discrim/discrim-overflow-2.stderr
+++ b/src/test/ui/discrim/discrim-overflow-2.stderr
@@ -1,5 +1,5 @@
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:15:9
+  --> $DIR/discrim-overflow-2.rs:13:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 127
@@ -7,7 +7,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -128` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:24:9
+  --> $DIR/discrim-overflow-2.rs:22:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 255
@@ -15,7 +15,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:33:9
+  --> $DIR/discrim-overflow-2.rs:31:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 32767
@@ -23,7 +23,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -32768` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:42:9
+  --> $DIR/discrim-overflow-2.rs:40:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 65535
@@ -31,7 +31,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:51:9
+  --> $DIR/discrim-overflow-2.rs:49:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 2147483647
@@ -39,7 +39,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -2147483648` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:60:9
+  --> $DIR/discrim-overflow-2.rs:58:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 4294967295
@@ -47,7 +47,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:69:9
+  --> $DIR/discrim-overflow-2.rs:67:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 9223372036854775807
@@ -55,7 +55,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow-2.rs:78:9
+  --> $DIR/discrim-overflow-2.rs:76:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 18446744073709551615
diff --git a/src/test/ui/discrim/discrim-overflow.rs b/src/test/ui/discrim/discrim-overflow.rs
index d8a9dacfa51..774ced93c17 100644
--- a/src/test/ui/discrim/discrim-overflow.rs
+++ b/src/test/ui/discrim/discrim-overflow.rs
@@ -3,8 +3,6 @@
 // See also run-pass/discrim-explicit-23030.rs where the suggested
 // workaround is tested.
 
-use std::{i8,u8,i16,u16,i32,u32,i64, u64};
-
 fn f_i8() {
     #[repr(i8)]
     enum A {
diff --git a/src/test/ui/discrim/discrim-overflow.stderr b/src/test/ui/discrim/discrim-overflow.stderr
index a2ae4863f9f..1b331bb1b8d 100644
--- a/src/test/ui/discrim/discrim-overflow.stderr
+++ b/src/test/ui/discrim/discrim-overflow.stderr
@@ -1,5 +1,5 @@
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:13:9
+  --> $DIR/discrim-overflow.rs:11:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 127
@@ -7,7 +7,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -128` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:24:9
+  --> $DIR/discrim-overflow.rs:22:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 255
@@ -15,7 +15,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:35:9
+  --> $DIR/discrim-overflow.rs:33:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 32767
@@ -23,7 +23,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -32768` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:46:9
+  --> $DIR/discrim-overflow.rs:44:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 65535
@@ -31,7 +31,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:58:9
+  --> $DIR/discrim-overflow.rs:56:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 2147483647
@@ -39,7 +39,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -2147483648` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:70:9
+  --> $DIR/discrim-overflow.rs:68:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 4294967295
@@ -47,7 +47,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = 0` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:82:9
+  --> $DIR/discrim-overflow.rs:80:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 9223372036854775807
@@ -55,7 +55,7 @@ LL |         OhNo,
    = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome
 
 error[E0370]: enum discriminant overflowed
-  --> $DIR/discrim-overflow.rs:94:9
+  --> $DIR/discrim-overflow.rs:92:9
    |
 LL |         OhNo,
    |         ^^^^ overflowed on value after 18446744073709551615
diff --git a/src/test/ui/drop/dynamic-drop-async.rs b/src/test/ui/drop/dynamic-drop-async.rs
index b027faa9d7c..c4f7c378616 100644
--- a/src/test/ui/drop/dynamic-drop-async.rs
+++ b/src/test/ui/drop/dynamic-drop-async.rs
@@ -18,7 +18,6 @@ use std::{
     ptr,
     rc::Rc,
     task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
-    usize,
 };
 
 struct InjectedFailure;
diff --git a/src/test/ui/drop/dynamic-drop.rs b/src/test/ui/drop/dynamic-drop.rs
index 6d0cd101dbc..88f557055f3 100644
--- a/src/test/ui/drop/dynamic-drop.rs
+++ b/src/test/ui/drop/dynamic-drop.rs
@@ -12,7 +12,6 @@ use std::mem::ManuallyDrop;
 use std::ops::Generator;
 use std::panic;
 use std::pin::Pin;
-use std::usize;
 
 struct InjectedFailure;
 
diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr
index 4f85d175ce6..1938a9a272a 100644
--- a/src/test/ui/error-codes/E0077.stderr
+++ b/src/test/ui/error-codes/E0077.stderr
@@ -1,4 +1,4 @@
-error[E0077]: SIMD vector element type should be machine type
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
   --> $DIR/E0077.rs:4:1
    |
 LL | struct Bad(String);
diff --git a/src/test/ui/explain.stdout b/src/test/ui/explain.stdout
index c50c46ee564..62f1a7f98ea 100644
--- a/src/test/ui/explain.stdout
+++ b/src/test/ui/explain.stdout
@@ -1,12 +1,18 @@
 Per [RFC 401][rfc401], if you have a function declaration `foo`:
 
 ```
+struct S;
+
 // For the purposes of this explanation, all of these
 // different kinds of `fn` declarations are equivalent:
-struct S;
+
 fn foo(x: S) { /* ... */ }
-extern "C" { fn foo(x: S); }
-impl S { fn foo(self) { /* ... */ } }
+extern "C" {
+    fn foo(x: S);
+}
+impl S {
+    fn foo(self) { /* ... */ }
+}
 ```
 
 the type of `foo` is **not** `fn(S)`, as one might expect.
@@ -34,8 +40,10 @@ extern "C" fn foo(userdata: Box<i32>) {
     /* ... */
 }
 
-let f: extern "C" fn(*mut i32) = transmute(foo);
-callback(f);
+unsafe {
+    let f: extern "C" fn(*mut i32) = transmute(foo);
+    callback(f);
+}
 ```
 
 Here, transmute is being used to convert the types of the fn arguments.
diff --git a/src/test/ui/if-bot.rs b/src/test/ui/expr/if-bot.rs
index 0f09db530d4..0f09db530d4 100644
--- a/src/test/ui/if-bot.rs
+++ b/src/test/ui/expr/if-bot.rs
diff --git a/src/test/ui/if-attrs/bad-cfg.rs b/src/test/ui/expr/if/attrs/bad-cfg.rs
index 3f84929a00e..3f84929a00e 100644
--- a/src/test/ui/if-attrs/bad-cfg.rs
+++ b/src/test/ui/expr/if/attrs/bad-cfg.rs
diff --git a/src/test/ui/if-attrs/bad-cfg.stderr b/src/test/ui/expr/if/attrs/bad-cfg.stderr
index 8a2890886a1..8a2890886a1 100644
--- a/src/test/ui/if-attrs/bad-cfg.stderr
+++ b/src/test/ui/expr/if/attrs/bad-cfg.stderr
diff --git a/src/test/ui/if-attrs/builtin-if-attr.rs b/src/test/ui/expr/if/attrs/builtin-if-attr.rs
index 7e290661501..7e290661501 100644
--- a/src/test/ui/if-attrs/builtin-if-attr.rs
+++ b/src/test/ui/expr/if/attrs/builtin-if-attr.rs
diff --git a/src/test/ui/if-attrs/cfg-false-if-attr.rs b/src/test/ui/expr/if/attrs/cfg-false-if-attr.rs
index 1f77a1bb342..1f77a1bb342 100644
--- a/src/test/ui/if-attrs/cfg-false-if-attr.rs
+++ b/src/test/ui/expr/if/attrs/cfg-false-if-attr.rs
diff --git a/src/test/ui/if-attrs/else-attrs.rs b/src/test/ui/expr/if/attrs/else-attrs.rs
index 85da7cf6bb8..85da7cf6bb8 100644
--- a/src/test/ui/if-attrs/else-attrs.rs
+++ b/src/test/ui/expr/if/attrs/else-attrs.rs
diff --git a/src/test/ui/if-attrs/else-attrs.stderr b/src/test/ui/expr/if/attrs/else-attrs.stderr
index 2733377054d..2733377054d 100644
--- a/src/test/ui/if-attrs/else-attrs.stderr
+++ b/src/test/ui/expr/if/attrs/else-attrs.stderr
diff --git a/src/test/ui/if-attrs/gate-whole-expr.rs b/src/test/ui/expr/if/attrs/gate-whole-expr.rs
index 63772d54b53..63772d54b53 100644
--- a/src/test/ui/if-attrs/gate-whole-expr.rs
+++ b/src/test/ui/expr/if/attrs/gate-whole-expr.rs
diff --git a/src/test/ui/if-attrs/let-chains-attr.rs b/src/test/ui/expr/if/attrs/let-chains-attr.rs
index 5237a9ff396..5237a9ff396 100644
--- a/src/test/ui/if-attrs/let-chains-attr.rs
+++ b/src/test/ui/expr/if/attrs/let-chains-attr.rs
diff --git a/src/test/ui/if-attrs/let-chains-attr.stderr b/src/test/ui/expr/if/attrs/let-chains-attr.stderr
index 8b987471534..8b987471534 100644
--- a/src/test/ui/if-attrs/let-chains-attr.stderr
+++ b/src/test/ui/expr/if/attrs/let-chains-attr.stderr
diff --git a/src/test/ui/if-attrs/stmt-expr-gated.rs b/src/test/ui/expr/if/attrs/stmt-expr-gated.rs
index 38599c8e67c..38599c8e67c 100644
--- a/src/test/ui/if-attrs/stmt-expr-gated.rs
+++ b/src/test/ui/expr/if/attrs/stmt-expr-gated.rs
diff --git a/src/test/ui/if-attrs/stmt-expr-gated.stderr b/src/test/ui/expr/if/attrs/stmt-expr-gated.stderr
index 47dac39a9ae..47dac39a9ae 100644
--- a/src/test/ui/if-attrs/stmt-expr-gated.stderr
+++ b/src/test/ui/expr/if/attrs/stmt-expr-gated.stderr
diff --git a/src/test/ui/if/expr-if-panic-fn.rs b/src/test/ui/expr/if/expr-if-panic-fn.rs
index 36e49785a49..36e49785a49 100644
--- a/src/test/ui/if/expr-if-panic-fn.rs
+++ b/src/test/ui/expr/if/expr-if-panic-fn.rs
diff --git a/src/test/ui/if/expr-if-panic.rs b/src/test/ui/expr/if/expr-if-panic.rs
index 520ee0870ee..520ee0870ee 100644
--- a/src/test/ui/if/expr-if-panic.rs
+++ b/src/test/ui/expr/if/expr-if-panic.rs
diff --git a/src/test/ui/if/if-branch-types.rs b/src/test/ui/expr/if/if-branch-types.rs
index c125ba30606..c125ba30606 100644
--- a/src/test/ui/if/if-branch-types.rs
+++ b/src/test/ui/expr/if/if-branch-types.rs
diff --git a/src/test/ui/if/if-branch-types.stderr b/src/test/ui/expr/if/if-branch-types.stderr
index 14f02163a83..14f02163a83 100644
--- a/src/test/ui/if/if-branch-types.stderr
+++ b/src/test/ui/expr/if/if-branch-types.stderr
diff --git a/src/test/ui/if/if-check-panic.rs b/src/test/ui/expr/if/if-check-panic.rs
index 037cd427ccf..037cd427ccf 100644
--- a/src/test/ui/if/if-check-panic.rs
+++ b/src/test/ui/expr/if/if-check-panic.rs
diff --git a/src/test/ui/if-check.rs b/src/test/ui/expr/if/if-check.rs
index 6593225e7dd..6593225e7dd 100644
--- a/src/test/ui/if-check.rs
+++ b/src/test/ui/expr/if/if-check.rs
diff --git a/src/test/ui/if/if-cond-bot.rs b/src/test/ui/expr/if/if-cond-bot.rs
index bcd11467852..bcd11467852 100644
--- a/src/test/ui/if/if-cond-bot.rs
+++ b/src/test/ui/expr/if/if-cond-bot.rs
diff --git a/src/test/ui/if-else-type-mismatch.rs b/src/test/ui/expr/if/if-else-type-mismatch.rs
index 1a0a36df2ad..1a0a36df2ad 100644
--- a/src/test/ui/if-else-type-mismatch.rs
+++ b/src/test/ui/expr/if/if-else-type-mismatch.rs
diff --git a/src/test/ui/if-else-type-mismatch.stderr b/src/test/ui/expr/if/if-else-type-mismatch.stderr
index 9fa190d6c9d..9fa190d6c9d 100644
--- a/src/test/ui/if-else-type-mismatch.stderr
+++ b/src/test/ui/expr/if/if-else-type-mismatch.stderr
diff --git a/src/test/ui/if/if-let-arm-types.rs b/src/test/ui/expr/if/if-let-arm-types.rs
index 1e8260a017d..1e8260a017d 100644
--- a/src/test/ui/if/if-let-arm-types.rs
+++ b/src/test/ui/expr/if/if-let-arm-types.rs
diff --git a/src/test/ui/if/if-let-arm-types.stderr b/src/test/ui/expr/if/if-let-arm-types.stderr
index b40a0f479d3..b40a0f479d3 100644
--- a/src/test/ui/if/if-let-arm-types.stderr
+++ b/src/test/ui/expr/if/if-let-arm-types.stderr
diff --git a/src/test/ui/if/if-let.rs b/src/test/ui/expr/if/if-let.rs
index 2ab0f9fed3f..2ab0f9fed3f 100644
--- a/src/test/ui/if/if-let.rs
+++ b/src/test/ui/expr/if/if-let.rs
diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/expr/if/if-let.stderr
index ee2b78af3b8..ee2b78af3b8 100644
--- a/src/test/ui/if/if-let.stderr
+++ b/src/test/ui/expr/if/if-let.stderr
diff --git a/src/test/ui/if/if-loop.rs b/src/test/ui/expr/if/if-loop.rs
index 06d0bdf456c..06d0bdf456c 100644
--- a/src/test/ui/if/if-loop.rs
+++ b/src/test/ui/expr/if/if-loop.rs
diff --git a/src/test/ui/if/if-no-match-bindings.rs b/src/test/ui/expr/if/if-no-match-bindings.rs
index ca3df0fdde4..ca3df0fdde4 100644
--- a/src/test/ui/if/if-no-match-bindings.rs
+++ b/src/test/ui/expr/if/if-no-match-bindings.rs
diff --git a/src/test/ui/if/if-no-match-bindings.stderr b/src/test/ui/expr/if/if-no-match-bindings.stderr
index 3f382e023a7..3f382e023a7 100644
--- a/src/test/ui/if/if-no-match-bindings.stderr
+++ b/src/test/ui/expr/if/if-no-match-bindings.stderr
diff --git a/src/test/ui/if-ret.rs b/src/test/ui/expr/if/if-ret.rs
index 6bb0141848a..6bb0141848a 100644
--- a/src/test/ui/if-ret.rs
+++ b/src/test/ui/expr/if/if-ret.rs
diff --git a/src/test/ui/if-ret.stderr b/src/test/ui/expr/if/if-ret.stderr
index 41bbd791862..41bbd791862 100644
--- a/src/test/ui/if-ret.stderr
+++ b/src/test/ui/expr/if/if-ret.stderr
diff --git a/src/test/ui/if/if-typeck.rs b/src/test/ui/expr/if/if-typeck.rs
index d8c262bd6b3..d8c262bd6b3 100644
--- a/src/test/ui/if/if-typeck.rs
+++ b/src/test/ui/expr/if/if-typeck.rs
diff --git a/src/test/ui/if/if-typeck.stderr b/src/test/ui/expr/if/if-typeck.stderr
index 74ed0ed0ae6..74ed0ed0ae6 100644
--- a/src/test/ui/if/if-typeck.stderr
+++ b/src/test/ui/expr/if/if-typeck.stderr
diff --git a/src/test/ui/if/if-without-block.rs b/src/test/ui/expr/if/if-without-block.rs
index 8a4c59f3261..8a4c59f3261 100644
--- a/src/test/ui/if/if-without-block.rs
+++ b/src/test/ui/expr/if/if-without-block.rs
diff --git a/src/test/ui/if/if-without-block.stderr b/src/test/ui/expr/if/if-without-block.stderr
index ee2bb62e2bb..ee2bb62e2bb 100644
--- a/src/test/ui/if/if-without-block.stderr
+++ b/src/test/ui/expr/if/if-without-block.stderr
diff --git a/src/test/ui/if/if-without-else-as-fn-expr.rs b/src/test/ui/expr/if/if-without-else-as-fn-expr.rs
index 19fbfb27ba6..19fbfb27ba6 100644
--- a/src/test/ui/if/if-without-else-as-fn-expr.rs
+++ b/src/test/ui/expr/if/if-without-else-as-fn-expr.rs
diff --git a/src/test/ui/if/if-without-else-as-fn-expr.stderr b/src/test/ui/expr/if/if-without-else-as-fn-expr.stderr
index 4daf27493c1..4daf27493c1 100644
--- a/src/test/ui/if/if-without-else-as-fn-expr.stderr
+++ b/src/test/ui/expr/if/if-without-else-as-fn-expr.stderr
diff --git a/src/test/ui/if/if-without-else-result.rs b/src/test/ui/expr/if/if-without-else-result.rs
index cf84a99e53f..cf84a99e53f 100644
--- a/src/test/ui/if/if-without-else-result.rs
+++ b/src/test/ui/expr/if/if-without-else-result.rs
diff --git a/src/test/ui/if/if-without-else-result.stderr b/src/test/ui/expr/if/if-without-else-result.stderr
index 821635d3768..821635d3768 100644
--- a/src/test/ui/if/if-without-else-result.stderr
+++ b/src/test/ui/expr/if/if-without-else-result.stderr
diff --git a/src/test/ui/if/ifmt-bad-arg.rs b/src/test/ui/expr/if/ifmt-bad-arg.rs
index a0b0a8fb985..a0b0a8fb985 100644
--- a/src/test/ui/if/ifmt-bad-arg.rs
+++ b/src/test/ui/expr/if/ifmt-bad-arg.rs
diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/expr/if/ifmt-bad-arg.stderr
index 0ff478826f7..0ff478826f7 100644
--- a/src/test/ui/if/ifmt-bad-arg.stderr
+++ b/src/test/ui/expr/if/ifmt-bad-arg.stderr
diff --git a/src/test/ui/if/ifmt-bad-format-args.rs b/src/test/ui/expr/if/ifmt-bad-format-args.rs
index ba7301561bd..ba7301561bd 100644
--- a/src/test/ui/if/ifmt-bad-format-args.rs
+++ b/src/test/ui/expr/if/ifmt-bad-format-args.rs
diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/expr/if/ifmt-bad-format-args.stderr
index 8bb0d40629f..8bb0d40629f 100644
--- a/src/test/ui/if/ifmt-bad-format-args.stderr
+++ b/src/test/ui/expr/if/ifmt-bad-format-args.stderr
diff --git a/src/test/ui/if/ifmt-unimpl.rs b/src/test/ui/expr/if/ifmt-unimpl.rs
index 258f4eea509..258f4eea509 100644
--- a/src/test/ui/if/ifmt-unimpl.rs
+++ b/src/test/ui/expr/if/ifmt-unimpl.rs
diff --git a/src/test/ui/if/ifmt-unimpl.stderr b/src/test/ui/expr/if/ifmt-unimpl.stderr
index 65b0f4a09b3..65b0f4a09b3 100644
--- a/src/test/ui/if/ifmt-unimpl.stderr
+++ b/src/test/ui/expr/if/ifmt-unimpl.stderr
diff --git a/src/test/ui/if/ifmt-unknown-trait.rs b/src/test/ui/expr/if/ifmt-unknown-trait.rs
index 158152c89a4..158152c89a4 100644
--- a/src/test/ui/if/ifmt-unknown-trait.rs
+++ b/src/test/ui/expr/if/ifmt-unknown-trait.rs
diff --git a/src/test/ui/if/ifmt-unknown-trait.stderr b/src/test/ui/expr/if/ifmt-unknown-trait.stderr
index 459432bf4e4..459432bf4e4 100644
--- a/src/test/ui/if/ifmt-unknown-trait.stderr
+++ b/src/test/ui/expr/if/ifmt-unknown-trait.stderr
diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
index d42fbf22938..4c77180b767 100644
--- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
+++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
@@ -1,5 +1,3 @@
-use std::{isize, usize};
-
 fn main() {
     match 0usize {
         //~^ ERROR non-exhaustive patterns: `_` not covered
diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
index da308c292df..9895646fc2b 100644
--- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
+++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
@@ -1,5 +1,5 @@
 error[E0004]: non-exhaustive patterns: `_` not covered
-  --> $DIR/feature-gate-precise_pointer_size_matching.rs:4:11
+  --> $DIR/feature-gate-precise_pointer_size_matching.rs:2:11
    |
 LL |     match 0usize {
    |           ^^^^^^ pattern `_` not covered
@@ -10,7 +10,7 @@ LL |     match 0usize {
    = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
 
 error[E0004]: non-exhaustive patterns: `_` not covered
-  --> $DIR/feature-gate-precise_pointer_size_matching.rs:12:11
+  --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
    |
 LL |     match 0isize {
    |           ^^^^^^ pattern `_` not covered
diff --git a/src/test/ui/foreign/foreign-pub-super.rs b/src/test/ui/foreign/foreign-pub-super.rs
new file mode 100644
index 00000000000..19f9e4e339e
--- /dev/null
+++ b/src/test/ui/foreign/foreign-pub-super.rs
@@ -0,0 +1,12 @@
+// Test for #79487
+// check-pass
+
+#![allow(dead_code)]
+
+mod sha2 {
+    extern "C" {
+        pub(super) fn GFp_sha512_block_data_order();
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs
index b135891d0b8..be225359bff 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs
@@ -13,8 +13,8 @@ macro_rules! m {
 }
 
 fn floats() {
-    m!(0f32, core::f32::NEG_INFINITY..); //~ ERROR non-exhaustive patterns: `_` not covered
-    m!(0f32, ..core::f32::INFINITY); //~ ERROR non-exhaustive patterns: `_` not covered
+    m!(0f32, f32::NEG_INFINITY..); //~ ERROR non-exhaustive patterns: `_` not covered
+    m!(0f32, ..f32::INFINITY); //~ ERROR non-exhaustive patterns: `_` not covered
 }
 
 fn khar() {
@@ -33,12 +33,12 @@ fn khar() {
 
 mod unsigned {
     fn u8() {
-        const ALMOST_MAX: u8 = core::u8::MAX - 1;
-        const ALMOST_MIN: u8 = core::u8::MIN + 1;
+        const ALMOST_MAX: u8 = u8::MAX - 1;
+        const ALMOST_MIN: u8 = u8::MIN + 1;
         const VAL: u8 = 42;
         const VAL_1: u8 = VAL + 1;
         const VAL_2: u8 = VAL + 2;
-        m!(0, ..core::u8::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..u8::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -46,12 +46,12 @@ mod unsigned {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn u16() {
-        const ALMOST_MAX: u16 = core::u16::MAX - 1;
-        const ALMOST_MIN: u16 = core::u16::MIN + 1;
+        const ALMOST_MAX: u16 = u16::MAX - 1;
+        const ALMOST_MIN: u16 = u16::MIN + 1;
         const VAL: u16 = 42;
         const VAL_1: u16 = VAL + 1;
         const VAL_2: u16 = VAL + 2;
-        m!(0, ..core::u16::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..u16::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -59,12 +59,12 @@ mod unsigned {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn u32() {
-        const ALMOST_MAX: u32 = core::u32::MAX - 1;
-        const ALMOST_MIN: u32 = core::u32::MIN + 1;
+        const ALMOST_MAX: u32 = u32::MAX - 1;
+        const ALMOST_MIN: u32 = u32::MIN + 1;
         const VAL: u32 = 42;
         const VAL_1: u32 = VAL + 1;
         const VAL_2: u32 = VAL + 2;
-        m!(0, ..core::u32::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..u32::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -72,12 +72,12 @@ mod unsigned {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn u64() {
-        const ALMOST_MAX: u64 = core::u64::MAX - 1;
-        const ALMOST_MIN: u64 = core::u64::MIN + 1;
+        const ALMOST_MAX: u64 = u64::MAX - 1;
+        const ALMOST_MIN: u64 = u64::MIN + 1;
         const VAL: u64 = 42;
         const VAL_1: u64 = VAL + 1;
         const VAL_2: u64 = VAL + 2;
-        m!(0, ..core::u64::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..u64::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -85,12 +85,12 @@ mod unsigned {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn u128() {
-        const ALMOST_MAX: u128 = core::u128::MAX - 1;
-        const ALMOST_MIN: u128 = core::u128::MIN + 1;
+        const ALMOST_MAX: u128 = u128::MAX - 1;
+        const ALMOST_MIN: u128 = u128::MIN + 1;
         const VAL: u128 = 42;
         const VAL_1: u128 = VAL + 1;
         const VAL_2: u128 = VAL + 2;
-        m!(0, ..core::u128::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..u128::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -101,12 +101,12 @@ mod unsigned {
 
 mod signed {
     fn i8() {
-        const ALMOST_MAX: i8 = core::i8::MAX - 1;
-        const ALMOST_MIN: i8 = core::i8::MIN + 1;
+        const ALMOST_MAX: i8 = i8::MAX - 1;
+        const ALMOST_MIN: i8 = i8::MIN + 1;
         const VAL: i8 = 42;
         const VAL_1: i8 = VAL + 1;
         const VAL_2: i8 = VAL + 2;
-        m!(0, ..core::i8::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..i8::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -114,12 +114,12 @@ mod signed {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn i16() {
-        const ALMOST_MAX: i16 = core::i16::MAX - 1;
-        const ALMOST_MIN: i16 = core::i16::MIN + 1;
+        const ALMOST_MAX: i16 = i16::MAX - 1;
+        const ALMOST_MIN: i16 = i16::MIN + 1;
         const VAL: i16 = 42;
         const VAL_1: i16 = VAL + 1;
         const VAL_2: i16 = VAL + 2;
-        m!(0, ..core::i16::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..i16::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -127,12 +127,12 @@ mod signed {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn i32() {
-        const ALMOST_MAX: i32 = core::i32::MAX - 1;
-        const ALMOST_MIN: i32 = core::i32::MIN + 1;
+        const ALMOST_MAX: i32 = i32::MAX - 1;
+        const ALMOST_MIN: i32 = i32::MIN + 1;
         const VAL: i32 = 42;
         const VAL_1: i32 = VAL + 1;
         const VAL_2: i32 = VAL + 2;
-        m!(0, ..core::i32::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..i32::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -140,12 +140,12 @@ mod signed {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn i64() {
-        const ALMOST_MAX: i64 = core::i64::MAX - 1;
-        const ALMOST_MIN: i64 = core::i64::MIN + 1;
+        const ALMOST_MAX: i64 = i64::MAX - 1;
+        const ALMOST_MIN: i64 = i64::MIN + 1;
         const VAL: i64 = 42;
         const VAL_1: i64 = VAL + 1;
         const VAL_2: i64 = VAL + 2;
-        m!(0, ..core::i64::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..i64::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
@@ -153,12 +153,12 @@ mod signed {
         m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns
     }
     fn i128() {
-        const ALMOST_MAX: i128 = core::i128::MAX - 1;
-        const ALMOST_MIN: i128 = core::i128::MIN + 1;
+        const ALMOST_MAX: i128 = i128::MAX - 1;
+        const ALMOST_MIN: i128 = i128::MIN + 1;
         const VAL: i128 = 42;
         const VAL_1: i128 = VAL + 1;
         const VAL_2: i128 = VAL + 2;
-        m!(0, ..core::i128::MAX); //~ ERROR non-exhaustive patterns
+        m!(0, ..i128::MAX); //~ ERROR non-exhaustive patterns
         m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns
         m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns
         m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
index 5744232235d..14dbca60b78 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
@@ -1,7 +1,7 @@
 error[E0004]: non-exhaustive patterns: `_` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:16:8
    |
-LL |     m!(0f32, core::f32::NEG_INFINITY..);
+LL |     m!(0f32, f32::NEG_INFINITY..);
    |        ^^^^ pattern `_` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -10,7 +10,7 @@ LL |     m!(0f32, core::f32::NEG_INFINITY..);
 error[E0004]: non-exhaustive patterns: `_` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:17:8
    |
-LL |     m!(0f32, ..core::f32::INFINITY);
+LL |     m!(0f32, ..f32::INFINITY);
    |        ^^^^ pattern `_` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -73,7 +73,7 @@ LL |     m!('a', ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12
    |
-LL |         m!(0, ..core::u8::MAX);
+LL |         m!(0, ..u8::MAX);
    |            ^ pattern `u8::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -127,7 +127,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12
    |
-LL |         m!(0, ..core::u16::MAX);
+LL |         m!(0, ..u16::MAX);
    |            ^ pattern `u16::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -181,7 +181,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12
    |
-LL |         m!(0, ..core::u32::MAX);
+LL |         m!(0, ..u32::MAX);
    |            ^ pattern `u32::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -235,7 +235,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12
    |
-LL |         m!(0, ..core::u64::MAX);
+LL |         m!(0, ..u64::MAX);
    |            ^ pattern `u64::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -289,7 +289,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12
    |
-LL |         m!(0, ..core::u128::MAX);
+LL |         m!(0, ..u128::MAX);
    |            ^ pattern `u128::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -343,7 +343,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12
    |
-LL |         m!(0, ..core::i8::MAX);
+LL |         m!(0, ..i8::MAX);
    |            ^ pattern `i8::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -397,7 +397,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12
    |
-LL |         m!(0, ..core::i16::MAX);
+LL |         m!(0, ..i16::MAX);
    |            ^ pattern `i16::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -451,7 +451,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12
    |
-LL |         m!(0, ..core::i32::MAX);
+LL |         m!(0, ..i32::MAX);
    |            ^ pattern `i32::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -505,7 +505,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12
    |
-LL |         m!(0, ..core::i64::MAX);
+LL |         m!(0, ..i64::MAX);
    |            ^ pattern `i64::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@@ -559,7 +559,7 @@ LL |         m!(0, ..VAL_1 | VAL_2..);
 error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
   --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12
    |
-LL |         m!(0, ..core::i128::MAX);
+LL |         m!(0, ..i128::MAX);
    |            ^ pattern `i128::MAX` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs
index efac0df2a43..d3a59e4dffc 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs
@@ -26,19 +26,19 @@ macro_rules! test_int {
 }
 
 fn unsigned_int() {
-    test_int!(0u8, core::u8::MIN, core::u8::MAX);
-    test_int!(0u16, core::u16::MIN, core::u16::MAX);
-    test_int!(0u32, core::u32::MIN, core::u32::MAX);
-    test_int!(0u64, core::u64::MIN, core::u64::MAX);
-    test_int!(0u128, core::u128::MIN, core::u128::MAX);
+    test_int!(0u8, u8::MIN, u8::MAX);
+    test_int!(0u16, u16::MIN, u16::MAX);
+    test_int!(0u32, u32::MIN, u32::MAX);
+    test_int!(0u64, u64::MIN, u64::MAX);
+    test_int!(0u128, u128::MIN, u128::MAX);
 }
 
 fn signed_int() {
-    test_int!(0i8, core::i8::MIN, core::i8::MAX);
-    test_int!(0i16, core::i16::MIN, core::i16::MAX);
-    test_int!(0i32, core::i32::MIN, core::i32::MAX);
-    test_int!(0i64, core::i64::MIN, core::i64::MAX);
-    test_int!(0i128, core::i128::MIN, core::i128::MAX);
+    test_int!(0i8, i8::MIN, i8::MAX);
+    test_int!(0i16, i16::MIN, i16::MAX);
+    test_int!(0i32, i32::MIN, i32::MAX);
+    test_int!(0i64, i64::MIN, i64::MAX);
+    test_int!(0i128, i128::MIN, i128::MAX);
 }
 
 fn khar() {
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-semantics.rs b/src/test/ui/half-open-range-patterns/half-open-range-pats-semantics.rs
index 416c59af3fd..ae532d935df 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-semantics.rs
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-semantics.rs
@@ -24,15 +24,15 @@ fn range_to_inclusive() {
     //---------------------------------------
 
     // u8; `..=X`
-    assert!(yes!(core::u8::MIN, ..=core::u8::MIN));
-    assert!(yes!(core::u8::MIN, ..=5));
+    assert!(yes!(u8::MIN, ..=u8::MIN));
+    assert!(yes!(u8::MIN, ..=5));
     assert!(yes!(5u8, ..=5));
     assert!(!yes!(6u8, ..=5));
 
     // i16; `..=X`
-    assert!(yes!(core::i16::MIN, ..=core::i16::MIN));
-    assert!(yes!(core::i16::MIN, ..=0));
-    assert!(yes!(core::i16::MIN, ..=-5));
+    assert!(yes!(i16::MIN, ..=i16::MIN));
+    assert!(yes!(i16::MIN, ..=0));
+    assert!(yes!(i16::MIN, ..=-5));
     assert!(yes!(-5, ..=-5));
     assert!(!yes!(-4, ..=-5));
 
@@ -43,14 +43,14 @@ fn range_to_inclusive() {
     assert!(!yes!('b', ..='a'));
 
     // f32; `..=X`
-    assert!(yes!(core::f32::NEG_INFINITY, ..=core::f32::NEG_INFINITY));
-    assert!(yes!(core::f32::NEG_INFINITY, ..=1.0f32));
+    assert!(yes!(f32::NEG_INFINITY, ..=f32::NEG_INFINITY));
+    assert!(yes!(f32::NEG_INFINITY, ..=1.0f32));
     assert!(yes!(1.5f32, ..=1.5f32));
     assert!(!yes!(1.6f32, ..=-1.5f32));
 
     // f64; `..=X`
-    assert!(yes!(core::f64::NEG_INFINITY, ..=core::f64::NEG_INFINITY));
-    assert!(yes!(core::f64::NEG_INFINITY, ..=1.0f64));
+    assert!(yes!(f64::NEG_INFINITY, ..=f64::NEG_INFINITY));
+    assert!(yes!(f64::NEG_INFINITY, ..=1.0f64));
     assert!(yes!(1.5f64, ..=1.5f64));
     assert!(!yes!(1.6f64, ..=-1.5f64));
 }
@@ -66,16 +66,16 @@ fn range_to() {
     assert!(!yes!(6u8, ..5));
 
     // u8; `..X`
-    const NU8: u8 = core::u8::MIN + 1;
-    assert!(yes!(core::u8::MIN, ..NU8));
+    const NU8: u8 = u8::MIN + 1;
+    assert!(yes!(u8::MIN, ..NU8));
     assert!(yes!(0u8, ..5));
     assert!(!yes!(5u8, ..5));
     assert!(!yes!(6u8, ..5));
 
     // i16; `..X`
-    const NI16: i16 = core::i16::MIN + 1;
-    assert!(yes!(core::i16::MIN, ..NI16));
-    assert!(yes!(core::i16::MIN, ..5));
+    const NI16: i16 = i16::MIN + 1;
+    assert!(yes!(i16::MIN, ..NI16));
+    assert!(yes!(i16::MIN, ..5));
     assert!(yes!(-6, ..-5));
     assert!(!yes!(-5, ..-5));
 
@@ -87,16 +87,16 @@ fn range_to() {
     assert!(!yes!('b', ..'a'));
 
     // f32; `..X`
-    assert!(yes!(core::f32::NEG_INFINITY, ..1.0f32));
+    assert!(yes!(f32::NEG_INFINITY, ..1.0f32));
     assert!(!yes!(1.5f32, ..1.5f32));
-    const E32: f32 = 1.5f32 + core::f32::EPSILON;
+    const E32: f32 = 1.5f32 + f32::EPSILON;
     assert!(yes!(1.5f32, ..E32));
     assert!(!yes!(1.6f32, ..1.5f32));
 
     // f64; `..X`
-    assert!(yes!(core::f64::NEG_INFINITY, ..1.0f64));
+    assert!(yes!(f64::NEG_INFINITY, ..1.0f64));
     assert!(!yes!(1.5f64, ..1.5f64));
-    const E64: f64 = 1.5f64 + core::f64::EPSILON;
+    const E64: f64 = 1.5f64 + f64::EPSILON;
     assert!(yes!(1.5f64, ..E64));
     assert!(!yes!(1.6f64, ..1.5f64));
 }
@@ -106,23 +106,23 @@ fn range_from() {
     //--------------------------------
 
     // u8; `X..`
-    assert!(yes!(core::u8::MIN, core::u8::MIN..));
-    assert!(yes!(core::u8::MAX, core::u8::MIN..));
-    assert!(!yes!(core::u8::MIN, 1..));
+    assert!(yes!(u8::MIN, u8::MIN..));
+    assert!(yes!(u8::MAX, u8::MIN..));
+    assert!(!yes!(u8::MIN, 1..));
     assert!(!yes!(4, 5..));
     assert!(yes!(5, 5..));
     assert!(yes!(6, 5..));
-    assert!(yes!(core::u8::MAX, core::u8::MAX..));
+    assert!(yes!(u8::MAX, u8::MAX..));
 
     // i16; `X..`
-    assert!(yes!(core::i16::MIN, core::i16::MIN..));
-    assert!(yes!(core::i16::MAX, core::i16::MIN..));
-    const NI16: i16 = core::i16::MIN + 1;
-    assert!(!yes!(core::i16::MIN, NI16..));
+    assert!(yes!(i16::MIN, i16::MIN..));
+    assert!(yes!(i16::MAX, i16::MIN..));
+    const NI16: i16 = i16::MIN + 1;
+    assert!(!yes!(i16::MIN, NI16..));
     assert!(!yes!(-4, 5..));
     assert!(yes!(-4, -4..));
     assert!(yes!(-3, -4..));
-    assert!(yes!(core::i16::MAX, core::i16::MAX..));
+    assert!(yes!(i16::MAX, i16::MAX..));
 
     // char; `X..`
     assert!(yes!('\u{0}', '\u{0}'..));
@@ -133,24 +133,24 @@ fn range_from() {
     assert!(yes!(core::char::MAX, core::char::MAX..));
 
     // f32; `X..`
-    assert!(yes!(core::f32::NEG_INFINITY, core::f32::NEG_INFINITY..));
-    assert!(yes!(core::f32::INFINITY, core::f32::NEG_INFINITY..));
-    assert!(!yes!(core::f32::NEG_INFINITY, 1.0f32..));
-    assert!(yes!(core::f32::INFINITY, 1.0f32..));
-    assert!(!yes!(1.0f32 - core::f32::EPSILON, 1.0f32..));
+    assert!(yes!(f32::NEG_INFINITY, f32::NEG_INFINITY..));
+    assert!(yes!(f32::INFINITY, f32::NEG_INFINITY..));
+    assert!(!yes!(f32::NEG_INFINITY, 1.0f32..));
+    assert!(yes!(f32::INFINITY, 1.0f32..));
+    assert!(!yes!(1.0f32 - f32::EPSILON, 1.0f32..));
     assert!(yes!(1.0f32, 1.0f32..));
-    assert!(yes!(core::f32::INFINITY, 1.0f32..));
-    assert!(yes!(core::f32::INFINITY, core::f32::INFINITY..));
+    assert!(yes!(f32::INFINITY, 1.0f32..));
+    assert!(yes!(f32::INFINITY, f32::INFINITY..));
 
     // f64; `X..`
-    assert!(yes!(core::f64::NEG_INFINITY, core::f64::NEG_INFINITY..));
-    assert!(yes!(core::f64::INFINITY, core::f64::NEG_INFINITY..));
-    assert!(!yes!(core::f64::NEG_INFINITY, 1.0f64..));
-    assert!(yes!(core::f64::INFINITY, 1.0f64..));
-    assert!(!yes!(1.0f64 - core::f64::EPSILON, 1.0f64..));
+    assert!(yes!(f64::NEG_INFINITY, f64::NEG_INFINITY..));
+    assert!(yes!(f64::INFINITY, f64::NEG_INFINITY..));
+    assert!(!yes!(f64::NEG_INFINITY, 1.0f64..));
+    assert!(yes!(f64::INFINITY, 1.0f64..));
+    assert!(!yes!(1.0f64 - f64::EPSILON, 1.0f64..));
     assert!(yes!(1.0f64, 1.0f64..));
-    assert!(yes!(core::f64::INFINITY, 1.0f64..));
-    assert!(yes!(core::f64::INFINITY, core::f64::INFINITY..));
+    assert!(yes!(f64::INFINITY, 1.0f64..));
+    assert!(yes!(f64::INFINITY, f64::INFINITY..));
 }
 
 fn main() {
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs b/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs
index 904efda903c..2c8e554b229 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs
@@ -9,42 +9,42 @@ macro_rules! m {
 }
 
 fn main() {
-    m!(0, ..core::u8::MIN);
+    m!(0, ..u8::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::u16::MIN);
+    m!(0, ..u16::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::u32::MIN);
+    m!(0, ..u32::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::u64::MIN);
+    m!(0, ..u64::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::u128::MIN);
+    m!(0, ..u128::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
 
-    m!(0, ..core::i8::MIN);
+    m!(0, ..i8::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::i16::MIN);
+    m!(0, ..i16::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::i32::MIN);
+    m!(0, ..i32::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::i64::MIN);
+    m!(0, ..i64::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0, ..core::i128::MIN);
+    m!(0, ..i128::MIN);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
 
-    m!(0f32, ..core::f32::NEG_INFINITY);
+    m!(0f32, ..f32::NEG_INFINITY);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
-    m!(0f64, ..core::f64::NEG_INFINITY);
+    m!(0f64, ..f64::NEG_INFINITY);
     //~^ ERROR lower range bound must be less than upper
     //~| ERROR lower range bound must be less than upper
 
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr
index 12ad8642961..4931ddfac71 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr
@@ -1,74 +1,74 @@
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:12:11
    |
-LL |     m!(0, ..core::u8::MIN);
-   |           ^^^^^^^^^^^^^^^
+LL |     m!(0, ..u8::MIN);
+   |           ^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:15:11
    |
-LL |     m!(0, ..core::u16::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u16::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:18:11
    |
-LL |     m!(0, ..core::u32::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u32::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:21:11
    |
-LL |     m!(0, ..core::u64::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u64::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:24:11
    |
-LL |     m!(0, ..core::u128::MIN);
-   |           ^^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u128::MIN);
+   |           ^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:28:11
    |
-LL |     m!(0, ..core::i8::MIN);
-   |           ^^^^^^^^^^^^^^^
+LL |     m!(0, ..i8::MIN);
+   |           ^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:31:11
    |
-LL |     m!(0, ..core::i16::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i16::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:34:11
    |
-LL |     m!(0, ..core::i32::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i32::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:37:11
    |
-LL |     m!(0, ..core::i64::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i64::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:40:11
    |
-LL |     m!(0, ..core::i128::MIN);
-   |           ^^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i128::MIN);
+   |           ^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:44:14
    |
-LL |     m!(0f32, ..core::f32::NEG_INFINITY);
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     m!(0f32, ..f32::NEG_INFINITY);
+   |              ^^^^^^^^^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:47:14
    |
-LL |     m!(0f64, ..core::f64::NEG_INFINITY);
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     m!(0f64, ..f64::NEG_INFINITY);
+   |              ^^^^^^^^^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:51:13
@@ -79,74 +79,74 @@ LL |     m!('a', ..'\u{0}');
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:12:11
    |
-LL |     m!(0, ..core::u8::MIN);
-   |           ^^^^^^^^^^^^^^^
+LL |     m!(0, ..u8::MIN);
+   |           ^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:15:11
    |
-LL |     m!(0, ..core::u16::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u16::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:18:11
    |
-LL |     m!(0, ..core::u32::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u32::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:21:11
    |
-LL |     m!(0, ..core::u64::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u64::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:24:11
    |
-LL |     m!(0, ..core::u128::MIN);
-   |           ^^^^^^^^^^^^^^^^^
+LL |     m!(0, ..u128::MIN);
+   |           ^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:28:11
    |
-LL |     m!(0, ..core::i8::MIN);
-   |           ^^^^^^^^^^^^^^^
+LL |     m!(0, ..i8::MIN);
+   |           ^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:31:11
    |
-LL |     m!(0, ..core::i16::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i16::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:34:11
    |
-LL |     m!(0, ..core::i32::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i32::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:37:11
    |
-LL |     m!(0, ..core::i64::MIN);
-   |           ^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i64::MIN);
+   |           ^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:40:11
    |
-LL |     m!(0, ..core::i128::MIN);
-   |           ^^^^^^^^^^^^^^^^^
+LL |     m!(0, ..i128::MIN);
+   |           ^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:44:14
    |
-LL |     m!(0f32, ..core::f32::NEG_INFINITY);
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     m!(0f32, ..f32::NEG_INFINITY);
+   |              ^^^^^^^^^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:47:14
    |
-LL |     m!(0f64, ..core::f64::NEG_INFINITY);
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     m!(0f64, ..f64::NEG_INFINITY);
+   |              ^^^^^^^^^^^^^^^^^^^
 
 error[E0579]: lower range bound must be less than upper
   --> $DIR/half-open-range-pats-thir-lower-empty.rs:51:13
diff --git a/src/test/ui/hashmap/hashmap-capacity-overflow.rs b/src/test/ui/hashmap/hashmap-capacity-overflow.rs
index 5f88683f4ad..2988af06556 100644
--- a/src/test/ui/hashmap/hashmap-capacity-overflow.rs
+++ b/src/test/ui/hashmap/hashmap-capacity-overflow.rs
@@ -3,7 +3,6 @@
 // ignore-emscripten no processes
 
 use std::collections::hash_map::HashMap;
-use std::usize;
 use std::mem::size_of;
 
 fn main() {
diff --git a/src/test/ui/issues/issue-20427.rs b/src/test/ui/issues/issue-20427.rs
index fa2ea6cf592..41922c62293 100644
--- a/src/test/ui/issues/issue-20427.rs
+++ b/src/test/ui/issues/issue-20427.rs
@@ -4,6 +4,7 @@
 #![allow(unused_imports)]
 #![allow(non_upper_case_globals)]
 #![allow(non_camel_case_types)]
+#![allow(deprecated, deprecated_in_future)]
 
 // aux-build:i8.rs
 // ignore-pretty issue #37201
diff --git a/src/test/ui/issues/issue-23833.rs b/src/test/ui/issues/issue-23833.rs
index 77dc5c50d7a..d4128fa54e3 100644
--- a/src/test/ui/issues/issue-23833.rs
+++ b/src/test/ui/issues/issue-23833.rs
@@ -1,8 +1,6 @@
 // run-pass
 #![allow(unused_imports)]
 use std::fmt;
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
 
 const A_I8_T
     : [u32; (i8::MAX as i8 - 1i8) as usize]
diff --git a/src/test/ui/issues/issue-37686.rs b/src/test/ui/issues/issue-37686.rs
index 8c376251449..ba58e9e9d89 100644
--- a/src/test/ui/issues/issue-37686.rs
+++ b/src/test/ui/issues/issue-37686.rs
@@ -1,7 +1,7 @@
 // run-pass
 fn main() {
     match (0, 0) {
-        (std::usize::MIN, std::usize::MAX) => {}
+        (usize::MIN, usize::MAX) => {}
         _ => {}
     }
 }
diff --git a/src/test/ui/issues/issue-41880.rs b/src/test/ui/issues/issue-41880.rs
index 10cde21abd7..977c43b71fb 100644
--- a/src/test/ui/issues/issue-41880.rs
+++ b/src/test/ui/issues/issue-41880.rs
@@ -19,7 +19,7 @@ impl<T: Clone, F> Iterator for Iterate<T, F> where F: Fn(&T) -> T {
         Some(self.state.clone())
     }
     #[inline]
-    fn size_hint(&self) -> (usize, Option<usize>) { (std::usize::MAX, None) }
+    fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) }
 }
 
 fn main() {
diff --git a/src/test/ui/issues/issue-48006.rs b/src/test/ui/issues/issue-48006.rs
index 3a862ace55e..cfef270e5a6 100644
--- a/src/test/ui/issues/issue-48006.rs
+++ b/src/test/ui/issues/issue-48006.rs
@@ -6,10 +6,10 @@ use std::iter::Step;
 
 #[cfg(target_pointer_width = "16")]
 fn main() {
-    assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_none());
+    assert!(Step::steps_between(&0u32, &u32::MAX).is_none());
 }
 
 #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
 fn main() {
-    assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_some());
+    assert!(Step::steps_between(&0u32, &u32::MAX).is_some());
 }
diff --git a/src/test/ui/issues/issue-50811.rs b/src/test/ui/issues/issue-50811.rs
index 63d87e03c48..683c856049f 100644
--- a/src/test/ui/issues/issue-50811.rs
+++ b/src/test/ui/issues/issue-50811.rs
@@ -3,7 +3,6 @@
 
 extern crate test;
 
-use std::f64::{NAN, NEG_INFINITY, INFINITY, MAX};
 use std::mem::size_of;
 use test::black_box;
 
@@ -12,7 +11,7 @@ use test::black_box;
 macro_rules! compare {
     ($op:tt) => {
         compare!(
-            [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN],
+            [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN],
             $op
         );
     };
@@ -20,7 +19,7 @@ macro_rules! compare {
         $(compare!(
             $lhs,
             $op,
-            [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN]
+            [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN]
         );)+
     };
     ($lhs:expr, $op:tt, [$($rhs:expr),+]) => {
@@ -44,8 +43,8 @@ macro_rules! compare {
 fn main() {
     assert_eq!(0.0/0.0 < 0.0/0.0, false);
     assert_eq!(0.0/0.0 > 0.0/0.0, false);
-    assert_eq!(NAN < NAN, false);
-    assert_eq!(NAN > NAN, false);
+    assert_eq!(f64::NAN < f64::NAN, false);
+    assert_eq!(f64::NAN > f64::NAN, false);
 
     compare!(==);
     compare!(!=);
diff --git a/src/test/ui/issues/issue-68010-large-zst-consts.rs b/src/test/ui/issues/issue-68010-large-zst-consts.rs
index 4f1bd45e90a..3277df69c02 100644
--- a/src/test/ui/issues/issue-68010-large-zst-consts.rs
+++ b/src/test/ui/issues/issue-68010-large-zst-consts.rs
@@ -1,5 +1,5 @@
 // build-pass
 
 fn main() {
-    println!("{}", [(); std::usize::MAX].len());
+    println!("{}", [(); usize::MAX].len());
 }
diff --git a/src/test/ui/issues/issue-6804.rs b/src/test/ui/issues/issue-6804.rs
index 325137327b2..6d950c424e3 100644
--- a/src/test/ui/issues/issue-6804.rs
+++ b/src/test/ui/issues/issue-6804.rs
@@ -3,7 +3,7 @@
 #![allow(unused)]
 #![deny(illegal_floating_point_literal_pattern)]
 
-use std::f64::NAN;
+const NAN: f64 = f64::NAN;
 
 fn main() {
     let x = NAN;
diff --git a/src/test/ui/issues/issue-8460-const.noopt.stderr b/src/test/ui/issues/issue-8460-const.noopt.stderr
index 739b5468743..d94c7742de3 100644
--- a/src/test/ui/issues/issue-8460-const.noopt.stderr
+++ b/src/test/ui/issues/issue-8460-const.noopt.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:14:36
+  --> $DIR/issue-8460-const.rs:13:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
@@ -7,37 +7,37 @@ LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:16:36
+  --> $DIR/issue-8460-const.rs:15:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:18:36
+  --> $DIR/issue-8460-const.rs:17:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:20:36
+  --> $DIR/issue-8460-const.rs:19:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:22:36
+  --> $DIR/issue-8460-const.rs:21:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:24:36
+  --> $DIR/issue-8460-const.rs:23:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:26:36
+  --> $DIR/issue-8460-const.rs:25:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to divide `1_isize` by zero
@@ -45,103 +45,103 @@ LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:28:36
+  --> $DIR/issue-8460-const.rs:27:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to divide `1_i8` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:30:36
+  --> $DIR/issue-8460-const.rs:29:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i16` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:32:36
+  --> $DIR/issue-8460-const.rs:31:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:34:36
+  --> $DIR/issue-8460-const.rs:33:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i64` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:36:36
+  --> $DIR/issue-8460-const.rs:35:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to divide `1_i128` by zero
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:38:36
+  --> $DIR/issue-8460-const.rs:37:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:40:36
+  --> $DIR/issue-8460-const.rs:39:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:42:36
+  --> $DIR/issue-8460-const.rs:41:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:44:36
+  --> $DIR/issue-8460-const.rs:43:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:46:36
+  --> $DIR/issue-8460-const.rs:45:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:48:36
+  --> $DIR/issue-8460-const.rs:47:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:50:36
+  --> $DIR/issue-8460-const.rs:49:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:52:36
+  --> $DIR/issue-8460-const.rs:51:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:54:36
+  --> $DIR/issue-8460-const.rs:53:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:56:36
+  --> $DIR/issue-8460-const.rs:55:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:58:36
+  --> $DIR/issue-8460-const.rs:57:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:60:36
+  --> $DIR/issue-8460-const.rs:59:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
diff --git a/src/test/ui/issues/issue-8460-const.opt.stderr b/src/test/ui/issues/issue-8460-const.opt.stderr
index 739b5468743..d94c7742de3 100644
--- a/src/test/ui/issues/issue-8460-const.opt.stderr
+++ b/src/test/ui/issues/issue-8460-const.opt.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:14:36
+  --> $DIR/issue-8460-const.rs:13:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
@@ -7,37 +7,37 @@ LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:16:36
+  --> $DIR/issue-8460-const.rs:15:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:18:36
+  --> $DIR/issue-8460-const.rs:17:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:20:36
+  --> $DIR/issue-8460-const.rs:19:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:22:36
+  --> $DIR/issue-8460-const.rs:21:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:24:36
+  --> $DIR/issue-8460-const.rs:23:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:26:36
+  --> $DIR/issue-8460-const.rs:25:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to divide `1_isize` by zero
@@ -45,103 +45,103 @@ LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:28:36
+  --> $DIR/issue-8460-const.rs:27:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to divide `1_i8` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:30:36
+  --> $DIR/issue-8460-const.rs:29:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i16` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:32:36
+  --> $DIR/issue-8460-const.rs:31:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:34:36
+  --> $DIR/issue-8460-const.rs:33:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i64` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:36:36
+  --> $DIR/issue-8460-const.rs:35:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to divide `1_i128` by zero
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:38:36
+  --> $DIR/issue-8460-const.rs:37:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:40:36
+  --> $DIR/issue-8460-const.rs:39:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:42:36
+  --> $DIR/issue-8460-const.rs:41:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:44:36
+  --> $DIR/issue-8460-const.rs:43:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:46:36
+  --> $DIR/issue-8460-const.rs:45:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:48:36
+  --> $DIR/issue-8460-const.rs:47:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:50:36
+  --> $DIR/issue-8460-const.rs:49:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:52:36
+  --> $DIR/issue-8460-const.rs:51:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:54:36
+  --> $DIR/issue-8460-const.rs:53:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:56:36
+  --> $DIR/issue-8460-const.rs:55:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:58:36
+  --> $DIR/issue-8460-const.rs:57:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:60:36
+  --> $DIR/issue-8460-const.rs:59:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
diff --git a/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr b/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr
index 739b5468743..d94c7742de3 100644
--- a/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr
+++ b/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr
@@ -1,5 +1,5 @@
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:14:36
+  --> $DIR/issue-8460-const.rs:13:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
@@ -7,37 +7,37 @@ LL |     assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    = note: `#[deny(arithmetic_overflow)]` on by default
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:16:36
+  --> $DIR/issue-8460-const.rs:15:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:18:36
+  --> $DIR/issue-8460-const.rs:17:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:20:36
+  --> $DIR/issue-8460-const.rs:19:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:22:36
+  --> $DIR/issue-8460-const.rs:21:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:24:36
+  --> $DIR/issue-8460-const.rs:23:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:26:36
+  --> $DIR/issue-8460-const.rs:25:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to divide `1_isize` by zero
@@ -45,103 +45,103 @@ LL |     assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    = note: `#[deny(unconditional_panic)]` on by default
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:28:36
+  --> $DIR/issue-8460-const.rs:27:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to divide `1_i8` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:30:36
+  --> $DIR/issue-8460-const.rs:29:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i16` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:32:36
+  --> $DIR/issue-8460-const.rs:31:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i32` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:34:36
+  --> $DIR/issue-8460-const.rs:33:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to divide `1_i64` by zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:36:36
+  --> $DIR/issue-8460-const.rs:35:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to divide `1_i128` by zero
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:38:36
+  --> $DIR/issue-8460-const.rs:37:36
    |
 LL |     assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:40:36
+  --> $DIR/issue-8460-const.rs:39:36
    |
 LL |     assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:42:36
+  --> $DIR/issue-8460-const.rs:41:36
    |
 LL |     assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:44:36
+  --> $DIR/issue-8460-const.rs:43:36
    |
 LL |     assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:46:36
+  --> $DIR/issue-8460-const.rs:45:36
    |
 LL |     assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
 
 error: this arithmetic operation will overflow
-  --> $DIR/issue-8460-const.rs:48:36
+  --> $DIR/issue-8460-const.rs:47:36
    |
 LL |     assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
    |                                    ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:50:36
+  --> $DIR/issue-8460-const.rs:49:36
    |
 LL |     assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
    |                                    ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:52:36
+  --> $DIR/issue-8460-const.rs:51:36
    |
 LL |     assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
    |                                    ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:54:36
+  --> $DIR/issue-8460-const.rs:53:36
    |
 LL |     assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:56:36
+  --> $DIR/issue-8460-const.rs:55:36
    |
 LL |     assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:58:36
+  --> $DIR/issue-8460-const.rs:57:36
    |
 LL |     assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
    |                                    ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
 
 error: this operation will panic at runtime
-  --> $DIR/issue-8460-const.rs:60:36
+  --> $DIR/issue-8460-const.rs:59:36
    |
 LL |     assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
    |                                    ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
diff --git a/src/test/ui/issues/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs
index 53005e46d2f..dc754666c8e 100644
--- a/src/test/ui/issues/issue-8460-const.rs
+++ b/src/test/ui/issues/issue-8460-const.rs
@@ -7,7 +7,6 @@
 
 #![deny(const_err)]
 
-use std::{isize, i8, i16, i32, i64, i128};
 use std::thread;
 
 fn main() {
diff --git a/src/test/ui/iterators/iter-count-overflow-debug.rs b/src/test/ui/iterators/iter-count-overflow-debug.rs
index d6612035750..5a0394ae760 100644
--- a/src/test/ui/iterators/iter-count-overflow-debug.rs
+++ b/src/test/ui/iterators/iter-count-overflow-debug.rs
@@ -4,13 +4,12 @@
 // compile-flags: -C debug_assertions=yes -C opt-level=3
 
 use std::panic;
-use std::usize::MAX;
 
 fn main() {
-    assert_eq!((0..MAX).by_ref().count(), MAX);
+    assert_eq!((0..usize::MAX).by_ref().count(), usize::MAX);
 
     let r = panic::catch_unwind(|| {
-        (0..=MAX).by_ref().count()
+        (0..=usize::MAX).by_ref().count()
     });
     assert!(r.is_err());
 }
diff --git a/src/test/ui/iterators/iter-count-overflow-ndebug.rs b/src/test/ui/iterators/iter-count-overflow-ndebug.rs
index c38755db87e..dcaaff671b2 100644
--- a/src/test/ui/iterators/iter-count-overflow-ndebug.rs
+++ b/src/test/ui/iterators/iter-count-overflow-ndebug.rs
@@ -2,9 +2,7 @@
 // only-32bit too impatient for 2⁶⁴ items
 // compile-flags: -C debug_assertions=no -C opt-level=3
 
-use std::usize::MAX;
-
 fn main() {
-    assert_eq!((0..MAX).by_ref().count(), MAX);
-    assert_eq!((0..=MAX).by_ref().count(), 0);
+    assert_eq!((0..usize::MAX).by_ref().count(), usize::MAX);
+    assert_eq!((0..=usize::MAX).by_ref().count(), 0);
 }
diff --git a/src/test/ui/iterators/iter-position-overflow-debug.rs b/src/test/ui/iterators/iter-position-overflow-debug.rs
index f1eded31702..733ee0c46cc 100644
--- a/src/test/ui/iterators/iter-position-overflow-debug.rs
+++ b/src/test/ui/iterators/iter-position-overflow-debug.rs
@@ -4,11 +4,10 @@
 // compile-flags: -C debug_assertions=yes -C opt-level=3
 
 use std::panic;
-use std::usize::MAX;
 
 fn main() {
-    let n = MAX as u64;
-    assert_eq!((0..).by_ref().position(|i| i >= n), Some(MAX));
+    let n = usize::MAX as u64;
+    assert_eq!((0..).by_ref().position(|i| i >= n), Some(usize::MAX));
 
     let r = panic::catch_unwind(|| {
         (0..).by_ref().position(|i| i > n)
diff --git a/src/test/ui/iterators/iter-position-overflow-ndebug.rs b/src/test/ui/iterators/iter-position-overflow-ndebug.rs
index 3b0c245a5c2..e610c35599c 100644
--- a/src/test/ui/iterators/iter-position-overflow-ndebug.rs
+++ b/src/test/ui/iterators/iter-position-overflow-ndebug.rs
@@ -2,11 +2,9 @@
 // only-32bit too impatient for 2⁶⁴ items
 // compile-flags: -C debug_assertions=no -C opt-level=3
 
-use std::usize::MAX;
-
 fn main() {
-    let n = MAX as u64;
-    assert_eq!((0..).by_ref().position(|i| i >= n), Some(MAX));
+    let n = usize::MAX as u64;
+    assert_eq!((0..).by_ref().position(|i| i >= n), Some(usize::MAX));
     assert_eq!((0..).by_ref().position(|i| i > n), Some(0));
     assert_eq!((0..=n + 1).by_ref().position(|_| false), None);
 }
diff --git a/src/test/ui/macros/macro-first-set.rs b/src/test/ui/macros/macro-first-set.rs
index eb2504d4bfd..f85376dabcb 100644
--- a/src/test/ui/macros/macro-first-set.rs
+++ b/src/test/ui/macros/macro-first-set.rs
@@ -249,7 +249,7 @@ macro_rules! test_path {
 test_path!();
 test_path!(,);
 test_path!(::std);
-test_path!(std::u8,);
+test_path!(std::ops,);
 test_path!(any, super, super::super::self::path, X<Y>::Z<'a, T=U>);
 
 macro_rules! test_lifetime {
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
index 5fcd3392d33..52a51038651 100644
--- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
+++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
@@ -1,7 +1,5 @@
 #![feature(box_syntax, unboxed_closures)]
 
-use std::usize;
-
 fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
 
 fn test(_x: Box<usize>) {}
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
index 462bbd7be58..9427ba546a9 100644
--- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
+++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of `i`, a captured variable in an `Fn` closure
-  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:11:28
+  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:9:28
    |
 LL |     let i = box 3;
    |         - captured outer variable
diff --git a/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs b/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs
index ced3c61ec16..7691149602b 100644
--- a/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs
+++ b/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs
@@ -2,8 +2,6 @@
 
 #![deny(const_err)]
 
-use std::{f32, f64};
-
 // Forces evaluation of constants, triggering hard error
 fn force<T>(_: T) {}
 
diff --git a/src/test/ui/numbers-arithmetic/float-nan.rs b/src/test/ui/numbers-arithmetic/float-nan.rs
index ee87b8cccfe..0cc6473e5c4 100644
--- a/src/test/ui/numbers-arithmetic/float-nan.rs
+++ b/src/test/ui/numbers-arithmetic/float-nan.rs
@@ -1,5 +1,4 @@
 // run-pass
-use std::f64;
 
 pub fn main() {
   let nan: f64 = f64::NAN;
diff --git a/src/test/ui/numbers-arithmetic/num-wrapping.rs b/src/test/ui/numbers-arithmetic/num-wrapping.rs
index 9a01549ecd2..43b1059f944 100644
--- a/src/test/ui/numbers-arithmetic/num-wrapping.rs
+++ b/src/test/ui/numbers-arithmetic/num-wrapping.rs
@@ -21,7 +21,8 @@ macro_rules! int_modules {
     ($(($name:ident, $size:expr),)*) => ($(
         mod $name {
             pub const BITS: usize = $size;
-            pub use std::$name::*;
+            pub const MAX: $name = $name::MAX;
+            pub const MIN: $name = $name::MIN;
         }
     )*)
 }
diff --git a/src/test/ui/numbers-arithmetic/overflowing-neg.rs b/src/test/ui/numbers-arithmetic/overflowing-neg.rs
index fe77544641c..df119805303 100644
--- a/src/test/ui/numbers-arithmetic/overflowing-neg.rs
+++ b/src/test/ui/numbers-arithmetic/overflowing-neg.rs
@@ -6,5 +6,5 @@
 #![allow(arithmetic_overflow)]
 
 fn main() {
-    let _x = -std::i8::MIN;
+    let _x = -i8::MIN;
 }
diff --git a/src/test/ui/numbers-arithmetic/saturating-float-casts-impl.rs b/src/test/ui/numbers-arithmetic/saturating-float-casts-impl.rs
index 6c3e503693c..4c6929d6627 100644
--- a/src/test/ui/numbers-arithmetic/saturating-float-casts-impl.rs
+++ b/src/test/ui/numbers-arithmetic/saturating-float-casts-impl.rs
@@ -11,10 +11,6 @@
 extern crate test;
 
 use self::test::black_box;
-use std::{f32, f64};
-#[cfg(not(target_os = "emscripten"))]
-use std::{i128, u128};
-use std::{i16, i32, i64, i8, u16, u32, u64, u8};
 
 macro_rules! test {
     ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => (
diff --git a/src/test/ui/numbers-arithmetic/shift-near-oflo.rs b/src/test/ui/numbers-arithmetic/shift-near-oflo.rs
index 939eb974612..55006a11342 100644
--- a/src/test/ui/numbers-arithmetic/shift-near-oflo.rs
+++ b/src/test/ui/numbers-arithmetic/shift-near-oflo.rs
@@ -47,21 +47,21 @@ fn test_left_shift() {
     let x = 1_u8 << id(0);
     assert_eq!(x, 1);
     let x = 1_i8 << id(7);
-    assert_eq!(x, std::i8::MIN);
+    assert_eq!(x, i8::MIN);
     let x = 1_u8 << id(7);
     assert_eq!(x, 0x80);
     // high-order bits on LHS are silently discarded without panic.
     let x = 3_i8 << id(7);
-    assert_eq!(x, std::i8::MIN);
+    assert_eq!(x, i8::MIN);
     let x = 3_u8 << id(7);
     assert_eq!(x, 0x80);
 
     // above is (approximately) expanded from:
-    tests!(i8, u8, 7, std::i8::MIN, 0x80_u8);
+    tests!(i8, u8, 7, i8::MIN, 0x80_u8);
 
-    tests!(i16, u16, 15, std::i16::MIN, 0x8000_u16);
-    tests!(i32, u32, 31, std::i32::MIN, 0x8000_0000_u32);
-    tests!(i64, u64, 63, std::i64::MIN, 0x8000_0000_0000_0000_u64);
+    tests!(i16, u16, 15, i16::MIN, 0x8000_u16);
+    tests!(i32, u32, 31, i32::MIN, 0x8000_0000_u32);
+    tests!(i64, u64, 63, i64::MIN, 0x8000_0000_0000_0000_u64);
 }
 
 fn test_right_shift() {
@@ -92,9 +92,9 @@ fn test_right_shift() {
         } }
     }
 
-    tests!(i8, u8, 7, std::i8::MIN, 0x40_i8, 0x80_u8);
-    tests!(i16, u16, 15, std::i16::MIN, 0x4000_u16, 0x8000_u16);
-    tests!(i32, u32, 31, std::i32::MIN, 0x4000_0000_u32, 0x8000_0000_u32);
-    tests!(i64, u64, 63, std::i64::MIN,
+    tests!(i8, u8, 7, i8::MIN, 0x40_i8, 0x80_u8);
+    tests!(i16, u16, 15, i16::MIN, 0x4000_u16, 0x8000_u16);
+    tests!(i32, u32, 31, i32::MIN, 0x4000_0000_u32, 0x8000_0000_u32);
+    tests!(i64, u64, 63, i64::MIN,
            0x4000_0000_0000_0000_u64, 0x8000_0000_0000_0000_u64);
 }
diff --git a/src/test/ui/numbers-arithmetic/u128-as-f32.rs b/src/test/ui/numbers-arithmetic/u128-as-f32.rs
index 2671a267f4a..839ce932d9e 100644
--- a/src/test/ui/numbers-arithmetic/u128-as-f32.rs
+++ b/src/test/ui/numbers-arithmetic/u128-as-f32.rs
@@ -4,8 +4,6 @@
 #![deny(overflowing_literals)]
 extern crate test;
 
-use std::f32;
-use std::u128;
 use test::black_box;
 
 macro_rules! test {
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
index 345e617a7a3..4c271a3916a 100644
--- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
+++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+  --> $DIR/regions-addr-of-upvar-self.rs:8:20
    |
 LL |         let _f = || {
    |                  -- lifetime `'1` represents this closure's body
@@ -9,7 +9,7 @@ LL |             let p: &'static mut usize = &mut self.food;
    = note: closure implements `FnMut`, so references to captured variables can't escape the closure
 
 error: lifetime may not live long enough
-  --> $DIR/regions-addr-of-upvar-self.rs:10:20
+  --> $DIR/regions-addr-of-upvar-self.rs:8:20
    |
 LL |     pub fn chase_cat(&mut self) {
    |                      - let's call the lifetime of this reference `'1`
@@ -18,7 +18,7 @@ LL |             let p: &'static mut usize = &mut self.food;
    |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
 
 error[E0597]: `self` does not live long enough
-  --> $DIR/regions-addr-of-upvar-self.rs:10:46
+  --> $DIR/regions-addr-of-upvar-self.rs:8:46
    |
 LL |         let _f = || {
    |                  -- value captured here
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs
index 1f8fe9a4439..6159ab02d3d 100644
--- a/src/test/ui/regions/regions-addr-of-upvar-self.rs
+++ b/src/test/ui/regions/regions-addr-of-upvar-self.rs
@@ -1,5 +1,3 @@
-use std::usize;
-
 struct Dog {
     food: usize,
 }
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr
index 005800d50a4..62e9058365f 100644
--- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr
+++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr
@@ -1,22 +1,22 @@
 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
-  --> $DIR/regions-addr-of-upvar-self.rs:10:41
+  --> $DIR/regions-addr-of-upvar-self.rs:8:41
    |
 LL |             let p: &'static mut usize = &mut self.food;
    |                                         ^^^^^^^^^^^^^^
    |
-note: first, the lifetime cannot outlive the lifetime `'_` as defined on the body at 9:18...
-  --> $DIR/regions-addr-of-upvar-self.rs:9:18
+note: first, the lifetime cannot outlive the lifetime `'_` as defined on the body at 7:18...
+  --> $DIR/regions-addr-of-upvar-self.rs:7:18
    |
 LL |         let _f = || {
    |                  ^^
 note: ...so that closure can access `self`
-  --> $DIR/regions-addr-of-upvar-self.rs:10:41
+  --> $DIR/regions-addr-of-upvar-self.rs:8:41
    |
 LL |             let p: &'static mut usize = &mut self.food;
    |                                         ^^^^^^^^^^^^^^
    = note: but, the lifetime must be valid for the static lifetime...
 note: ...so that reference does not outlive borrowed content
-  --> $DIR/regions-addr-of-upvar-self.rs:10:41
+  --> $DIR/regions-addr-of-upvar-self.rs:8:41
    |
 LL |             let p: &'static mut usize = &mut self.food;
    |                                         ^^^^^^^^^^^^^^
diff --git a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
index 1cca2752061..fa5630837b9 100644
--- a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
+++ b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs
@@ -1,5 +1,3 @@
-use std::f32;
-
 #[derive(PartialEq)]
 struct Foo {
     x: u32
diff --git a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr
index 02fa2398189..9a5d57d4118 100644
--- a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr
+++ b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr
@@ -1,11 +1,11 @@
 error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/match-forbidden-without-eq.rs:13:9
+  --> $DIR/match-forbidden-without-eq.rs:11:9
    |
 LL |         FOO => { }
    |         ^^^
 
 warning: floating-point types cannot be used in patterns
-  --> $DIR/match-forbidden-without-eq.rs:20:9
+  --> $DIR/match-forbidden-without-eq.rs:18:9
    |
 LL |         f32::INFINITY => { }
    |         ^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL |         f32::INFINITY => { }
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 warning: floating-point types cannot be used in patterns
-  --> $DIR/match-forbidden-without-eq.rs:20:9
+  --> $DIR/match-forbidden-without-eq.rs:18:9
    |
 LL |         f32::INFINITY => { }
    |         ^^^^^^^^^^^^^
diff --git a/src/test/ui/simd-type-generic-monomorphisation.rs b/src/test/ui/simd-type-generic-monomorphisation.rs
index fc5e23f4986..0275f0ce4c1 100644
--- a/src/test/ui/simd-type-generic-monomorphisation.rs
+++ b/src/test/ui/simd-type-generic-monomorphisation.rs
@@ -2,7 +2,9 @@
 
 #![feature(repr_simd, platform_intrinsics)]
 
-// error-pattern:monomorphising SIMD type `Simd2<X>` with a non-machine element type `X`
+// ignore-tidy-linelength
+
+// error-pattern:monomorphising SIMD type `Simd2<X>` with a non-primitive-scalar (integer/float/pointer) element type `X`
 
 struct X(Vec<i32>);
 #[repr(simd)]
diff --git a/src/test/ui/simd-type-generic-monomorphisation.stderr b/src/test/ui/simd-type-generic-monomorphisation.stderr
index 2a74506e80e..7f23893ac85 100644
--- a/src/test/ui/simd-type-generic-monomorphisation.stderr
+++ b/src/test/ui/simd-type-generic-monomorphisation.stderr
@@ -1,4 +1,4 @@
-error: monomorphising SIMD type `Simd2<X>` with a non-machine element type `X`
+error: monomorphising SIMD type `Simd2<X>` with a non-primitive-scalar (integer/float/pointer) element type `X`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/simd-type.rs b/src/test/ui/simd-type.rs
index 9e4b7e76560..a320df85138 100644
--- a/src/test/ui/simd-type.rs
+++ b/src/test/ui/simd-type.rs
@@ -1,10 +1,20 @@
 #![feature(repr_simd)]
 #![allow(non_camel_case_types)]
 
+// ignore-tidy-linelength
+
 #[repr(simd)]
 struct empty; //~ ERROR SIMD vector cannot be empty
 
 #[repr(simd)]
 struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous
 
+struct Foo;
+
+#[repr(simd)]
+struct FooV(Foo, Foo); //~ ERROR SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+
+#[repr(simd)]
+struct FooV2([Foo; 2]); //~ ERROR SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+
 fn main() {}
diff --git a/src/test/ui/simd-type.stderr b/src/test/ui/simd-type.stderr
index 0c4242f46b7..23004c78591 100644
--- a/src/test/ui/simd-type.stderr
+++ b/src/test/ui/simd-type.stderr
@@ -1,16 +1,28 @@
 error[E0075]: SIMD vector cannot be empty
-  --> $DIR/simd-type.rs:5:1
+  --> $DIR/simd-type.rs:7:1
    |
 LL | struct empty;
    | ^^^^^^^^^^^^^
 
 error[E0076]: SIMD vector should be homogeneous
-  --> $DIR/simd-type.rs:8:1
+  --> $DIR/simd-type.rs:10:1
    |
 LL | struct i64f64(i64, f64);
    | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type
 
-error: aborting due to 2 previous errors
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+  --> $DIR/simd-type.rs:15:1
+   |
+LL | struct FooV(Foo, Foo);
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+  --> $DIR/simd-type.rs:18:1
+   |
+LL | struct FooV2([Foo; 2]);
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0075, E0076.
+Some errors have detailed explanations: E0075, E0076, E0077.
 For more information about an error, try `rustc --explain E0075`.
diff --git a/src/test/ui/simd/simd-array-trait.rs b/src/test/ui/simd/simd-array-trait.rs
new file mode 100644
index 00000000000..d6ed5f61a00
--- /dev/null
+++ b/src/test/ui/simd/simd-array-trait.rs
@@ -0,0 +1,41 @@
+// Figuring out the size of a vector type that depends on traits doesn't ICE
+
+#![allow(dead_code)]
+
+// pretty-expanded FIXME #23616
+
+#![feature(repr_simd, platform_intrinsics, const_generics)]
+#![allow(non_camel_case_types, incomplete_features)]
+
+pub trait Simd {
+    type Lane: Clone + Copy;
+    const SIZE: usize;
+}
+
+pub struct i32x4;
+impl Simd for i32x4 {
+    type Lane = i32;
+    const SIZE: usize = 4;
+}
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct T<S: Simd>([S::Lane; S::SIZE]);
+//~^ ERROR constant expression depends on a generic parameter
+
+extern "platform-intrinsic" {
+    fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
+    fn simd_extract<T, E>(x: T, idx: u32) -> E;
+}
+
+pub fn main() {
+    let mut t = T::<i32x4>([0; 4]);
+    unsafe {
+        for i in 0_i32..4 {
+            t = simd_insert(t, i as u32, i);
+        }
+        for i in 0_i32..4 {
+            assert_eq!(i, simd_extract(t, i as u32));
+        }
+    }
+}
diff --git a/src/test/ui/simd/simd-array-trait.stderr b/src/test/ui/simd/simd-array-trait.stderr
new file mode 100644
index 00000000000..c100e020c54
--- /dev/null
+++ b/src/test/ui/simd/simd-array-trait.stderr
@@ -0,0 +1,10 @@
+error: constant expression depends on a generic parameter
+  --> $DIR/simd-array-trait.rs:23:23
+   |
+LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
+   |                       ^^^^^^^^^^^^^^^^^^
+   |
+   = note: this may fail depending on what value the parameter takes
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/simd/simd-array-type.rs b/src/test/ui/simd/simd-array-type.rs
new file mode 100644
index 00000000000..e84186a42ad
--- /dev/null
+++ b/src/test/ui/simd/simd-array-type.rs
@@ -0,0 +1,42 @@
+// run-pass
+#![allow(dead_code)]
+
+// pretty-expanded FIXME #23616
+
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct S([i32; 4]);
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct T<const N: usize>([i32; N]);
+
+extern "platform-intrinsic" {
+    fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
+    fn simd_extract<T, E>(x: T, idx: u32) -> E;
+}
+
+pub fn main() {
+    let mut s = S([0; 4]);
+
+    unsafe {
+        for i in 0_i32..4 {
+            s = simd_insert(s, i as u32, i);
+        }
+        for i in 0_i32..4 {
+            assert_eq!(i, simd_extract(s, i as u32));
+        }
+    }
+
+    let mut t = T::<4>([0; 4]);
+    unsafe {
+        for i in 0_i32..4 {
+            t = simd_insert(t, i as u32, i);
+        }
+        for i in 0_i32..4 {
+            assert_eq!(i, simd_extract(t, i as u32));
+        }
+    }
+}
diff --git a/src/test/ui/simd/simd-generics.rs b/src/test/ui/simd/simd-generics.rs
index ab6caee9d7b..dedca6276cd 100644
--- a/src/test/ui/simd/simd-generics.rs
+++ b/src/test/ui/simd/simd-generics.rs
@@ -1,9 +1,6 @@
 // run-pass
 #![allow(non_camel_case_types)]
-
-
-
-#![feature(repr_simd, platform_intrinsics)]
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
 
 use std::ops;
 
@@ -11,6 +8,11 @@ use std::ops;
 #[derive(Copy, Clone)]
 struct f32x4(f32, f32, f32, f32);
 
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct S<const N: usize>([f32; N]);
+
+
 extern "platform-intrinsic" {
     fn simd_add<T>(x: T, y: T) -> T;
 }
@@ -23,10 +25,19 @@ impl ops::Add for f32x4 {
     type Output = f32x4;
 
     fn add(self, rhs: f32x4) -> f32x4 {
-        unsafe {simd_add(self, rhs)}
+        unsafe { simd_add(self, rhs) }
     }
 }
 
+impl ops::Add for S<4> {
+    type Output = Self;
+
+    fn add(self, rhs: Self) -> Self {
+        unsafe { simd_add(self, rhs) }
+    }
+}
+
+
 pub fn main() {
     let lr = f32x4(1.0f32, 2.0f32, 3.0f32, 4.0f32);
 
@@ -36,4 +47,11 @@ pub fn main() {
     assert_eq!(y, 4.0f32);
     assert_eq!(z, 6.0f32);
     assert_eq!(w, 8.0f32);
+
+    let lr2 = S::<4>([1.0f32, 2.0f32, 3.0f32, 4.0f32]);
+    let [x, y, z, w] = add(lr2, lr2).0;
+    assert_eq!(x, 2.0f32);
+    assert_eq!(y, 4.0f32);
+    assert_eq!(z, 6.0f32);
+    assert_eq!(w, 8.0f32);
 }
diff --git a/src/test/ui/simd/simd-intrinsic-float-minmax.rs b/src/test/ui/simd/simd-intrinsic-float-minmax.rs
index 5f0aa11af5f..d79be61f909 100644
--- a/src/test/ui/simd/simd-intrinsic-float-minmax.rs
+++ b/src/test/ui/simd/simd-intrinsic-float-minmax.rs
@@ -20,11 +20,11 @@ fn main() {
     let y = f32x4(2.0, 1.0, 4.0, 3.0);
 
     #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
-    let nan = ::std::f32::NAN;
+    let nan = f32::NAN;
     // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit.
     // See https://github.com/rust-lang/rust/issues/52746.
     #[cfg(any(target_arch = "mips", target_arch = "mips64"))]
-    let nan = f32::from_bits(::std::f32::NAN.to_bits() - 1);
+    let nan = f32::from_bits(f32::NAN.to_bits() - 1);
 
     let n = f32x4(nan, nan, nan, nan);
 
diff --git a/src/test/ui/simd/simd-intrinsic-generic-arithmetic-saturating.rs b/src/test/ui/simd/simd-intrinsic-generic-arithmetic-saturating.rs
index b7b3ec99781..4c459fa4bc8 100644
--- a/src/test/ui/simd/simd-intrinsic-generic-arithmetic-saturating.rs
+++ b/src/test/ui/simd/simd-intrinsic-generic-arithmetic-saturating.rs
@@ -2,15 +2,15 @@
 // ignore-emscripten
 
 #![allow(non_camel_case_types)]
-#![feature(repr_simd, platform_intrinsics)]
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
 
 #[repr(simd)]
 #[derive(Copy, Clone, PartialEq, Debug)]
 struct u32x4(pub u32, pub u32, pub u32, pub u32);
 
 #[repr(simd)]
-#[derive(Copy, Clone, PartialEq, Debug)]
-struct i32x4(pub i32, pub i32, pub i32, pub i32);
+#[derive(Copy, Clone)]
+struct I32<const N: usize>([i32; N]);
 
 extern "platform-intrinsic" {
     fn simd_saturating_add<T>(x: T, y: T) -> T;
@@ -51,41 +51,41 @@ fn main() {
         const MIN: i32 = i32::MIN;
         const MAX: i32 = i32::MAX;
 
-        let a = i32x4(1, 2, 3, 4);
-        let b = i32x4(2, 4, 6, 8);
-        let c = i32x4(-1, -2, -3, -4);
-        let d = i32x4(-2, -4, -6, -8);
+        let a = I32::<4>([1, 2, 3, 4]);
+        let b = I32::<4>([2, 4, 6, 8]);
+        let c = I32::<4>([-1, -2, -3, -4]);
+        let d = I32::<4>([-2, -4, -6, -8]);
 
-        let max = i32x4(MAX, MAX, MAX, MAX);
-        let max1 = i32x4(MAX - 1, MAX - 1, MAX - 1, MAX - 1);
-        let min = i32x4(MIN, MIN, MIN, MIN);
-        let min1 = i32x4(MIN + 1, MIN + 1, MIN + 1, MIN + 1);
+        let max = I32::<4>([MAX, MAX, MAX, MAX]);
+        let max1 = I32::<4>([MAX - 1, MAX - 1, MAX - 1, MAX - 1]);
+        let min = I32::<4>([MIN, MIN, MIN, MIN]);
+        let min1 = I32::<4>([MIN + 1, MIN + 1, MIN + 1, MIN + 1]);
 
-        let z = i32x4(0, 0, 0, 0);
+        let z = I32::<4>([0, 0, 0, 0]);
 
         unsafe {
-            assert_eq!(simd_saturating_add(z, z), z);
-            assert_eq!(simd_saturating_add(z, a), a);
-            assert_eq!(simd_saturating_add(b, z), b);
-            assert_eq!(simd_saturating_add(a, a), b);
-            assert_eq!(simd_saturating_add(a, max), max);
-            assert_eq!(simd_saturating_add(max, b), max);
-            assert_eq!(simd_saturating_add(max1, a), max);
-            assert_eq!(simd_saturating_add(min1, z), min1);
-            assert_eq!(simd_saturating_add(min, z), min);
-            assert_eq!(simd_saturating_add(min1, c), min);
-            assert_eq!(simd_saturating_add(min, c), min);
-            assert_eq!(simd_saturating_add(min1, d), min);
-            assert_eq!(simd_saturating_add(min, d), min);
+            assert_eq!(simd_saturating_add(z, z).0, z.0);
+            assert_eq!(simd_saturating_add(z, a).0, a.0);
+            assert_eq!(simd_saturating_add(b, z).0, b.0);
+            assert_eq!(simd_saturating_add(a, a).0, b.0);
+            assert_eq!(simd_saturating_add(a, max).0, max.0);
+            assert_eq!(simd_saturating_add(max, b).0, max.0);
+            assert_eq!(simd_saturating_add(max1, a).0, max.0);
+            assert_eq!(simd_saturating_add(min1, z).0, min1.0);
+            assert_eq!(simd_saturating_add(min, z).0, min.0);
+            assert_eq!(simd_saturating_add(min1, c).0, min.0);
+            assert_eq!(simd_saturating_add(min, c).0, min.0);
+            assert_eq!(simd_saturating_add(min1, d).0, min.0);
+            assert_eq!(simd_saturating_add(min, d).0, min.0);
 
-            assert_eq!(simd_saturating_sub(b, z), b);
-            assert_eq!(simd_saturating_sub(b, a), a);
-            assert_eq!(simd_saturating_sub(a, a), z);
-            assert_eq!(simd_saturating_sub(a, b), c);
-            assert_eq!(simd_saturating_sub(z, max), min1);
-            assert_eq!(simd_saturating_sub(min1, z), min1);
-            assert_eq!(simd_saturating_sub(min1, a), min);
-            assert_eq!(simd_saturating_sub(min1, b), min);
+            assert_eq!(simd_saturating_sub(b, z).0, b.0);
+            assert_eq!(simd_saturating_sub(b, a).0, a.0);
+            assert_eq!(simd_saturating_sub(a, a).0, z.0);
+            assert_eq!(simd_saturating_sub(a, b).0, c.0);
+            assert_eq!(simd_saturating_sub(z, max).0, min1.0);
+            assert_eq!(simd_saturating_sub(min1, z).0, min1.0);
+            assert_eq!(simd_saturating_sub(min1, a).0, min.0);
+            assert_eq!(simd_saturating_sub(min1, b).0, min.0);
         }
     }
 }
diff --git a/src/test/ui/simd/simd-intrinsic-generic-arithmetic.rs b/src/test/ui/simd/simd-intrinsic-generic-arithmetic.rs
index b67c0ad1eb2..5b0ff88432e 100644
--- a/src/test/ui/simd/simd-intrinsic-generic-arithmetic.rs
+++ b/src/test/ui/simd/simd-intrinsic-generic-arithmetic.rs
@@ -3,7 +3,7 @@
 
 // ignore-emscripten FIXME(#45351) hits an LLVM assert
 
-#![feature(repr_simd, platform_intrinsics)]
+#![feature(repr_simd, platform_intrinsics, min_const_generics)]
 
 #[repr(simd)]
 #[derive(Copy, Clone)]
@@ -11,7 +11,7 @@ struct i32x4(pub i32, pub i32, pub i32, pub i32);
 
 #[repr(simd)]
 #[derive(Copy, Clone)]
-struct u32x4(pub u32, pub u32, pub u32, pub u32);
+struct U32<const N: usize>([u32; N]);
 
 #[repr(simd)]
 #[derive(Copy, Clone)]
@@ -25,6 +25,15 @@ macro_rules! all_eq {
     }}
 }
 
+macro_rules! all_eq_ {
+    ($a: expr, $b: expr) => {{
+        let a = $a;
+        let b = $b;
+        assert!(a.0 == b.0);
+    }}
+}
+
+
 extern "platform-intrinsic" {
     fn simd_add<T>(x: T, y: T) -> T;
     fn simd_sub<T>(x: T, y: T) -> T;
@@ -40,81 +49,81 @@ extern "platform-intrinsic" {
 
 fn main() {
     let x1 = i32x4(1, 2, 3, 4);
-    let y1 = u32x4(1, 2, 3, 4);
+    let y1 = U32::<4>([1, 2, 3, 4]);
     let z1 = f32x4(1.0, 2.0, 3.0, 4.0);
     let x2 = i32x4(2, 3, 4, 5);
-    let y2 = u32x4(2, 3, 4, 5);
+    let y2 = U32::<4>([2, 3, 4, 5]);
     let z2 = f32x4(2.0, 3.0, 4.0, 5.0);
 
     unsafe {
         all_eq!(simd_add(x1, x2), i32x4(3, 5, 7, 9));
         all_eq!(simd_add(x2, x1), i32x4(3, 5, 7, 9));
-        all_eq!(simd_add(y1, y2), u32x4(3, 5, 7, 9));
-        all_eq!(simd_add(y2, y1), u32x4(3, 5, 7, 9));
+        all_eq_!(simd_add(y1, y2), U32::<4>([3, 5, 7, 9]));
+        all_eq_!(simd_add(y2, y1), U32::<4>([3, 5, 7, 9]));
         all_eq!(simd_add(z1, z2), f32x4(3.0, 5.0, 7.0, 9.0));
         all_eq!(simd_add(z2, z1), f32x4(3.0, 5.0, 7.0, 9.0));
 
         all_eq!(simd_mul(x1, x2), i32x4(2, 6, 12, 20));
         all_eq!(simd_mul(x2, x1), i32x4(2, 6, 12, 20));
-        all_eq!(simd_mul(y1, y2), u32x4(2, 6, 12, 20));
-        all_eq!(simd_mul(y2, y1), u32x4(2, 6, 12, 20));
+        all_eq_!(simd_mul(y1, y2), U32::<4>([2, 6, 12, 20]));
+        all_eq_!(simd_mul(y2, y1), U32::<4>([2, 6, 12, 20]));
         all_eq!(simd_mul(z1, z2), f32x4(2.0, 6.0, 12.0, 20.0));
         all_eq!(simd_mul(z2, z1), f32x4(2.0, 6.0, 12.0, 20.0));
 
         all_eq!(simd_sub(x2, x1), i32x4(1, 1, 1, 1));
         all_eq!(simd_sub(x1, x2), i32x4(-1, -1, -1, -1));
-        all_eq!(simd_sub(y2, y1), u32x4(1, 1, 1, 1));
-        all_eq!(simd_sub(y1, y2), u32x4(!0, !0, !0, !0));
+        all_eq_!(simd_sub(y2, y1), U32::<4>([1, 1, 1, 1]));
+        all_eq_!(simd_sub(y1, y2), U32::<4>([!0, !0, !0, !0]));
         all_eq!(simd_sub(z2, z1), f32x4(1.0, 1.0, 1.0, 1.0));
         all_eq!(simd_sub(z1, z2), f32x4(-1.0, -1.0, -1.0, -1.0));
 
         all_eq!(simd_div(x1, x1), i32x4(1, 1, 1, 1));
         all_eq!(simd_div(i32x4(2, 4, 6, 8), i32x4(2, 2, 2, 2)), x1);
-        all_eq!(simd_div(y1, y1), u32x4(1, 1, 1, 1));
-        all_eq!(simd_div(u32x4(2, 4, 6, 8), u32x4(2, 2, 2, 2)), y1);
+        all_eq_!(simd_div(y1, y1), U32::<4>([1, 1, 1, 1]));
+        all_eq_!(simd_div(U32::<4>([2, 4, 6, 8]), U32::<4>([2, 2, 2, 2])), y1);
         all_eq!(simd_div(z1, z1), f32x4(1.0, 1.0, 1.0, 1.0));
         all_eq!(simd_div(z1, z2), f32x4(1.0/2.0, 2.0/3.0, 3.0/4.0, 4.0/5.0));
         all_eq!(simd_div(z2, z1), f32x4(2.0/1.0, 3.0/2.0, 4.0/3.0, 5.0/4.0));
 
         all_eq!(simd_rem(x1, x1), i32x4(0, 0, 0, 0));
         all_eq!(simd_rem(x2, x1), i32x4(0, 1, 1, 1));
-        all_eq!(simd_rem(y1, y1), u32x4(0, 0, 0, 0));
-        all_eq!(simd_rem(y2, y1), u32x4(0, 1, 1, 1));
+        all_eq_!(simd_rem(y1, y1), U32::<4>([0, 0, 0, 0]));
+        all_eq_!(simd_rem(y2, y1), U32::<4>([0, 1, 1, 1]));
         all_eq!(simd_rem(z1, z1), f32x4(0.0, 0.0, 0.0, 0.0));
         all_eq!(simd_rem(z1, z2), z1);
         all_eq!(simd_rem(z2, z1), f32x4(0.0, 1.0, 1.0, 1.0));
 
         all_eq!(simd_shl(x1, x2), i32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5));
         all_eq!(simd_shl(x2, x1), i32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4));
-        all_eq!(simd_shl(y1, y2), u32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5));
-        all_eq!(simd_shl(y2, y1), u32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4));
+        all_eq_!(simd_shl(y1, y2), U32::<4>([1 << 2, 2 << 3, 3 << 4, 4 << 5]));
+        all_eq_!(simd_shl(y2, y1), U32::<4>([2 << 1, 3 << 2, 4 << 3, 5 << 4]));
 
         // test right-shift by assuming left-shift is correct
         all_eq!(simd_shr(simd_shl(x1, x2), x2), x1);
         all_eq!(simd_shr(simd_shl(x2, x1), x1), x2);
-        all_eq!(simd_shr(simd_shl(y1, y2), y2), y1);
-        all_eq!(simd_shr(simd_shl(y2, y1), y1), y2);
+        all_eq_!(simd_shr(simd_shl(y1, y2), y2), y1);
+        all_eq_!(simd_shr(simd_shl(y2, y1), y1), y2);
 
         // ensure we get logical vs. arithmetic shifts correct
         let (a, b, c, d) = (-12, -123, -1234, -12345);
         all_eq!(simd_shr(i32x4(a, b, c, d), x1), i32x4(a >> 1, b >> 2, c >> 3, d >> 4));
-        all_eq!(simd_shr(u32x4(a as u32, b as u32, c as u32, d as u32), y1),
-                u32x4((a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4));
+        all_eq_!(simd_shr(U32::<4>([a as u32, b as u32, c as u32, d as u32]), y1),
+                U32::<4>([(a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4]));
 
         all_eq!(simd_and(x1, x2), i32x4(0, 2, 0, 4));
         all_eq!(simd_and(x2, x1), i32x4(0, 2, 0, 4));
-        all_eq!(simd_and(y1, y2), u32x4(0, 2, 0, 4));
-        all_eq!(simd_and(y2, y1), u32x4(0, 2, 0, 4));
+        all_eq_!(simd_and(y1, y2), U32::<4>([0, 2, 0, 4]));
+        all_eq_!(simd_and(y2, y1), U32::<4>([0, 2, 0, 4]));
 
         all_eq!(simd_or(x1, x2), i32x4(3, 3, 7, 5));
         all_eq!(simd_or(x2, x1), i32x4(3, 3, 7, 5));
-        all_eq!(simd_or(y1, y2), u32x4(3, 3, 7, 5));
-        all_eq!(simd_or(y2, y1), u32x4(3, 3, 7, 5));
+        all_eq_!(simd_or(y1, y2), U32::<4>([3, 3, 7, 5]));
+        all_eq_!(simd_or(y2, y1), U32::<4>([3, 3, 7, 5]));
 
         all_eq!(simd_xor(x1, x2), i32x4(3, 1, 7, 1));
         all_eq!(simd_xor(x2, x1), i32x4(3, 1, 7, 1));
-        all_eq!(simd_xor(y1, y2), u32x4(3, 1, 7, 1));
-        all_eq!(simd_xor(y2, y1), u32x4(3, 1, 7, 1));
+        all_eq_!(simd_xor(y1, y2), U32::<4>([3, 1, 7, 1]));
+        all_eq_!(simd_xor(y2, y1), U32::<4>([3, 1, 7, 1]));
 
     }
 }
diff --git a/src/test/ui/simd/simd-intrinsic-generic-comparison.rs b/src/test/ui/simd/simd-intrinsic-generic-comparison.rs
index 2b593e1c9b8..103132c18ae 100644
--- a/src/test/ui/simd/simd-intrinsic-generic-comparison.rs
+++ b/src/test/ui/simd/simd-intrinsic-generic-comparison.rs
@@ -4,8 +4,6 @@
 #![feature(repr_simd, platform_intrinsics, concat_idents)]
 #![allow(non_camel_case_types)]
 
-use std::f32::NAN;
-
 #[repr(simd)]
 #[derive(Copy, Clone)]
 struct i32x4(i32, i32, i32, i32);
@@ -94,7 +92,7 @@ fn main() {
     // NAN comparisons are special:
     // -11 (*)    13
     // -5        -100 (*)
-    let f4 = f32x4(NAN, f1.1, NAN, f2.3);
+    let f4 = f32x4(f32::NAN, f1.1, f32::NAN, f2.3);
 
     unsafe {
         tests! {
diff --git a/src/test/ui/sleep.rs b/src/test/ui/sleep.rs
index 3b3a4a4f325..f3f8d7259c4 100644
--- a/src/test/ui/sleep.rs
+++ b/src/test/ui/sleep.rs
@@ -4,7 +4,6 @@
 use std::thread::{self, sleep};
 use std::time::Duration;
 use std::sync::{Arc, Mutex};
-use std::u64;
 
 fn main() {
     let finished = Arc::new(Mutex::new(false));
diff --git a/src/test/ui/structs-enums/discrim-explicit-23030.rs b/src/test/ui/structs-enums/discrim-explicit-23030.rs
index 211ca7e4e8f..af7ab865e32 100644
--- a/src/test/ui/structs-enums/discrim-explicit-23030.rs
+++ b/src/test/ui/structs-enums/discrim-explicit-23030.rs
@@ -5,8 +5,6 @@
 // See also compile-fail/overflow-discrim.rs, which shows what
 // happens if you leave the OhNo explicit cases out here.
 
-use std::{i8,u8,i16,u16,i32,u32,i64,u64,isize,usize};
-
 fn f_i8() {
     #[repr(i8)]
     enum A {
diff --git a/src/test/ui/symbol-names/const-generics.rs b/src/test/ui/symbol-names/const-generics.rs
index ad87000228d..823995e5be3 100644
--- a/src/test/ui/symbol-names/const-generics.rs
+++ b/src/test/ui/symbol-names/const-generics.rs
@@ -19,11 +19,11 @@
     // `i8`
     pub struct I8<const F: i8>;
 
-    impl I8<{std::i8::MIN}> {
+    impl I8<{i8::MIN}> {
         pub fn foo() {}
     }
 
-    impl I8<{std::i8::MAX}> {
+    impl I8<{i8::MAX}> {
         pub fn foo() {}
     }
 
@@ -34,7 +34,7 @@
     // `i16`
     pub struct I16<const F: i16>;
 
-    impl I16<{std::i16::MIN}> {
+    impl I16<{i16::MIN}> {
         pub fn foo() {}
     }
 
@@ -45,7 +45,7 @@
     // `i32`
     pub struct I32<const F: i32>;
 
-    impl I32<{std::i32::MIN}> {
+    impl I32<{i32::MIN}> {
         pub fn foo() {}
     }
 
@@ -56,7 +56,7 @@
     // `i64`
     pub struct I64<const F: i64>;
 
-    impl I64<{std::i64::MIN}> {
+    impl I64<{i64::MIN}> {
         pub fn foo() {}
     }
 
@@ -67,7 +67,7 @@
     // `i128`
     pub struct I128<const F: i128>;
 
-    impl I128<{std::i128::MIN}> {
+    impl I128<{i128::MIN}> {
         pub fn foo() {}
     }
 
diff --git a/src/test/ui/test-panic-abort-nocapture.rs b/src/test/ui/test-panic-abort-nocapture.rs
index 978732a9ec3..af530cc1a0b 100644
--- a/src/test/ui/test-panic-abort-nocapture.rs
+++ b/src/test/ui/test-panic-abort-nocapture.rs
@@ -4,6 +4,7 @@
 // run-fail
 // check-run-results
 // exec-env:RUST_BACKTRACE=0
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // ignore-wasm no panic or subprocess support
 // ignore-emscripten no panic or subprocess support
diff --git a/src/test/ui/test-panic-abort-nocapture.run.stderr b/src/test/ui/test-panic-abort-nocapture.run.stderr
index 3388813d5a0..727e9691c53 100644
--- a/src/test/ui/test-panic-abort-nocapture.run.stderr
+++ b/src/test/ui/test-panic-abort-nocapture.run.stderr
@@ -1,9 +1,9 @@
 thread 'main' panicked at 'assertion failed: `(left == right)`
   left: `2`,
- right: `4`', $DIR/test-panic-abort-nocapture.rs:32:5
+ right: `4`', $DIR/test-panic-abort-nocapture.rs:33:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 thread 'main' panicked at 'assertion failed: `(left == right)`
   left: `2`,
- right: `4`', $DIR/test-panic-abort-nocapture.rs:26:5
+ right: `4`', $DIR/test-panic-abort-nocapture.rs:27:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 testing321
diff --git a/src/test/ui/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-panic-abort-nocapture.run.stdout
index 87a246db5e0..15b19676a7c 100644
--- a/src/test/ui/test-panic-abort-nocapture.run.stdout
+++ b/src/test/ui/test-panic-abort-nocapture.run.stdout
@@ -19,5 +19,5 @@ failures:
 failures:
     it_fails
 
-test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/ui/test-panic-abort.rs b/src/test/ui/test-panic-abort.rs
index 21e7dc393f5..931b7993c81 100644
--- a/src/test/ui/test-panic-abort.rs
+++ b/src/test/ui/test-panic-abort.rs
@@ -4,6 +4,7 @@
 // run-fail
 // check-run-results
 // exec-env:RUST_BACKTRACE=0
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // ignore-wasm no panic or subprocess support
 // ignore-emscripten no panic or subprocess support
diff --git a/src/test/ui/test-panic-abort.run.stdout b/src/test/ui/test-panic-abort.run.stdout
index 33ddd519030..467f834afec 100644
--- a/src/test/ui/test-panic-abort.run.stdout
+++ b/src/test/ui/test-panic-abort.run.stdout
@@ -18,7 +18,7 @@ testing123
 testing321
 thread 'main' panicked at 'assertion failed: `(left == right)`
   left: `2`,
- right: `5`', $DIR/test-panic-abort.rs:33:5
+ right: `5`', $DIR/test-panic-abort.rs:34:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 
@@ -26,5 +26,5 @@ failures:
     it_exits
     it_fails
 
-test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/ui/test-passed-wasm.rs b/src/test/ui/test-passed-wasm.rs
new file mode 100644
index 00000000000..578aa4b1760
--- /dev/null
+++ b/src/test/ui/test-passed-wasm.rs
@@ -0,0 +1,20 @@
+// no-prefer-dynamic
+// compile-flags: --test
+// run-flags: --test-threads=1
+// run-pass
+// check-run-results
+// only-wasm32
+
+// Tests the output of the test harness with only passed tests.
+
+#![cfg(test)]
+
+#[test]
+fn it_works() {
+    assert_eq!(1 + 1, 2);
+}
+
+#[test]
+fn it_works_too() {
+    assert_eq!(1 * 0, 0);
+}
diff --git a/src/test/ui/test-passed-wasm.run.stdout b/src/test/ui/test-passed-wasm.run.stdout
new file mode 100644
index 00000000000..c3005a77983
--- /dev/null
+++ b/src/test/ui/test-passed-wasm.run.stdout
@@ -0,0 +1,7 @@
+
+running 2 tests
+test it_works ... ok
+test it_works_too ... ok
+
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
+
diff --git a/src/test/ui/test-passed.rs b/src/test/ui/test-passed.rs
new file mode 100644
index 00000000000..f65f0003022
--- /dev/null
+++ b/src/test/ui/test-passed.rs
@@ -0,0 +1,21 @@
+// no-prefer-dynamic
+// compile-flags: --test
+// run-flags: --test-threads=1
+// run-pass
+// check-run-results
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+// ignore-wasm32 no support for `Instant`
+
+// Tests the output of the test harness with only passed tests.
+
+#![cfg(test)]
+
+#[test]
+fn it_works() {
+    assert_eq!(1 + 1, 2);
+}
+
+#[test]
+fn it_works_too() {
+    assert_eq!(1 * 0, 0);
+}
diff --git a/src/test/ui/test-passed.run.stdout b/src/test/ui/test-passed.run.stdout
new file mode 100644
index 00000000000..17f70d60749
--- /dev/null
+++ b/src/test/ui/test-passed.run.stdout
@@ -0,0 +1,7 @@
+
+running 2 tests
+test it_works ... ok
+test it_works_too ... ok
+
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/src/test/ui/test-thread-capture.rs b/src/test/ui/test-thread-capture.rs
index 6bec48cd816..edc972837a3 100644
--- a/src/test/ui/test-thread-capture.rs
+++ b/src/test/ui/test-thread-capture.rs
@@ -3,6 +3,7 @@
 // run-flags: --test-threads=1
 // check-run-results
 // exec-env:RUST_BACKTRACE=0
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // ignore-emscripten no threads support
 
 #[test]
diff --git a/src/test/ui/test-thread-capture.run.stdout b/src/test/ui/test-thread-capture.run.stdout
index 1102aadab02..487cfb55eb4 100644
--- a/src/test/ui/test-thread-capture.run.stdout
+++ b/src/test/ui/test-thread-capture.run.stdout
@@ -10,12 +10,12 @@ fee
 fie
 foe
 fum
-thread 'main' panicked at 'explicit panic', $DIR/test-thread-capture.rs:30:5
+thread 'main' panicked at 'explicit panic', $DIR/test-thread-capture.rs:31:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 
 failures:
     thready_fail
 
-test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/ui/test-thread-nocapture.rs b/src/test/ui/test-thread-nocapture.rs
index 82df6e77cb1..8e8e9bbfdf0 100644
--- a/src/test/ui/test-thread-nocapture.rs
+++ b/src/test/ui/test-thread-nocapture.rs
@@ -3,6 +3,7 @@
 // run-flags: --test-threads=1 --nocapture
 // check-run-results
 // exec-env:RUST_BACKTRACE=0
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // ignore-emscripten no threads support
 
 #[test]
diff --git a/src/test/ui/test-thread-nocapture.run.stderr b/src/test/ui/test-thread-nocapture.run.stderr
index 98bd96d0abe..06495681b3e 100644
--- a/src/test/ui/test-thread-nocapture.run.stderr
+++ b/src/test/ui/test-thread-nocapture.run.stderr
@@ -1,2 +1,2 @@
-thread 'main' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:30:5
+thread 'main' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:31:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/test-thread-nocapture.run.stdout b/src/test/ui/test-thread-nocapture.run.stdout
index 77b42ed88d6..9d2da50826c 100644
--- a/src/test/ui/test-thread-nocapture.run.stdout
+++ b/src/test/ui/test-thread-nocapture.run.stdout
@@ -16,5 +16,5 @@ failures:
 failures:
     thready_fail
 
-test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/ui/union/union-transmute.rs b/src/test/ui/union/union-transmute.rs
index ac7dede98a3..be8062f6276 100644
--- a/src/test/ui/union/union-transmute.rs
+++ b/src/test/ui/union/union-transmute.rs
@@ -1,8 +1,5 @@
 // run-pass
 
-extern crate core;
-use core::f32;
-
 union U {
     a: (u8, u8),
     b: u16,
diff --git a/src/test/ui/use-module-level-int-consts.rs b/src/test/ui/use-module-level-int-consts.rs
index 758fb414ead..200f742d771 100644
--- a/src/test/ui/use-module-level-int-consts.rs
+++ b/src/test/ui/use-module-level-int-consts.rs
@@ -2,6 +2,7 @@
 
 // Make sure the module level constants are still there and accessible even after
 // the corresponding associated constants have been added, and later stabilized.
+#![allow(deprecated, deprecated_in_future)]
 use std::{u16, f32};
 
 fn main() {
diff --git a/src/test/ui/wrapping-int-api.rs b/src/test/ui/wrapping-int-api.rs
index ecdd742fb4e..6e2fc7f80b9 100644
--- a/src/test/ui/wrapping-int-api.rs
+++ b/src/test/ui/wrapping-int-api.rs
@@ -4,9 +4,6 @@
 // Don't warn about overflowing ops on 32-bit platforms
 #![cfg_attr(target_pointer_width = "32", allow(const_err))]
 
-use std::{i8, i16, i32, i64, isize};
-use std::{u8, u16, u32, u64, usize};
-
 fn main() {
     assert_eq!(   i8::MAX.wrapping_add(1),    i8::MIN);
     assert_eq!(  i16::MAX.wrapping_add(1),   i16::MIN);
diff --git a/src/tools/clippy/tests/ui/float_cmp_const.rs b/src/tools/clippy/tests/ui/float_cmp_const.rs
index dfc025558a2..263d9a7b92d 100644
--- a/src/tools/clippy/tests/ui/float_cmp_const.rs
+++ b/src/tools/clippy/tests/ui/float_cmp_const.rs
@@ -48,7 +48,7 @@ fn main() {
     v != 1.0;
 
     const ZERO_ARRAY: [f32; 3] = [0.0, 0.0, 0.0];
-    const ZERO_INF_ARRAY: [f32; 3] = [0.0, ::std::f32::INFINITY, ::std::f32::NEG_INFINITY];
+    const ZERO_INF_ARRAY: [f32; 3] = [0.0, f32::INFINITY, f32::NEG_INFINITY];
     const NON_ZERO_ARRAY: [f32; 3] = [0.0, 0.1, 0.2];
     const NON_ZERO_ARRAY2: [f32; 3] = [0.2, 0.1, 0.0];
 
diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js
index 139e6f73f42..63f2d2f5d2f 100644
--- a/src/tools/rustdoc-js/tester.js
+++ b/src/tools/rustdoc-js/tester.js
@@ -190,6 +190,30 @@ function loadThings(thingsToLoad, kindOfLoad, funcToCall, fileContent) {
     return content;
 }
 
+function contentToDiffLine(key, value) {
+    return `"${key}": "${value}",`;
+}
+
+// This function is only called when no matching result was found and therefore will only display
+// the diff between the two items.
+function betterLookingDiff(entry, data) {
+    let output = ' {\n';
+    let spaces = '     ';
+    for (let key in entry) {
+        if (!entry.hasOwnProperty(key)) {
+            continue;
+        }
+        let value = data[key];
+        if (value !== entry[key]) {
+            output += '-' + spaces + contentToDiffLine(key, entry[key]) + '\n';
+            output += '+' + spaces + contentToDiffLine(key, value) + '\n';
+        } else {
+            output += spaces + contentToDiffLine(key, value) + '\n';
+        }
+    }
+    return output + ' }';
+}
+
 function lookForEntry(entry, data) {
     for (var i = 0; i < data.length; ++i) {
         var allGood = true;
@@ -281,6 +305,13 @@ function runSearch(query, expected, index, loaded, loadedFile, queryName) {
             if (entry_pos === null) {
                 error_text.push(queryName + "==> Result not found in '" + key + "': '" +
                                 JSON.stringify(entry[i]) + "'");
+                // By default, we just compare the two first items.
+                let item_to_diff = 0;
+                if ((ignore_order === false || exact_check === true) && i < results[key].length) {
+                    item_to_diff = i;
+                }
+                error_text.push("Diff of first error:\n" +
+                    betterLookingDiff(entry[i], results[key][item_to_diff]));
             } else if (exact_check === true && prev_pos + 1 !== entry_pos) {
                 error_text.push(queryName + "==> Exact check failed at position " + (prev_pos + 1) +
                                 ": expected '" + JSON.stringify(entry[i]) + "' but found '" +