From c2d0f1457ac71342fb6411ecf6d8253a04686dc1 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Tue, 16 Mar 2021 21:47:06 +0100
Subject: [PATCH 01/14] Update BARE_TRAIT_OBJECT and
 ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021

---
 compiler/rustc_ast_lowering/src/lib.rs        | 23 ++++--
 compiler/rustc_error_codes/src/error_codes.rs |  2 +
 .../src/error_codes/E0782.md                  | 17 +++++
 .../src/error_codes/E0783.md                  | 18 +++++
 compiler/rustc_lint/src/builtin.rs            | 75 ++++++++++++-------
 .../ui/dyn-keyword/dyn-2021-edition-error.rs  | 12 +++
 .../dyn-keyword/dyn-2021-edition-error.stderr | 21 ++++++
 .../ui/range/exclusive-range-patterns-2021.rs | 14 ++++
 .../exclusive-range-patterns-2021.stderr      | 27 +++++++
 9 files changed, 177 insertions(+), 32 deletions(-)
 create mode 100644 compiler/rustc_error_codes/src/error_codes/E0782.md
 create mode 100644 compiler/rustc_error_codes/src/error_codes/E0783.md
 create mode 100644 src/test/ui/dyn-keyword/dyn-2021-edition-error.rs
 create mode 100644 src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
 create mode 100644 src/test/ui/range/exclusive-range-patterns-2021.rs
 create mode 100644 src/test/ui/range/exclusive-range-patterns-2021.stderr

diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index be56f97af8a3d..fa32645289c58 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -58,6 +58,7 @@ use rustc_session::lint::builtin::{BARE_TRAIT_OBJECTS, MISSING_ABI};
 use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
 use rustc_session::parse::ParseSess;
 use rustc_session::Session;
+use rustc_span::edition::Edition;
 use rustc_span::hygiene::ExpnId;
 use rustc_span::source_map::{respan, DesugaringKind};
 use rustc_span::symbol::{kw, sym, Ident, Symbol};
@@ -2774,13 +2775,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
             .map(|snippet| snippet.starts_with("#["))
             .unwrap_or(true);
         if !is_macro_callsite {
-            self.resolver.lint_buffer().buffer_lint_with_diagnostic(
-                BARE_TRAIT_OBJECTS,
-                id,
-                span,
-                "trait objects without an explicit `dyn` are deprecated",
-                BuiltinLintDiagnostics::BareTraitObject(span, is_global),
-            )
+            if self.sess.edition() < Edition::Edition2021 {
+                self.resolver.lint_buffer().buffer_lint_with_diagnostic(
+                    BARE_TRAIT_OBJECTS,
+                    id,
+                    span,
+                    "trait objects without an explicit `dyn` are deprecated",
+                    BuiltinLintDiagnostics::BareTraitObject(span, is_global),
+                )
+            } else {
+                let msg = "trait objects must include the `dyn` keyword";
+                let label = "`dyn` keyword should be added before this trait";
+                let mut err = struct_span_err!(self.sess, span, E0782, "{}", msg,);
+                err.span_label(span, label);
+                err.emit();
+            }
         }
     }
 
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs
index 4b529734328c7..ab7a13dee693b 100644
--- a/compiler/rustc_error_codes/src/error_codes.rs
+++ b/compiler/rustc_error_codes/src/error_codes.rs
@@ -471,6 +471,8 @@ E0778: include_str!("./error_codes/E0778.md"),
 E0779: include_str!("./error_codes/E0779.md"),
 E0780: include_str!("./error_codes/E0780.md"),
 E0781: include_str!("./error_codes/E0781.md"),
+E0782: include_str!("./error_codes/E0782.md"),
+E0783: include_str!("./error_codes/E0783.md"),
 ;
 //  E0006, // merged with E0005
 //  E0008, // cannot bind by-move into a pattern guard
diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
new file mode 100644
index 0000000000000..e001aa8bc9bc3
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -0,0 +1,17 @@
+Trait objects must include the `dyn` keyword.
+
+Trait objects are a way to call methods on types that are not known until
+runtime but conform to some trait.
+
+In the following code the trait object should be formed with
+`Box<dyn Foo>`, but `dyn` is left off.
+
+```compile_fail,E0782
+trait Foo {}
+fn test(arg: Box<Foo>) {}
+```
+
+This makes it harder to see that `arg` is a trait object and not a
+simply a heap allocated type called `Foo`.
+
+This used to be allowed before edition 2021, but is now an error.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
new file mode 100644
index 0000000000000..cc904543b0d26
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -0,0 +1,18 @@
+The range pattern `...` is no longer allowed.
+
+Older Rust code using previous editions allowed `...` to stand for exclusive
+ranges which are now signified using `..=`.
+
+The following code use to compile, but now it now longer does.
+
+```compile_fail,E0783
+fn main() {
+    let n = 2u8;
+    match n {
+        ...9 => println!("Got a number less than 10),
+        _ => println!("Got a number 10 or more")
+    }
+}
+```
+
+To make this code compile replace the `...` with `..=`.
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index b9de144b0eb39..9f1efe980f67f 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1699,32 +1699,57 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
             let suggestion = "use `..=` for an inclusive range";
             if parenthesise {
                 self.node_id = Some(pat.id);
-                cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, pat.span, |lint| {
-                    let end = expr_to_string(&end);
-                    let replace = match start {
-                        Some(start) => format!("&({}..={})", expr_to_string(&start), end),
-                        None => format!("&(..={})", end),
-                    };
-                    lint.build(msg)
-                        .span_suggestion(
-                            pat.span,
-                            suggestion,
-                            replace,
-                            Applicability::MachineApplicable,
-                        )
-                        .emit();
-                });
+                let end = expr_to_string(&end);
+                let replace = match start {
+                    Some(start) => format!("&({}..={})", expr_to_string(&start), end),
+                    None => format!("&(..={})", end),
+                };
+                if cx.sess().edition() >= Edition::Edition2021 {
+                    let mut err =
+                        rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
+                    err.span_suggestion(
+                        pat.span,
+                        suggestion,
+                        replace,
+                        Applicability::MachineApplicable,
+                    )
+                    .emit();
+                } else {
+                    cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, pat.span, |lint| {
+                        lint.build(msg)
+                            .span_suggestion(
+                                pat.span,
+                                suggestion,
+                                replace,
+                                Applicability::MachineApplicable,
+                            )
+                            .emit();
+                    });
+                }
             } else {
-                cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, join, |lint| {
-                    lint.build(msg)
-                        .span_suggestion_short(
-                            join,
-                            suggestion,
-                            "..=".to_owned(),
-                            Applicability::MachineApplicable,
-                        )
-                        .emit();
-                });
+                let replace = "..=".to_owned();
+                if cx.sess().edition() >= Edition::Edition2021 {
+                    let mut err =
+                        rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
+                    err.span_suggestion_short(
+                        join,
+                        suggestion,
+                        replace,
+                        Applicability::MachineApplicable,
+                    )
+                    .emit();
+                } else {
+                    cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, join, |lint| {
+                        lint.build(msg)
+                            .span_suggestion_short(
+                                join,
+                                suggestion,
+                                replace,
+                                Applicability::MachineApplicable,
+                            )
+                            .emit();
+                    });
+                }
             };
         }
     }
diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.rs b/src/test/ui/dyn-keyword/dyn-2021-edition-error.rs
new file mode 100644
index 0000000000000..bc1bed8a9a4c6
--- /dev/null
+++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.rs
@@ -0,0 +1,12 @@
+// edition:2021
+
+fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+    //~^ ERROR trait objects must include the `dyn` keyword
+    //~| ERROR trait objects must include the `dyn` keyword
+    let _x: &SomeTrait = todo!();
+    //~^ ERROR trait objects must include the `dyn` keyword
+}
+
+trait SomeTrait {}
+
+fn main() {}
diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
new file mode 100644
index 0000000000000..791ff6979cb0b
--- /dev/null
+++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
@@ -0,0 +1,21 @@
+error[E0782]: trait objects must include the `dyn` keyword
+  --> $DIR/dyn-2021-edition-error.rs:6:14
+   |
+LL |     let _x: &SomeTrait = todo!();
+   |              ^^^^^^^^^ `dyn` keyword should be added before this trait
+
+error[E0782]: trait objects must include the `dyn` keyword
+  --> $DIR/dyn-2021-edition-error.rs:3:17
+   |
+LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+   |                 ^^^^^^^^^ `dyn` keyword should be added before this trait
+
+error[E0782]: trait objects must include the `dyn` keyword
+  --> $DIR/dyn-2021-edition-error.rs:3:35
+   |
+LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+   |                                   ^^^^^^^^^ `dyn` keyword should be added before this trait
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0782`.
diff --git a/src/test/ui/range/exclusive-range-patterns-2021.rs b/src/test/ui/range/exclusive-range-patterns-2021.rs
new file mode 100644
index 0000000000000..de69c9bf2f384
--- /dev/null
+++ b/src/test/ui/range/exclusive-range-patterns-2021.rs
@@ -0,0 +1,14 @@
+// edition:2021
+
+fn main() {
+    let n = 2;
+    match n {
+        0...3 => {}
+        //~^ ERROR `...` range patterns are deprecated
+        4...10 => {}
+        //~^ ERROR `...` range patterns are deprecated
+        (11...100) => {}
+        //~^ ERROR `...` range patterns are deprecated
+        _ => {}
+    }
+}
diff --git a/src/test/ui/range/exclusive-range-patterns-2021.stderr b/src/test/ui/range/exclusive-range-patterns-2021.stderr
new file mode 100644
index 0000000000000..a967437041a54
--- /dev/null
+++ b/src/test/ui/range/exclusive-range-patterns-2021.stderr
@@ -0,0 +1,27 @@
+error[E0783]: `...` range patterns are deprecated
+  --> $DIR/exclusive-range-patterns-2021.rs:6:9
+   |
+LL |         0...3 => {}
+   |         ^---^
+   |          |
+   |          help: use `..=` for an inclusive range
+
+error[E0783]: `...` range patterns are deprecated
+  --> $DIR/exclusive-range-patterns-2021.rs:8:9
+   |
+LL |         4...10 => {}
+   |         ^---^^
+   |          |
+   |          help: use `..=` for an inclusive range
+
+error[E0783]: `...` range patterns are deprecated
+  --> $DIR/exclusive-range-patterns-2021.rs:10:10
+   |
+LL |         (11...100) => {}
+   |          ^^---^^^
+   |            |
+   |            help: use `..=` for an inclusive range
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0783`.

From 1d84947bb568ab7652fb0e04d6f0f1bdaaaf489a Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Wed, 17 Mar 2021 11:14:55 +0100
Subject: [PATCH 02/14] Fix error code tests for now

---
 compiler/rustc_error_codes/src/error_codes/E0782.md | 2 +-
 compiler/rustc_error_codes/src/error_codes/E0783.md | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
index e001aa8bc9bc3..933e37763f69a 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0782.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -6,7 +6,7 @@ runtime but conform to some trait.
 In the following code the trait object should be formed with
 `Box<dyn Foo>`, but `dyn` is left off.
 
-```compile_fail,E0782
+```no_run
 trait Foo {}
 fn test(arg: Box<Foo>) {}
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index cc904543b0d26..73c19cd7f02c6 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -5,11 +5,11 @@ ranges which are now signified using `..=`.
 
 The following code use to compile, but now it now longer does.
 
-```compile_fail,E0783
+```no_run
 fn main() {
     let n = 2u8;
     match n {
-        ...9 => println!("Got a number less than 10),
+        ...9 => println!("Got a number less than 10"),
         _ => println!("Got a number 10 or more")
     }
 }

From 152c86211b4e79634dc4b811d59bb3166d106ca5 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Thu, 18 Mar 2021 13:22:25 +0100
Subject: [PATCH 03/14] Proper format for error code explanations

---
 .../src/error_codes/E0782.md                  | 21 +++++++++++++-----
 .../src/error_codes/E0783.md                  | 22 +++++++++++++------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
index 933e37763f69a..63c48506e7fde 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0782.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -1,17 +1,26 @@
 Trait objects must include the `dyn` keyword.
 
-Trait objects are a way to call methods on types that are not known until
-runtime but conform to some trait.
-
-In the following code the trait object should be formed with
-`Box<dyn Foo>`, but `dyn` is left off.
+Erroneous code example:
 
-```no_run
+```edition2021,compile_fail,E782
 trait Foo {}
 fn test(arg: Box<Foo>) {}
 ```
 
+Trait objects are a way to call methods on types that are not known until
+runtime but conform to some trait.
+
+Trait objects should be formed with `Box<dyn Foo>`, but in the code above
+`dyn` is left off.
+
 This makes it harder to see that `arg` is a trait object and not a
 simply a heap allocated type called `Foo`.
 
+To fix this issue, add `dyn` before the trait name.
+
+```
+trait Foo {}
+fn test(arg: Box<dyn Foo>) {}
+```
+
 This used to be allowed before edition 2021, but is now an error.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index 73c19cd7f02c6..41989b3ba2f92 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -1,18 +1,26 @@
 The range pattern `...` is no longer allowed.
 
+Erroneous code example:
+
+```edition2021,compile_fail,E782
+fn main() {
+    match 2u8 {
+        0...9 => println!("Got a number less than 10"),
+        _ => println!("Got a number 10 or more")
+    }
+}
+```
+
 Older Rust code using previous editions allowed `...` to stand for exclusive
 ranges which are now signified using `..=`.
 
-The following code use to compile, but now it now longer does.
+To make this code compile replace the `...` with `..=`.
 
-```no_run
+```
 fn main() {
-    let n = 2u8;
-    match n {
-        ...9 => println!("Got a number less than 10"),
+    match 2u8 {
+        0..=9 => println!("Got a number less than 10"),
         _ => println!("Got a number 10 or more")
     }
 }
 ```
-
-To make this code compile replace the `...` with `..=`.

From 4f67392c485b746b6264e81bbd1b66e40725a95f Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Thu, 18 Mar 2021 13:38:47 +0100
Subject: [PATCH 04/14] Update new part of code with error

---
 .../rustc_typeck/src/check/fn_ctxt/_impl.rs   | 51 ++++++++++++++-----
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
index 9ace455042103..a5efc63c66cc3 100644
--- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
+++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
@@ -30,6 +30,7 @@ use rustc_middle::ty::{
 use rustc_session::lint;
 use rustc_session::lint::builtin::BARE_TRAIT_OBJECTS;
 use rustc_session::parse::feature_err;
+use rustc_span::edition::Edition;
 use rustc_span::source_map::{original_sp, DUMMY_SP};
 use rustc_span::symbol::{kw, sym, Ident};
 use rustc_span::{self, BytePos, MultiSpan, Span};
@@ -969,20 +970,42 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             if let TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) =
                 self_ty.kind
             {
-                self.tcx.struct_span_lint_hir(BARE_TRAIT_OBJECTS, hir_id, self_ty.span, |lint| {
-                    let mut db = lint
-                        .build(&format!("trait objects without an explicit `dyn` are deprecated"));
-                    let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(self_ty.span)
-                    {
-                        Ok(s) if poly_trait_ref.trait_ref.path.is_global() => {
-                            (format!("<dyn ({})>", s), Applicability::MachineApplicable)
-                        }
-                        Ok(s) => (format!("<dyn {}>", s), Applicability::MachineApplicable),
-                        Err(_) => ("<dyn <type>>".to_string(), Applicability::HasPlaceholders),
-                    };
-                    db.span_suggestion(self_ty.span, "use `dyn`", sugg, app);
-                    db.emit()
-                });
+                let msg = "trait objects without an explicit `dyn` are deprecated";
+                let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(self_ty.span) {
+                    Ok(s) if poly_trait_ref.trait_ref.path.is_global() => {
+                        (format!("<dyn ({})>", s), Applicability::MachineApplicable)
+                    }
+                    Ok(s) => (format!("<dyn {}>", s), Applicability::MachineApplicable),
+                    Err(_) => ("<dyn <type>>".to_string(), Applicability::HasPlaceholders),
+                };
+                let replace = String::from("use `dyn`");
+                if self.sess().edition() >= Edition::Edition2021 {
+                    let mut err = rustc_errors::struct_span_err!(
+                        self.sess(),
+                        self_ty.span,
+                        E0783,
+                        "{}",
+                        msg,
+                    );
+                    err.span_suggestion(
+                        self_ty.span,
+                        &sugg,
+                        replace,
+                        Applicability::MachineApplicable,
+                    )
+                    .emit();
+                } else {
+                    self.tcx.struct_span_lint_hir(
+                        BARE_TRAIT_OBJECTS,
+                        hir_id,
+                        self_ty.span,
+                        |lint| {
+                            let mut db = lint.build(msg);
+                            db.span_suggestion(self_ty.span, &replace, sugg, app);
+                            db.emit()
+                        },
+                    );
+                }
             }
         }
     }

From 2c1429ca5ebccecb463d268bc1628a9d330d57b0 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Thu, 18 Mar 2021 17:45:30 +0100
Subject: [PATCH 05/14] Update error code docs even more

---
 .../rustc_error_codes/src/error_codes/E0782.md   |  4 ++--
 .../rustc_error_codes/src/error_codes/E0783.md   | 16 ++++++----------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
index 63c48506e7fde..b19d5209e4f49 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0782.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -4,7 +4,7 @@ Erroneous code example:
 
 ```edition2021,compile_fail,E782
 trait Foo {}
-fn test(arg: Box<Foo>) {}
+fn test(arg: Box<Foo>) {} // error!
 ```
 
 Trait objects are a way to call methods on types that are not known until
