about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-18 22:29:06 +0000
committerbors <bors@rust-lang.org>2020-02-18 22:29:06 +0000
commite0e5d82e1677c82d209b214bbfc2cc5705c2336a (patch)
tree39649c075dab42df78c94de2fafa81466fc7694d /src/test
parente620d0f337d0643c757bab791fc7d88d63217704 (diff)
parent6c6d45c6e7ca1e7685e2556d9f58b6f3109c13bf (diff)
downloadrust-e0e5d82e1677c82d209b214bbfc2cc5705c2336a.tar.gz
rust-e0e5d82e1677c82d209b214bbfc2cc5705c2336a.zip
Auto merge of #69271 - Centril:rollup-iupsol6, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #69146 (Always const qualify literals by type)
 - #69159 (Select an appropriate unused lifetime name in suggestion)
 - #69194 (parse: fuse associated and extern items up to defaultness)
 - #69211 (parser: Simplify treatment of macro variables in `Parser::bump`)
 - #69217 (Do not emit note suggesting to implement operation trait to foreign type)
 - #69236 (parse: recover `mut (x @ y)` as `(mut x @ mut y)`.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/min-global-align/min_global_align.rs10
-rw-r--r--src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs11
-rw-r--r--src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr23
-rw-r--r--src/test/ui/autoderef-full-lval.stderr4
-rw-r--r--src/test/ui/binop/binop-bitxor-str.stderr2
-rw-r--r--src/test/ui/binop/binop-mul-bool.stderr2
-rw-r--r--src/test/ui/binop/binop-typeck.stderr2
-rw-r--r--src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr4
-rw-r--r--src/test/ui/destructuring-assignment/note-unsupported.stderr4
-rw-r--r--src/test/ui/did_you_mean/issue-40006.rs4
-rw-r--r--src/test/ui/did_you_mean/issue-40006.stderr24
-rw-r--r--src/test/ui/error-codes/E0067.stderr2
-rw-r--r--src/test/ui/error-festival.stderr2
-rw-r--r--src/test/ui/extern/extern-const.stderr8
-rw-r--r--src/test/ui/for/for-loop-type-error.stderr2
-rw-r--r--src/test/ui/issues/issue-14915.stderr2
-rw-r--r--src/test/ui/issues/issue-24363.stderr2
-rw-r--r--src/test/ui/issues/issue-31076.stderr4
-rw-r--r--src/test/ui/issues/issue-35668.stderr2
-rw-r--r--src/test/ui/issues/issue-40610.stderr2
-rw-r--r--src/test/ui/issues/issue-41394.stderr2
-rw-r--r--src/test/ui/issues/issue-58856-2.stderr4
-rw-r--r--src/test/ui/issues/issue-59488.stderr3
-rw-r--r--src/test/ui/issues/issue-60075.stderr2
-rw-r--r--src/test/ui/issues/issue-6596-1.rs2
-rw-r--r--src/test/ui/issues/issue-6596-1.stderr4
-rw-r--r--src/test/ui/issues/issue-6596-2.rs2
-rw-r--r--src/test/ui/issues/issue-6596-2.stderr4
-rw-r--r--src/test/ui/macros/issue-54441.rs2
-rw-r--r--src/test/ui/macros/issue-54441.stderr4
-rw-r--r--src/test/ui/minus-string.stderr2
-rw-r--r--src/test/ui/parser/assoc-const-underscore-semantic-fail.rs17
-rw-r--r--src/test/ui/parser/assoc-const-underscore-semantic-fail.stderr27
-rw-r--r--src/test/ui/parser/assoc-const-underscore-syntactic-pass.rs18
-rw-r--r--src/test/ui/parser/assoc-static-semantic-fail.rs43
-rw-r--r--src/test/ui/parser/assoc-static-semantic-fail.stderr99
-rw-r--r--src/test/ui/parser/assoc-static-syntactic-fail.rs27
-rw-r--r--src/test/ui/parser/assoc-static-syntactic-fail.stderr74
-rw-r--r--src/test/ui/parser/default.rs2
-rw-r--r--src/test/ui/parser/default.stderr4
-rw-r--r--src/test/ui/parser/duplicate-visibility.rs2
-rw-r--r--src/test/ui/parser/duplicate-visibility.stderr4
-rw-r--r--src/test/ui/parser/extern-no-fn.rs3
-rw-r--r--src/test/ui/parser/extern-no-fn.stderr5
-rw-r--r--src/test/ui/parser/foreign-const-semantic-fail.rs8
-rw-r--r--src/test/ui/parser/foreign-const-semantic-fail.stderr22
-rw-r--r--src/test/ui/parser/foreign-const-syntactic-fail.rs9
-rw-r--r--src/test/ui/parser/foreign-const-syntactic-fail.stderr22
-rw-r--r--src/test/ui/parser/foreign-static-semantic-fail.rs8
-rw-r--r--src/test/ui/parser/foreign-static-semantic-fail.stderr27
-rw-r--r--src/test/ui/parser/foreign-static-syntactic-pass.rs11
-rw-r--r--src/test/ui/parser/foreign-ty-semantic-fail.rs18
-rw-r--r--src/test/ui/parser/foreign-ty-semantic-fail.stderr65
-rw-r--r--src/test/ui/parser/foreign-ty-syntactic-pass.rs12
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs4
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr4
-rw-r--r--src/test/ui/parser/issue-19398.rs2
-rw-r--r--src/test/ui/parser/issue-19398.stderr4
-rw-r--r--src/test/ui/parser/issue-21153.rs3
-rw-r--r--src/test/ui/parser/issue-21153.stderr5
-rw-r--r--src/test/ui/parser/issue-32446.stderr4
-rw-r--r--src/test/ui/parser/issue-41155.stderr4
-rw-r--r--src/test/ui/parser/item-free-const-no-body-semantic-fail.rs7
-rw-r--r--src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr24
-rw-r--r--src/test/ui/parser/item-free-const-no-body-syntactic-pass.rs8
-rw-r--r--src/test/ui/parser/item-free-static-no-body-semantic-fail.rs11
-rw-r--r--src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr46
-rw-r--r--src/test/ui/parser/item-free-static-no-body-syntactic-pass.rs8
-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-impl-trait.rs2
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr4
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs2
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr4
-rw-r--r--src/test/ui/parser/mut-patterns.rs2
-rw-r--r--src/test/ui/parser/mut-patterns.stderr30
-rw-r--r--src/test/ui/parser/removed-syntax-extern-const.rs6
-rw-r--r--src/test/ui/parser/removed-syntax-extern-const.stderr8
-rw-r--r--src/test/ui/parser/removed-syntax-static-fn.rs4
-rw-r--r--src/test/ui/parser/removed-syntax-static-fn.stderr25
-rw-r--r--src/test/ui/parser/underscore_item_not_const.rs16
-rw-r--r--src/test/ui/parser/underscore_item_not_const.stderr44
-rw-r--r--src/test/ui/pattern/pattern-tyvar-2.stderr2
-rw-r--r--src/test/ui/proc-macro/auxiliary/generate-dollar-ident.rs17
-rw-r--r--src/test/ui/proc-macro/generate-dollar-ident.rs18
-rw-r--r--src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr6
-rw-r--r--src/test/ui/span/issue-39018.stderr4
-rw-r--r--src/test/ui/traits/trait-resolution-in-overloaded-op.stderr2
-rw-r--r--src/test/ui/unop-neg-bool.stderr2
-rw-r--r--src/test/ui/vec/vec-res-add.stderr2
89 files changed, 801 insertions, 211 deletions
diff --git a/src/test/run-make-fulldeps/min-global-align/min_global_align.rs b/src/test/run-make-fulldeps/min-global-align/min_global_align.rs
index ce86d202c62..d9851a2f794 100644
--- a/src/test/run-make-fulldeps/min-global-align/min_global_align.rs
+++ b/src/test/run-make-fulldeps/min-global-align/min_global_align.rs
@@ -1,5 +1,5 @@
 #![feature(no_core, lang_items)]
-#![crate_type="rlib"]
+#![crate_type = "rlib"]
 #![no_core]
 
 pub static STATIC_BOOL: bool = true;
@@ -9,7 +9,6 @@ pub static mut STATIC_MUT_BOOL: bool = true;
 const CONST_BOOL: bool = true;
 pub static CONST_BOOL_REF: &'static bool = &CONST_BOOL;
 
-
 #[lang = "sized"]
 trait Sized {}
 
@@ -19,10 +18,13 @@ trait Copy {}
 #[lang = "freeze"]
 trait Freeze {}
 
+// No `UnsafeCell`, so everything is `Freeze`.
+impl<T: ?Sized> Freeze for T {}
+
 #[lang = "sync"]
 trait Sync {}
 impl Sync for bool {}
 impl Sync for &'static bool {}
 
-#[lang="drop_in_place"]
-pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) { }
+#[lang = "drop_in_place"]
+pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {}
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs
index 8a5777d4d7c..58f186d7775 100644
--- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs
@@ -12,11 +12,12 @@ struct SomeStruct<I: for<'x> Foo<&'x isize>> {
     //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
 }
 
