about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-20 16:24:12 +0000
committerbors <bors@rust-lang.org>2019-12-20 16:24:12 +0000
commit01a46509a4c2dc430ebebf940a26232fdaeeba81 (patch)
tree4e6f0da977dffdce7073fdf1a681986d7b38650b /src/test
parent6b561b4917e803c4be4ca44d8e552b680cb9e380 (diff)
parent43d1532cd7c2d03e8af3e7179edccd89e989897f (diff)
downloadrust-01a46509a4c2dc430ebebf940a26232fdaeeba81.tar.gz
rust-01a46509a4c2dc430ebebf940a26232fdaeeba81.zip
Auto merge of #67455 - Centril:rollup-mf0yc81, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #64588 (Add a raw "address of" operator)
 - #67031 (Update tokio crates to latest versions)
 - #67131 (Merge `TraitItem` & `ImplItem into `AssocItem`)
 - #67354 (Fix pointing at arg when cause is outside of call)
 - #67363 (Fix handling of wasm import modules and names)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/mir-opt/address-of.rs112
-rw-r--r--src/test/mir-opt/array-index-is-temporary.rs19
-rw-r--r--src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs18
-rw-r--r--src/test/mir-opt/retag.rs10
-rw-r--r--src/test/mir-opt/slice-drop-shim.rs18
-rw-r--r--src/test/pretty/raw-address-of.rs12
-rw-r--r--src/test/run-make/wasm-symbols-different-module/Makefile28
-rw-r--r--src/test/run-make/wasm-symbols-different-module/bar.rs33
-rw-r--r--src/test/run-make/wasm-symbols-different-module/baz.rs22
-rw-r--r--src/test/run-make/wasm-symbols-different-module/foo.rs23
-rw-r--r--src/test/run-make/wasm-symbols-different-module/log.rs16
-rw-r--r--src/test/run-make/wasm-symbols-different-module/verify-imports.js32
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-borrowed.rs22
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr40
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs23
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.rs17
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr21
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-mutability-ok.rs44
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-mutability.rs42
-rw-r--r--src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr59
-rw-r--r--src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr4
-rw-r--r--src/test/ui/cast/cast-as-bool.rs2
-rw-r--r--src/test/ui/cast/cast-as-bool.stderr7
-rw-r--r--src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs1
-rw-r--r--src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr19
-rw-r--r--src/test/ui/consts/const-address-of-interior-mut.rs16
-rw-r--r--src/test/ui/consts/const-address-of-interior-mut.stderr27
-rw-r--r--src/test/ui/consts/const-address-of-mut.rs14
-rw-r--r--src/test/ui/consts/const-address-of-mut.stderr39
-rw-r--r--src/test/ui/consts/const-address-of.rs19
-rw-r--r--src/test/ui/consts/const-eval/ub-wide-ptr.rs15
-rw-r--r--src/test/ui/consts/const-eval/ub-wide-ptr.stderr54
-rw-r--r--src/test/ui/consts/const-mut-refs/const_mut_address_of.rs30
-rw-r--r--src/test/ui/consts/const-prop-ice3.rs7
-rw-r--r--src/test/ui/consts/min_const_fn/address_of.rs17
-rw-r--r--src/test/ui/consts/min_const_fn/address_of.stderr21
-rw-r--r--src/test/ui/consts/min_const_fn/address_of_const.rs19
-rw-r--r--src/test/ui/did_you_mean/issue-40006.rs4
-rw-r--r--src/test/ui/did_you_mean/issue-40006.stderr12
-rw-r--r--src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr18
-rw-r--r--src/test/ui/invalid/invalid-variadic-function.rs3
-rw-r--r--src/test/ui/invalid/invalid-variadic-function.stderr15
-rw-r--r--src/test/ui/issues/issue-58856-1.rs2
-rw-r--r--src/test/ui/issues/issue-58856-1.stderr17
-rw-r--r--src/test/ui/issues/issue-60075.stderr2
-rw-r--r--src/test/ui/issues/issue-66923-show-error-for-correct-call.rs15
-rw-r--r--src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr19
-rw-r--r--src/test/ui/lint/lint-unused-mut-variables.rs8
-rw-r--r--src/test/ui/lint/lint-unused-mut-variables.stderr14
-rw-r--r--src/test/ui/packed/packed-struct-address-of-element.rs37
-rw-r--r--src/test/ui/packed/packed-struct-borrow-element.rs2
-rw-r--r--src/test/ui/parser/impl-item-const-pass.rs8
-rw-r--r--src/test/ui/parser/impl-item-const-semantic-fail.rs7
-rw-r--r--src/test/ui/parser/impl-item-const-semantic-fail.stderr10
-rw-r--r--src/test/ui/parser/impl-item-fn-no-body-pass.rs8
-rw-r--r--src/test/ui/parser/impl-item-fn-no-body-semantic-fail.rs7
-rw-r--r--src/test/ui/parser/impl-item-fn-no-body-semantic-fail.stderr10
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-pass.rs11
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs22
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr73
-rw-r--r--src/test/ui/parser/issue-21153.stderr2
-rw-r--r--src/test/ui/parser/issue-32446.stderr4
-rw-r--r--src/test/ui/parser/macro/trait-non-item-macros.stderr4
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr4
-rw-r--r--src/test/ui/parser/trait-item-with-defaultness-fail-semantic.rs12
-rw-r--r--src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr38
-rw-r--r--src/test/ui/parser/trait-item-with-defaultness-pass.rs13
-rw-r--r--src/test/ui/parser/variadic-ffi-3.rs5
-rw-r--r--src/test/ui/parser/variadic-ffi-3.stderr9
-rw-r--r--src/test/ui/parser/variadic-ffi-4.rs5
-rw-r--r--src/test/ui/parser/variadic-ffi-4.stderr9
-rw-r--r--src/test/ui/parser/variadic-ffi-nested-syntactic-fail.rs9
-rw-r--r--src/test/ui/parser/variadic-ffi-nested-syntactic-fail.stderr24
-rw-r--r--src/test/ui/parser/variadic-ffi-semantic-restrictions.rs76
-rw-r--r--src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr206
-rw-r--r--src/test/ui/parser/variadic-ffi-syntactic-pass.rs53
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-op.rs6
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-op.stderr18
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-temp-deref.rs20
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-temp-deref.stderr74
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-temp.rs6
-rw-r--r--src/test/ui/raw-ref-op/raw-ref-temp.stderr40
-rw-r--r--src/test/ui/raw-ref-op/unusual_locations.rs31
-rw-r--r--src/test/ui/raw-ref-op/unusual_locations.stderr18
84 files changed, 1622 insertions, 310 deletions
diff --git a/src/test/mir-opt/address-of.rs b/src/test/mir-opt/address-of.rs
new file mode 100644
index 00000000000..bbd1ca68a86
--- /dev/null
+++ b/src/test/mir-opt/address-of.rs
@@ -0,0 +1,112 @@
+fn address_of_reborrow() {
+    let y = &[0; 10];
+    let mut z = &mut [0; 10];
+
+    y as *const _;
+    y as *const [i32; 10];
+    y as *const dyn Send;
+    y as *const [i32];
+    y as *const i32;            // This is a cast, not a coercion
+
+    let p: *const _ = y;
+    let p: *const [i32; 10] = y;
+    let p: *const dyn Send = y;
+    let p: *const [i32] = y;
+
+    z as *const _;
+    z as *const [i32; 10];
+    z as *const dyn Send;
+    z as *const [i32];
+
+    let p: *const _ = z;
+    let p: *const [i32; 10] = z;
+    let p: *const dyn Send = z;
+    let p: *const [i32] = z;
+
+    z as *mut _;
+    z as *mut [i32; 10];
+    z as *mut dyn Send;
+    z as *mut [i32];
+
+    let p: *mut _ = z;
+    let p: *mut [i32; 10] = z;
+    let p: *mut dyn Send = z;
+    let p: *mut [i32] = z;
+}
+
+// The normal borrows here should be preserved
+fn borrow_and_cast(mut x: i32) {
+    let p = &x as *const i32;
+    let q = &mut x as *const i32;
+    let r = &mut x as *mut i32;
+}
+
+fn main() {}
+
+// START rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
+// bb0: {
+//  ...
+//  _5 = &raw const (*_1); // & to *const casts
+//  ...
+//  _7 = &raw const (*_1);
+//  ...
+//  _11 = &raw const (*_1);
+//  ...
+//  _14 = &raw const (*_1);
+//  ...
+//  _16 = &raw const (*_1);
+//  ...
+//  _17 = &raw const (*_1); // & to *const coercions
+//  ...
+//  _18 = &raw const (*_1);
+//  ...
+//  _20 = &raw const (*_1);
+//  ...
+//  _22 = &raw const (*_1);
+// ...
+//  _24 = &raw const (*_2); // &mut to *const casts
+// ...
+//  _26 = &raw const (*_2);
+// ...
+//  _30 = &raw const (*_2);
+// ...
+//  _33 = &raw const (*_2);
+// ...
+//  _34 = &raw const (*_2); // &mut to *const coercions
+// ...
+//  _35 = &raw const (*_2);
+// ...
+//  _37 = &raw const (*_2);
+// ...
+//  _39 = &raw const (*_2);
+// ...
+//  _41 = &raw mut (*_2); // &mut to *mut casts
+// ...
+//  _43 = &raw mut (*_2);
+// ...
+//  _47 = &raw mut (*_2);
+// ...
+//  _50 = &raw mut (*_2);
+// ...
+//  _51 = &raw mut (*_2); // &mut to *mut coercions
+// ...
+//  _52 = &raw mut (*_2);
+// ...
+//  _54 = &raw mut (*_2);
+// ...
+//  _56 = &raw mut (*_2);
+// ...
+// }
+// END rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
+
+// START rustc.borrow_and_cast.EraseRegions.after.mir
+// bb0: {
+//  ...
+//  _4 = &_1;
+//  ...
+//  _7 = &mut _1;
+//  ...
+//  _10 = &mut _1;
+//  ...
+// }
+// END rustc.borrow_and_cast.EraseRegions.after.mir
diff --git a/src/test/mir-opt/array-index-is-temporary.rs b/src/test/mir-opt/array-index-is-temporary.rs
index 00a6b26d0cf..096f98bade2 100644
--- a/src/test/mir-opt/array-index-is-temporary.rs
+++ b/src/test/mir-opt/array-index-is-temporary.rs
@@ -18,24 +18,23 @@ fn main() {
 // START rustc.main.EraseRegions.after.mir
 //     bb0: {
 //         ...
-//         _5 = &mut _2;
-//         _4 = &mut (*_5);
-//         _3 = move _4 as *mut usize (Misc);
+//         _4 = &mut _2;
+//         _3 = &raw mut (*_4);
 //         ...
-//         _7 = _3;
-//         _6 = const foo(move _7) -> bb1;
+//         _6 = _3;
+//         _5 = const foo(move _6) -> bb1;
 //     }
 //
 //     bb1: {
 //         ...
-//         _8 = _2;
-//         _9 = Len(_1);
-//         _10 = Lt(_8, _9);
-//         assert(move _10, "index out of bounds: the len is move _9 but the index is _8") -> bb2;
+//         _7 = _2;
+//         _8 = Len(_1);
+//         _9 = Lt(_7, _8);
+//         assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2;
 //     }
 //
 //     bb2: {
-//         _1[_8] = move _6;
+//         _1[_7] = move _5;
 //         ...
 //         return;
 //     }
diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs
index 3f82b81a47d..3c8c0ff4493 100644
--- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs
+++ b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs
@@ -11,25 +11,21 @@ fn main() {
 // START rustc.main.ConstProp.before.mir
 //  bb0: {
 //      ...
-//      _3 = _4;
-//      _2 = move _3 as *const i32 (Misc);
-//      ...
+//      _2 = &raw const (*_3);
 //      _1 = move _2 as usize (Misc);
 //      ...
-//      _6 = _1;
-//      _5 = const read(move _6) -> bb1;
+//      _5 = _1;
+//      _4 = const read(move _5) -> bb1;
 //  }
 // END rustc.main.ConstProp.before.mir
 // START rustc.main.ConstProp.after.mir
 //  bb0: {
 //      ...
-//      _4 = const main::FOO;
-//      _3 = _4;
-//      _2 = move _3 as *const i32 (Misc);
-//      ...
+//      _3 = const main::FOO;
+//      _2 = &raw const (*_3);
 //      _1 = move _2 as usize (Misc);
 //      ...
-//      _6 = _1;
-//      _5 = const read(move _6) -> bb1;
+//      _5 = _1;
+//      _4 = const read(move _5) -> bb1;
 //  }
 // END rustc.main.ConstProp.after.mir
diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs
index 32995448a21..ccecaeac96b 100644
--- a/src/test/mir-opt/retag.rs
+++ b/src/test/mir-opt/retag.rs
@@ -82,18 +82,16 @@ fn main() {
 //         _10 = move _8;
 //         Retag(_10);
 //         ...
-//         _13 = &mut (*_10);
-//         Retag(_13);
-//         _12 = move _13 as *mut i32 (Misc);
+//         _12 = &raw mut (*_10);
 //         Retag([raw] _12);
 //         ...
-//         _16 = move _17(move _18) -> bb5;
+//         _15 = move _16(move _17) -> bb5;
 //     }
 //
 //     bb5: {
-//         Retag(_16);
+//         Retag(_15);
 //         ...
-//         _20 = const Test::foo_shr(move _21, move _23) -> [return: bb6, unwind: bb7];
+//         _19 = const Test::foo_shr(move _20, move _22) -> [return: bb6, unwind: bb7];
 //     }
 //
 //     ...
diff --git a/src/test/mir-opt/slice-drop-shim.rs b/src/test/mir-opt/slice-drop-shim.rs
index f270dec5fe2..5a37b67229c 100644
--- a/src/test/mir-opt/slice-drop-shim.rs
+++ b/src/test/mir-opt/slice-drop-shim.rs
@@ -10,15 +10,15 @@ fn main() {
 // let mut _2: usize;
 // let mut _3: usize;
 // let mut _4: usize;
-// let mut _5: &mut std::string::String;
+// let mut _5: *mut std::string::String;
 // let mut _6: bool;
-// let mut _7: &mut std::string::String;
+// let mut _7: *mut std::string::String;
 // let mut _8: bool;
 // let mut _9: *mut std::string::String;
 // let mut _10: *mut std::string::String;
-// let mut _11: &mut std::string::String;
+// let mut _11: *mut std::string::String;
 // let mut _12: bool;
-// let mut _13: &mut std::string::String;
+// let mut _13: *mut std::string::String;
 // let mut _14: bool;
 // let mut _15: *mut [std::string::String];
 // bb0: {
@@ -31,7 +31,7 @@ fn main() {
 //     resume;
 // }
 // bb3 (cleanup): {
-//     _5 = &mut (*_1)[_4];
+//     _5 = &raw mut (*_1)[_4];
 //     _4 = Add(move _4, const 1usize);
 //     drop((*_5)) -> bb4;
 // }
@@ -40,7 +40,7 @@ fn main() {
 //     switchInt(move _6) -> [false: bb3, otherwise: bb2];
 // }
 // bb5: {
-//     _7 = &mut (*_1)[_4];
+//     _7 = &raw mut (*_1)[_4];
 //     _4 = Add(move _4, const 1usize);
 //     drop((*_7)) -> [return: bb6, unwind: bb4];
 // }
@@ -56,7 +56,7 @@ fn main() {
 //     goto -> bb7;
 // }
 // bb9 (cleanup): {
-//     _11 = &mut (*_9);
+//     _11 = _9;
 //     _9 = Offset(move _9, const 1usize);
 //     drop((*_11)) -> bb10;
 // }
@@ -65,7 +65,7 @@ fn main() {
 //     switchInt(move _12) -> [false: bb9, otherwise: bb2];
 // }
 // bb11: {
-//     _13 = &mut (*_9);
+//     _13 = _9;
 //     _9 = Offset(move _9, const 1usize);
 //     drop((*_13)) -> [return: bb12, unwind: bb10];
 // }
@@ -74,7 +74,7 @@ fn main() {
 //     switchInt(move _14) -> [false: bb11, otherwise: bb1];
 // }
 // bb13: {
-//     _15 = &mut (*_1);
+//     _15 = &raw mut (*_1);
 //     _9 = move _15 as *mut std::string::String (Misc);
 //     _10 = Offset(_9, move _3);
 //     goto -> bb12;
diff --git a/src/test/pretty/raw-address-of.rs b/src/test/pretty/raw-address-of.rs
new file mode 100644
index 00000000000..6ccc434a1e7
--- /dev/null
+++ b/src/test/pretty/raw-address-of.rs
@@ -0,0 +1,12 @@
+// pp-exact
+#![feature(raw_ref_op)]
+
+const C_PTR: () = { let a = 1; &raw const a; };
+static S_PTR: () = { let b = false; &raw const b; };
+
+fn main() {
+    let x = 123;
+    let mut y = 345;
+    let c_p = &raw const x;
+    let parens = unsafe { *(&raw mut (y)) };
+}
diff --git a/src/test/run-make/wasm-symbols-different-module/Makefile b/src/test/run-make/wasm-symbols-different-module/Makefile
new file mode 100644
index 00000000000..bb6a5d3c9d2
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/Makefile
@@ -0,0 +1,28 @@
+-include ../../run-make-fulldeps/tools.mk
+
+# only-wasm32-bare
+
+all:
+	$(RUSTC) foo.rs --target wasm32-unknown-unknown
+	$(NODE) verify-imports.js $(TMPDIR)/foo.wasm a/foo b/foo
+	$(RUSTC) foo.rs --target wasm32-unknown-unknown -C lto
+	$(NODE) verify-imports.js $(TMPDIR)/foo.wasm a/foo b/foo
+	$(RUSTC) foo.rs --target wasm32-unknown-unknown -O
+	$(NODE) verify-imports.js $(TMPDIR)/foo.wasm a/foo b/foo
+	$(RUSTC) foo.rs --target wasm32-unknown-unknown -O -C lto
+	$(NODE) verify-imports.js $(TMPDIR)/foo.wasm a/foo b/foo
+
+	$(RUSTC) bar.rs --target wasm32-unknown-unknown
+	$(NODE) verify-imports.js $(TMPDIR)/bar.wasm m1/f m1/g m2/f
+	$(RUSTC) bar.rs --target wasm32-unknown-unknown -C lto
+	$(NODE) verify-imports.js $(TMPDIR)/bar.wasm m1/f m1/g m2/f
+	$(RUSTC) bar.rs --target wasm32-unknown-unknown -O
+	$(NODE) verify-imports.js $(TMPDIR)/bar.wasm m1/f m1/g m2/f
+	$(RUSTC) bar.rs --target wasm32-unknown-unknown -O -C lto
+	$(NODE) verify-imports.js $(TMPDIR)/bar.wasm m1/f m1/g m2/f
+
+	$(RUSTC) baz.rs --target wasm32-unknown-unknown
+	$(NODE) verify-imports.js $(TMPDIR)/baz.wasm sqlite/allocate sqlite/deallocate
+
+	$(RUSTC) log.rs --target wasm32-unknown-unknown
+	$(NODE) verify-imports.js $(TMPDIR)/log.wasm test/log
diff --git a/src/test/run-make/wasm-symbols-different-module/bar.rs b/src/test/run-make/wasm-symbols-different-module/bar.rs
new file mode 100644
index 00000000000..7567060d781
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/bar.rs
@@ -0,0 +1,33 @@
+//! Issue #50021
+
+#![crate_type = "cdylib"]
+
+mod m1 {
+    #[link(wasm_import_module = "m1")]
+    extern "C" {
+        pub fn f();
+    }
+    #[link(wasm_import_module = "m1")]
+    extern "C" {
+        pub fn g();
+    }
+}
+
+mod m2 {
+    #[link(wasm_import_module = "m2")]
+    extern "C" {
+        pub fn f(_: i32);
+    }
+}
+
+#[no_mangle]
+pub unsafe fn run() {
+    m1::f();
+    m1::g();
+
+    // In generated code, expected:
+    // (import "m2" "f" (func $f (param i32)))
+    // but got:
+    // (import "m1" "f" (func $f (param i32)))
+    m2::f(0);
+}
diff --git a/src/test/run-make/wasm-symbols-different-module/baz.rs b/src/test/run-make/wasm-symbols-different-module/baz.rs
new file mode 100644
index 00000000000..fbb78619bb8
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/baz.rs
@@ -0,0 +1,22 @@
+//! Issue #63562
+
+#![crate_type = "cdylib"]
+
+mod foo {
+    #[link(wasm_import_module = "sqlite")]
+    extern "C" {
+        pub fn allocate(size: usize) -> i32;
+        pub fn deallocate(ptr: i32, size: usize);
+    }
+}
+
+#[no_mangle]
+pub extern "C" fn allocate() {
+    unsafe {
+        foo::allocate(1);
+        foo::deallocate(1, 2);
+    }
+}
+
+#[no_mangle]
+pub extern "C" fn deallocate() {}
diff --git a/src/test/run-make/wasm-symbols-different-module/foo.rs b/src/test/run-make/wasm-symbols-different-module/foo.rs
new file mode 100644
index 00000000000..a4ba7e714cc
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/foo.rs
@@ -0,0 +1,23 @@
+#![crate_type = "cdylib"]
+
+mod a {
+    #[link(wasm_import_module = "a")]
+    extern "C" {
+        pub fn foo();
+    }
+}
+
+mod b {
+    #[link(wasm_import_module = "b")]
+    extern "C" {
+        pub fn foo();
+    }
+}
+
+#[no_mangle]
+pub fn start() {
+    unsafe {
+        a::foo();
+        b::foo();
+    }
+}
diff --git a/src/test/run-make/wasm-symbols-different-module/log.rs b/src/test/run-make/wasm-symbols-different-module/log.rs
new file mode 100644
index 00000000000..ea3e0b4b2be
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/log.rs
@@ -0,0 +1,16 @@
+//! Issue #56309
+
+#![crate_type = "cdylib"]
+
+#[link(wasm_import_module = "test")]
+extern "C" {
+    fn log(message_data: u32, message_size: u32);
+}
+
+#[no_mangle]
+pub fn main() {
+    let message = "Hello, world!";
+    unsafe {
+        log(message.as_ptr() as u32, message.len() as u32);
+    }
+}
diff --git a/src/test/run-make/wasm-symbols-different-module/verify-imports.js b/src/test/run-make/wasm-symbols-different-module/verify-imports.js
new file mode 100644
index 00000000000..7e9f90cf8bd
--- /dev/null
+++ b/src/test/run-make/wasm-symbols-different-module/verify-imports.js
@@ -0,0 +1,32 @@
+const fs = require('fs');
+const process = require('process');
+const assert = require('assert');
+const buffer = fs.readFileSync(process.argv[2]);
+
+let m = new WebAssembly.Module(buffer);
+let list = WebAssembly.Module.imports(m);
+console.log('imports', list);
+if (list.length !== process.argv.length - 3)
+  throw new Error("wrong number of imports")
+
+const imports = new Map();
+for (let i = 3; i < process.argv.length; i++) {
+  const [module, name] = process.argv[i].split('/');
+  if (!imports.has(module))
+    imports.set(module, new Map());
+  imports.get(module).set(name, true);
+}
+
+for (let i of list) {
+  if (imports.get(i.module) === undefined || imports.get(i.module).get(i.name) === undefined)
+    throw new Error(`didn't find import of ${i.module}::${i.name}`);
+  imports.get(i.module).delete(i.name);
+
+  if (imports.get(i.module).size === 0)
+    imports.delete(i.module);
+}
+
+console.log(imports);
+if (imports.size !== 0) {
+  throw new Error('extra imports');
+}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.rs b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.rs
new file mode 100644
index 00000000000..f25fd7f66b3
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.rs
@@ -0,0 +1,22 @@
+#![feature(raw_ref_op)]
+
+fn address_of_shared() {
+    let mut x = 0;
+    let y = &x;
+
+    let q = &raw mut x;                 //~ ERROR cannot borrow
+
+    drop(y);
+}
+
+fn address_of_mutably_borrowed() {
+    let mut x = 0;
+    let y = &mut x;
+
+    let p = &raw const x;               //~ ERROR cannot borrow
+    let q = &raw mut x;                 //~ ERROR cannot borrow
+
+    drop(y);
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr
new file mode 100644
index 00000000000..ff461b748be
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr
@@ -0,0 +1,40 @@
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+  --> $DIR/borrow-raw-address-of-borrowed.rs:7:13
+   |
+LL |     let y = &x;
+   |             -- immutable borrow occurs here
+LL | 
+LL |     let q = &raw mut x;
+   |             ^^^^^^^^^^ mutable borrow occurs here
+LL | 
+LL |     drop(y);
+   |          - immutable borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+  --> $DIR/borrow-raw-address-of-borrowed.rs:16:13
+   |
+LL |     let y = &mut x;
+   |             ------ mutable borrow occurs here
+LL | 
+LL |     let p = &raw const x;
+   |             ^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL |     drop(y);
+   |          - mutable borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+  --> $DIR/borrow-raw-address-of-borrowed.rs:17:13
+   |
+LL |     let y = &mut x;
+   |             ------ first mutable borrow occurs here
+...
+LL |     let q = &raw mut x;
+   |             ^^^^^^^^^^ second mutable borrow occurs here
+LL | 
+LL |     drop(y);
+   |          - first borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs
new file mode 100644
index 00000000000..e381384fe65
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+#![feature(raw_ref_op)]
+
+fn raw_reborrow() {
+    let x = &0;
+    let y = &mut 0;
+
+    let p = &raw const *x;
+    let r = &raw const *y;
+    let s = &raw mut *y;
+}
+
+unsafe fn raw_reborrow_of_raw() {
+    let x = &0 as *const i32;
+    let y = &mut 0 as *mut i32;
+
+    let p = &raw const *x;
+    let r = &raw const *y;
+    let s = &raw mut *y;
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.rs b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.rs
new file mode 100644
index 00000000000..712873528b5
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.rs
@@ -0,0 +1,17 @@
+// Check that `&raw mut` cannot be used to turn a `&T` into a `*mut T`.
+
+#![feature(raw_ref_op)]
+
+fn raw_reborrow() {
+    let x = &0;
+
+    let q = &raw mut *x;                //~ ERROR cannot borrow
+}
+
+unsafe fn raw_reborrow_of_raw() {
+    let x = &0 as *const i32;
+
+    let q = &raw mut *x;                //~ ERROR cannot borrow
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr
new file mode 100644
index 00000000000..31af38507c7
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+  --> $DIR/borrow-raw-address-of-deref-mutability.rs:8:13
+   |
+LL |     let x = &0;
+   |             -- help: consider changing this to be a mutable reference: `&mut 0`
+LL | 
+LL |     let q = &raw mut *x;
+   |             ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
+  --> $DIR/borrow-raw-address-of-deref-mutability.rs:14:13
+   |
+LL |     let x = &0 as *const i32;
+   |             -- help: consider changing this to be a mutable pointer: `&mut 0`
+LL | 
+LL |     let q = &raw mut *x;
+   |             ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-mutability-ok.rs b/src/test/ui/borrowck/borrow-raw-address-of-mutability-ok.rs
new file mode 100644
index 00000000000..e1cf2dc5386
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-mutability-ok.rs
@@ -0,0 +1,44 @@
+// check-pass
+
+#![feature(raw_ref_op)]
+
+fn mutable_address_of() {
+    let mut x = 0;
+    let y = &raw mut x;
+}
+
+fn mutable_address_of_closure() {
+    let mut x = 0;
+    let mut f = || {
+        let y = &raw mut x;
+    };
+    f();
+}
+
+fn const_address_of_closure() {
+    let x = 0;
+    let f = || {
+        let y = &raw const x;
+    };
+    f();
+}
+
+fn make_fn<F: Fn()>(f: F) -> F { f }
+
+fn const_address_of_fn_closure() {
+    let x = 0;
+    let f = make_fn(|| {
+        let y = &raw const x;
+    });
+    f();
+}
+
+fn const_address_of_fn_closure_move() {
+    let x = 0;
+    let f = make_fn(move || {
+        let y = &raw const x;
+    });
+    f();
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-mutability.rs b/src/test/ui/borrowck/borrow-raw-address-of-mutability.rs
new file mode 100644
index 00000000000..320c54b806a
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-mutability.rs
@@ -0,0 +1,42 @@
+#![feature(raw_ref_op)]
+
+fn mutable_address_of() {
+    let x = 0;
+    let y = &raw mut x;                 //~ ERROR cannot borrow
+}
+
+fn mutable_address_of_closure() {
+    let x = 0;
+    let mut f = || {
+        let y = &raw mut x;             //~ ERROR cannot borrow
+    };
+    f();
+}
+
+fn mutable_address_of_imm_closure() {
+    let mut x = 0;
+    let f = || {
+        let y = &raw mut x;
+    };
+    f();                                //~ ERROR cannot borrow
+}
+
+fn make_fn<F: Fn()>(f: F) -> F { f }
+
+fn mutable_address_of_fn_closure() {
+    let mut x = 0;
+    let f = make_fn(|| {
+        let y = &raw mut x;             //~ ERROR cannot borrow
+    });
+    f();
+}
+
+fn mutable_address_of_fn_closure_move() {
+    let mut x = 0;
+    let f = make_fn(move || {
+        let y = &raw mut x;             //~ ERROR cannot borrow
+    });
+    f();
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr b/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr
new file mode 100644
index 00000000000..cf01c362d50
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-raw-address-of-mutability.stderr
@@ -0,0 +1,59 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+  --> $DIR/borrow-raw-address-of-mutability.rs:5:13
+   |
+LL |     let x = 0;
+   |         - help: consider changing this to be mutable: `mut x`
+LL |     let y = &raw mut x;
+   |             ^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+  --> $DIR/borrow-raw-address-of-mutability.rs:11:17
+   |
+LL |     let x = 0;
+   |         - help: consider changing this to be mutable: `mut x`
+LL |     let mut f = || {
+LL |         let y = &raw mut x;
+   |                 ^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
+  --> $DIR/borrow-raw-address-of-mutability.rs:21:5
+   |
+LL |     let f = || {
+   |         - help: consider changing this to be mutable: `mut f`
+...
+LL |     f();
+   |     ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+  --> $DIR/borrow-raw-address-of-mutability.rs:29:17
+   |
+LL |         let y = &raw mut x;
+   |                 ^^^^^^^^^^ cannot borrow as mutable
+   |
+help: consider changing this to accept closures that implement `FnMut`
+  --> $DIR/borrow-raw-address-of-mutability.rs:28:21
+   |
+LL |       let f = make_fn(|| {
+   |  _____________________^
+LL | |         let y = &raw mut x;
+LL | |     });
+   | |_____^
+
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+  --> $DIR/borrow-raw-address-of-mutability.rs:37:17
+   |
+LL |         let y = &raw mut x;
+   |                 ^^^^^^^^^^ cannot borrow as mutable
+   |
+help: consider changing this to accept closures that implement `FnMut`
+  --> $DIR/borrow-raw-address-of-mutability.rs:36:21
+   |
+LL |       let f = make_fn(move || {
+   |  _____________________^
+LL | |         let y = &raw mut x;
+LL | |     });
+   | |_____^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
index cb6060525fc..7af38c88f43 100644
--- a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
+++ b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
@@ -1,8 +1,8 @@
 error: C-variadic function must be declared with at least one named argument
-  --> $DIR/variadic-ffi-no-fixed-args.rs:2:11
+  --> $DIR/variadic-ffi-no-fixed-args.rs:2:12
    |
 LL |     fn foo(...);
-   |           ^
+   |            ^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/cast/cast-as-bool.rs b/src/test/ui/cast/cast-as-bool.rs
index 8130f4dedc9..1aed218aeb4 100644
--- a/src/test/ui/cast/cast-as-bool.rs
+++ b/src/test/ui/cast/cast-as-bool.rs
@@ -5,5 +5,5 @@ fn main() {
     let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
                              //~| HELP compare with zero instead
                              //~| SUGGESTION (1 + 2) != 0
-    let v = "hello" as bool; //~ ERROR cannot cast as `bool`
+    let v = "hello" as bool; //~ ERROR casting `&'static str` as `bool` is invalid
 }
diff --git a/src/test/ui/cast/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr
index 30f8459c2e1..15d94ab69d8 100644
--- a/src/test/ui/cast/cast-as-bool.stderr
+++ b/src/test/ui/cast/cast-as-bool.stderr
@@ -10,12 +10,13 @@ error[E0054]: cannot cast as `bool`
 LL |     let t = (1 + 2) as bool;
    |             ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0`
 
-error[E0054]: cannot cast as `bool`
+error[E0606]: casting `&'static str` as `bool` is invalid
   --> $DIR/cast-as-bool.rs:8:13
    |
 LL |     let v = "hello" as bool;
-   |             ^^^^^^^^^^^^^^^ unsupported cast
+   |             ^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0054`.
+Some errors have detailed explanations: E0054, E0606.
+For more information about an error, try `rustc --explain E0054`.
diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs
index 8397d204f35..7fa059583f5 100644
--- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs
+++ b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs
@@ -6,6 +6,7 @@ pub fn no_debug() {
 pub fn no_hash() {
     use std::collections::HashSet;
     let mut set = HashSet::new();
+    //~^ ERROR arrays only have std trait implementations for lengths 0..=32
     set.insert([0_usize; 33]);
     //~^ ERROR arrays only have std trait implementations for lengths 0..=32
 }
diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
index 594a0d4b5d8..d885c98dcb2 100644
--- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
+++ b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
@@ -8,15 +8,24 @@ LL |     println!("{:?}", [0_usize; 33]);
    = note: required by `std::fmt::Debug::fmt`
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
-  --> $DIR/core-traits-no-impls-length-33.rs:9:16
+  --> $DIR/core-traits-no-impls-length-33.rs:10:16
    |
 LL |     set.insert([0_usize; 33]);
    |                ^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]`
    |
    = note: required because of the requirements on the impl of `std::cmp::Eq` for `[usize; 33]`
 
+error[E0277]: arrays only have std trait implementations for lengths 0..=32
+  --> $DIR/core-traits-no-impls-length-33.rs:8:19
+   |
+LL |     let mut set = HashSet::new();
+   |                   ^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]`
+   |
+   = note: required because of the requirements on the impl of `std::cmp::Eq` for `[usize; 33]`
+   = note: required by `std::collections::HashSet::<T>::new`
+
 error[E0369]: binary operation `==` cannot be applied to type `[usize; 33]`
-  --> $DIR/core-traits-no-impls-length-33.rs:14:19
+  --> $DIR/core-traits-no-impls-length-33.rs:15:19
    |
 LL |     [0_usize; 33] == [1_usize; 33]
    |     ------------- ^^ ------------- [usize; 33]
@@ -26,7 +35,7 @@ LL |     [0_usize; 33] == [1_usize; 33]
    = note: an implementation of `std::cmp::PartialEq` might be missing for `[usize; 33]`
 
 error[E0369]: binary operation `<` cannot be applied to type `[usize; 33]`
-  --> $DIR/core-traits-no-impls-length-33.rs:19:19
+  --> $DIR/core-traits-no-impls-length-33.rs:20:19
    |
 LL |     [0_usize; 33] < [1_usize; 33]
    |     ------------- ^ ------------- [usize; 33]
@@ -36,7 +45,7 @@ LL |     [0_usize; 33] < [1_usize; 33]
    = note: an implementation of `std::cmp::PartialOrd` might be missing for `[usize; 33]`
 
 error[E0277]: the trait bound `&[usize; 33]: std::iter::IntoIterator` is not satisfied
-  --> $DIR/core-traits-no-impls-length-33.rs:24:14
+  --> $DIR/core-traits-no-impls-length-33.rs:25:14
    |
 LL |     for _ in &[0_usize; 33] {
    |              ^^^^^^^^^^^^^^ the trait `std::iter::IntoIterator` is not implemented for `&[usize; 33]`
@@ -48,7 +57,7 @@ LL |     for _ in &[0_usize; 33] {
              <&'a mut [T] as std::iter::IntoIterator>
    = note: required by `std::iter::IntoIterator::into_iter`
 
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors
 
 Some errors have detailed explanations: E0277, E0369.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/consts/const-address-of-interior-mut.rs b/src/test/ui/consts/const-address-of-interior-mut.rs
new file mode 100644
index 00000000000..60c7c31daca
--- /dev/null
+++ b/src/test/ui/consts/const-address-of-interior-mut.rs
@@ -0,0 +1,16 @@
+#![feature(raw_ref_op)]
+
+use std::cell::Cell;
+
+const A: () = { let x = Cell::new(2); &raw const x; };      //~ ERROR interior mutability
+
+static B: () = { let x = Cell::new(2); &raw const x; };     //~ ERROR interior mutability
+
+static mut C: () = { let x = Cell::new(2); &raw const x; }; //~ ERROR interior mutability
+
+const fn foo() {
+    let x = Cell::new(0);
+    let y = &raw const x;                                   //~ ERROR interior mutability
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const-address-of-interior-mut.stderr b/src/test/ui/consts/const-address-of-interior-mut.stderr
new file mode 100644
index 00000000000..f15174c33b3
--- /dev/null
+++ b/src/test/ui/consts/const-address-of-interior-mut.stderr
@@ -0,0 +1,27 @@
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+  --> $DIR/const-address-of-interior-mut.rs:5:39
+   |
+LL | const A: () = { let x = Cell::new(2); &raw const x; };
+   |                                       ^^^^^^^^^^^^
+
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+  --> $DIR/const-address-of-interior-mut.rs:7:40
+   |
+LL | static B: () = { let x = Cell::new(2); &raw const x; };
+   |                                        ^^^^^^^^^^^^
+
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+  --> $DIR/const-address-of-interior-mut.rs:9:44
+   |
+LL | static mut C: () = { let x = Cell::new(2); &raw const x; };
+   |                                            ^^^^^^^^^^^^
+
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+  --> $DIR/const-address-of-interior-mut.rs:13:13
+   |
+LL |     let y = &raw const x;
+   |             ^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0492`.
diff --git a/src/test/ui/consts/const-address-of-mut.rs b/src/test/ui/consts/const-address-of-mut.rs
new file mode 100644
index 00000000000..fe9188cb490
--- /dev/null
+++ b/src/test/ui/consts/const-address-of-mut.rs
@@ -0,0 +1,14 @@
+#![feature(raw_ref_op)]
+
+const A: () = { let mut x = 2; &raw mut x; };           //~ ERROR `&raw mut` is not allowed
+
+static B: () = { let mut x = 2; &raw mut x; };          //~ ERROR `&raw mut` is not allowed
+
+static mut C: () = { let mut x = 2; &raw mut x; };      //~ ERROR `&raw mut` is not allowed
+
+const fn foo() {
+    let mut x = 0;
+    let y = &raw mut x;                                 //~ ERROR `&raw mut` is not allowed
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const-address-of-mut.stderr b/src/test/ui/consts/const-address-of-mut.stderr
new file mode 100644
index 00000000000..15f2296c42c
--- /dev/null
+++ b/src/test/ui/consts/const-address-of-mut.stderr
@@ -0,0 +1,39 @@
+error[E0658]: `&raw mut` is not allowed in constants
+  --> $DIR/const-address-of-mut.rs:3:32
+   |
+LL | const A: () = { let mut x = 2; &raw mut x; };
+   |                                ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: `&raw mut` is not allowed in statics
+  --> $DIR/const-address-of-mut.rs:5:33
+   |
+LL | static B: () = { let mut x = 2; &raw mut x; };
+   |                                 ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: `&raw mut` is not allowed in statics
+  --> $DIR/const-address-of-mut.rs:7:37
+   |
+LL | static mut C: () = { let mut x = 2; &raw mut x; };
+   |                                     ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: `&raw mut` is not allowed in constant functions
+  --> $DIR/const-address-of-mut.rs:11:13
+   |
+LL |     let y = &raw mut x;
+   |             ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/const-address-of.rs b/src/test/ui/consts/const-address-of.rs
new file mode 100644
index 00000000000..ba162f2a2ba
--- /dev/null
+++ b/src/test/ui/consts/const-address-of.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(raw_ref_op)]
+
+const A: *const i32 = &raw const *&2;
+static B: () = { &raw const *&2; };
+static mut C: *const i32 = &raw const *&2;
+const D: () = { let x = 2; &raw const x; };
+static E: () = { let x = 2; &raw const x; };
+static mut F: () = { let x = 2; &raw const x; };
+
+const fn const_ptr() {
+    let x = 0;
+    let ptr = &raw const x;
+    let r = &x;
+    let ptr2 = &raw const *r;
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
index 1f810c40572..a5c2a57c6c8 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
@@ -2,7 +2,6 @@
 #![allow(unused)]
 #![allow(const_err)] // make sure we cannot allow away the errors tested here
 
-// normalize-stderr-test "alignment \d+" -> "alignment N"
 // normalize-stderr-test "offset \d+" -> "offset N"
 // normalize-stderr-test "allocation \d+" -> "allocation N"
 // normalize-stderr-test "size \d+" -> "size N"
@@ -149,11 +148,23 @@ const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = &unsafe { BoolTransmute { val: 3 }
 //~^ ERROR it is undefined behavior to use this value
 
 // # raw trait object
-const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.rust};
+const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.raw_rust};
 //~^ ERROR it is undefined behavior to use this value
 const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.raw_rust};
 //~^ ERROR it is undefined behavior to use this value
 const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl } as *const _; // ok because raw
 
+// Const eval fails for these, so they need to be statics to error.
+static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe {
+    DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.rust
+    //~^ ERROR could not evaluate static initializer
+};
+static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
+    DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust
+    //~^ ERROR could not evaluate static initializer
+};
+
 fn main() {
+    let _ = RAW_TRAIT_OBJ_VTABLE_NULL;
+    let _ = RAW_TRAIT_OBJ_VTABLE_INVALID;
 }
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
index 85fb8ac2a4a..ce57d680dc9 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:87:1
+  --> $DIR/ub-wide-ptr.rs:86:1
    |
 LL | const STR_TOO_LONG: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds)
@@ -7,7 +7,7 @@ LL | const STR_TOO_LONG: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr:
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:90:1
+  --> $DIR/ub-wide-ptr.rs:89:1
    |
 LL | const STR_LENGTH_PTR: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -15,7 +15,7 @@ LL | const STR_LENGTH_PTR: &str = unsafe { SliceTransmute { bad: BadSliceRepr {
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:93:1
+  --> $DIR/ub-wide-ptr.rs:92:1
    |
 LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.my_str};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -23,7 +23,7 @@ LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { SliceTransmute { bad: BadSliceRe
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:97:1
+  --> $DIR/ub-wide-ptr.rs:96:1
    |
 LL | const STR_NO_UTF8: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>
@@ -31,7 +31,7 @@ LL | const STR_NO_UTF8: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str };
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:100:1
+  --> $DIR/ub-wide-ptr.rs:99:1
    |
 LL | const MYSTR_NO_UTF8: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at .<deref>.0
@@ -39,7 +39,7 @@ LL | const MYSTR_NO_UTF8: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:107:1
+  --> $DIR/ub-wide-ptr.rs:106:1
    |
 LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { SliceTransmute { addr: 42 }.slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered undefined pointer
@@ -47,7 +47,7 @@ LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { SliceTransmute { addr: 42 }.sli
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:110:1
+  --> $DIR/ub-wide-ptr.rs:109:1
    |
 LL | const SLICE_TOO_LONG: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds)
@@ -55,7 +55,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { p
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:113:1
+  --> $DIR/ub-wide-ptr.rs:112:1
    |
 LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -63,7 +63,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:117:1
+  --> $DIR/ub-wide-ptr.rs:116:1
    |
 LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }];
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>[0], but expected something less or equal to 1
@@ -71,7 +71,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { BoolTransmute { val: 3 }.
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:123:1
+  --> $DIR/ub-wide-ptr.rs:122:1
    |
 LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [false]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.0, but expected something less or equal to 1
@@ -79,7 +79,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { BoolTransmute {
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:126:1
+  --> $DIR/ub-wide-ptr.rs:125:1
    |
 LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }.bl }]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.1[0], but expected something less or equal to 1
@@ -87,7 +87,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { BoolTrans
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:133:1
+  --> $DIR/ub-wide-ptr.rs:132:1
    |
 LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { SliceTransmute { addr: 42 }.raw_slice};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered undefined pointer
@@ -95,7 +95,7 @@ LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { SliceTransmute { addr
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:138:1
+  --> $DIR/ub-wide-ptr.rs:137:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_1: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
@@ -103,7 +103,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: &dyn Trait = unsafe { DynTransmute { repr:
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:141:1
+  --> $DIR/ub-wide-ptr.rs:140:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_2: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
@@ -111,7 +111,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: &dyn Trait = unsafe { DynTransmute { repr2:
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:144:1
+  --> $DIR/ub-wide-ptr.rs:143:1
    |
 LL | const TRAIT_OBJ_INT_VTABLE: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
@@ -119,7 +119,7 @@ LL | const TRAIT_OBJ_INT_VTABLE: &dyn Trait = unsafe { DynTransmute { bad: BadDy
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:148:1
+  --> $DIR/ub-wide-ptr.rs:147:1
    |
 LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .<deref>.<dyn-downcast>, but expected something less or equal to 1
@@ -127,21 +127,33 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = &unsafe { BoolTransmute { val
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:152:1
+  --> $DIR/ub-wide-ptr.rs:151:1
    |
-LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.rust};
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
+LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.raw_rust};
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/ub-wide-ptr.rs:154:1
+  --> $DIR/ub-wide-ptr.rs:153:1
    |
 LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.raw_rust};
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling or unaligned vtable pointer in wide pointer or too small vtable
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
 
-error: aborting due to 18 previous errors
+error[E0080]: could not evaluate static initializer
+  --> $DIR/ub-wide-ptr.rs:159:5
+   |
+LL |     DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 0 } }.rust
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid use of NULL pointer
+
+error[E0080]: could not evaluate static initializer
+  --> $DIR/ub-wide-ptr.rs:163:5
+   |
+LL |     DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Memory access failed: pointer must be in-bounds at offset N, but is outside bounds of allocation N which has size N
+
+error: aborting due to 20 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs b/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs
new file mode 100644
index 00000000000..130ba9283b1
--- /dev/null
+++ b/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs
@@ -0,0 +1,30 @@
+// check-pass
+
+#![feature(const_mut_refs)]
+#![feature(const_fn)]
+#![feature(raw_ref_op)]
+
+struct Foo {
+    x: usize
+}
+
+const fn foo() -> Foo {
+    Foo { x: 0 }
+}
+
+impl Foo {
+    const fn bar(&mut self) -> *mut usize {
+        &raw mut self.x
+    }
+}
+
+const fn baz(foo: &mut Foo)-> *mut usize {
+    &raw mut foo.x
+}
+
+const _: () = {
+    foo().bar();
+    baz(&mut foo());
+};
+
+fn main() {}
diff --git a/src/test/ui/consts/const-prop-ice3.rs b/src/test/ui/consts/const-prop-ice3.rs
new file mode 100644
index 00000000000..8ab011661e3
--- /dev/null
+++ b/src/test/ui/consts/const-prop-ice3.rs
@@ -0,0 +1,7 @@
+// run-pass (ensure that const-prop is run)
+
+struct A<T: ?Sized>(T);
+
+fn main() {
+    let _x = &(&A([2, 3]) as &A<[i32]>).0 as *const [i32] as *const i32;
+}
diff --git a/src/test/ui/consts/min_const_fn/address_of.rs b/src/test/ui/consts/min_const_fn/address_of.rs
new file mode 100644
index 00000000000..f8506d70b24
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/address_of.rs
@@ -0,0 +1,17 @@
+#![feature(raw_ref_op)]
+
+const fn mutable_address_of_in_const() {
+    let mut a = 0;
+    let b = &raw mut a;         //~ ERROR `&raw mut` is not allowed
+}
+
+struct X;
+
+impl X {
+    const fn inherent_mutable_address_of_in_const() {
+        let mut a = 0;
+        let b = &raw mut a;     //~ ERROR `&raw mut` is not allowed
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/address_of.stderr b/src/test/ui/consts/min_const_fn/address_of.stderr
new file mode 100644
index 00000000000..3554b8112b1
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/address_of.stderr
@@ -0,0 +1,21 @@
+error[E0658]: `&raw mut` is not allowed in constant functions
+  --> $DIR/address_of.rs:5:13
+   |
+LL |     let b = &raw mut a;
+   |             ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: `&raw mut` is not allowed in constant functions
+  --> $DIR/address_of.rs:13:17
+   |
+LL |         let b = &raw mut a;
+   |                 ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/57349
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/min_const_fn/address_of_const.rs b/src/test/ui/consts/min_const_fn/address_of_const.rs
new file mode 100644
index 00000000000..3db19e9cde8
--- /dev/null
+++ b/src/test/ui/consts/min_const_fn/address_of_const.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(raw_ref_op)]
+
+const fn const_address_of_in_const() {
+    let mut a = 0;
+    let b = &raw const a;
+}
+
+struct X;
+
+impl X {
+    const fn inherent_const_address_of_in_const() {
+        let mut a = 0;
+        let b = &raw const a;
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs
index b3c1f60b7eb..ea21592997b 100644
--- a/src/test/ui/did_you_mean/issue-40006.rs
+++ b/src/test/ui/did_you_mean/issue-40006.rs
@@ -18,10 +18,10 @@ trait A { //~ ERROR missing
 trait B {
     fn xxx() { ### } //~ ERROR expected
 }
-trait C { //~ ERROR missing `fn`, `type`, or `const` for trait-item declaration
+trait C { //~ ERROR missing `fn`, `type`, or `const` for associated-item declaration
     L = M;
 }
-trait D { //~ ERROR missing `fn`, `type`, or `const` for trait-item declaration
+trait D { //~ ERROR missing `fn`, `type`, or `const` for associated-item declaration
     Z = { 2 + 3 };
 }
 trait E {
diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr
index 30ae6ed4c6d..d1e995013cb 100644
--- a/src/test/ui/did_you_mean/issue-40006.stderr
+++ b/src/test/ui/did_you_mean/issue-40006.stderr
@@ -1,4 +1,4 @@
-error: missing `fn`, `type`, or `const` for impl-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:1:13
    |
 LL |   impl dyn A {
@@ -6,7 +6,7 @@ LL |   impl dyn A {
 LL | |     Y
    | |____^ missing `fn`, `type`, or `const`
 
-error: missing `fn`, `type`, or `const` for trait-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:7:10
    |
 LL |   trait X {
@@ -14,7 +14,7 @@ LL |   trait X {
 LL | |     X() {}
    | |____^ missing `fn`, `type`, or `const`
 
-error: missing `fn`, `type`, or `const` for trait-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:15:10
    |
 LL |   trait A {
@@ -28,7 +28,7 @@ error: expected `[`, found `#`
 LL |     fn xxx() { ### }
    |                 ^ expected `[`
 
-error: missing `fn`, `type`, or `const` for trait-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:21:10
    |
 LL |   trait C {
@@ -36,7 +36,7 @@ LL |   trait C {
 LL | |     L = M;
    | |____^ missing `fn`, `type`, or `const`
 
-error: missing `fn`, `type`, or `const` for trait-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:24:10
    |
 LL |   trait D {
@@ -50,7 +50,7 @@ error: expected one of `!` or `::`, found `(`
 LL |     ::Y ();
    |         ^ expected one of `!` or `::`
 
-error: missing `fn`, `type`, or `const` for impl-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-40006.rs:32:8
    |
 LL |     pub hello_method(&self) {
diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
index d9ebcdecb9b..1f61473c9d2 100644
--- a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
+++ b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
@@ -16,15 +16,6 @@ LL |     type Baa = impl Debug;
    = note: for more information, see https://github.com/rust-lang/rust/issues/63063
    = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
 
-error[E0658]: `impl Trait` in type aliases is unstable
-  --> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
-   |
-LL |     type Assoc = impl Debug;
-   |                  ^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/63063
-   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
-
 error[E0658]: associated type defaults are unstable
   --> $DIR/feature-gate-type_alias_impl_trait.rs:18:5
    |
@@ -35,6 +26,15 @@ LL |     type Assoc = impl Debug;
    = help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
 
 error[E0658]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
+   |
+LL |     type Assoc = impl Debug;
+   |                  ^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/63063
+   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
+
+error[E0658]: `impl Trait` in type aliases is unstable
   --> $DIR/feature-gate-type_alias_impl_trait.rs:24:24
    |
 LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
diff --git a/src/test/ui/invalid/invalid-variadic-function.rs b/src/test/ui/invalid/invalid-variadic-function.rs
deleted file mode 100644
index 8d23f0e4770..00000000000
--- a/src/test/ui/invalid/invalid-variadic-function.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-extern "C" fn foo(x: u8, ...);
-//~^ ERROR only foreign functions are allowed to be C-variadic
-//~| ERROR expected one of `->`, `where`, or `{`, found `;`
diff --git a/src/test/ui/invalid/invalid-variadic-function.stderr b/src/test/ui/invalid/invalid-variadic-function.stderr
deleted file mode 100644
index 7e58b17e7db..00000000000
--- a/src/test/ui/invalid/invalid-variadic-function.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0743]: only foreign functions are allowed to be C-variadic
-  --> $DIR/invalid-variadic-function.rs:1:26
-   |
-LL | extern "C" fn foo(x: u8, ...);
-   |                          ^^^
-
-error: expected one of `->`, `where`, or `{`, found `;`
-  --> $DIR/invalid-variadic-function.rs:1:30
-   |
-LL | extern "C" fn foo(x: u8, ...);
-   |                              ^ expected one of `->`, `where`, or `{`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0743`.
diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs
index db3984cd189..8b1a39a94e6 100644
--- a/src/test/ui/issues/issue-58856-1.rs
+++ b/src/test/ui/issues/issue-58856-1.rs
@@ -1,6 +1,8 @@
 impl A {
+    //~^ ERROR cannot find type `A` in this scope
     fn b(self>
     //~^ ERROR expected one of `)`, `,`, or `:`, found `>`
+    //~| ERROR expected `;` or `{`, found `>`
 }
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr
index 58ab0a142d6..0ea6b017548 100644
--- a/src/test/ui/issues/issue-58856-1.stderr
+++ b/src/test/ui/issues/issue-58856-1.stderr
@@ -1,10 +1,23 @@
 error: expected one of `)`, `,`, or `:`, found `>`
-  --> $DIR/issue-58856-1.rs:2:14
+  --> $DIR/issue-58856-1.rs:3:14
    |
 LL |     fn b(self>
    |         -    ^ help: `)` may belong here
    |         |
    |         unclosed delimiter
 
-error: aborting due to previous error
+error: expected `;` or `{`, found `>`
+  --> $DIR/issue-58856-1.rs:3:14
+   |
+LL |     fn b(self>
+   |              ^ expected `;` or `{`
+
+error[E0412]: cannot find type `A` in this scope
+  --> $DIR/issue-58856-1.rs:1:6
+   |
+LL | impl A {
+   |      ^ not found in this scope
+
+error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/issues/issue-60075.stderr b/src/test/ui/issues/issue-60075.stderr
index e0b15130c33..e8ef981f515 100644
--- a/src/test/ui/issues/issue-60075.stderr
+++ b/src/test/ui/issues/issue-60075.stderr
@@ -4,7 +4,7 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}`
 LL |         });
    |          ^ expected one of `.`, `;`, `?`, `else`, or an operator
 
-error: expected one of `async`, `const`, `crate`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `;`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `;`
   --> $DIR/issue-60075.rs:6:11
    |
 LL |     fn qux() -> Option<usize> {
diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.rs b/src/test/ui/issues/issue-66923-show-error-for-correct-call.rs
new file mode 100644
index 00000000000..83328073972
--- /dev/null
+++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.rs
@@ -0,0 +1,15 @@
+// This test checks that errors are showed for lines with `collect` rather than `push` method.
+
+fn main() {
+    let v = vec![1_f64, 2.2_f64];
+    let mut fft: Vec<Vec<f64>> = vec![];
+
+    let x1: &[f64] = &v;
+    let x2: Vec<f64> = x1.into_iter().collect();
+    //~^ ERROR a value of type
+    fft.push(x2);
+
+    let x3 = x1.into_iter().collect::<Vec<f64>>();
+    //~^ ERROR a value of type
+    fft.push(x3);
+}
diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
new file mode 100644
index 00000000000..8e7ee97e0b9
--- /dev/null
+++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -0,0 +1,19 @@
+error[E0277]: a value of type `std::vec::Vec<f64>` cannot be built from an iterator over elements of type `&f64`
+  --> $DIR/issue-66923-show-error-for-correct-call.rs:8:39
+   |
+LL |     let x2: Vec<f64> = x1.into_iter().collect();
+   |                                       ^^^^^^^ value of type `std::vec::Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+   |
+   = help: the trait `std::iter::FromIterator<&f64>` is not implemented for `std::vec::Vec<f64>`
+
+error[E0277]: a value of type `std::vec::Vec<f64>` cannot be built from an iterator over elements of type `&f64`
+  --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
+   |
+LL |     let x3 = x1.into_iter().collect::<Vec<f64>>();
+   |                             ^^^^^^^ value of type `std::vec::Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+   |
+   = help: the trait `std::iter::FromIterator<&f64>` is not implemented for `std::vec::Vec<f64>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/lint/lint-unused-mut-variables.rs b/src/test/ui/lint/lint-unused-mut-variables.rs
index 1af44ecf362..dd8dbda6d43 100644
--- a/src/test/ui/lint/lint-unused-mut-variables.rs
+++ b/src/test/ui/lint/lint-unused-mut-variables.rs
@@ -3,7 +3,7 @@
 // Exercise the unused_mut attribute in some positive and negative cases
 
 #![deny(unused_mut)]
-#![feature(async_closure)]
+#![feature(async_closure, raw_ref_op)]
 
 async fn baz_async(
     mut a: i32,
@@ -177,6 +177,12 @@ fn main() {
     // leading underscore should avoid the warning, just like the
     // unused variable lint.
     let mut _allowed = 1;
+
+    let mut raw_address_of_mut = 1; // OK
+    let mut_ptr = &raw mut raw_address_of_mut;
+
+    let mut raw_address_of_const = 1; //~ ERROR: variable does not need to be mutable
+    let const_ptr = &raw const raw_address_of_const;
 }
 
 fn callback<F>(f: F) where F: FnOnce() {}
diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr
index 92c2b68652d..c1ab0ab33d4 100644
--- a/src/test/ui/lint/lint-unused-mut-variables.stderr
+++ b/src/test/ui/lint/lint-unused-mut-variables.stderr
@@ -181,6 +181,14 @@ LL |     let mut v : &mut Vec<()> = &mut vec![];
    |         help: remove this `mut`
 
 error: variable does not need to be mutable
+  --> $DIR/lint-unused-mut-variables.rs:184:9
+   |
+LL |     let mut raw_address_of_const = 1;
+   |         ----^^^^^^^^^^^^^^^^^^^^
+   |         |
+   |         help: remove this `mut`
+
+error: variable does not need to be mutable
   --> $DIR/lint-unused-mut-variables.rs:106:13
    |
 LL |     fn what(mut foo: isize) {}
@@ -197,7 +205,7 @@ LL |     fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
    |                    help: remove this `mut`
 
 error: variable does not need to be mutable
-  --> $DIR/lint-unused-mut-variables.rs:196:9
+  --> $DIR/lint-unused-mut-variables.rs:202:9
    |
 LL |     let mut b = vec![2];
    |         ----^
@@ -205,10 +213,10 @@ LL |     let mut b = vec![2];
    |         help: remove this `mut`
    |
 note: lint level defined here
-  --> $DIR/lint-unused-mut-variables.rs:192:8
+  --> $DIR/lint-unused-mut-variables.rs:198:8
    |
 LL | #[deny(unused_mut)]
    |        ^^^^^^^^^^
 
-error: aborting due to 25 previous errors
+error: aborting due to 26 previous errors
 
diff --git a/src/test/ui/packed/packed-struct-address-of-element.rs b/src/test/ui/packed/packed-struct-address-of-element.rs
new file mode 100644
index 00000000000..812d23fb580
--- /dev/null
+++ b/src/test/ui/packed/packed-struct-address-of-element.rs
@@ -0,0 +1,37 @@
+// run-pass
+#![allow(dead_code)]
+#![deny(safe_packed_borrows)]
+#![feature(raw_ref_op)]
+// ignore-emscripten weird assertion?
+
+#[repr(packed)]
+struct Foo1 {
+    bar: u8,
+    baz: usize
+}
+
+#[repr(packed(2))]
+struct Foo2 {
+    bar: u8,
+    baz: usize
+}
+
+#[repr(C, packed(4))]
+struct Foo4C {
+    bar: u8,
+    baz: usize
+}
+
+pub fn main() {
+    let foo = Foo1 { bar: 1, baz: 2 };
+    let brw = &raw const foo.baz;
+    unsafe { assert_eq!(brw.read_unaligned(), 2); }
+
+    let foo = Foo2 { bar: 1, baz: 2 };
+    let brw = &raw const foo.baz;
+    unsafe { assert_eq!(brw.read_unaligned(), 2); }
+
+    let mut foo = Foo4C { bar: 1, baz: 2 };
+    let brw = &raw mut foo.baz;
+    unsafe { assert_eq!(brw.read_unaligned(), 2); }
+}
diff --git a/src/test/ui/packed/packed-struct-borrow-element.rs b/src/test/ui/packed/packed-struct-borrow-element.rs
index 6ac42ed0d47..0072b6191eb 100644
--- a/src/test/ui/packed/packed-struct-borrow-element.rs
+++ b/src/test/ui/packed/packed-struct-borrow-element.rs
@@ -1,4 +1,4 @@
-// run-pass
+// run-pass (note: this is spec-UB, but it works for now)
 #![allow(dead_code)]
 // ignore-emscripten weird assertion?
 
diff --git a/src/test/ui/parser/impl-item-const-pass.rs b/src/test/ui/parser/impl-item-const-pass.rs
new file mode 100644
index 00000000000..d1124561374
--- /dev/null
+++ b/src/test/ui/parser/impl-item-const-pass.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+impl X {
+    const Y: u8;
+}
diff --git a/src/test/ui/parser/impl-item-const-semantic-fail.rs b/src/test/ui/parser/impl-item-const-semantic-fail.rs
new file mode 100644
index 00000000000..5d4692f9f14
--- /dev/null
+++ b/src/test/ui/parser/impl-item-const-semantic-fail.rs
@@ -0,0 +1,7 @@
+fn main() {}
+
+struct X;
+
+impl X {
+    const Y: u8; //~ ERROR associated constant in `impl` without body
+}
diff --git a/src/test/ui/parser/impl-item-const-semantic-fail.stderr b/src/test/ui/parser/impl-item-const-semantic-fail.stderr
new file mode 100644
index 00000000000..ec3bee0ce68
--- /dev/null
+++ b/src/test/ui/parser/impl-item-const-semantic-fail.stderr
@@ -0,0 +1,10 @@
+error: associated constant in `impl` without body
+  --> $DIR/impl-item-const-semantic-fail.rs:6:5
+   |
+LL |     const Y: u8;
+   |     ^^^^^^^^^^^-
+   |                |
+   |                help: provide a definition for the constant: `= <expr>;`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/impl-item-fn-no-body-pass.rs b/src/test/ui/parser/impl-item-fn-no-body-pass.rs
new file mode 100644
index 00000000000..16b09d64e8c
--- /dev/null
+++ b/src/test/ui/parser/impl-item-fn-no-body-pass.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+impl X {
+    fn f();
+}
diff --git a/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.rs
new file mode 100644
index 00000000000..cb183db5964
--- /dev/null
+++ b/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.rs
@@ -0,0 +1,7 @@
+fn main() {}
+
+struct X;
+
+impl X {
+    fn f(); //~ ERROR associated function in `impl` without body
+}
diff --git a/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.stderr
new file mode 100644
index 00000000000..1acb727368b
--- /dev/null
+++ b/src/test/ui/parser/impl-item-fn-no-body-semantic-fail.stderr
@@ -0,0 +1,10 @@
+error: associated function in `impl` without body
+  --> $DIR/impl-item-fn-no-body-semantic-fail.rs:6:5
+   |
+LL |     fn f();
+   |     ^^^^^^-
+   |           |
+   |           help: provide a definition for the function: `{ <body> }`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/impl-item-type-no-body-pass.rs b/src/test/ui/parser/impl-item-type-no-body-pass.rs
new file mode 100644
index 00000000000..74a9c6ab7e8
--- /dev/null
+++ b/src/test/ui/parser/impl-item-type-no-body-pass.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+impl X {
+    type Y;
+    type Z: Ord;
+    type W: Ord where Self: Eq;
+    type W where Self: Eq;
+}
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
new file mode 100644
index 00000000000..71c7d4ba21d
--- /dev/null
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
@@ -0,0 +1,22 @@
+#![feature(generic_associated_types)]
+//~^ WARN the feature `generic_associated_types` is incomplete
+
+fn main() {}
+
+struct X;
+
+impl X {
+    type Y;
+    //~^ ERROR associated type in `impl` without body
+    //~| ERROR associated types are not yet supported in inherent impls
+    type Z: Ord;
+    //~^ ERROR associated type in `impl` without body
+    //~| ERROR bounds on associated `type`s in `impl`s have no effect
+    //~| ERROR associated types are not yet supported in inherent impls
+    type W: Ord where Self: Eq;
+    //~^ ERROR associated type in `impl` without body
+    //~| ERROR bounds on associated `type`s in `impl`s have no effect
+    //~| ERROR associated types are not yet supported in inherent impls
+    type W where Self: Eq;
+    //~^ ERROR associated type in `impl` without body
+}
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
new file mode 100644
index 00000000000..6f1439c8f0b
--- /dev/null
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
@@ -0,0 +1,73 @@
+error: associated type in `impl` without body
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5
+   |
+LL |     type Y;
+   |     ^^^^^^-
+   |           |
+   |           help: provide a definition for the type: `= <type>;`
+
+error: associated type in `impl` without body
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:12:5
+   |
+LL |     type Z: Ord;
+   |     ^^^^^^^^^^^-
+   |                |
+   |                help: provide a definition for the type: `= <type>;`
+
+error: bounds on associated `type`s in `impl`s have no effect
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:12:13
+   |
+LL |     type Z: Ord;
+   |             ^^^
+
+error: associated type in `impl` without body
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:16:5
+   |
+LL |     type W: Ord where Self: Eq;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |                               |
+   |                               help: provide a definition for the type: `= <type>;`
+
+error: bounds on associated `type`s in `impl`s have no effect
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:16:13
+   |
+LL |     type W: Ord where Self: Eq;
+   |             ^^^
+
+error: associated type in `impl` without body
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:20:5
+   |
+LL |     type W where Self: Eq;
+   |     ^^^^^^^^^^^^^^^^^^^^^-
+   |                          |
+   |                          help: provide a definition for the type: `= <type>;`
+
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:1:12
+   |
+LL | #![feature(generic_associated_types)]
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5
+   |
+LL |     type Y;
+   |     ^^^^^^^
+
+error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:12:5
+   |
+LL |     type Z: Ord;
+   |     ^^^^^^^^^^^^
+
+error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+  --> $DIR/impl-item-type-no-body-semantic-fail.rs:16:5
+   |
+LL |     type W: Ord where Self: Eq;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0202`.
diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr
index 70f55f0aeb9..6e20a9ce3c4 100644
--- a/src/test/ui/parser/issue-21153.stderr
+++ b/src/test/ui/parser/issue-21153.stderr
@@ -1,4 +1,4 @@
-error: missing `fn`, `type`, or `const` for trait-item declaration
+error: missing `fn`, `type`, or `const` for associated-item declaration
   --> $DIR/issue-21153.rs:1:29
    |
 LL |   trait MyTrait<T>: Iterator {
diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr
index 70256a59231..1a97f54160b 100644
--- a/src/test/ui/parser/issue-32446.stderr
+++ b/src/test/ui/parser/issue-32446.stderr
@@ -1,8 +1,8 @@
-error: expected one of `async`, `const`, `crate`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `...`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `...`
   --> $DIR/issue-32446.rs:4:11
    |
 LL | trait T { ... }
-   |           ^^^ expected one of 9 possible tokens
+   |           ^^^ expected one of 10 possible tokens
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/macro/trait-non-item-macros.stderr b/src/test/ui/parser/macro/trait-non-item-macros.stderr
index 0a433ab278e..7647ba500e0 100644
--- a/src/test/ui/parser/macro/trait-non-item-macros.stderr
+++ b/src/test/ui/parser/macro/trait-non-item-macros.stderr
@@ -1,8 +1,8 @@
-error: expected one of `async`, `const`, `crate`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `2`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `2`
   --> $DIR/trait-non-item-macros.rs:2:19
    |
 LL |     ($a:expr) => ($a)
-   |                   ^^ expected one of 8 possible tokens
+   |                   ^^ expected one of 9 possible tokens
 ...
 LL |     bah!(2);
    |     -------- in this macro invocation
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
index cbaf9315e85..7e8abf22d55 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
@@ -7,11 +7,11 @@ LL | trait T {
 LL | fn main() {}
    |                                                                  ^
 
-error: expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe`, found keyword `struct`
+error: expected one of `async`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found keyword `struct`
   --> $DIR/missing-close-brace-in-trait.rs:5:12
    |
 LL | pub(crate) struct Bar<T>();
-   |            ^^^^^^ expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe`
+   |            ^^^^^^ expected one of 7 possible tokens
 
 error[E0601]: `main` function not found in crate `missing_close_brace_in_trait`
   --> $DIR/missing-close-brace-in-trait.rs:1:1
diff --git a/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.rs b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.rs
new file mode 100644
index 00000000000..09f967f161e
--- /dev/null
+++ b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.rs
@@ -0,0 +1,12 @@
+#![feature(specialization)]
+
+fn main() {}
+
+trait X {
+    default const A: u8; //~ ERROR `default` is only allowed on items in `impl` definitions
+    default const B: u8 = 0;  //~ ERROR `default` is only allowed on items in `impl` definitions
+    default type D; //~ ERROR `default` is only allowed on items in `impl` definitions
+    default type C: Ord; //~ ERROR `default` is only allowed on items in `impl` definitions
+    default fn f1(); //~ ERROR `default` is only allowed on items in `impl` definitions
+    default fn f2() {} //~ ERROR `default` is only allowed on items in `impl` definitions
+}
diff --git a/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr
new file mode 100644
index 00000000000..54111df3423
--- /dev/null
+++ b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr
@@ -0,0 +1,38 @@
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:6:5
+   |
+LL |     default const A: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:7:5
+   |
+LL |     default const B: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:8:5
+   |
+LL |     default type D;
+   |     ^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:9:5
+   |
+LL |     default type C: Ord;
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:10:5
+   |
+LL |     default fn f1();
+   |     ^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/trait-item-with-defaultness-fail-semantic.rs:11:5
+   |
+LL |     default fn f2() {}
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/trait-item-with-defaultness-pass.rs b/src/test/ui/parser/trait-item-with-defaultness-pass.rs
new file mode 100644
index 00000000000..a6318bd99e2
--- /dev/null
+++ b/src/test/ui/parser/trait-item-with-defaultness-pass.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+trait X {
+    default const A: u8;
+    default const B: u8 = 0;
+    default type D;
+    default type C: Ord;
+    default fn f1();
+    default fn f2() {}
+}
diff --git a/src/test/ui/parser/variadic-ffi-3.rs b/src/test/ui/parser/variadic-ffi-3.rs
deleted file mode 100644
index ce83cc87abe..00000000000
--- a/src/test/ui/parser/variadic-ffi-3.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn foo(x: isize, ...) {
-    //~^ ERROR: only foreign functions are allowed to be C-variadic
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/variadic-ffi-3.stderr b/src/test/ui/parser/variadic-ffi-3.stderr
deleted file mode 100644
index aeeebdb9914..00000000000
--- a/src/test/ui/parser/variadic-ffi-3.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0743]: only foreign functions are allowed to be C-variadic
-  --> $DIR/variadic-ffi-3.rs:1:18
-   |
-LL | fn foo(x: isize, ...) {
-   |                  ^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0743`.
diff --git a/src/test/ui/parser/variadic-ffi-4.rs b/src/test/ui/parser/variadic-ffi-4.rs
deleted file mode 100644
index 5f8b3f8f539..00000000000
--- a/src/test/ui/parser/variadic-ffi-4.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-extern "C" fn foo(x: isize, ...) {
-    //~^ ERROR: only foreign functions are allowed to be C-variadic
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/variadic-ffi-4.stderr b/src/test/ui/parser/variadic-ffi-4.stderr
deleted file mode 100644
index da83276c72d..00000000000
--- a/src/test/ui/parser/variadic-ffi-4.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0743]: only foreign functions are allowed to be C-variadic
-  --> $DIR/variadic-ffi-4.rs:1:29
-   |
-LL | extern "C" fn foo(x: isize, ...) {
-   |                             ^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0743`.
diff --git a/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.rs
new file mode 100644
index 00000000000..9eeee195e56
--- /dev/null
+++ b/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.rs
@@ -0,0 +1,9 @@
+fn f1<'a>(x: u8, y: &'a ...) {}
+//~^ ERROR C-variadic type `...` may not be nested inside another type
+
+fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
+//~^ ERROR C-variadic type `...` may not be nested inside another type
+
+fn main() {
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
new file mode 100644
index 00000000000..8b9d676a45d
--- /dev/null
+++ b/src/test/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
@@ -0,0 +1,24 @@
+error[E0743]: C-variadic type `...` may not be nested inside another type
+  --> $DIR/variadic-ffi-nested-syntactic-fail.rs:1:25
+   |
+LL | fn f1<'a>(x: u8, y: &'a ...) {}
+   |                         ^^^
+
+error[E0743]: C-variadic type `...` may not be nested inside another type
+  --> $DIR/variadic-ffi-nested-syntactic-fail.rs:4:29
+   |
+LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
+   |                             ^^^
+
+error[E0308]: mismatched types
+  --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33
+   |
+LL |     let _recovery_witness: () = 0;
+   |                            --   ^ expected `()`, found integer
+   |                            |
+   |                            expected due to this
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0308, E0743.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs
new file mode 100644
index 00000000000..aa85f6d6b52
--- /dev/null
+++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs
@@ -0,0 +1,76 @@
+#![feature(c_variadic)]
+
+fn main() {}
+
+fn f1_1(x: isize, ...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+
+fn f1_2(...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+//~| ERROR C-variadic function must be declared with at least one named argument
+
+extern "C" fn f2_1(x: isize, ...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+
+extern "C" fn f2_2(...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+//~| ERROR C-variadic function must be declared with at least one named argument
+
+extern "C" fn f2_3(..., x: isize) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+//~| ERROR `...` must be the last argument of a C-variadic function
+
+extern fn f3_1(x: isize, ...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+
+extern fn f3_2(...) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+//~| ERROR C-variadic function must be declared with at least one named argument
+
+extern fn f3_3(..., x: isize) {}
+//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+//~| ERROR `...` must be the last argument of a C-variadic function
+
+extern {
+    fn e_f1(...);
+    //~^ ERROR C-variadic function must be declared with at least one named argument
+    fn e_f2(..., x: isize);
+    //~^ ERROR `...` must be the last argument of a C-variadic function
+}
+
+struct X;
+
+impl X {
+    fn i_f1(x: isize, ...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    fn i_f2(...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR C-variadic function must be declared with at least one named argument
+    fn i_f3(..., x: isize, ...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR `...` must be the last argument of a C-variadic function
+    fn i_f4(..., x: isize, ...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR `...` must be the last argument of a C-variadic function
+}
+
+trait T {
+    fn t_f1(x: isize, ...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    fn t_f2(x: isize, ...);
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    fn t_f3(...) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR C-variadic function must be declared with at least one named argument
+    fn t_f4(...);
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR C-variadic function must be declared with at least one named argument
+    fn t_f5(..., x: isize) {}
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR `...` must be the last argument of a C-variadic function
+    fn t_f6(..., x: isize);
+    //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
+    //~| ERROR `...` must be the last argument of a C-variadic function
+}
diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
new file mode 100644
index 00000000000..21992a29670
--- /dev/null
+++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr
@@ -0,0 +1,206 @@
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:5:19
+   |
+LL | fn f1_1(x: isize, ...) {}
+   |                   ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
+   |
+LL | fn f1_2(...) {}
+   |         ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
+   |
+LL | fn f1_2(...) {}
+   |         ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
+   |
+LL | extern "C" fn f2_1(x: isize, ...) {}
+   |                              ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
+   |
+LL | extern "C" fn f2_2(...) {}
+   |                    ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
+   |
+LL | extern "C" fn f2_2(...) {}
+   |                    ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
+   |
+LL | extern "C" fn f2_3(..., x: isize) {}
+   |                    ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
+   |
+LL | extern "C" fn f2_3(..., x: isize) {}
+   |                    ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:23:26
+   |
+LL | extern fn f3_1(x: isize, ...) {}
+   |                          ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
+   |
+LL | extern fn f3_2(...) {}
+   |                ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:26:16
+   |
+LL | extern fn f3_2(...) {}
+   |                ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
+   |
+LL | extern fn f3_3(..., x: isize) {}
+   |                ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:30:16
+   |
+LL | extern fn f3_3(..., x: isize) {}
+   |                ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:35:13
+   |
+LL |     fn e_f1(...);
+   |             ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:37:13
+   |
+LL |     fn e_f2(..., x: isize);
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:44:23
+   |
+LL |     fn i_f1(x: isize, ...) {}
+   |                       ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
+   |
+LL |     fn i_f2(...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
+   |
+LL |     fn i_f2(...) {}
+   |             ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
+   |
+LL |     fn i_f3(..., x: isize, ...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
+   |
+LL |     fn i_f3(..., x: isize, ...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:49:28
+   |
+LL |     fn i_f3(..., x: isize, ...) {}
+   |                            ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
+   |
+LL |     fn i_f4(..., x: isize, ...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
+   |
+LL |     fn i_f4(..., x: isize, ...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:53:28
+   |
+LL |     fn i_f4(..., x: isize, ...) {}
+   |                            ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:60:23
+   |
+LL |     fn t_f1(x: isize, ...) {}
+   |                       ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:62:23
+   |
+LL |     fn t_f2(x: isize, ...);
+   |                       ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
+   |
+LL |     fn t_f3(...) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
+   |
+LL |     fn t_f3(...) {}
+   |             ^^^^
+
+error: C-variadic function must be declared with at least one named argument
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
+   |
+LL |     fn t_f4(...);
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
+   |
+LL |     fn t_f4(...);
+   |             ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
+   |
+LL |     fn t_f5(..., x: isize) {}
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
+   |
+LL |     fn t_f5(..., x: isize) {}
+   |             ^^^^
+
+error: `...` must be the last argument of a C-variadic function
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
+   |
+LL |     fn t_f6(..., x: isize);
+   |             ^^^^
+
+error: only foreign or `unsafe extern "C" functions may be C-variadic
+  --> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
+   |
+LL |     fn t_f6(..., x: isize);
+   |             ^^^^
+
+error: aborting due to 34 previous errors
+
diff --git a/src/test/ui/parser/variadic-ffi-syntactic-pass.rs b/src/test/ui/parser/variadic-ffi-syntactic-pass.rs
new file mode 100644
index 00000000000..3875d6af137
--- /dev/null
+++ b/src/test/ui/parser/variadic-ffi-syntactic-pass.rs
@@ -0,0 +1,53 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+fn f1_1(x: isize, ...) {}
+
+#[cfg(FALSE)]
+fn f1_2(...) {}
+
+#[cfg(FALSE)]
+extern "C" fn f2_1(x: isize, ...) {}
+
+#[cfg(FALSE)]
+extern "C" fn f2_2(...) {}
+
+#[cfg(FALSE)]
+extern "C" fn f2_3(..., x: isize) {}
+
+#[cfg(FALSE)]
+extern fn f3_1(x: isize, ...) {}
+
+#[cfg(FALSE)]
+extern fn f3_2(...) {}
+
+#[cfg(FALSE)]
+extern fn f3_3(..., x: isize) {}
+
+#[cfg(FALSE)]
+extern {
+    fn e_f1(...);
+    fn e_f2(..., x: isize);
+}
+
+struct X;
+
+#[cfg(FALSE)]
+impl X {
+    fn i_f1(x: isize, ...) {}
+    fn i_f2(...) {}
+    fn i_f3(..., x: isize, ...) {}
+    fn i_f4(..., x: isize, ...) {}
+}
+
+#[cfg(FALSE)]
+trait T {
+    fn t_f1(x: isize, ...) {}
+    fn t_f2(x: isize, ...);
+    fn t_f3(...) {}
+    fn t_f4(...);
+    fn t_f5(..., x: isize) {}
+    fn t_f6(..., x: isize);
+}
diff --git a/src/test/ui/raw-ref-op/raw-ref-op.rs b/src/test/ui/raw-ref-op/raw-ref-op.rs
index de847909eb3..0c6e23a00d5 100644
--- a/src/test/ui/raw-ref-op/raw-ref-op.rs
+++ b/src/test/ui/raw-ref-op/raw-ref-op.rs
@@ -1,11 +1,11 @@
-// FIXME(#64490): make this run-pass
+// run-pass
 
 #![feature(raw_ref_op)]
 
 fn main() {
     let mut x = 123;
-    let c_p = &raw const x;                     //~ ERROR not yet implemented
-    let m_p = &raw mut x;                       //~ ERROR not yet implemented
+    let c_p = &raw const x;
+    let m_p = &raw mut x;
     let i_r = &x;
     assert!(c_p == i_r);
     assert!(c_p == m_p);
diff --git a/src/test/ui/raw-ref-op/raw-ref-op.stderr b/src/test/ui/raw-ref-op/raw-ref-op.stderr
deleted file mode 100644
index 04c59c95fca..00000000000
--- a/src/test/ui/raw-ref-op/raw-ref-op.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-op.rs:7:15
-   |
-LL |     let c_p = &raw const x;
-   |               ^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-op.rs:8:15
-   |
-LL |     let m_p = &raw mut x;
-   |               ^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs
index d251586de55..a814003aebf 100644
--- a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs
+++ b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs
@@ -1,4 +1,4 @@
-// FIXME(#64490) This should be check-pass
+// check-pass
 // Check that taking the address of a place that contains a dereference is
 // allowed.
 #![feature(raw_ref_op, type_ascription)]
@@ -10,15 +10,15 @@ const SLICE_REF: &[i32] = &[5, 6];
 
 fn main() {
     // These are all OK, we're not taking the address of the temporary
-    let deref_ref = &raw const *PAIR_REF;                       //~ ERROR not yet implemented
-    let field_deref_ref = &raw const PAIR_REF.0;                //~ ERROR not yet implemented
-    let deref_ref = &raw const *ARRAY_REF;                      //~ ERROR not yet implemented
-    let index_deref_ref = &raw const ARRAY_REF[0];              //~ ERROR not yet implemented
-    let deref_ref = &raw const *SLICE_REF;                      //~ ERROR not yet implemented
-    let index_deref_ref = &raw const SLICE_REF[1];              //~ ERROR not yet implemented
+    let deref_ref = &raw const *PAIR_REF;
+    let field_deref_ref = &raw const PAIR_REF.0;
+    let deref_ref = &raw const *ARRAY_REF;
+    let index_deref_ref = &raw const ARRAY_REF[0];
+    let deref_ref = &raw const *SLICE_REF;
+    let index_deref_ref = &raw const SLICE_REF[1];
 
     let x = 0;
-    let ascribe_ref = &raw const (x: i32);                      //~ ERROR not yet implemented
-    let ascribe_deref = &raw const (*ARRAY_REF: [i32; 2]);      //~ ERROR not yet implemented
-    let ascribe_index_deref = &raw const (ARRAY_REF[0]: i32);   //~ ERROR not yet implemented
+    let ascribe_ref = &raw const (x: i32);
+    let ascribe_deref = &raw const (*ARRAY_REF: [i32; 2]);
+    let ascribe_index_deref = &raw const (ARRAY_REF[0]: i32);
 }
diff --git a/src/test/ui/raw-ref-op/raw-ref-temp-deref.stderr b/src/test/ui/raw-ref-op/raw-ref-temp-deref.stderr
deleted file mode 100644
index b0bfc74903b..00000000000
--- a/src/test/ui/raw-ref-op/raw-ref-temp-deref.stderr
+++ /dev/null
@@ -1,74 +0,0 @@
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:13:21
-   |
-LL |     let deref_ref = &raw const *PAIR_REF;
-   |                     ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:14:27
-   |
-LL |     let field_deref_ref = &raw const PAIR_REF.0;
-   |                           ^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:15:21
-   |
-LL |     let deref_ref = &raw const *ARRAY_REF;
-   |                     ^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:16:27
-   |
-LL |     let index_deref_ref = &raw const ARRAY_REF[0];
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:17:21
-   |
-LL |     let deref_ref = &raw const *SLICE_REF;
-   |                     ^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:18:27
-   |
-LL |     let index_deref_ref = &raw const SLICE_REF[1];
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:21:23
-   |
-LL |     let ascribe_ref = &raw const (x: i32);
-   |                       ^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:22:25
-   |
-LL |     let ascribe_deref = &raw const (*ARRAY_REF: [i32; 2]);
-   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/raw-ref-temp-deref.rs:23:31
-   |
-LL |     let ascribe_index_deref = &raw const (ARRAY_REF[0]: i32);
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: aborting due to 9 previous errors
-
diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.rs b/src/test/ui/raw-ref-op/raw-ref-temp.rs
index ac2445f049c..32df56468da 100644
--- a/src/test/ui/raw-ref-op/raw-ref-temp.rs
+++ b/src/test/ui/raw-ref-op/raw-ref-temp.rs
@@ -1,6 +1,8 @@
 // Ensure that we don't allow taking the address of temporary values
 #![feature(raw_ref_op, type_ascription)]
 
+const FOUR: u64 = 4;
+
 const PAIR: (i32, i64) = (1, 2);
 
 const ARRAY: [i32; 2] = [1, 2];
@@ -8,8 +10,8 @@ const ARRAY: [i32; 2] = [1, 2];
 fn main() {
     let ref_expr = &raw const 2;                        //~ ERROR cannot take address
     let mut_ref_expr = &raw mut 3;                      //~ ERROR cannot take address
-    let ref_const = &raw const 4;                       //~ ERROR cannot take address
-    let mut_ref_const = &raw mut 5;                     //~ ERROR cannot take address
+    let ref_const = &raw const FOUR;                    //~ ERROR cannot take address
+    let mut_ref_const = &raw mut FOUR;                  //~ ERROR cannot take address
 
     let field_ref_expr = &raw const (1, 2).0;           //~ ERROR cannot take address
     let mut_field_ref_expr = &raw mut (1, 2).0;         //~ ERROR cannot take address
diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.stderr b/src/test/ui/raw-ref-op/raw-ref-temp.stderr
index de070733735..80dea76d595 100644
--- a/src/test/ui/raw-ref-op/raw-ref-temp.stderr
+++ b/src/test/ui/raw-ref-op/raw-ref-temp.stderr
@@ -1,95 +1,95 @@
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:9:31
+  --> $DIR/raw-ref-temp.rs:11:31
    |
 LL |     let ref_expr = &raw const 2;
    |                               ^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:10:33
+  --> $DIR/raw-ref-temp.rs:12:33
    |
 LL |     let mut_ref_expr = &raw mut 3;
    |                                 ^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:11:32
+  --> $DIR/raw-ref-temp.rs:13:32
    |
-LL |     let ref_const = &raw const 4;
-   |                                ^ temporary value
+LL |     let ref_const = &raw const FOUR;
+   |                                ^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:12:34
+  --> $DIR/raw-ref-temp.rs:14:34
    |
-LL |     let mut_ref_const = &raw mut 5;
-   |                                  ^ temporary value
+LL |     let mut_ref_const = &raw mut FOUR;
+   |                                  ^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:14:37
+  --> $DIR/raw-ref-temp.rs:16:37
    |
 LL |     let field_ref_expr = &raw const (1, 2).0;
    |                                     ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:15:39
+  --> $DIR/raw-ref-temp.rs:17:39
    |
 LL |     let mut_field_ref_expr = &raw mut (1, 2).0;
    |                                       ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:16:32
+  --> $DIR/raw-ref-temp.rs:18:32
    |
 LL |     let field_ref = &raw const PAIR.0;
    |                                ^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:17:34
+  --> $DIR/raw-ref-temp.rs:19:34
    |
 LL |     let mut_field_ref = &raw mut PAIR.0;
    |                                  ^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:19:37
+  --> $DIR/raw-ref-temp.rs:21:37
    |
 LL |     let index_ref_expr = &raw const [1, 2][0];
    |                                     ^^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:20:39
+  --> $DIR/raw-ref-temp.rs:22:39
    |
 LL |     let mut_index_ref_expr = &raw mut [1, 2][0];
    |                                       ^^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:21:32
+  --> $DIR/raw-ref-temp.rs:23:32
    |
 LL |     let index_ref = &raw const ARRAY[0];
    |                                ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:22:34
+  --> $DIR/raw-ref-temp.rs:24:34
    |
 LL |     let mut_index_ref = &raw mut ARRAY[1];
    |                                  ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:24:34
+  --> $DIR/raw-ref-temp.rs:26:34
    |
 LL |     let ref_ascribe = &raw const (2: i32);
    |                                  ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:25:36
+  --> $DIR/raw-ref-temp.rs:27:36
    |
 LL |     let mut_ref_ascribe = &raw mut (3: i32);
    |                                    ^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:27:40
+  --> $DIR/raw-ref-temp.rs:29:40
    |
 LL |     let ascribe_field_ref = &raw const (PAIR.0: i32);
    |                                        ^^^^^^^^^^^^^ temporary value
 
 error[E0745]: cannot take address of a temporary
-  --> $DIR/raw-ref-temp.rs:28:38
+  --> $DIR/raw-ref-temp.rs:30:38
    |
 LL |     let ascribe_index_ref = &raw mut (ARRAY[0]: i32);
    |                                      ^^^^^^^^^^^^^^^ temporary value
diff --git a/src/test/ui/raw-ref-op/unusual_locations.rs b/src/test/ui/raw-ref-op/unusual_locations.rs
index f0a6bcce2ac..6bf37408a8b 100644
--- a/src/test/ui/raw-ref-op/unusual_locations.rs
+++ b/src/test/ui/raw-ref-op/unusual_locations.rs
@@ -1,25 +1,22 @@
-// FIXME(#64490): make this check-pass
+// check-pass
 
 #![feature(raw_ref_op)]
 
-const USES_PTR: () = { let u = (); &raw const u; };         //~ ERROR not yet implemented
-static ALSO_USES_PTR: () = { let u = (); &raw const u; };   //~ ERROR not yet implemented
+const USES_PTR: () = { let u = (); &raw const u; };
+static ALSO_USES_PTR: () = { let u = (); &raw const u; };
 
 fn main() {
-    #[cfg(FALSE)]
-    {
-        let x: [i32; { let u = 2; let x = &raw const u; 4 }]
-            = [2; { let v = 3; let y = &raw const v; 4 }];
-        let mut one = 1;
-        let two = 2;
-        if &raw const one == &raw mut one {
-            match &raw const two {
-                _ => {}
-            }
+    let x: [i32; { let u = 2; let x = &raw const u; 4 }]
+        = [2; { let v = 3; let y = &raw const v; 4 }];
+    let mut one = 1;
+    let two = 2;
+    if &raw const one == &raw mut one {
+        match &raw const two {
+            _ => {}
         }
-        let three = 3;
-        let mut four = 4;
-        println!("{:p}", &raw const three);
-        unsafe { &raw mut four; }
     }
+    let three = 3;
+    let mut four = 4;
+    println!("{:p}", &raw const three);
+    unsafe { &raw mut four; }
 }
diff --git a/src/test/ui/raw-ref-op/unusual_locations.stderr b/src/test/ui/raw-ref-op/unusual_locations.stderr
deleted file mode 100644
index 3fae5db3d51..00000000000
--- a/src/test/ui/raw-ref-op/unusual_locations.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: raw borrows are not yet implemented
-  --> $DIR/unusual_locations.rs:5:36
-   |
-LL | const USES_PTR: () = { let u = (); &raw const u; };
-   |                                    ^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: raw borrows are not yet implemented
-  --> $DIR/unusual_locations.rs:6:42
-   |
-LL | static ALSO_USES_PTR: () = { let u = (); &raw const u; };
-   |                                          ^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/64490
-
-error: aborting due to 2 previous errors
-