@@ -20,7 +20,7 @@ To fix this issue, add `dyn` before the trait name.
 
 ```
 trait Foo {}
-fn test(arg: Box<dyn Foo>) {}
+fn test(arg: Box<dyn Foo>) {} // ok!
 ```
 
 This used to be allowed before edition 2021, but is now an error.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index 41989b3ba2f92..1d398660fb37e 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -3,11 +3,9 @@ The range pattern `...` is no longer allowed.
 Erroneous code example:
 
 ```edition2021,compile_fail,E782
-fn main() {
-    match 2u8 {
-        0...9 => println!("Got a number less than 10"),
-        _ => println!("Got a number 10 or more")
-    }
+match 2u8 {
+    0...9 => println!("Got a number less than 10"), // error!
+    _ => println!("Got a number 10 or more"),
 }
 ```
 
@@ -17,10 +15,8 @@ ranges which are now signified using `..=`.
 To make this code compile replace the `...` with `..=`.
 
 ```
-fn main() {
-    match 2u8 {
-        0..=9 => println!("Got a number less than 10"),
-        _ => println!("Got a number 10 or more")
-    }
+match 2u8 {
+    0..=9 => println!("Got a number less than 10"), // ok!
+    _ => println!("Got a number 10 or more"),
 }
 ```

From a2b1347bbb4c3f16d6c7a6eff2b04d90561f9b09 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Fri, 19 Mar 2021 10:18:22 +0100
Subject: [PATCH 06/14] Improve error

---
 compiler/rustc_ast_lowering/src/lib.rs        | 11 +++++++---
 .../src/error_codes/E0783.md                  |  2 +-
 .../dyn-keyword/dyn-2021-edition-error.stderr | 21 ++++++++++++++++---
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index fa32645289c58..aefc896955871 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -46,7 +46,7 @@ use rustc_ast_pretty::pprust;
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::sync::Lrc;
-use rustc_errors::struct_span_err;
+use rustc_errors::{struct_span_err, Applicability};
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res};
 use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, CRATE_DEF_ID};
@@ -2785,9 +2785,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
                 )
             } else {
                 let msg = "trait objects must include the `dyn` keyword";
-                let label = "`dyn` keyword should be added before this trait";
+                let label = "add `dyn` keyword before this trait";
                 let mut err = struct_span_err!(self.sess, span, E0782, "{}", msg,);
-                err.span_label(span, label);
+                err.span_suggestion_verbose(
+                    span.shrink_to_lo(),
+                    label,
+                    String::from("dyn "),
+                    Applicability::MachineApplicable,
+                );
                 err.emit();
             }
         }
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index 1d398660fb37e..afc82546dac02 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -2,7 +2,7 @@ The range pattern `...` is no longer allowed.
 
 Erroneous code example:
 