-enum SomeEnum<I: for<'x> Foo<&'x isize>> {
+enum SomeEnum<'b, I: for<'a> Foo<&'a isize>> {
     TupleVariant(I::A),
     //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
     StructVariant { field: I::A },
     //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
+    OkVariant(&'b usize),
 }
 
 // FIXME(eddyb) This one doesn't even compile because of the unsupported syntax.
@@ -26,7 +27,13 @@ enum SomeEnum<I: for<'x> Foo<&'x isize>> {
 // }
 
 struct YetAnotherStruct<'a, I: for<'x> Foo<&'x isize>> {
-    field: <I as Foo<&'a isize>>::A
+    field: <I as Foo<&'a isize>>::A,
+}
+
+struct Why<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x,
+    'y, 'z, 'aa, I: for<'l, 'm> Foo<&'l &'m isize>> {
+    field: I::A,
+    //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
 }
 
 pub fn main() {}
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr
index c71bc70ea6c..e3fd2860ebc 100644
--- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr
@@ -18,8 +18,8 @@ LL |     TupleVariant(I::A),
    |
 help: use a fully qualified path with explicit lifetimes
    |
-LL | enum SomeEnum<'a, I: for<'x> Foo<&'x isize>> {
-LL |     TupleVariant(<I as Foo<&'a isize>>::A),
+LL | enum SomeEnum<'c, 'b, I: for<'a> Foo<&'a isize>> {
+LL |     TupleVariant(<I as Foo<&'c isize>>::A),
    |
 
 error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
@@ -30,11 +30,24 @@ LL |     StructVariant { field: I::A },
    |
 help: use a fully qualified path with explicit lifetimes
    |
-LL | enum SomeEnum<'a, I: for<'x> Foo<&'x isize>> {
+LL | enum SomeEnum<'c, 'b, I: for<'a> Foo<&'a isize>> {
 LL |     TupleVariant(I::A),
 LL |
-LL |     StructVariant { field: <I as Foo<&'a isize>>::A },
+LL |     StructVariant { field: <I as Foo<&'c isize>>::A },
    |
 
-error: aborting due to 3 previous errors
+error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
+  --> $DIR/associated-types-project-from-hrtb-in-struct.rs:35:12
+   |
+LL |     field: I::A,
+   |            ^^^^
+   |
+help: use a fully qualified path with explicit lifetimes
+   |
+LL | struct Why<'bb, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x,
+LL |     'y, 'z, 'aa, I: for<'l, 'm> Foo<&'l &'m isize>> {
+LL |     field: <I as Foo<&'bb &'bb isize>>::A,
+   |
+
+error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/autoderef-full-lval.stderr b/src/test/ui/autoderef-full-lval.stderr
index e2870ef8062..f094388794e 100644
--- a/src/test/ui/autoderef-full-lval.stderr
+++ b/src/test/ui/autoderef-full-lval.stderr
@@ -5,8 +5,6 @@ LL |     let z: isize = a.x + b.y;
    |                    --- ^ --- std::boxed::Box<isize>
    |                    |
    |                    std::boxed::Box<isize>
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
 
 error[E0369]: cannot add `std::boxed::Box<isize>` to `std::boxed::Box<isize>`
   --> $DIR/autoderef-full-lval.rs:21:33
@@ -15,8 +13,6 @@ LL |     let answer: isize = forty.a + two.a;
    |                         ------- ^ ----- std::boxed::Box<isize>
    |                         |
    |                         std::boxed::Box<isize>
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/binop/binop-bitxor-str.stderr b/src/test/ui/binop/binop-bitxor-str.stderr
index 9a0d301d863..18c1ce0ff02 100644
--- a/src/test/ui/binop/binop-bitxor-str.stderr
+++ b/src/test/ui/binop/binop-bitxor-str.stderr
@@ -5,8 +5,6 @@ LL | fn main() { let x = "a".to_string() ^ "b".to_string(); }
    |                     --------------- ^ --------------- std::string::String
    |                     |
    |                     std::string::String
-   |
-   = note: an implementation of `std::ops::BitXor` might be missing for `std::string::String`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/binop/binop-mul-bool.stderr b/src/test/ui/binop/binop-mul-bool.stderr
index ade22025589..859c44a859e 100644
--- a/src/test/ui/binop/binop-mul-bool.stderr
+++ b/src/test/ui/binop/binop-mul-bool.stderr
@@ -5,8 +5,6 @@ LL | fn main() { let x = true * false; }
    |                     ---- ^ ----- bool
    |                     |
    |                     bool
-   |
-   = note: an implementation of `std::ops::Mul` might be missing for `bool`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/binop/binop-typeck.stderr b/src/test/ui/binop/binop-typeck.stderr
index ebf82079ef2..42d91081999 100644
--- a/src/test/ui/binop/binop-typeck.stderr
+++ b/src/test/ui/binop/binop-typeck.stderr
@@ -5,8 +5,6 @@ LL |     let z = x + y;
    |             - ^ - {integer}
    |             |
    |             bool
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `bool`
 
 error: aborting due to previous error
 
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 781a179624e..c03377d74e9 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
@@ -23,8 +23,6 @@ LL |     [0_usize; 33] == [1_usize; 33]
    |     ------------- ^^ ------------- [usize; 33]
    |     |
    |     [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
@@ -33,8 +31,6 @@ LL |     [0_usize; 33] < [1_usize; 33]
    |     ------------- ^ ------------- [usize; 33]
    |     |
    |     [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
diff --git a/src/test/ui/destructuring-assignment/note-unsupported.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr
index a6805c32a6e..d4e25930d22 100644
--- a/src/test/ui/destructuring-assignment/note-unsupported.stderr
+++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr
@@ -16,8 +16,6 @@ LL |     (a, b) += (3, 4);
    |     ------^^^^^^^^^^
    |     |
    |     cannot use `+=` on type `({integer}, {integer})`
-   |
-   = note: an implementation of `std::ops::AddAssign` might be missing for `({integer}, {integer})`
 
 error[E0067]: invalid left-hand side of assignment
   --> $DIR/note-unsupported.rs:7:12
@@ -48,8 +46,6 @@ LL |     [a, b] += [3, 4];
    |     ------^^^^^^^^^^
    |     |
    |     cannot use `+=` on type `[{integer}; 2]`
-   |
-   = note: an implementation of `std::ops::AddAssign` might be missing for `[{integer}; 2]`
 
 error[E0067]: invalid left-hand side of assignment
   --> $DIR/note-unsupported.rs:11:12
diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs
index 60633c6930c..2ed682cea95 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 associated-item declaration
+trait C { //~ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
     L = M;
 }
-trait D { //~ ERROR missing `fn`, `type`, or `const` for associated-item declaration
+trait D { //~ ERROR missing `fn`, `type`, `const`, or `static` for 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 072e61f6a3c..119e30a3e0f 100644
--- a/src/test/ui/did_you_mean/issue-40006.stderr
+++ b/src/test/ui/did_you_mean/issue-40006.stderr
@@ -1,26 +1,26 @@
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:1:13
    |
 LL |   impl dyn A {
    |  _____________^
 LL | |     Y
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:7:10
    |
 LL |   trait X {
    |  __________^
 LL | |     X() {}
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:15:10
    |
 LL |   trait A {
    |  __________^
 LL | |     X() {}
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
 error: expected `[`, found `#`
   --> $DIR/issue-40006.rs:19:17
@@ -28,21 +28,21 @@ error: expected `[`, found `#`
 LL |     fn xxx() { ### }
    |                 ^ expected `[`
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:21:10
    |
 LL |   trait C {
    |  __________^
 LL | |     L = M;
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:24:10
    |
 LL |   trait D {
    |  __________^
 LL | |     Z = { 2 + 3 };
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
 error: expected one of `!` or `::`, found `(`
   --> $DIR/issue-40006.rs:28:9
@@ -50,11 +50,11 @@ error: expected one of `!` or `::`, found `(`
 LL |     ::Y ();
    |         ^ expected one of `!` or `::`
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-40006.rs:32:8
    |
 LL |     pub hello_method(&self) {
-   |        ^ missing `fn`, `type`, or `const`
+   |        ^ missing `fn`, `type`, `const`, or `static`
 
 error[E0599]: no method named `hello_method` found for struct `S` in the current scope
   --> $DIR/issue-40006.rs:38:7
diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr
index 526503798b3..fad8270fd5a 100644
--- a/src/test/ui/error-codes/E0067.stderr
+++ b/src/test/ui/error-codes/E0067.stderr
@@ -5,8 +5,6 @@ LL |     LinkedList::new() += 1;
    |     -----------------^^^^^
    |     |
    |     cannot use `+=` on type `std::collections::LinkedList<_>`
-   |
-   = note: an implementation of `std::ops::AddAssign` might be missing for `std::collections::LinkedList<_>`
 
 error[E0067]: invalid left-hand side of assignment
   --> $DIR/E0067.rs:4:23
diff --git a/src/test/ui/error-festival.stderr b/src/test/ui/error-festival.stderr
index 9b69b373364..fb5290bf64e 100644
--- a/src/test/ui/error-festival.stderr
+++ b/src/test/ui/error-festival.stderr
@@ -23,8 +23,6 @@ LL |     x += 2;
    |     -^^^^^
    |     |
    |     cannot use `+=` on type `&str`
-   |
-   = note: an implementation of `std::ops::AddAssign` might be missing for `&str`
 
 error[E0599]: no method named `z` found for reference `&str` in the current scope
   --> $DIR/error-festival.rs:16:7
diff --git a/src/test/ui/extern/extern-const.stderr b/src/test/ui/extern/extern-const.stderr
index 258202b6903..7f67adbdb19 100644
--- a/src/test/ui/extern/extern-const.stderr
+++ b/src/test/ui/extern/extern-const.stderr
@@ -1,8 +1,12 @@
 error: extern items cannot be `const`
-  --> $DIR/extern-const.rs:16:5
+  --> $DIR/extern-const.rs:16:11
    |
 LL |     const rust_dbg_static_mut: libc::c_int;
-   |     ^^^^^ help: try using a static value: `static`
+   |     ------^^^^^^^^^^^^^^^^^^^
+   |     |
+   |     help: try using a static value: `static`
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/for/for-loop-type-error.stderr b/src/test/ui/for/for-loop-type-error.stderr
index 0ed26384f40..c93a3b9b25c 100644
--- a/src/test/ui/for/for-loop-type-error.stderr
+++ b/src/test/ui/for/for-loop-type-error.stderr
@@ -5,8 +5,6 @@ LL |     let x = () + ();
    |             -- ^ -- ()
    |             |
    |             ()
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `()`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-14915.stderr b/src/test/ui/issues/issue-14915.stderr
index 00b9909af59..3c34a8a3467 100644
--- a/src/test/ui/issues/issue-14915.stderr
+++ b/src/test/ui/issues/issue-14915.stderr
@@ -5,8 +5,6 @@ LL |     println!("{}", x + 1);
    |                    - ^ - {integer}
    |                    |
    |                    std::boxed::Box<isize>
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-24363.stderr b/src/test/ui/issues/issue-24363.stderr
index a60fb24ec12..16537e21ae0 100644
--- a/src/test/ui/issues/issue-24363.stderr
+++ b/src/test/ui/issues/issue-24363.stderr
@@ -11,8 +11,6 @@ LL |         ()+()
    |         --^-- ()
    |         |
    |         ()
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `()`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-31076.stderr b/src/test/ui/issues/issue-31076.stderr
index 5d65734cd23..4c0e1cf7ebb 100644
--- a/src/test/ui/issues/issue-31076.stderr
+++ b/src/test/ui/issues/issue-31076.stderr
@@ -5,8 +5,6 @@ LL |     let x = 5 + 6;
    |             - ^ - {integer}
    |             |
    |             {integer}
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `{integer}`
 
 error[E0369]: cannot add `i32` to `i32`
   --> $DIR/issue-31076.rs:15:18
@@ -15,8 +13,6 @@ LL |     let y = 5i32 + 6i32;
    |             ---- ^ ---- i32
    |             |
    |             i32
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `i32`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-35668.stderr b/src/test/ui/issues/issue-35668.stderr
index 9d5796a5eef..98e8e6366b9 100644
--- a/src/test/ui/issues/issue-35668.stderr
+++ b/src/test/ui/issues/issue-35668.stderr
@@ -5,8 +5,6 @@ LL |     a.iter().map(|a| a*a)
    |                      -^- &T
    |                      |
    |                      &T
-   |
-   = note: an implementation of `std::ops::Mul` might be missing for `&T`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-40610.stderr b/src/test/ui/issues/issue-40610.stderr
index 95f45c168e1..b4e302dfffc 100644
--- a/src/test/ui/issues/issue-40610.stderr
+++ b/src/test/ui/issues/issue-40610.stderr
@@ -5,8 +5,6 @@ LL |     () + f(&[1.0]);
    |     -- ^ --------- ()
    |     |
    |     ()
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `()`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-41394.stderr b/src/test/ui/issues/issue-41394.stderr
index 3f60ea4bbf7..47a24547d45 100644
--- a/src/test/ui/issues/issue-41394.stderr
+++ b/src/test/ui/issues/issue-41394.stderr
@@ -5,8 +5,6 @@ LL |     A = "" + 1
    |         -- ^ - {integer}
    |         |
    |         &str
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `&str`
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/issue-41394.rs:7:9
diff --git a/src/test/ui/issues/issue-58856-2.stderr b/src/test/ui/issues/issue-58856-2.stderr
index 6221b90b31d..f4ca3c46ea2 100644
--- a/src/test/ui/issues/issue-58856-2.stderr
+++ b/src/test/ui/issues/issue-58856-2.stderr
@@ -7,11 +7,11 @@ LL |     fn how_are_you(&self -> Empty {
    |                   |     help: `)` may belong here
    |                   unclosed delimiter
 
-error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, `}`, or identifier, found `)`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `static`, `type`, `unsafe`, `}`, or identifier, found `)`
   --> $DIR/issue-58856-2.rs:11:1
    |
 LL |     }
-   |      - expected one of 11 possible tokens
+   |      - expected one of 12 possible tokens
 LL | }
    | ^ unexpected token
 
diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr
index 2ac5577e0a0..58f1376b19d 100644
--- a/src/test/ui/issues/issue-59488.stderr
+++ b/src/test/ui/issues/issue-59488.stderr
@@ -58,8 +58,6 @@ LL |     foo > bar;
    |     --- ^ --- fn(i64) -> i64 {bar}
    |     |
    |     fn() -> i32 {foo}
-   |
-   = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
 
 error[E0308]: mismatched types
   --> $DIR/issue-59488.rs:25:11
@@ -79,7 +77,6 @@ LL |     assert_eq!(Foo::Bar, i);
    |     fn(usize) -> Foo {Foo::Bar}
    |     fn(usize) -> Foo {Foo::Bar}
    |
-   = note: an implementation of `std::cmp::PartialEq` might be missing for `fn(usize) -> Foo {Foo::Bar}`
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `std::fmt::Debug`
diff --git a/src/test/ui/issues/issue-60075.stderr b/src/test/ui/issues/issue-60075.stderr
index b2beb73503b..bab50a53b1a 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`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, `}`, or identifier, found `;`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `static`, `type`, `unsafe`, `}`, or identifier, found `;`
   --> $DIR/issue-60075.rs:6:11
    |
 LL |     fn qux() -> Option<usize> {
diff --git a/src/test/ui/issues/issue-6596-1.rs b/src/test/ui/issues/issue-6596-1.rs
index 5da54451346..25f1d650072 100644
--- a/src/test/ui/issues/issue-6596-1.rs
+++ b/src/test/ui/issues/issue-6596-1.rs
@@ -1,7 +1,7 @@
 macro_rules! e {
     ($inp:ident) => (
         $nonexistent
-        //~^ ERROR unknown macro variable `nonexistent`
+        //~^ ERROR expected expression, found `$`
     );
 }
 
diff --git a/src/test/ui/issues/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr
index 4f29d8a9274..216fe6472a5 100644
--- a/src/test/ui/issues/issue-6596-1.stderr
+++ b/src/test/ui/issues/issue-6596-1.stderr
@@ -1,8 +1,8 @@
-error: unknown macro variable `nonexistent`
+error: expected expression, found `$`
   --> $DIR/issue-6596-1.rs:3:9
    |
 LL |         $nonexistent
-   |         ^^^^^^^^^^^^ unknown macro variable
+   |         ^^^^^^^^^^^^ expected expression
 ...
 LL |     e!(foo);
    |     -------- in this macro invocation
diff --git a/src/test/ui/issues/issue-6596-2.rs b/src/test/ui/issues/issue-6596-2.rs
index b19700efe5a..8f7c98d9a67 100644
--- a/src/test/ui/issues/issue-6596-2.rs
+++ b/src/test/ui/issues/issue-6596-2.rs
@@ -3,7 +3,7 @@
 macro_rules! g {
     ($inp:ident) => (
         { $inp $nonexistent }
-        //~^ ERROR unknown macro variable `nonexistent`
+        //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `$`
     );
 }
 
diff --git a/src/test/ui/issues/issue-6596-2.stderr b/src/test/ui/issues/issue-6596-2.stderr
index 4fcb0176faa..3d13c64f762 100644
--- a/src/test/ui/issues/issue-6596-2.stderr
+++ b/src/test/ui/issues/issue-6596-2.stderr
@@ -1,8 +1,8 @@
-error: unknown macro variable `nonexistent`
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `$`
   --> $DIR/issue-6596-2.rs:5:16
    |
 LL |         { $inp $nonexistent }
-   |                ^^^^^^^^^^^^ unknown macro variable
+   |                ^^^^^^^^^^^^ expected one of 8 possible tokens
 ...
 LL |     g!(foo);
    |     -------- in this macro invocation
diff --git a/src/test/ui/macros/issue-54441.rs b/src/test/ui/macros/issue-54441.rs
index a70163df1cb..5570f081b15 100644
--- a/src/test/ui/macros/issue-54441.rs
+++ b/src/test/ui/macros/issue-54441.rs
@@ -1,5 +1,5 @@
 macro_rules! m {
-    //~^ ERROR missing `fn`, `type`, or `static` for extern-item declaration
+    //~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
     () => {
         let
     };
diff --git a/src/test/ui/macros/issue-54441.stderr b/src/test/ui/macros/issue-54441.stderr
index 761e7aec723..5857aacb431 100644
--- a/src/test/ui/macros/issue-54441.stderr
+++ b/src/test/ui/macros/issue-54441.stderr
@@ -1,11 +1,11 @@
-error: missing `fn`, `type`, or `static` for extern-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-54441.rs:1:1
    |
 LL | / macro_rules! m {
 LL | |
 LL | |     () => {
 LL | |         let
-   | |________^ missing `fn`, `type`, or `static`
+   | |________^ missing `fn`, `type`, `const`, or `static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/minus-string.stderr b/src/test/ui/minus-string.stderr
index 9177082cf0b..3fbec7c89c9 100644
--- a/src/test/ui/minus-string.stderr
+++ b/src/test/ui/minus-string.stderr
@@ -3,8 +3,6 @@ error[E0600]: cannot apply unary operator `-` to type `std::string::String`
    |
 LL | fn main() { -"foo".to_string(); }
    |             ^^^^^^^^^^^^^^^^^^ cannot apply unary operator `-`
-   |
-   = note: an implementation of `std::ops::Neg` might be missing for `std::string::String`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/assoc-const-underscore-semantic-fail.rs b/src/test/ui/parser/assoc-const-underscore-semantic-fail.rs
new file mode 100644
index 00000000000..d37ce06c555
--- /dev/null
+++ b/src/test/ui/parser/assoc-const-underscore-semantic-fail.rs
@@ -0,0 +1,17 @@
+// Semantically, an associated constant cannot use `_` as a name.
+
+fn main() {}
+
+const _: () = {
+    pub trait A {
+        const _: () = (); //~ ERROR `const` items in this context need a name
+    }
+    impl A for () {
+        const _: () = (); //~ ERROR `const` items in this context need a name
+        //~^ ERROR const `_` is not a member of trait `A`
+    }
+    struct B;
+    impl B {
+        const _: () = (); //~ ERROR `const` items in this context need a name
+    }
+};
diff --git a/src/test/ui/parser/assoc-const-underscore-semantic-fail.stderr b/src/test/ui/parser/assoc-const-underscore-semantic-fail.stderr
new file mode 100644
index 00000000000..538bf0ec100
--- /dev/null
+++ b/src/test/ui/parser/assoc-const-underscore-semantic-fail.stderr
@@ -0,0 +1,27 @@
+error: `const` items in this context need a name
+  --> $DIR/assoc-const-underscore-semantic-fail.rs:7:15
+   |
+LL |         const _: () = ();
+   |               ^ `_` is not a valid name for this `const` item
+
+error: `const` items in this context need a name
+  --> $DIR/assoc-const-underscore-semantic-fail.rs:10:15
+   |
+LL |         const _: () = ();
+   |               ^ `_` is not a valid name for this `const` item
+
+error: `const` items in this context need a name
+  --> $DIR/assoc-const-underscore-semantic-fail.rs:15:15
+   |
+LL |         const _: () = ();
+   |               ^ `_` is not a valid name for this `const` item
+
+error[E0438]: const `_` is not a member of trait `A`
+  --> $DIR/assoc-const-underscore-semantic-fail.rs:10:9
+   |
+LL |         const _: () = ();
+   |         ^^^^^^^^^^^^^^^^^ not a member of trait `A`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0438`.
diff --git a/src/test/ui/parser/assoc-const-underscore-syntactic-pass.rs b/src/test/ui/parser/assoc-const-underscore-syntactic-pass.rs
new file mode 100644
index 00000000000..60da408c811
--- /dev/null
+++ b/src/test/ui/parser/assoc-const-underscore-syntactic-pass.rs
@@ -0,0 +1,18 @@
+// All constant items (associated or otherwise) may syntactically use `_` as a name.
+
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+const _: () = {
+    pub trait A {
+        const _: () = ();
+    }
+    impl A for () {
+        const _: () = ();
+    }
+    impl dyn A {
+        const _: () = ();
+    }
+};
diff --git a/src/test/ui/parser/assoc-static-semantic-fail.rs b/src/test/ui/parser/assoc-static-semantic-fail.rs
new file mode 100644
index 00000000000..cf3debd77cb
--- /dev/null
+++ b/src/test/ui/parser/assoc-static-semantic-fail.rs
@@ -0,0 +1,43 @@
+// Semantically, we do not allow e.g., `static X: u8 = 0;` as an associated item.
+
+#![feature(specialization)]
+
+fn main() {}
+
+struct S;
+impl S {
+    static IA: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    static IB: u8;
+    //~^ ERROR associated `static` items are not allowed
+    default static IC: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    pub(crate) default static ID: u8;
+    //~^ ERROR associated `static` items are not allowed
+}
+
+trait T {
+    static TA: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    static TB: u8;
+    //~^ ERROR associated `static` items are not allowed
+    default static TC: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    //~| ERROR `default` is only allowed on items in
+    pub(crate) default static TD: u8;
+    //~^ ERROR associated `static` items are not allowed
+    //~| ERROR `default` is only allowed on items in
+    //~| ERROR unnecessary visibility qualifier
+}
+
+impl T for S {
+    static TA: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    static TB: u8;
+    //~^ ERROR associated `static` items are not allowed
+    default static TC: u8 = 0;
+    //~^ ERROR associated `static` items are not allowed
+    pub default static TD: u8;
+    //~^ ERROR associated `static` items are not allowed
+    //~| ERROR unnecessary visibility qualifier
+}
diff --git a/src/test/ui/parser/assoc-static-semantic-fail.stderr b/src/test/ui/parser/assoc-static-semantic-fail.stderr
new file mode 100644
index 00000000000..d02e2855c7e
--- /dev/null
+++ b/src/test/ui/parser/assoc-static-semantic-fail.stderr
@@ -0,0 +1,99 @@
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:9:5
+   |
+LL |     static IA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:11:5
+   |
+LL |     static IB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:13:5
+   |
+LL |     default static IC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:15:5
+   |
+LL |     pub(crate) default static ID: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:20:5
+   |
+LL |     static TA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:22:5
+   |
+LL |     static TB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:24:5
+   |
+LL |     default static TC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:27:5
+   |
+LL |     pub(crate) default static TD: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:34:5
+   |
+LL |     static TA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:36:5
+   |
+LL |     static TB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:38:5
+   |
+LL |     default static TC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-semantic-fail.rs:40:5
+   |
+LL |     pub default static TD: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/assoc-static-semantic-fail.rs:24:5
+   |
+LL |     default static TC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `default` is only allowed on items in `impl` definitions
+  --> $DIR/assoc-static-semantic-fail.rs:27:5
+   |
+LL |     pub(crate) default static TD: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0449]: unnecessary visibility qualifier
+  --> $DIR/assoc-static-semantic-fail.rs:27:5
+   |
+LL |     pub(crate) default static TD: u8;
+   |     ^^^^^^^^^^
+
+error[E0449]: unnecessary visibility qualifier
+  --> $DIR/assoc-static-semantic-fail.rs:40:5
+   |
+LL |     pub default static TD: u8;
+   |     ^^^ `pub` not permitted here because it's implied
+
+error: aborting due to 16 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/src/test/ui/parser/assoc-static-syntactic-fail.rs b/src/test/ui/parser/assoc-static-syntactic-fail.rs
new file mode 100644
index 00000000000..8f042767e55
--- /dev/null
+++ b/src/test/ui/parser/assoc-static-syntactic-fail.rs
@@ -0,0 +1,27 @@
+// Syntactically, we do allow e.g., `static X: u8 = 0;` as an associated item.
+
+fn main() {}
+
+#[cfg(FALSE)]
+impl S {
+    static IA: u8 = 0; //~ ERROR associated `static` items are not allowed
+    static IB: u8; //~ ERROR associated `static` items are not allowed
+    default static IC: u8 = 0; //~ ERROR associated `static` items are not allowed
+    pub(crate) default static ID: u8; //~ ERROR associated `static` items are not allowed
+}
+
+#[cfg(FALSE)]
+trait T {
+    static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
+    static TB: u8; //~ ERROR associated `static` items are not allowed
+    default static TC: u8 = 0; //~ ERROR associated `static` items are not allowed
+    pub(crate) default static TD: u8; //~ ERROR associated `static` items are not allowed
+}
+
+#[cfg(FALSE)]
+impl T for S {
+    static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
+    static TB: u8; //~ ERROR associated `static` items are not allowed
+    default static TC: u8 = 0; //~ ERROR associated `static` items are not allowed
+    pub default static TD: u8; //~ ERROR associated `static` items are not allowed
+}
diff --git a/src/test/ui/parser/assoc-static-syntactic-fail.stderr b/src/test/ui/parser/assoc-static-syntactic-fail.stderr
new file mode 100644
index 00000000000..bb1e5c4be2e
--- /dev/null
+++ b/src/test/ui/parser/assoc-static-syntactic-fail.stderr
@@ -0,0 +1,74 @@
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:7:5
+   |
+LL |     static IA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:8:5
+   |
+LL |     static IB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:9:5
+   |
+LL |     default static IC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:10:5
+   |
+LL |     pub(crate) default static ID: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:15:5
+   |
+LL |     static TA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:16:5
+   |
+LL |     static TB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:17:5
+   |
+LL |     default static TC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:18:5
+   |
+LL |     pub(crate) default static TD: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:23:5
+   |
+LL |     static TA: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:24:5
+   |
+LL |     static TB: u8;
+   |     ^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:25:5
+   |
+LL |     default static TC: u8 = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: associated `static` items are not allowed
+  --> $DIR/assoc-static-syntactic-fail.rs:26:5
+   |
+LL |     pub default static TD: u8;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/parser/default.rs b/src/test/ui/parser/default.rs
index 65ecb1ebbe9..50952eef22f 100644
--- a/src/test/ui/parser/default.rs
+++ b/src/test/ui/parser/default.rs
@@ -20,7 +20,7 @@ impl Foo for u16 {
 
 impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo`
     default pub fn foo<T: Default>() -> T { T::default() }
-    //~^ ERROR missing `fn`, `type`, or `const` for associated-item declaration
+    //~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
 }
 
 fn main() {}
diff --git a/src/test/ui/parser/default.stderr b/src/test/ui/parser/default.stderr
index ede9e471518..07b051ece2b 100644
--- a/src/test/ui/parser/default.stderr
+++ b/src/test/ui/parser/default.stderr
@@ -1,8 +1,8 @@
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/default.rs:22:12
    |
 LL |     default pub fn foo<T: Default>() -> T { T::default() }
-   |            ^ missing `fn`, `type`, or `const`
+   |            ^ missing `fn`, `type`, `const`, or `static`
 
 error[E0449]: unnecessary visibility qualifier
   --> $DIR/default.rs:16:5
diff --git a/src/test/ui/parser/duplicate-visibility.rs b/src/test/ui/parser/duplicate-visibility.rs
index 1d271fa64b0..f6e7f7e6abe 100644
--- a/src/test/ui/parser/duplicate-visibility.rs
+++ b/src/test/ui/parser/duplicate-visibility.rs
@@ -2,5 +2,5 @@ fn main() {}
 
 extern {
     pub pub fn foo();
-    //~^ ERROR missing `fn`, `type`, or `static` for extern-item declaration
+    //~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
 }
diff --git a/src/test/ui/parser/duplicate-visibility.stderr b/src/test/ui/parser/duplicate-visibility.stderr
index 36a3a1ed5a0..398ba65c9e1 100644
--- a/src/test/ui/parser/duplicate-visibility.stderr
+++ b/src/test/ui/parser/duplicate-visibility.stderr
@@ -1,8 +1,8 @@
-error: missing `fn`, `type`, or `static` for extern-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/duplicate-visibility.rs:4:8
    |
 LL |     pub pub fn foo();
-   |        ^ missing `fn`, `type`, or `static`
+   |        ^ missing `fn`, `type`, `const`, or `static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/extern-no-fn.rs b/src/test/ui/parser/extern-no-fn.rs
index c37ddd69ce5..dc47f741073 100644
--- a/src/test/ui/parser/extern-no-fn.rs
+++ b/src/test/ui/parser/extern-no-fn.rs
@@ -1,4 +1,5 @@
-extern { //~ ERROR missing `fn`, `type`, or `static` for extern-item declaration
+extern {
+//~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
     f();
 }
 
diff --git a/src/test/ui/parser/extern-no-fn.stderr b/src/test/ui/parser/extern-no-fn.stderr
index d2d5e3c4687..8d55eefc8d0 100644
--- a/src/test/ui/parser/extern-no-fn.stderr
+++ b/src/test/ui/parser/extern-no-fn.stderr
@@ -1,10 +1,11 @@
-error: missing `fn`, `type`, or `static` for extern-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/extern-no-fn.rs:1:9
    |
 LL |   extern {
    |  _________^
+LL | |
 LL | |     f();
-   | |____^ missing `fn`, `type`, or `static`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/foreign-const-semantic-fail.rs b/src/test/ui/parser/foreign-const-semantic-fail.rs
new file mode 100644
index 00000000000..d28b6414282
--- /dev/null
+++ b/src/test/ui/parser/foreign-const-semantic-fail.rs
@@ -0,0 +1,8 @@
+fn main() {}
+
+extern {
+    const A: isize;
+    //~^ ERROR extern items cannot be `const`
+    const B: isize = 42;
+    //~^ ERROR extern items cannot be `const`
+}
diff --git a/src/test/ui/parser/foreign-const-semantic-fail.stderr b/src/test/ui/parser/foreign-const-semantic-fail.stderr
new file mode 100644
index 00000000000..f364f11bb03
--- /dev/null
+++ b/src/test/ui/parser/foreign-const-semantic-fail.stderr
@@ -0,0 +1,22 @@
+error: extern items cannot be `const`
+  --> $DIR/foreign-const-semantic-fail.rs:4:11
+   |
+LL |     const A: isize;
+   |     ------^
+   |     |
+   |     help: try using a static value: `static`
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: extern items cannot be `const`
+  --> $DIR/foreign-const-semantic-fail.rs:6:11
+   |
+LL |     const B: isize = 42;
+   |     ------^
+   |     |
+   |     help: try using a static value: `static`
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/foreign-const-syntactic-fail.rs b/src/test/ui/parser/foreign-const-syntactic-fail.rs
new file mode 100644
index 00000000000..a78f8b1623a
--- /dev/null
+++ b/src/test/ui/parser/foreign-const-syntactic-fail.rs
@@ -0,0 +1,9 @@
+// Syntactically, a `const` item inside an `extern { ... }` block is not allowed.
+
+fn main() {}
+
+#[cfg(FALSE)]
+extern {
+    const A: isize; //~ ERROR extern items cannot be `const`
+    const B: isize = 42; //~ ERROR extern items cannot be `const`
+}
diff --git a/src/test/ui/parser/foreign-const-syntactic-fail.stderr b/src/test/ui/parser/foreign-const-syntactic-fail.stderr
new file mode 100644
index 00000000000..9cf58fa95fb
--- /dev/null
+++ b/src/test/ui/parser/foreign-const-syntactic-fail.stderr
@@ -0,0 +1,22 @@
+error: extern items cannot be `const`
+  --> $DIR/foreign-const-syntactic-fail.rs:7:11
+   |
+LL |     const A: isize;
+   |     ------^
+   |     |
+   |     help: try using a static value: `static`
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: extern items cannot be `const`
+  --> $DIR/foreign-const-syntactic-fail.rs:8:11
+   |
+LL |     const B: isize = 42;
+   |     ------^
+   |     |
+   |     help: try using a static value: `static`
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/foreign-static-semantic-fail.rs b/src/test/ui/parser/foreign-static-semantic-fail.rs
new file mode 100644
index 00000000000..9abdf33df9c
--- /dev/null
+++ b/src/test/ui/parser/foreign-static-semantic-fail.rs
@@ -0,0 +1,8 @@
+// Syntactically, a foreign static may not have a body.
+
+fn main() {}
+
+extern {
+    static X: u8 = 0; //~ ERROR incorrect `static` inside `extern` block
+    static mut Y: u8 = 0; //~ ERROR incorrect `static` inside `extern` block
+}
diff --git a/src/test/ui/parser/foreign-static-semantic-fail.stderr b/src/test/ui/parser/foreign-static-semantic-fail.stderr
new file mode 100644
index 00000000000..5942e3a9449
--- /dev/null
+++ b/src/test/ui/parser/foreign-static-semantic-fail.stderr
@@ -0,0 +1,27 @@
+error: incorrect `static` inside `extern` block
+  --> $DIR/foreign-static-semantic-fail.rs:6:12
+   |
+LL | extern {
+   | ------ `extern` blocks define existing foreign statics and statics inside of them cannot have a body
+LL |     static X: u8 = 0;
+   |            ^       - the invalid body
+   |            |
+   |            cannot have a body
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: incorrect `static` inside `extern` block
+  --> $DIR/foreign-static-semantic-fail.rs:7:16
+   |
+LL | extern {
+   | ------ `extern` blocks define existing foreign statics and statics inside of them cannot have a body
+LL |     static X: u8 = 0;
+LL |     static mut Y: u8 = 0;
+   |                ^       - the invalid body
+   |                |
+   |                cannot have a body
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/foreign-static-syntactic-pass.rs b/src/test/ui/parser/foreign-static-syntactic-pass.rs
new file mode 100644
index 00000000000..2c805e8a0b7
--- /dev/null
+++ b/src/test/ui/parser/foreign-static-syntactic-pass.rs
@@ -0,0 +1,11 @@
+// Syntactically, a foreign static may have a body.
+
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+extern {
+    static X: u8 = 0;
+    static mut Y: u8 = 0;
+}
diff --git a/src/test/ui/parser/foreign-ty-semantic-fail.rs b/src/test/ui/parser/foreign-ty-semantic-fail.rs
new file mode 100644
index 00000000000..96b15232b10
--- /dev/null
+++ b/src/test/ui/parser/foreign-ty-semantic-fail.rs
@@ -0,0 +1,18 @@
+#![feature(extern_types)]
+
+fn main() {}
+
+extern "C" {
+    type A: Ord;
+    //~^ ERROR bounds on `type`s in `extern` blocks have no effect
+    type B<'a> where 'a: 'static;
+    //~^ ERROR `type`s inside `extern` blocks cannot have generic parameters
+    //~| ERROR `type`s inside `extern` blocks cannot have `where` clauses
+    type C<T: Ord> where T: 'static;
+    //~^ ERROR `type`s inside `extern` blocks cannot have generic parameters
+    //~| ERROR `type`s inside `extern` blocks cannot have `where` clauses
+    type D = u8;
+    //~^ ERROR incorrect `type` inside `extern` block
+
+    type E: where;
+}
diff --git a/src/test/ui/parser/foreign-ty-semantic-fail.stderr b/src/test/ui/parser/foreign-ty-semantic-fail.stderr
new file mode 100644
index 00000000000..588e4966aae
--- /dev/null
+++ b/src/test/ui/parser/foreign-ty-semantic-fail.stderr
@@ -0,0 +1,65 @@
+error: bounds on `type`s in `extern` blocks have no effect
+  --> $DIR/foreign-ty-semantic-fail.rs:6:13
+   |
+LL |     type A: Ord;
+   |             ^^^
+
+error: `type`s inside `extern` blocks cannot have generic parameters
+  --> $DIR/foreign-ty-semantic-fail.rs:8:11
+   |
+LL | extern "C" {
+   | ---------- `extern` block begins here
+...
+LL |     type B<'a> where 'a: 'static;
+   |           ^^^^ help: remove the generic parameters
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: `type`s inside `extern` blocks cannot have `where` clauses
+  --> $DIR/foreign-ty-semantic-fail.rs:8:16
+   |
+LL | extern "C" {
+   | ---------- `extern` block begins here
+...
+LL |     type B<'a> where 'a: 'static;
+   |                ^^^^^^^^^^^^^^^^^ help: remove the `where` clause
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: `type`s inside `extern` blocks cannot have generic parameters
+  --> $DIR/foreign-ty-semantic-fail.rs:11:11
+   |
+LL | extern "C" {
+   | ---------- `extern` block begins here
+...
+LL |     type C<T: Ord> where T: 'static;
+   |           ^^^^^^^^ help: remove the generic parameters
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: `type`s inside `extern` blocks cannot have `where` clauses
+  --> $DIR/foreign-ty-semantic-fail.rs:11:20
+   |
+LL | extern "C" {
+   | ---------- `extern` block begins here
+...
+LL |     type C<T: Ord> where T: 'static;
+   |                    ^^^^^^^^^^^^^^^^ help: remove the `where` clause
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: incorrect `type` inside `extern` block
+  --> $DIR/foreign-ty-semantic-fail.rs:14:10
+   |
+LL | extern "C" {
+   | ---------- `extern` blocks define existing foreign types and types inside of them cannot have a body
+...
+LL |     type D = u8;
+   |          ^   -- the invalid body
+   |          |
+   |          cannot have a body
+   |
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/foreign-ty-syntactic-pass.rs b/src/test/ui/parser/foreign-ty-syntactic-pass.rs
new file mode 100644
index 00000000000..a746de1f14f
--- /dev/null
+++ b/src/test/ui/parser/foreign-ty-syntactic-pass.rs
@@ -0,0 +1,12 @@
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+extern "C" {
+    type A: Ord;
+    type A<'a> where 'a: 'static;
+    type A<T: Ord> where T: 'static;
+    type A = u8;
+    type A<'a: 'static, T: Ord + 'static>: Eq + PartialEq where T: 'static + Copy = Vec<u8>;
+}
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
index 9c321c4bd0d..fa9c7ababcf 100644
--- 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
@@ -11,11 +11,11 @@ impl X {
     //~| 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 bounds on `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 bounds on `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
index 65e1981e3ac..541d9317c79 100644
--- 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
@@ -14,7 +14,7 @@ LL |     type Z: Ord;
    |                |
    |                help: provide a definition for the type: `= <type>;`
 
-error: bounds on associated `type`s in `impl`s have no effect
+error: bounds on `type`s in `impl`s have no effect
   --> $DIR/impl-item-type-no-body-semantic-fail.rs:12:13
    |
 LL |     type Z: Ord;
@@ -28,7 +28,7 @@ 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
+error: bounds on `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;
diff --git a/src/test/ui/parser/issue-19398.rs b/src/test/ui/parser/issue-19398.rs
index 982a6be23ac..014c930ef82 100644
--- a/src/test/ui/parser/issue-19398.rs
+++ b/src/test/ui/parser/issue-19398.rs
@@ -1,5 +1,5 @@
 trait T {
-    //~^ ERROR missing `fn`, `type`, or `const` for associated-item declaration
+    //~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
     extern "Rust" unsafe fn foo();
 }
 
diff --git a/src/test/ui/parser/issue-19398.stderr b/src/test/ui/parser/issue-19398.stderr
index 2bd6ac3a4b3..b38b39f9bd9 100644
--- a/src/test/ui/parser/issue-19398.stderr
+++ b/src/test/ui/parser/issue-19398.stderr
@@ -1,11 +1,11 @@
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-19398.rs:1:10
    |
 LL |   trait T {
    |  __________^
 LL | |
 LL | |     extern "Rust" unsafe fn foo();
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-21153.rs b/src/test/ui/parser/issue-21153.rs
index 46cd45f28b4..4fe05e6f041 100644
--- a/src/test/ui/parser/issue-21153.rs
+++ b/src/test/ui/parser/issue-21153.rs
@@ -1,4 +1,5 @@
-trait MyTrait<T>: Iterator { //~ ERROR missing `fn`, `type`, or `const`
+trait MyTrait<T>: Iterator {
+    //~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
     Item = T;
 }
 
diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr
index 6e20a9ce3c4..e9824bd7290 100644
--- a/src/test/ui/parser/issue-21153.stderr
+++ b/src/test/ui/parser/issue-21153.stderr
@@ -1,10 +1,11 @@
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/issue-21153.rs:1:29
    |
 LL |   trait MyTrait<T>: Iterator {
    |  _____________________________^
+LL | |
 LL | |     Item = T;
-   | |____^ missing `fn`, `type`, or `const`
+   | |____^ missing `fn`, `type`, `const`, or `static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr
index 25c1efe35ae..d25828da0b9 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`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, `}`, or identifier, found `...`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `static`, `type`, `unsafe`, `}`, or identifier, found `...`
   --> $DIR/issue-32446.rs:4:11
    |
 LL | trait T { ... }
-   |           ^^^ expected one of 11 possible tokens
+   |           ^^^ expected one of 12 possible tokens
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr
index 327bc65818f..a91ef6c67e8 100644
--- a/src/test/ui/parser/issue-41155.stderr
+++ b/src/test/ui/parser/issue-41155.stderr
@@ -1,8 +1,8 @@
-error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `type`, `unsafe`, or identifier, found `}`
+error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `static`, `type`, `unsafe`, or identifier, found `}`
   --> $DIR/issue-41155.rs:5:1
    |
 LL |     pub
-   |        - expected one of 9 possible tokens
+   |        - expected one of 10 possible tokens
 LL | }
    | ^ unexpected token
 
diff --git a/src/test/ui/parser/item-free-const-no-body-semantic-fail.rs b/src/test/ui/parser/item-free-const-no-body-semantic-fail.rs
new file mode 100644
index 00000000000..613b3c98561
--- /dev/null
+++ b/src/test/ui/parser/item-free-const-no-body-semantic-fail.rs
@@ -0,0 +1,7 @@
+// Semantically, a free `const` item cannot omit its body.
+
+fn main() {}
+
+const A: u8; //~ ERROR free constant item without body
+const B; //~ ERROR free constant item without body
+//~^ ERROR missing type for `const` item
diff --git a/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr
new file mode 100644
index 00000000000..4e97229fa1a
--- /dev/null
+++ b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr
@@ -0,0 +1,24 @@
+error: free constant item without body
+  --> $DIR/item-free-const-no-body-semantic-fail.rs:5:1
+   |
+LL | const A: u8;
+   | ^^^^^^^^^^^-
+   |            |
+   |            help: provide a definition for the constant: `= <expr>;`
+
+error: free constant item without body
+  --> $DIR/item-free-const-no-body-semantic-fail.rs:6:1
+   |
+LL | const B;
+   | ^^^^^^^-
+   |        |
+   |        help: provide a definition for the constant: `= <expr>;`
+
+error: missing type for `const` item
+  --> $DIR/item-free-const-no-body-semantic-fail.rs:6:7
+   |
+LL | const B;
+   |       ^ help: provide a type for the item: `B: [type error]`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/item-free-const-no-body-syntactic-pass.rs b/src/test/ui/parser/item-free-const-no-body-syntactic-pass.rs
new file mode 100644
index 00000000000..acfdd3c363f
--- /dev/null
+++ b/src/test/ui/parser/item-free-const-no-body-syntactic-pass.rs
@@ -0,0 +1,8 @@
+// Syntactically, a free `const` item can omit its body.
+
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+const X: u8;
diff --git a/src/test/ui/parser/item-free-static-no-body-semantic-fail.rs b/src/test/ui/parser/item-free-static-no-body-semantic-fail.rs
new file mode 100644
index 00000000000..780479e3d26
--- /dev/null
+++ b/src/test/ui/parser/item-free-static-no-body-semantic-fail.rs
@@ -0,0 +1,11 @@
+// Semantically, a free `static` item cannot omit its body.
+
+fn main() {}
+
+static A: u8; //~ ERROR free static item without body
+static B; //~ ERROR free static item without body
+//~^ ERROR missing type for `static` item
+
+static mut C: u8; //~ ERROR free static item without body
+static mut D; //~ ERROR free static item without body
+//~^ ERROR missing type for `static mut` item
diff --git a/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr
new file mode 100644
index 00000000000..60b7bb34c69
--- /dev/null
+++ b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr
@@ -0,0 +1,46 @@
+error: free static item without body
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:5:1
+   |
+LL | static A: u8;
+   | ^^^^^^^^^^^^-
+   |             |
+   |             help: provide a definition for the static: `= <expr>;`
+
+error: free static item without body
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:6:1
+   |
+LL | static B;
+   | ^^^^^^^^-
+   |         |
+   |         help: provide a definition for the static: `= <expr>;`
+
+error: free static item without body
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
+   |
+LL | static mut C: u8;
+   | ^^^^^^^^^^^^^^^^-
+   |                 |
+   |                 help: provide a definition for the static: `= <expr>;`
+
+error: free static item without body
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:10:1
+   |
+LL | static mut D;
+   | ^^^^^^^^^^^^-
+   |             |
+   |             help: provide a definition for the static: `= <expr>;`
+
+error: missing type for `static` item
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:6:8
+   |
+LL | static B;
+   |        ^ help: provide a type for the item: `B: [type error]`
+
+error: missing type for `static mut` item
+  --> $DIR/item-free-static-no-body-semantic-fail.rs:10:12
+   |
+LL | static mut D;
+   |            ^ help: provide a type for the item: `D: [type error]`
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/item-free-static-no-body-syntactic-pass.rs b/src/test/ui/parser/item-free-static-no-body-syntactic-pass.rs
new file mode 100644
index 00000000000..db0039204d8
--- /dev/null
+++ b/src/test/ui/parser/item-free-static-no-body-syntactic-pass.rs
@@ -0,0 +1,8 @@
+// Syntactically, a free `const` item can omit its body.
+
+// check-pass
+
+fn main() {}
+
+#[cfg(FALSE)]
+static X: u8;
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 9d05e85bcc0..c76b096a1eb 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`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or identifier, found `2`
+error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `static`, `type`, `unsafe`, or identifier, found `2`
   --> $DIR/trait-non-item-macros.rs:2:19
    |
 LL |     ($a:expr) => ($a)
-   |                   ^^ expected one of 10 possible tokens
+   |                   ^^ expected one of 11 possible tokens
 ...
 LL |     bah!(2);
    |     -------- in this macro invocation
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
index 592215030f5..748db8983b5 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
@@ -3,7 +3,7 @@ fn main() {}
 impl T for () { //~ ERROR cannot find trait `T` in this scope
 
 fn foo(&self) {}
-//~^ ERROR missing `fn`, `type`, or `const`
+//~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
 
 trait T {
     fn foo(&self);
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
index 1ec54525105..240be39eace 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
@@ -7,7 +7,7 @@ LL | impl T for () {
 LL |
    |                                                    ^
 
-error: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/missing-close-brace-in-impl-trait.rs:5:17
    |
 LL |   fn foo(&self) {}
@@ -15,7 +15,7 @@ LL |   fn foo(&self) {}
 LL | |
 LL | |
 LL | | trait T {
-   | |_ missing `fn`, `type`, or `const`
+   | |_ missing `fn`, `type`, `const`, or `static`
 
 error[E0405]: cannot find trait `T` in this scope
   --> $DIR/missing-close-brace-in-impl-trait.rs:3:6
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
index 077e3347194..4e8cc6489bc 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
@@ -3,7 +3,7 @@ trait T {
     fn foo(&self);
 
 pub(crate) struct Bar<T>();
-//~^ ERROR missing `fn`, `type`, or `const`
+//~^ ERROR missing `fn`, `type`, `const`, or `static` for item declaration
 
 impl T for Bar<usize> {
 fn foo(&self) {}
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 1bb153c461d..54afad5755b 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: missing `fn`, `type`, or `const` for associated-item declaration
+error: missing `fn`, `type`, `const`, or `static` for item declaration
   --> $DIR/missing-close-brace-in-trait.rs:5:11
    |
 LL | pub(crate) struct Bar<T>();
-   |           ^ missing `fn`, `type`, or `const`
+   |           ^ missing `fn`, `type`, `const`, or `static`
 
 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/mut-patterns.rs b/src/test/ui/parser/mut-patterns.rs
index 66fd5893af5..8b83d6ab2f8 100644
--- a/src/test/ui/parser/mut-patterns.rs
+++ b/src/test/ui/parser/mut-patterns.rs
@@ -9,6 +9,8 @@ pub fn main() {
     let mut _ = 0; //~ ERROR `mut` must be followed by a named binding
     let mut (_, _) = (0, 0); //~ ERROR `mut` must be followed by a named binding
 
+    let mut (x @ y) = 0; //~ ERROR `mut` must be attached to each individual binding
+
     let mut mut x = 0;
     //~^ ERROR `mut` on a binding may not be repeated
     //~| remove the additional `mut`s
diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr
index 5f4c349d7d6..9a6af7394bf 100644
--- a/src/test/ui/parser/mut-patterns.stderr
+++ b/src/test/ui/parser/mut-patterns.stderr
@@ -14,14 +14,22 @@ LL |     let mut (_, _) = (0, 0);
    |
    = note: `mut` may be followed by `variable` and `variable @ pattern`
 
+error: `mut` must be attached to each individual binding
+  --> $DIR/mut-patterns.rs:12:9
+   |
+LL |     let mut (x @ y) = 0;
+   |         ^^^^^^^^^^^ help: add `mut` to each binding: `(mut x @ mut y)`
+   |
+   = note: `mut` may be followed by `variable` and `variable @ pattern`
+
 error: `mut` on a binding may not be repeated
-  --> $DIR/mut-patterns.rs:12:13
+  --> $DIR/mut-patterns.rs:14:13
    |
 LL |     let mut mut x = 0;
    |             ^^^ help: remove the additional `mut`s
 
 error: `mut` must be attached to each individual binding
-  --> $DIR/mut-patterns.rs:17:9
+  --> $DIR/mut-patterns.rs:19:9
    |
 LL |     let mut Foo { x: x } = Foo { x: 3 };
    |         ^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `Foo { x: mut x }`
@@ -29,7 +37,7 @@ LL |     let mut Foo { x: x } = Foo { x: 3 };
    = note: `mut` may be followed by `variable` and `variable @ pattern`
 
 error: `mut` must be attached to each individual binding
-  --> $DIR/mut-patterns.rs:21:9
+  --> $DIR/mut-patterns.rs:23:9
    |
 LL |     let mut Foo { x } = Foo { x: 3 };
    |         ^^^^^^^^^^^^^ help: add `mut` to each binding: `Foo { mut x }`
@@ -37,13 +45,13 @@ LL |     let mut Foo { x } = Foo { x: 3 };
    = note: `mut` may be followed by `variable` and `variable @ pattern`
 
 error: `mut` on a binding may not be repeated
-  --> $DIR/mut-patterns.rs:26:13
+  --> $DIR/mut-patterns.rs:28:13
    |
 LL |     let mut mut yield(become, await) = r#yield(0, 0);
    |             ^^^ help: remove the additional `mut`s
 
 error: expected identifier, found reserved keyword `yield`
-  --> $DIR/mut-patterns.rs:26:17
+  --> $DIR/mut-patterns.rs:28:17
    |
 LL |     let mut mut yield(become, await) = r#yield(0, 0);
    |                 ^^^^^ expected identifier, found reserved keyword
@@ -54,7 +62,7 @@ LL |     let mut mut r#yield(become, await) = r#yield(0, 0);
    |                 ^^^^^^^
 
 error: expected identifier, found reserved keyword `become`
-  --> $DIR/mut-patterns.rs:26:23
+  --> $DIR/mut-patterns.rs:28:23
    |
 LL |     let mut mut yield(become, await) = r#yield(0, 0);
    |                       ^^^^^^ expected identifier, found reserved keyword
@@ -65,7 +73,7 @@ LL |     let mut mut yield(r#become, await) = r#yield(0, 0);
    |                       ^^^^^^^^
 
 error: expected identifier, found keyword `await`
-  --> $DIR/mut-patterns.rs:26:31
+  --> $DIR/mut-patterns.rs:28:31
    |
 LL |     let mut mut yield(become, await) = r#yield(0, 0);
    |                               ^^^^^ expected identifier, found keyword
@@ -76,7 +84,7 @@ LL |     let mut mut yield(become, r#await) = r#yield(0, 0);
    |                               ^^^^^^^
 
 error: `mut` must be attached to each individual binding
-  --> $DIR/mut-patterns.rs:26:9
+  --> $DIR/mut-patterns.rs:28:9
    |
 LL |     let mut mut yield(become, await) = r#yield(0, 0);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `r#yield(mut r#become, mut r#await)`
@@ -84,7 +92,7 @@ LL |     let mut mut yield(become, await) = r#yield(0, 0);
    = note: `mut` may be followed by `variable` and `variable @ pattern`
 
 error: `mut` must be attached to each individual binding
-  --> $DIR/mut-patterns.rs:35:9
+  --> $DIR/mut-patterns.rs:37:9
    |
 LL |     let mut W(mut a, W(b, W(ref c, W(d, B { box f }))))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f }))))`
@@ -92,7 +100,7 @@ LL |     let mut W(mut a, W(b, W(ref c, W(d, B { box f }))))
    = note: `mut` may be followed by `variable` and `variable @ pattern`
 
 error: expected identifier, found `x`
-  --> $DIR/mut-patterns.rs:42:21
+  --> $DIR/mut-patterns.rs:44:21
    |
 LL |             let mut $p = 0;
    |                     ^^ expected identifier
@@ -102,5 +110,5 @@ LL |     foo!(x);
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 12 previous errors
+error: aborting due to 13 previous errors
 
diff --git a/src/test/ui/parser/removed-syntax-extern-const.rs b/src/test/ui/parser/removed-syntax-extern-const.rs
deleted file mode 100644
index 71c22e62f8e..00000000000
--- a/src/test/ui/parser/removed-syntax-extern-const.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-extern {
-    const i: isize;
-    //~^ ERROR extern items cannot be `const`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/removed-syntax-extern-const.stderr b/src/test/ui/parser/removed-syntax-extern-const.stderr
deleted file mode 100644
index 2bccbd91452..00000000000
--- a/src/test/ui/parser/removed-syntax-extern-const.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: extern items cannot be `const`
-  --> $DIR/removed-syntax-extern-const.rs:2:5
-   |
-LL |     const i: isize;
-   |     ^^^^^ help: try using a static value: `static`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/removed-syntax-static-fn.rs b/src/test/ui/parser/removed-syntax-static-fn.rs
index 9e12222f3fd..cd643b874db 100644
--- a/src/test/ui/parser/removed-syntax-static-fn.rs
+++ b/src/test/ui/parser/removed-syntax-static-fn.rs
@@ -1,8 +1,10 @@
 struct S;
 
 impl S {
-    //~^ ERROR missing `fn`, `type`, or `const` for associated-item declaration
     static fn f() {}
+    //~^ ERROR expected identifier, found keyword `fn`
+    //~| ERROR expected one of `:`, `;`, or `=`
+    //~| ERROR missing type for `static` item
 }
 
 fn main() {}
diff --git a/src/test/ui/parser/removed-syntax-static-fn.stderr b/src/test/ui/parser/removed-syntax-static-fn.stderr
index 5edf88026fb..dc5625bdade 100644
--- a/src/test/ui/parser/removed-syntax-static-fn.stderr
+++ b/src/test/ui/parser/removed-syntax-static-fn.stderr
@@ -1,11 +1,20 @@
-error: missing `fn`, `type`, or `const` for associated-item declaration
-  --> $DIR/removed-syntax-static-fn.rs:3:9
+error: expected identifier, found keyword `fn`
+  --> $DIR/removed-syntax-static-fn.rs:4:12
    |
-LL |   impl S {
-   |  _________^
-LL | |
-LL | |     static fn f() {}
-   | |____^ missing `fn`, `type`, or `const`
+LL |     static fn f() {}
+   |            ^^ expected identifier, found keyword
 
-error: aborting due to previous error
+error: expected one of `:`, `;`, or `=`, found `f`
+  --> $DIR/removed-syntax-static-fn.rs:4:15
+   |
+LL |     static fn f() {}
+   |               ^ expected one of `:`, `;`, or `=`
+
+error: missing type for `static` item
+  --> $DIR/removed-syntax-static-fn.rs:4:12
+   |
+LL |     static fn f() {}
+   |            ^^ help: provide a type for the item: `r#fn: <type>`
+
+error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/parser/underscore_item_not_const.rs b/src/test/ui/parser/underscore_item_not_const.rs
index 7b0d128f06f..c01ac4752e0 100644
--- a/src/test/ui/parser/underscore_item_not_const.rs
+++ b/src/test/ui/parser/underscore_item_not_const.rs
@@ -1,18 +1,4 @@
-// Test that various non-const items and associated consts do not permit `_` as a name.
-
-// Associated `const`s:
-
-pub trait A {
-    const _: () = (); //~ ERROR expected identifier, found reserved identifier `_`
-}
-impl A for () {
-    const _: () = (); //~ ERROR expected identifier, found reserved identifier `_`
-}
-impl dyn A {
-    const _: () = (); //~ ERROR expected identifier, found reserved identifier `_`
-}
-
-// Other kinds of items:
+// Test that various non-const items do not syntactically permit `_` as a name.
 
 static _: () = (); //~ ERROR expected identifier, found reserved identifier `_`
 struct _(); //~ ERROR expected identifier, found reserved identifier `_`
diff --git a/src/test/ui/parser/underscore_item_not_const.stderr b/src/test/ui/parser/underscore_item_not_const.stderr
index ebf1ff9ff1e..0bc7642dd19 100644
--- a/src/test/ui/parser/underscore_item_not_const.stderr
+++ b/src/test/ui/parser/underscore_item_not_const.stderr
@@ -1,92 +1,74 @@
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:6:11
-   |
-LL |     const _: () = ();
-   |           ^ expected identifier, found reserved identifier
-
-error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:9:11
-   |
-LL |     const _: () = ();
-   |           ^ expected identifier, found reserved identifier
-
-error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:12:11
-   |
-LL |     const _: () = ();
-   |           ^ expected identifier, found reserved identifier
-
-error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:17:8
+  --> $DIR/underscore_item_not_const.rs:3:8
    |
 LL | static _: () = ();
    |        ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:18:8
+  --> $DIR/underscore_item_not_const.rs:4:8
    |
 LL | struct _();
    |        ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:19:6
+  --> $DIR/underscore_item_not_const.rs:5:6
    |
 LL | enum _ {}
    |      ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:20:4
+  --> $DIR/underscore_item_not_const.rs:6:4
    |
 LL | fn _() {}
    |    ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:21:5
+  --> $DIR/underscore_item_not_const.rs:7:5
    |
 LL | mod _ {}
    |     ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:22:6
+  --> $DIR/underscore_item_not_const.rs:8:6
    |
 LL | type _ = ();
    |      ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:23:5
+  --> $DIR/underscore_item_not_const.rs:9:5
    |
 LL | use _;
    |     ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:24:5
+  --> $DIR/underscore_item_not_const.rs:10:5
    |
 LL | use _ as g;
    |     ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:25:7
+  --> $DIR/underscore_item_not_const.rs:11:7
    |
 LL | trait _ {}
    |       ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:26:7
+  --> $DIR/underscore_item_not_const.rs:12:7
    |
 LL | trait _ = Copy;
    |       ^ expected identifier, found reserved identifier
 
 error: expected identifier, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:27:14
+  --> $DIR/underscore_item_not_const.rs:13:14
    |
 LL | macro_rules! _ { () => {} }
    |              ^ expected identifier, found reserved identifier
 
 error: expected one of `!` or `::`, found reserved identifier `_`
-  --> $DIR/underscore_item_not_const.rs:28:7
+  --> $DIR/underscore_item_not_const.rs:14:7
    |
 LL | union _ { f: u8 }
    |       ^ expected one of `!` or `::`
 
-error: aborting due to 15 previous errors
+error: aborting due to 12 previous errors
 
diff --git a/src/test/ui/pattern/pattern-tyvar-2.stderr b/src/test/ui/pattern/pattern-tyvar-2.stderr
index bb3e61017d4..95662444640 100644
--- a/src/test/ui/pattern/pattern-tyvar-2.stderr
+++ b/src/test/ui/pattern/pattern-tyvar-2.stderr
@@ -5,8 +5,6 @@ LL | fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3;
    |                                                                     - ^ - {integer}
    |                                                                     |
    |                                                                     std::vec::Vec<isize>
-   |
-   = note: an implementation of `std::ops::Mul` might be missing for `std::vec::Vec<isize>`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/auxiliary/generate-dollar-ident.rs b/src/test/ui/proc-macro/auxiliary/generate-dollar-ident.rs
new file mode 100644
index 00000000000..c9f0664c3a3
--- /dev/null
+++ b/src/test/ui/proc-macro/auxiliary/generate-dollar-ident.rs
@@ -0,0 +1,17 @@
+// force-host
+// no-prefer-dynamic
+
+#![feature(proc_macro_hygiene)]
+#![feature(proc_macro_quote)]
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::*;
+
+#[proc_macro]
+pub fn dollar_ident(input: TokenStream) -> TokenStream {
+    let black_hole = input.into_iter().next().unwrap();
+    quote! {
+        $black_hole!($$var);
+    }
+}
diff --git a/src/test/ui/proc-macro/generate-dollar-ident.rs b/src/test/ui/proc-macro/generate-dollar-ident.rs
new file mode 100644
index 00000000000..b838be9fb9f
--- /dev/null
+++ b/src/test/ui/proc-macro/generate-dollar-ident.rs
@@ -0,0 +1,18 @@
+// Proc macros can generate token sequence `$ IDENT`
+// without it being recognized as an unknown macro variable.
+
+// check-pass
+// aux-build:generate-dollar-ident.rs
+
+extern crate generate_dollar_ident;
+use generate_dollar_ident::*;
+
+macro_rules! black_hole {
+    ($($tt:tt)*) => {};
+}
+
+black_hole!($var);
+
+dollar_ident!(black_hole);
+
+fn main() {}
diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
index 084f070989b..39874a6c680 100644
--- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
+++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
@@ -560,8 +560,6 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
    |
 LL |     if -let 0 = 0 {}
    |        ^^^^^^^^^^ cannot apply unary operator `-`
-   |
-   = note: an implementation of `std::ops::Neg` might be missing for `bool`
 
 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> $DIR/disallowed-positions.rs:46:8
@@ -748,8 +746,6 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
    |
 LL |     while -let 0 = 0 {}
    |           ^^^^^^^^^^ cannot apply unary operator `-`
-   |
-   = note: an implementation of `std::ops::Neg` might be missing for `bool`
 
 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> $DIR/disallowed-positions.rs:110:11
@@ -927,8 +923,6 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
    |
 LL |     -let 0 = 0;
    |     ^^^^^^^^^^ cannot apply unary operator `-`
-   |
-   = note: an implementation of `std::ops::Neg` might be missing for `bool`
 
 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> $DIR/disallowed-positions.rs:183:5
diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr
index 8a32561bd01..8caa5bea4ac 100644
--- a/src/test/ui/span/issue-39018.stderr
+++ b/src/test/ui/span/issue-39018.stderr
@@ -136,8 +136,6 @@ LL |     let _ = &c + &d;
    |             -- ^ -- &&str
    |             |
    |             &&str
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `&&str`
 
 error[E0369]: cannot add `&str` to `&&str`
   --> $DIR/issue-39018.rs:35:16
@@ -146,8 +144,6 @@ LL |     let _ = &c + d;
    |             -- ^ - &str
    |             |
    |             &&str
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `&&str`
 
 error[E0369]: cannot add `&&str` to `&str`
   --> $DIR/issue-39018.rs:36:15
diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr
index 8d7ba36c665..29216f36f5f 100644
--- a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr
+++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr
@@ -5,8 +5,6 @@ LL |     a * b
    |     - ^ - f64
    |     |
    |     &T
-   |
-   = note: an implementation of `std::ops::Mul` might be missing for `&T`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unop-neg-bool.stderr b/src/test/ui/unop-neg-bool.stderr
index 18273013749..9913747b88e 100644
--- a/src/test/ui/unop-neg-bool.stderr
+++ b/src/test/ui/unop-neg-bool.stderr
@@ -3,8 +3,6 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
    |
 LL |     -true;
    |     ^^^^^ cannot apply unary operator `-`
-   |
-   = note: an implementation of `std::ops::Neg` might be missing for `bool`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/vec/vec-res-add.stderr b/src/test/ui/vec/vec-res-add.stderr
index 1cc12a222e5..2d41583268c 100644
--- a/src/test/ui/vec/vec-res-add.stderr
+++ b/src/test/ui/vec/vec-res-add.stderr
@@ -5,8 +5,6 @@ LL |     let k = i + j;
    |             - ^ - std::vec::Vec<R>
    |             |
    |             std::vec::Vec<R>
-   |
-   = note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec<R>`
 
 error: aborting due to previous error