-```edition2021,compile_fail,E782
+```edition2021,compile_fail,E783
 match 2u8 {
     0...9 => println!("Got a number less than 10"), // error!
     _ => println!("Got a number 10 or more"),
diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
index 791ff6979cb0b..798f48060e7b7 100644
--- a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
+++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr
@@ -2,19 +2,34 @@ error[E0782]: trait objects must include the `dyn` keyword
   --> $DIR/dyn-2021-edition-error.rs:6:14
    |
 LL |     let _x: &SomeTrait = todo!();
-   |              ^^^^^^^^^ `dyn` keyword should be added before this trait
+   |              ^^^^^^^^^
+   |
+help: add `dyn` keyword before this trait
+   |
+LL |     let _x: &dyn SomeTrait = todo!();
+   |              ^^^
 
 error[E0782]: trait objects must include the `dyn` keyword
   --> $DIR/dyn-2021-edition-error.rs:3:17
    |
 LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
-   |                 ^^^^^^^^^ `dyn` keyword should be added before this trait
+   |                 ^^^^^^^^^
+   |
+help: add `dyn` keyword before this trait
+   |
+LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
+   |                 ^^^
 
 error[E0782]: trait objects must include the `dyn` keyword
   --> $DIR/dyn-2021-edition-error.rs:3:35
    |
 LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
-   |                                   ^^^^^^^^^ `dyn` keyword should be added before this trait
+   |                                   ^^^^^^^^^
+   |
+help: add `dyn` keyword before this trait
+   |
+LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
+   |                                   ^^^
 
 error: aborting due to 3 previous errors
 

From d7b226398ecbba34b5dbc67dc9570ebee203741e Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Wed, 7 Apr 2021 18:20:23 +0200
Subject: [PATCH 07/14] Change how edition is determined

---
 compiler/rustc_ast_lowering/src/lib.rs | 2 +-
 compiler/rustc_lint/src/builtin.rs     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index aefc896955871..e83975f56c44b 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -2775,7 +2775,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
             .map(|snippet| snippet.starts_with("#["))
             .unwrap_or(true);
         if !is_macro_callsite {
-            if self.sess.edition() < Edition::Edition2021 {
+            if span.edition() < Edition::Edition2021 {
                 self.resolver.lint_buffer().buffer_lint_with_diagnostic(
                     BARE_TRAIT_OBJECTS,
                     id,
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 9f1efe980f67f..379f41319f6a1 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1704,7 +1704,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
                     Some(start) => format!("&({}..={})", expr_to_string(&start), end),
                     None => format!("&(..={})", end),
                 };
-                if cx.sess().edition() >= Edition::Edition2021 {
+                if join.edition() >= Edition::Edition2021 {
                     let mut err =
                         rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
                     err.span_suggestion(
@@ -1728,7 +1728,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
                 }
             } else {
                 let replace = "..=".to_owned();
-                if cx.sess().edition() >= Edition::Edition2021 {
+                if join.edition() >= Edition::Edition2021 {
                     let mut err =
                         rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
                     err.span_suggestion_short(

From cebc520034d1225c30b92e91834ac15b91cf779c Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Thu, 8 Apr 2021 16:33:24 +0200
Subject: [PATCH 08/14] Fix error code tests

---
 compiler/rustc_error_codes/src/error_codes/E0782.md | 2 +-
 compiler/rustc_error_codes/src/error_codes/E0783.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
index b19d5209e4f49..5eddd7ae8d549 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0782.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -2,7 +2,7 @@ Trait objects must include the `dyn` keyword.
 
 Erroneous code example:
 
-```edition2021,compile_fail,E782
+```edition2021,compile_fail,E0782
 trait Foo {}
 fn test(arg: Box<Foo>) {} // error!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index afc82546dac02..ee784be35efef 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -2,7 +2,7 @@ The range pattern `...` is no longer allowed.
 
 Erroneous code example:
 
-```edition2021,compile_fail,E783
+```edition2021,compile_fail,E0783
 match 2u8 {
     0...9 => println!("Got a number less than 10"), // error!
     _ => println!("Got a number 10 or more"),

From aa4457fa5fd1151a7f7a674373c2f4c0df9a3df4 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Tue, 13 Apr 2021 16:55:54 +0200
Subject: [PATCH 09/14] Add compatibility info to lints

---
 .../src/error_codes/E0782.md                  |  2 +-
 .../src/error_codes/E0783.md                  |  2 +-
 compiler/rustc_lint/src/builtin.rs            |  6 +++-
 compiler/rustc_lint_defs/src/builtin.rs       |  6 +++-
 .../ui/dyn-keyword/dyn-2018-edition-lint.rs   | 16 +++++++++
 .../dyn-keyword/dyn-2018-edition-lint.stderr  | 34 +++++++++++++++++++
 6 files changed, 62 insertions(+), 4 deletions(-)
 create mode 100644 src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs
 create mode 100644 src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr

diff --git a/compiler/rustc_error_codes/src/error_codes/E0782.md b/compiler/rustc_error_codes/src/error_codes/E0782.md
index 5eddd7ae8d549..0f3253c050e2b 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0782.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0782.md
@@ -18,7 +18,7 @@ simply a heap allocated type called `Foo`.
 
 To fix this issue, add `dyn` before the trait name.
 
-```
+```edition2021
 trait Foo {}
 fn test(arg: Box<dyn Foo>) {} // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0783.md b/compiler/rustc_error_codes/src/error_codes/E0783.md
index ee784be35efef..73981e59e0d95 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0783.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0783.md
@@ -14,7 +14,7 @@ ranges which are now signified using `..=`.
 
 To make this code compile replace the `...` with `..=`.
 
-```
+```edition2021
 match 2u8 {
     0..=9 => println!("Got a number less than 10"), // ok!
     _ => println!("Got a number 10 or more"),
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 379f41319f6a1..7a62f20ccc8b8 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1655,7 +1655,11 @@ declare_lint! {
     /// [`..` range expression]: https://doc.rust-lang.org/reference/expressions/range-expr.html
     pub ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
     Warn,
-    "`...` range patterns are deprecated"
+    "`...` range patterns are deprecated",
+    @future_incompatible = FutureIncompatibleInfo {
+        reference: "issue #80165 <https://github.com/rust-lang/rust/issues/80165>",
+        edition: Some(Edition::Edition2021),
+    };
 }
 
 #[derive(Default)]
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 27724b4965c3c..813796a68df65 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1618,7 +1618,11 @@ declare_lint! {
     /// [`impl Trait`]: https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
     pub BARE_TRAIT_OBJECTS,
     Warn,
-    "suggest using `dyn Trait` for trait objects"
+    "suggest using `dyn Trait` for trait objects",
+    @future_incompatible = FutureIncompatibleInfo {
+        reference: "issue #80165 <https://github.com/rust-lang/rust/issues/80165>",
+        edition: Some(Edition::Edition2021),
+    };
 }
 
 declare_lint! {
diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs
new file mode 100644
index 0000000000000..7c2babaf7abaa
--- /dev/null
+++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs
@@ -0,0 +1,16 @@
+// edition:2018
+#[deny(bare_trait_objects)]
+
+fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+    //~^ ERROR trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted
+    //~| ERROR trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted
+    let _x: &SomeTrait = todo!();
+    //~^ ERROR trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted
+}
+
+trait SomeTrait {}
+
+fn main() {}
diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr
new file mode 100644
index 0000000000000..ea73e56d8433d
--- /dev/null
+++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr
@@ -0,0 +1,34 @@
+error: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/dyn-2018-edition-lint.rs:4:17
+   |
+LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+   |                 ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
+   |
+note: the lint level is defined here
+  --> $DIR/dyn-2018-edition-lint.rs:2:8
+   |
+LL | #[deny(bare_trait_objects)]
+   |        ^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
+
+error: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/dyn-2018-edition-lint.rs:4:35
+   |
+LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
+   |                                   ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
+
+error: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/dyn-2018-edition-lint.rs:9:14
+   |
+LL |     let _x: &SomeTrait = todo!();
+   |              ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
+
+error: aborting due to 3 previous errors
+

From 43f9d0ae7e0733b1e4e7ad84165ddd57144f2db7 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Wed, 14 Apr 2021 18:56:13 +0200
Subject: [PATCH 10/14] Cancel emitting FCW lint if it is an edition fixing
 lint

---
 compiler/rustc_middle/src/lint.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 26e61ec8cf866..7adaf54fa2374 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -272,11 +272,13 @@ pub fn struct_lint_level<'s, 'd>(
             // emit shouldn't be automatically fixed by rustfix.
             err.allow_suggestions(false);
 
-            // If this is a future incompatible lint it'll become a hard error, so
-            // we have to emit *something*. Also, if this lint occurs in the
-            // expansion of a macro from an external crate, allow individual lints
-            // to opt-out from being reported.
-            if future_incompatible.is_none() && !lint.report_in_external_macro {
+            // If this is a future incompatible that is not an edition fixing lint
+            // it'll become a hard error, so we have to emit *something*. Also,
+            // if this lint occurs in the expansion of a macro from an external crate,
+            // allow individual lints to opt-out from being reported.
+            let not_future_incompatible =
+                future_incompatible.map(|f| f.edition.is_some()).unwrap_or(true);
+            if not_future_incompatible && !lint.report_in_external_macro {
                 err.cancel();
                 // Don't continue further, since we don't want to have
                 // `diag_span_note_once` called for a diagnostic that isn't emitted.

From cd8392dd9932c30f5e6e7b42a1f3ab9e90ab11f8 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Fri, 16 Apr 2021 11:06:51 +0200
Subject: [PATCH 11/14] Fix tests

---
 ...const-expression-suggest-missing-braces.rs |   1 +
 ...t-expression-suggest-missing-braces.stderr |  22 ++--
 .../gat-trait-path-parenthesised-args.rs      |   1 +
 .../gat-trait-path-parenthesised-args.stderr  |   2 +
 src/test/ui/lint/bare-trait-objects-path.rs   |  12 +-
 .../ui/lint/bare-trait-objects-path.stderr    |  14 ++-
 .../lint/inclusive-range-pattern-syntax.fixed |   2 +
 .../ui/lint/inclusive-range-pattern-syntax.rs |   2 +
 .../inclusive-range-pattern-syntax.stderr     |   7 +-
 src/test/ui/parser/issue-68890-2.rs           |   1 +
 src/test/ui/parser/issue-68890-2.stderr       |   2 +
 .../parser/issue-73568-lifetime-after-mut.rs  |   2 +
 .../issue-73568-lifetime-after-mut.stderr     |   9 +-
 .../macro/trait-object-macro-matcher.rs       |   1 +
 .../macro/trait-object-macro-matcher.stderr   |   2 +
 src/test/ui/parser/recover-range-pats.rs      |  21 +++-
 src/test/ui/parser/recover-range-pats.stderr  | 119 +++++++++++-------
 .../ui/parser/trait-object-trait-parens.rs    |   7 +-
 .../parser/trait-object-trait-parens.stderr   |  52 ++++----
 .../range-inclusive-pattern-precedence.fixed  |   3 +-
 .../range-inclusive-pattern-precedence.rs     |   3 +-
 .../range-inclusive-pattern-precedence.stderr |   4 +-
 .../range-inclusive-pattern-precedence2.rs    |   1 +
 ...range-inclusive-pattern-precedence2.stderr |   4 +-
 .../suggestions-not-always-applicable.fixed   |   8 +-
 .../suggestions-not-always-applicable.rs      |   8 +-
 .../suggestions-not-always-applicable.stderr  |  28 -----
 src/test/ui/suggestions/issue-61963.rs        |   4 +-
 src/test/ui/suggestions/issue-61963.stderr    |   7 +-
 src/test/ui/traits/bound/not-on-bare-trait.rs |   5 +-
 .../ui/traits/bound/not-on-bare-trait.stderr  |   2 +
 31 files changed, 214 insertions(+), 142 deletions(-)
 delete mode 100644 src/test/ui/rust-2018/suggestions-not-always-applicable.stderr

diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
index f8b9d7adbfef3..d845e00694a2d 100644
--- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
+++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
@@ -13,6 +13,7 @@ fn b() {
     //~| ERROR expected trait, found constant `BAR`
     //~| ERROR type provided when a constant was expected
     //~| WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
 fn c() {
     foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces
diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
index ad451fcf65df7..857498a1111f5 100644
--- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
+++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
@@ -10,7 +10,7 @@ LL |     foo::<{ BAR + 3 }>();
    |           ^         ^
 
 error: expressions must be enclosed in braces to be used as const generic arguments
-  --> $DIR/const-expression-suggest-missing-braces.rs:18:11
+  --> $DIR/const-expression-suggest-missing-braces.rs:19:11
    |
 LL |     foo::<3 + 3>();
    |           ^^^^^
@@ -21,7 +21,7 @@ LL |     foo::<{ 3 + 3 }>();
    |           ^       ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:21:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:22:15
    |
 LL |     foo::<BAR - 3>();
    |               ^ expected one of `,` or `>`
@@ -32,7 +32,7 @@ LL |     foo::<{ BAR - 3 }>();
    |           ^         ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:24:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:25:15
    |
 LL |     foo::<BAR - BAR>();
    |               ^ expected one of `,` or `>`
@@ -43,7 +43,7 @@ LL |     foo::<{ BAR - BAR }>();
    |           ^           ^
 
 error: expressions must be enclosed in braces to be used as const generic arguments
-  --> $DIR/const-expression-suggest-missing-braces.rs:27:11
+  --> $DIR/const-expression-suggest-missing-braces.rs:28:11
    |
 LL |     foo::<100 - BAR>();
    |           ^^^^^^^^^
@@ -54,7 +54,7 @@ LL |     foo::<{ 100 - BAR }>();
    |           ^           ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:30:19
+  --> $DIR/const-expression-suggest-missing-braces.rs:31:19
    |
 LL |     foo::<bar<i32>()>();
    |                   ^ expected one of `,` or `>`
@@ -65,7 +65,7 @@ LL |     foo::<{ bar<i32>() }>();
    |           ^            ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:33:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:34:21
    |
 LL |     foo::<bar::<i32>()>();
    |                     ^ expected one of `,` or `>`
@@ -76,7 +76,7 @@ LL |     foo::<{ bar::<i32>() }>();
    |           ^              ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:36:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:37:21
    |
 LL |     foo::<bar::<i32>() + BAR>();
    |                     ^ expected one of `,` or `>`
@@ -87,7 +87,7 @@ LL |     foo::<{ bar::<i32>() + BAR }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:39:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:40:21
    |
 LL |     foo::<bar::<i32>() - BAR>();
    |                     ^ expected one of `,` or `>`
@@ -98,7 +98,7 @@ LL |     foo::<{ bar::<i32>() - BAR }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:42:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:43:15
    |
 LL |     foo::<BAR - bar::<i32>()>();
    |               ^ expected one of `,` or `>`
@@ -109,7 +109,7 @@ LL |     foo::<{ BAR - bar::<i32>() }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:45:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:46:15
    |
 LL |     foo::<BAR - bar::<i32>()>();
    |               ^ expected one of `,` or `>`
@@ -138,6 +138,8 @@ LL |     foo::<BAR + BAR>();
    |           ^^^^^^^^^ help: use `dyn`: `dyn BAR + BAR`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0747]: type provided when a constant was expected
   --> $DIR/const-expression-suggest-missing-braces.rs:11:11
diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs
index bb1f27a17ca4c..40ed42c9ce017 100644
--- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs
+++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs
@@ -11,5 +11,6 @@ fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
   //~^ ERROR: lifetime in trait object type must be followed by `+`
   //~| ERROR: parenthesized generic arguments cannot be used
   //~| WARNING: trait objects without an explicit `dyn` are deprecated
+  //~| WARNING: this was previously accepted by the compiler
 
 fn main() {}
diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
index 20cb6d8828755..0e95c54d8114f 100644
--- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
+++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
@@ -26,6 +26,8 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
    |                             ^^ help: use `dyn`: `dyn 'a`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
   --> $DIR/gat-trait-path-parenthesised-args.rs:5:8
diff --git a/src/test/ui/lint/bare-trait-objects-path.rs b/src/test/ui/lint/bare-trait-objects-path.rs
index 4c961e998df64..74f838e9ed18d 100644
--- a/src/test/ui/lint/bare-trait-objects-path.rs
+++ b/src/test/ui/lint/bare-trait-objects-path.rs
@@ -11,8 +11,14 @@ trait Dyn {}
 impl Assoc for dyn Dyn {}
 
 fn main() {
-    Dyn::func(); //~ WARN trait objects without an explicit `dyn` are deprecated
-    ::Dyn::func(); //~ WARN trait objects without an explicit `dyn` are deprecated
-    Dyn::CONST; //~ WARN trait objects without an explicit `dyn` are deprecated
+    Dyn::func();
+    //~^ WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
+    ::Dyn::func();
+    //~^ WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
+    Dyn::CONST;
+    //~^ WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
     let _: Dyn::Ty; //~ ERROR ambiguous associated type
 }
diff --git a/src/test/ui/lint/bare-trait-objects-path.stderr b/src/test/ui/lint/bare-trait-objects-path.stderr
index 0a2dc5858285a..55c9ea234de29 100644
--- a/src/test/ui/lint/bare-trait-objects-path.stderr
+++ b/src/test/ui/lint/bare-trait-objects-path.stderr
@@ -1,5 +1,5 @@
 error[E0223]: ambiguous associated type
-  --> $DIR/bare-trait-objects-path.rs:17:12
+  --> $DIR/bare-trait-objects-path.rs:23:12
    |
 LL |     let _: Dyn::Ty;
    |            ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Trait>::Ty`
@@ -11,18 +11,26 @@ LL |     Dyn::func();
    |     ^^^ help: use `dyn`: `<dyn Dyn>`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/bare-trait-objects-path.rs:15:5
+  --> $DIR/bare-trait-objects-path.rs:17:5
    |
 LL |     ::Dyn::func();
    |     ^^^^^ help: use `dyn`: `<dyn (::Dyn)>`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/bare-trait-objects-path.rs:16:5
+  --> $DIR/bare-trait-objects-path.rs:20:5
    |
 LL |     Dyn::CONST;
    |     ^^^ help: use `dyn`: `<dyn Dyn>`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: aborting due to previous error; 3 warnings emitted
 
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
index d6e5033a0c4c2..a1b738e33fa9b 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed
@@ -8,12 +8,14 @@ fn main() {
     match despondency {
         1..=2 => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         _ => {}
     }
 
     match &despondency {
         &(1..=2) => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         _ => {}
     }
 }
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.rs b/src/test/ui/lint/inclusive-range-pattern-syntax.rs
index 773eea14fd790..d3ebbf38e1cba 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.rs
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.rs
@@ -8,12 +8,14 @@ fn main() {
     match despondency {
         1...2 => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         _ => {}
     }
 
     match &despondency {
         &1...2 => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         _ => {}
     }
 }
diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
index 19fe9ed892acb..ba4ae208e39cb 100644
--- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
+++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr
@@ -9,12 +9,17 @@ note: the lint level is defined here
    |
 LL | #![warn(ellipsis_inclusive_range_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: `...` range patterns are deprecated
-  --> $DIR/inclusive-range-pattern-syntax.rs:15:9
+  --> $DIR/inclusive-range-pattern-syntax.rs:16:9
    |
 LL |         &1...2 => {}
    |         ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: 2 warnings emitted
 
diff --git a/src/test/ui/parser/issue-68890-2.rs b/src/test/ui/parser/issue-68890-2.rs
index ae02246046880..88527cc8783c8 100644
--- a/src/test/ui/parser/issue-68890-2.rs
+++ b/src/test/ui/parser/issue-68890-2.rs
@@ -4,3 +4,4 @@ type X<'a> = (?'a) +;
 //~^ ERROR `?` may only modify trait bounds, not lifetime bounds
 //~| ERROR at least one trait is required for an object type
 //~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this was previously accepted by the compiler
diff --git a/src/test/ui/parser/issue-68890-2.stderr b/src/test/ui/parser/issue-68890-2.stderr
index e51c2c0e8428b..37f38365b016f 100644
--- a/src/test/ui/parser/issue-68890-2.stderr
+++ b/src/test/ui/parser/issue-68890-2.stderr
@@ -11,6 +11,8 @@ LL | type X<'a> = (?'a) +;
    |              ^^^^^^^ help: use `dyn`: `dyn (?'a) +`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0224]: at least one trait is required for an object type
   --> $DIR/issue-68890-2.rs:3:14
diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.rs b/src/test/ui/parser/issue-73568-lifetime-after-mut.rs
index 0b10a5f6f4e41..0733b2d2df781 100644
--- a/src/test/ui/parser/issue-73568-lifetime-after-mut.rs
+++ b/src/test/ui/parser/issue-73568-lifetime-after-mut.rs
@@ -14,8 +14,10 @@ mac!('a);
 fn y<'a>(y: &mut 'a + Send) {
     //~^ ERROR expected a path on the left-hand side of `+`, not `&mut 'a`
     //~| WARNING trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
     //~| ERROR at least one trait is required for an object type
     let z = y as &mut 'a + Send;
     //~^ ERROR expected value, found trait `Send`
     //~| WARNING trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr b/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr
index abb64f7e490df..9b05383dd7de0 100644
--- a/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr
+++ b/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr
@@ -22,7 +22,7 @@ LL | mac!('a);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0423]: expected value, found trait `Send`
-  --> $DIR/issue-73568-lifetime-after-mut.rs:18:28
+  --> $DIR/issue-73568-lifetime-after-mut.rs:19:28
    |
 LL |     let z = y as &mut 'a + Send;
    |                            ^^^^ not a value
@@ -34,12 +34,17 @@ LL | fn y<'a>(y: &mut 'a + Send) {
    |                  ^^ help: use `dyn`: `dyn 'a`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/issue-73568-lifetime-after-mut.rs:18:23
+  --> $DIR/issue-73568-lifetime-after-mut.rs:19:23
    |
 LL |     let z = y as &mut 'a + Send;
    |                       ^^ help: use `dyn`: `dyn 'a`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0224]: at least one trait is required for an object type
   --> $DIR/issue-73568-lifetime-after-mut.rs:14:18
diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.rs b/src/test/ui/parser/macro/trait-object-macro-matcher.rs
index 170ac22780b63..0428ea0e2c1b1 100644
--- a/src/test/ui/parser/macro/trait-object-macro-matcher.rs
+++ b/src/test/ui/parser/macro/trait-object-macro-matcher.rs
@@ -12,4 +12,5 @@ fn main() {
     //~^ ERROR lifetime in trait object type must be followed by `+`
     //~| ERROR at least one trait is required for an object type
     //~| WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr
index b12eedf3581b5..8ae5611d89d19 100644
--- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr
+++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr
@@ -11,6 +11,8 @@ LL |     m!('static);
    |        ^^^^^^^ help: use `dyn`: `dyn 'static`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0224]: at least one trait is required for an object type
   --> $DIR/trait-object-macro-matcher.rs:11:8
diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs
index 7412b624b09cd..a10add6d9e523 100644
--- a/src/test/ui/parser/recover-range-pats.rs
+++ b/src/test/ui/parser/recover-range-pats.rs
@@ -39,20 +39,32 @@ fn inclusive_from_to() {
 }
 
 fn inclusive2_from_to() {
-    if let 0...3 = 0 {} //~ ERROR `...` range patterns are deprecated
-    if let 0...Y = 0 {} //~ ERROR `...` range patterns are deprecated
-    if let X...3 = 0 {} //~ ERROR `...` range patterns are deprecated
-    if let X...Y = 0 {} //~ ERROR `...` range patterns are deprecated
+    if let 0...3 = 0 {}
+    //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
+    if let 0...Y = 0 {}
+    //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
+    if let X...3 = 0 {}
+    //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
+    if let X...Y = 0 {}
+    //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
     if let true...Y = 0 {} //~ ERROR only `char` and numeric types
     //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
     if let X...true = 0 {} //~ ERROR only `char` and numeric types
     //~^ ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
     if let .0...Y = 0 {} //~ ERROR mismatched types
     //~^ ERROR float literals must have an integer part
+    //~| WARN this was previously accepted by the compiler
     //~| ERROR `...` range patterns are deprecated
     if let X... .0 = 0 {} //~ ERROR mismatched types
     //~^ ERROR float literals must have an integer part
     //~| ERROR `...` range patterns are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
 
 fn exclusive_from() {
@@ -125,6 +137,7 @@ fn with_macro_expr_var() {
             let $e1..$e2;
             let $e1...$e2;
             //~^ ERROR `...` range patterns are deprecated
+            //~| WARN this was previously accepted by the compiler
             let $e1..=$e2;
         }
     }
diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr
index e351a9783bf17..45f6b111e259c 100644
--- a/src/test/ui/parser/recover-range-pats.stderr
+++ b/src/test/ui/parser/recover-range-pats.stderr
@@ -23,25 +23,25 @@ LL |     if let X..=.0 = 0 {}
    |                ^^ help: must have an integer part: `0.0`
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:50:12
+  --> $DIR/recover-range-pats.rs:60:12
    |
 LL |     if let .0...Y = 0 {}
    |            ^^ help: must have an integer part: `0.0`
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:53:17
+  --> $DIR/recover-range-pats.rs:64:17
    |
 LL |     if let X... .0 = 0 {}
    |                 ^^ help: must have an integer part: `0.0`
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:63:12
+  --> $DIR/recover-range-pats.rs:75:12
    |
 LL |     if let .0.. = 0 {}
    |            ^^ help: must have an integer part: `0.0`
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:69:13
+  --> $DIR/recover-range-pats.rs:81:13
    |
 LL |     if let 0..= = 0 {}
    |             ^^^ help: use `..` instead
@@ -49,7 +49,7 @@ LL |     if let 0..= = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:70:13
+  --> $DIR/recover-range-pats.rs:82:13
    |
 LL |     if let X..= = 0 {}
    |             ^^^ help: use `..` instead
@@ -57,7 +57,7 @@ LL |     if let X..= = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:71:16
+  --> $DIR/recover-range-pats.rs:83:16
    |
 LL |     if let true..= = 0 {}
    |                ^^^ help: use `..` instead
@@ -65,13 +65,13 @@ LL |     if let true..= = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:73:12
+  --> $DIR/recover-range-pats.rs:85:12
    |
 LL |     if let .0..= = 0 {}
    |            ^^ help: must have an integer part: `0.0`
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:73:14
+  --> $DIR/recover-range-pats.rs:85:14
    |
 LL |     if let .0..= = 0 {}
    |              ^^^ help: use `..` instead
@@ -79,7 +79,7 @@ LL |     if let .0..= = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:79:13
+  --> $DIR/recover-range-pats.rs:91:13
    |
 LL |     if let 0... = 0 {}
    |             ^^^ help: use `..` instead
@@ -87,7 +87,7 @@ LL |     if let 0... = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:80:13
+  --> $DIR/recover-range-pats.rs:92:13
    |
 LL |     if let X... = 0 {}
    |             ^^^ help: use `..` instead
@@ -95,7 +95,7 @@ LL |     if let X... = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:81:16
+  --> $DIR/recover-range-pats.rs:93:16
    |
 LL |     if let true... = 0 {}
    |                ^^^ help: use `..` instead
@@ -103,13 +103,13 @@ LL |     if let true... = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:83:12
+  --> $DIR/recover-range-pats.rs:95:12
    |
 LL |     if let .0... = 0 {}
    |            ^^ help: must have an integer part: `0.0`
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:83:14
+  --> $DIR/recover-range-pats.rs:95:14
    |
 LL |     if let .0... = 0 {}
    |              ^^^ help: use `..` instead
@@ -117,49 +117,49 @@ LL |     if let .0... = 0 {}
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:93:15
+  --> $DIR/recover-range-pats.rs:105:15
    |
 LL |     if let .. .0 = 0 {}
    |               ^^ help: must have an integer part: `0.0`
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:103:15
+  --> $DIR/recover-range-pats.rs:115:15
    |
 LL |     if let ..=.0 = 0 {}
    |               ^^ help: must have an integer part: `0.0`
 
 error: range-to patterns with `...` are not allowed
-  --> $DIR/recover-range-pats.rs:109:12
+  --> $DIR/recover-range-pats.rs:121:12
    |
 LL |     if let ...3 = 0 {}
    |            ^^^ help: use `..=` instead
 
 error: range-to patterns with `...` are not allowed
-  --> $DIR/recover-range-pats.rs:111:12
+  --> $DIR/recover-range-pats.rs:123:12
    |
 LL |     if let ...Y = 0 {}
    |            ^^^ help: use `..=` instead
 
 error: range-to patterns with `...` are not allowed
-  --> $DIR/recover-range-pats.rs:113:12
+  --> $DIR/recover-range-pats.rs:125:12
    |
 LL |     if let ...true = 0 {}
    |            ^^^ help: use `..=` instead
 
 error: float literals must have an integer part
-  --> $DIR/recover-range-pats.rs:116:15
+  --> $DIR/recover-range-pats.rs:128:15
    |
 LL |     if let ....3 = 0 {}
    |               ^^ help: must have an integer part: `0.3`
 
 error: range-to patterns with `...` are not allowed
-  --> $DIR/recover-range-pats.rs:116:12
+  --> $DIR/recover-range-pats.rs:128:12
    |
 LL |     if let ....3 = 0 {}
    |            ^^^ help: use `..=` instead
 
 error: range-to patterns with `...` are not allowed
-  --> $DIR/recover-range-pats.rs:137:17
+  --> $DIR/recover-range-pats.rs:150:17
    |
 LL |             let ...$e;
    |                 ^^^ help: use `..=` instead
@@ -170,7 +170,7 @@ LL |     mac!(0);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:141:19
+  --> $DIR/recover-range-pats.rs:154:19
    |
 LL |             let $e...;
    |                   ^^^ help: use `..` instead
@@ -182,7 +182,7 @@ LL |     mac!(0);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/recover-range-pats.rs:142:19
+  --> $DIR/recover-range-pats.rs:155:19
    |
 LL |             let $e..=;
    |                   ^^^ help: use `..` instead
@@ -204,51 +204,74 @@ note: the lint level is defined here
    |
 LL | #![deny(ellipsis_inclusive_range_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:43:13
+  --> $DIR/recover-range-pats.rs:45:13
    |
 LL |     if let 0...Y = 0 {}
    |             ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:44:13
+  --> $DIR/recover-range-pats.rs:48:13
    |
 LL |     if let X...3 = 0 {}
    |             ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:45:13
+  --> $DIR/recover-range-pats.rs:51:13
    |
 LL |     if let X...Y = 0 {}
    |             ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:46:16
+  --> $DIR/recover-range-pats.rs:54:16
    |
 LL |     if let true...Y = 0 {}
    |                ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:48:13
+  --> $DIR/recover-range-pats.rs:57:13
    |
 LL |     if let X...true = 0 {}
    |             ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:50:14
+  --> $DIR/recover-range-pats.rs:60:14
    |
 LL |     if let .0...Y = 0 {}
    |              ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:53:13
+  --> $DIR/recover-range-pats.rs:64:13
    |
 LL |     if let X... .0 = 0 {}
    |             ^^^ help: use `..=` for an inclusive range
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: `...` range patterns are deprecated
-  --> $DIR/recover-range-pats.rs:126:20
+  --> $DIR/recover-range-pats.rs:138:20
    |
 LL |             let $e1...$e2;
    |                    ^^^ help: use `..=` for an inclusive range
@@ -256,6 +279,8 @@ LL |             let $e1...$e2;
 LL |     mac2!(0, 1);
    |     ------------ in this macro invocation
    |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
@@ -325,7 +350,7 @@ LL |     if let X..=.0 = 0 {}
    |            this is of type `u8`
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:46:12
+  --> $DIR/recover-range-pats.rs:54:12
    |
 LL |     if let true...Y = 0 {}
    |            ^^^^   - this is of type `u8`
@@ -333,7 +358,7 @@ LL |     if let true...Y = 0 {}
    |            this is of type `bool` but it should be `char` or numeric
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:48:16
+  --> $DIR/recover-range-pats.rs:57:16
    |
 LL |     if let X...true = 0 {}
    |            -   ^^^^ this is of type `bool` but it should be `char` or numeric
@@ -341,7 +366,7 @@ LL |     if let X...true = 0 {}
    |            this is of type `u8`
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:50:12
+  --> $DIR/recover-range-pats.rs:60:12
    |
 LL |     if let .0...Y = 0 {}
    |            ^^   - this is of type `u8`
@@ -349,7 +374,7 @@ LL |     if let .0...Y = 0 {}
    |            expected integer, found floating-point number
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:53:17
+  --> $DIR/recover-range-pats.rs:64:17
    |
 LL |     if let X... .0 = 0 {}
    |            -    ^^   - this expression has type `u8`
@@ -358,73 +383,73 @@ LL |     if let X... .0 = 0 {}
    |            this is of type `u8`
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:61:12
+  --> $DIR/recover-range-pats.rs:73:12
    |
 LL |     if let true.. = 0 {}
    |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:63:12
+  --> $DIR/recover-range-pats.rs:75:12
    |
 LL |     if let .0.. = 0 {}
    |            ^^ expected integer, found floating-point number
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:71:12
+  --> $DIR/recover-range-pats.rs:83:12
    |
 LL |     if let true..= = 0 {}
    |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:73:12
+  --> $DIR/recover-range-pats.rs:85:12
    |
 LL |     if let .0..= = 0 {}
    |            ^^ expected integer, found floating-point number
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:81:12
+  --> $DIR/recover-range-pats.rs:93:12
    |
 LL |     if let true... = 0 {}
    |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:83:12
+  --> $DIR/recover-range-pats.rs:95:12
    |
 LL |     if let .0... = 0 {}
    |            ^^ expected integer, found floating-point number
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:91:14
+  --> $DIR/recover-range-pats.rs:103:14
    |
 LL |     if let ..true = 0 {}
    |              ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:93:15
+  --> $DIR/recover-range-pats.rs:105:15
    |
 LL |     if let .. .0 = 0 {}
    |               ^^ expected integer, found floating-point number
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:101:15
+  --> $DIR/recover-range-pats.rs:113:15
    |
 LL |     if let ..=true = 0 {}
    |               ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:103:15
+  --> $DIR/recover-range-pats.rs:115:15
    |
 LL |     if let ..=.0 = 0 {}
    |               ^^ expected integer, found floating-point number
 
 error[E0029]: only `char` and numeric types are allowed in range patterns
-  --> $DIR/recover-range-pats.rs:113:15
+  --> $DIR/recover-range-pats.rs:125:15
    |
 LL |     if let ...true = 0 {}
    |               ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
-  --> $DIR/recover-range-pats.rs:116:15
+  --> $DIR/recover-range-pats.rs:128:15
    |
 LL |     if let ....3 = 0 {}
    |               ^^ expected integer, found floating-point number
diff --git a/src/test/ui/parser/trait-object-trait-parens.rs b/src/test/ui/parser/trait-object-trait-parens.rs
index 9fbc938c4dce8..7d55da7d09721 100644
--- a/src/test/ui/parser/trait-object-trait-parens.rs
+++ b/src/test/ui/parser/trait-object-trait-parens.rs
@@ -9,12 +9,15 @@ fn main() {
     //~^ ERROR `?Trait` is not permitted in trait object types
     //~| ERROR only auto traits can be used as additional traits
     //~| WARN trait objects without an explicit `dyn` are deprecated
-    let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Obj)>;
+    //~| WARN this was previously accepted by the compiler
+    let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
     //~^ ERROR `?Trait` is not permitted in trait object types
     //~| ERROR only auto traits can be used as additional traits
     //~| WARN trait objects without an explicit `dyn` are deprecated
-    let _: Box<(for<'a> Trait<'a>) + (Obj) + (?Sized)>;
+    //~| WARN this was previously accepted by the compiler
+    let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
     //~^ ERROR `?Trait` is not permitted in trait object types
     //~| ERROR only auto traits can be used as additional traits
     //~| WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr
index 6efbfad8f3865..79b6892dc079a 100644
--- a/src/test/ui/parser/trait-object-trait-parens.stderr
+++ b/src/test/ui/parser/trait-object-trait-parens.stderr
@@ -5,16 +5,16 @@ LL |     let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
    |                        ^^^^^^^^
 
 error: `?Trait` is not permitted in trait object types
-  --> $DIR/trait-object-trait-parens.rs:12:17
+  --> $DIR/trait-object-trait-parens.rs:13:16
    |
-LL |     let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Obj)>;
-   |                 ^^^^^^
+LL |     let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
+   |                ^^^^^^
 
 error: `?Trait` is not permitted in trait object types
-  --> $DIR/trait-object-trait-parens.rs:16:46
+  --> $DIR/trait-object-trait-parens.rs:18:44
    |
-LL |     let _: Box<(for<'a> Trait<'a>) + (Obj) + (?Sized)>;
-   |                                              ^^^^^^^^
+LL |     let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
+   |                                            ^^^^^^^^
 
 warning: trait objects without an explicit `dyn` are deprecated
   --> $DIR/trait-object-trait-parens.rs:8:16
@@ -23,18 +23,26 @@ LL |     let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/trait-object-trait-parens.rs:12:16
+  --> $DIR/trait-object-trait-parens.rs:13:16
    |
-LL |     let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Obj)>;
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (?Sized) + (for<'a> Trait<'a>) + (Obj)`
+LL |     let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn ?Sized + (for<'a> Trait<'a>) + (Obj)`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/trait-object-trait-parens.rs:16:16
+  --> $DIR/trait-object-trait-parens.rs:18:16
+   |
+LL |     let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn for<'a> Trait<'a> + (Obj) + (?Sized)`
    |
-LL |     let _: Box<(for<'a> Trait<'a>) + (Obj) + (?Sized)>;
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (for<'a> Trait<'a>) + (Obj) + (?Sized)`
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0225]: only auto traits can be used as additional traits in a trait object
   --> $DIR/trait-object-trait-parens.rs:8:35
@@ -48,23 +56,23 @@ LL |     let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/trait-object-trait-parens.rs:12:49
+  --> $DIR/trait-object-trait-parens.rs:13:47
    |
-LL |     let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Obj)>;
-   |                           -------------------   ^^^^^ additional non-auto trait
-   |                           |
-   |                           first non-auto trait
+LL |     let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
+   |                         -------------------   ^^^^^ additional non-auto trait
+   |                         |
+   |                         first non-auto trait
    |
    = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/trait-object-trait-parens.rs:16:38
+  --> $DIR/trait-object-trait-parens.rs:18:36
    |
-LL |     let _: Box<(for<'a> Trait<'a>) + (Obj) + (?Sized)>;
-   |                 -----------------    ^^^^^ additional non-auto trait
-   |                 |
-   |                 first non-auto trait
+LL |     let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
+   |                -----------------   ^^^^^ additional non-auto trait
+   |                |
+   |                first non-auto trait
    |
    = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.fixed b/src/test/ui/range/range-inclusive-pattern-precedence.fixed
index 22ab6c755be2d..6c01209967605 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence.fixed
+++ b/src/test/ui/range/range-inclusive-pattern-precedence.fixed
@@ -10,10 +10,11 @@ pub fn main() {
     match &12 {
         &(0..=9) => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         //~| HELP use `..=` for an inclusive range
         &(10 ..=15) => {}
         //~^ ERROR the range pattern here has ambiguous interpretation
-        //~^^ HELP add parentheses to clarify the precedence
+        //~| HELP add parentheses to clarify the precedence
         &(16..=20) => {}
         _ => {}
     }
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.rs b/src/test/ui/range/range-inclusive-pattern-precedence.rs
index f38a7920c94d6..ce763ba267798 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence.rs
+++ b/src/test/ui/range/range-inclusive-pattern-precedence.rs
@@ -10,10 +10,11 @@ pub fn main() {
     match &12 {
         &0...9 => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         //~| HELP use `..=` for an inclusive range
         &10..=15 => {}
         //~^ ERROR the range pattern here has ambiguous interpretation
-        //~^^ HELP add parentheses to clarify the precedence
+        //~| HELP add parentheses to clarify the precedence
         &(16..=20) => {}
         _ => {}
     }
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr
index 853141969c20d..ffb833535c2f0 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr
+++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr
@@ -1,5 +1,5 @@
 error: the range pattern here has ambiguous interpretation
-  --> $DIR/range-inclusive-pattern-precedence.rs:14:10
+  --> $DIR/range-inclusive-pattern-precedence.rs:15:10
    |
 LL |         &10..=15 => {}
    |          ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)`
@@ -15,6 +15,8 @@ note: the lint level is defined here
    |
 LL | #![warn(ellipsis_inclusive_range_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: aborting due to previous error; 1 warning emitted
 
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence2.rs b/src/test/ui/range/range-inclusive-pattern-precedence2.rs
index 6a3fd413e4fd7..7fa2698a49603 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence2.rs
+++ b/src/test/ui/range/range-inclusive-pattern-precedence2.rs
@@ -9,6 +9,7 @@ fn main() {
         // FIXME: can we add suggestions like `&(0..=9)`?
         box 0...9 => {}
         //~^ WARN `...` range patterns are deprecated
+        //~| WARN this was previously accepted by the compiler
         //~| HELP use `..=` for an inclusive range
         box 10..=15 => {}
         //~^ ERROR the range pattern here has ambiguous interpretation
diff --git a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr
index 7fbd972569e8d..e8e62b485cc1d 100644
--- a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr
+++ b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr
@@ -1,5 +1,5 @@
 error: the range pattern here has ambiguous interpretation
-  --> $DIR/range-inclusive-pattern-precedence2.rs:13:13
+  --> $DIR/range-inclusive-pattern-precedence2.rs:14:13
    |
 LL |         box 10..=15 => {}
    |             ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)`
@@ -15,6 +15,8 @@ note: the lint level is defined here
    |
 LL | #![warn(ellipsis_inclusive_range_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: aborting due to previous error; 1 warning emitted
 
diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed
index 12348e6e07dbc..f5afbad9f78fe 100644
--- a/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed
@@ -14,12 +14,8 @@ pub struct Foo;
 mod test {
     use crate::foo::foo;
 
-    #[foo] //~ WARN: absolute paths must start with
-    //~| WARN: previously accepted
-    //~| WARN: absolute paths
-    //~| WARN: previously accepted
-    fn main() {
-    }
+    #[foo]
+    fn main() {}
 }
 
 fn main() {
diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.rs b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs
index 12348e6e07dbc..f5afbad9f78fe 100644
--- a/src/test/ui/rust-2018/suggestions-not-always-applicable.rs
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs
@@ -14,12 +14,8 @@ pub struct Foo;
 mod test {
     use crate::foo::foo;
 
-    #[foo] //~ WARN: absolute paths must start with
-    //~| WARN: previously accepted
-    //~| WARN: absolute paths
-    //~| WARN: previously accepted
-    fn main() {
-    }
+    #[foo]
+    fn main() {}
 }
 
 fn main() {
diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
deleted file mode 100644
index 45502a5b88081..0000000000000
--- a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
-  --> $DIR/suggestions-not-always-applicable.rs:17:5
-   |
-LL |     #[foo]
-   |     ^^^^^^
-   |
-note: the lint level is defined here
-  --> $DIR/suggestions-not-always-applicable.rs:8:9
-   |
-LL | #![warn(rust_2018_compatibility)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^
-   = note: `#[warn(absolute_paths_not_starting_with_crate)]` implied by `#[warn(rust_2018_compatibility)]`
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
-   = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
-   = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
-  --> $DIR/suggestions-not-always-applicable.rs:17:5
-   |
-LL |     #[foo]
-   |     ^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
-   = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
-   = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
-
-warning: 2 warnings emitted
-
diff --git a/src/test/ui/suggestions/issue-61963.rs b/src/test/ui/suggestions/issue-61963.rs
index 666fc965f02f5..b5c379ebc6eb9 100644
--- a/src/test/ui/suggestions/issue-61963.rs
+++ b/src/test/ui/suggestions/issue-61963.rs
@@ -11,15 +11,17 @@ extern crate issue_61963_1;
 // generate code which would trigger the lint.
 
 pub struct Baz;
-pub trait Bar { }
+pub trait Bar {}
 pub struct Qux<T>(T);
 
 #[dom_struct]
 pub struct Foo {
     //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
+    //~| WARN this was previously accepted by the compiler
     qux: Qux<Qux<Baz>>,
     bar: Box<Bar>,
     //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
+    //~| WARN this was previously accepted by the compiler
 }
 
 fn main() {}
diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr
index 62ae5fa3fe54f..f8c58b6173477 100644
--- a/src/test/ui/suggestions/issue-61963.stderr
+++ b/src/test/ui/suggestions/issue-61963.stderr
@@ -1,5 +1,5 @@
 error: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/issue-61963.rs:21:14
+  --> $DIR/issue-61963.rs:22:14
    |
 LL |     bar: Box<Bar>,
    |              ^^^ help: use `dyn`: `dyn Bar`
@@ -9,12 +9,17 @@ note: the lint level is defined here
    |
 LL | #![deny(bare_trait_objects)]
    |         ^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: trait objects without an explicit `dyn` are deprecated
   --> $DIR/issue-61963.rs:18:1
    |
 LL | pub struct Foo {
    | ^^^ help: use `dyn`: `dyn pub`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/traits/bound/not-on-bare-trait.rs b/src/test/ui/traits/bound/not-on-bare-trait.rs
index 33c9f2f00cfee..08355a55630f6 100644
--- a/src/test/ui/traits/bound/not-on-bare-trait.rs
+++ b/src/test/ui/traits/bound/not-on-bare-trait.rs
@@ -1,5 +1,5 @@
 trait Foo {
-    fn dummy(&self) { }
+    fn dummy(&self) {}
 }
 
 // This should emit the less confusing error, not the more confusing one.
@@ -7,6 +7,7 @@ trait Foo {
 fn foo(_x: Foo + Send) {
     //~^ ERROR the size for values of type
     //~| WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this was previously accepted by the compiler
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr
index e7fc0fa5ec0ec..f087a45a6c488 100644
--- a/src/test/ui/traits/bound/not-on-bare-trait.stderr
+++ b/src/test/ui/traits/bound/not-on-bare-trait.stderr
@@ -5,6 +5,8 @@ LL | fn foo(_x: Foo + Send) {
    |            ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send`
    |
    = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time
   --> $DIR/not-on-bare-trait.rs:7:8

From 4e25ae480753baca2664d32cea6591f6cd221a32 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Mon, 26 Apr 2021 12:14:10 +0200
Subject: [PATCH 12/14] Pass unstable options to error index rustdoc invocation

---
 src/bootstrap/test.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 117201ab3cd86..977d6ca8e8e51 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1687,6 +1687,9 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
     builder.info(&format!("doc tests for: {}", markdown.display()));
     let mut cmd = builder.rustdoc_cmd(compiler);
     builder.add_rust_test_threads(&mut cmd);
+    // allow for unstable options such as new editions
+    cmd.arg("-Z");
+    cmd.arg("unstable-options");
     cmd.arg("--test");
     cmd.arg(markdown);
     cmd.env("RUSTC_BOOTSTRAP", "1");

From 4193b0bb7082506f0fd8f15750c989bcd3a5ce33 Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Mon, 26 Apr 2021 15:08:55 +0200
Subject: [PATCH 13/14] Add 2021 compatibility lint description

---
 src/tools/lint-docs/src/groups.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs
index e8fd19a63812b..9696e35b7963f 100644
--- a/src/tools/lint-docs/src/groups.rs
+++ b/src/tools/lint-docs/src/groups.rs
@@ -13,6 +13,7 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
     ("nonstandard-style", "Violation of standard naming conventions"),
     ("future-incompatible", "Lints that detect code that has future-compatibility problems"),
     ("rust-2018-compatibility", "Lints used to transition code from the 2015 edition to 2018"),
+    ("rust-2021-compatibility", "Lints used to transition code from the 2018 edition to 2021"),
 ];
 
 type LintGroups = BTreeMap<String, BTreeSet<String>>;

From 7a5039251ae9d4a356e0608b4adafcea84a11a7e Mon Sep 17 00:00:00 2001
From: Ryan Levick <me@ryanlevick.com>
Date: Thu, 29 Apr 2021 18:37:22 +0200
Subject: [PATCH 14/14] Fix clippy error

---
 src/tools/clippy/tests/ui/crashes/ice-3969.stderr | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
index 923db0664a714..fb4589a48ec42 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
@@ -5,18 +5,26 @@ LL |     for<'a> Dst<A + 'a>: Sized,
    |                 ^^^^^^ help: use `dyn`: `dyn A + 'a`
    |
    = note: `-D bare-trait-objects` implied by `-D warnings`
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: trait objects without an explicit `dyn` are deprecated
   --> $DIR/ice-3969.rs:27:16
    |
 LL |     let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
    |                ^ help: use `dyn`: `dyn A`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: trait objects without an explicit `dyn` are deprecated
   --> $DIR/ice-3969.rs:27:57
    |
 LL |     let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
    |                                                         ^ help: use `dyn`: `dyn A`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
+   = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
 
 error: aborting due to 3 previous errors