diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs
index debed38361a14..478488900a223 100644
--- a/src/librustc/hir/def_id.rs
+++ b/src/librustc/hir/def_id.rs
@@ -13,10 +13,8 @@ newtype_index! {
 
 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub enum CrateNum {
-    /// Virtual crate for builtin macros
-    // FIXME(jseyfried): this is also used for custom derives until proc-macro crates get
-    // `CrateNum`s.
-    BuiltinMacros,
+    /// Virtual crate for legacy proc macros registered with `#![plugin]`.
+    LegacyProcMacros,
     /// A special CrateNum that we use for the tcx.rcache when decoding from
     /// the incr. comp. cache.
     ReservedForIncrCompCache,
@@ -27,7 +25,7 @@ impl ::std::fmt::Debug for CrateNum {
     fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         match self {
             CrateNum::Index(id) => write!(fmt, "crate{}", id.private),
-            CrateNum::BuiltinMacros => write!(fmt, "builtin macros crate"),
+            CrateNum::LegacyProcMacros => write!(fmt, "legacy proc macros crate"),
             CrateNum::ReservedForIncrCompCache => write!(fmt, "crate for decoding incr comp cache"),
         }
     }
@@ -87,7 +85,7 @@ impl fmt::Display for CrateNum {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
             CrateNum::Index(id) => fmt::Display::fmt(&id.private, f),
-            CrateNum::BuiltinMacros => write!(f, "builtin macros crate"),
+            CrateNum::LegacyProcMacros => write!(f, "legacy proc macros crate"),
             CrateNum::ReservedForIncrCompCache => write!(f, "crate for decoding incr comp cache"),
         }
     }
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index 6a561f0c63a2a..f4815587f4505 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -394,7 +394,11 @@ impl Definitions {
     #[inline]
     pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> hir::HirId {
         let node_id = self.def_index_to_node[def_index.index()];
-        self.node_to_hir_id[node_id]
+        if unlikely!(node_id == ast::DUMMY_NODE_ID) {
+            hir::DUMMY_HIR_ID
+        } else {
+            self.node_to_hir_id[node_id]
+        }
     }
 
     #[inline]
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index 86536b179f222..391bb35cc31c0 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -381,6 +381,10 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
 }
 
 impl cstore::CStore {
+    pub fn is_proc_macro_untracked(&self, def_id: DefId) -> bool {
+        self.get_crate_data(def_id.krate).is_proc_macro(def_id.index)
+    }
+
     pub fn export_macros_untracked(&self, cnum: CrateNum) {
         let data = self.get_crate_data(cnum);
         let mut dep_kind = data.dep_kind.lock();
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 4bafe16b8e66d..e85cfc8a85054 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -470,7 +470,7 @@ crate fn proc_macro_def_path_table(crate_root: &CrateRoot<'_>,
 }
 
 impl<'a, 'tcx> CrateMetadata {
-    fn is_proc_macro(&self, id: DefIndex) -> bool {
+    crate fn is_proc_macro(&self, id: DefIndex) -> bool {
         self.proc_macros.is_some() && id != CRATE_DEF_INDEX
     }
 
@@ -665,7 +665,10 @@ impl<'a, 'tcx> CrateMetadata {
     pub fn get_deprecation(&self, id: DefIndex) -> Option<attr::Deprecation> {
         match self.is_proc_macro(id) {
             true => None,
-            false => self.entry(id).deprecation.map(|depr| depr.decode(self)),
+            // Deprecation may be queried for built-in macro imports
+            // for which the entry doesn't exist.
+            false => self.maybe_entry(id).and_then(|e| e.decode(self).deprecation)
+                                         .map(|depr| depr.decode(self)),
         }
     }
 
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 6d0b142fb2409..e03f36f0c673b 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -14,6 +14,7 @@ use crate::{resolve_error, resolve_struct_error, ResolutionError};
 use rustc::bug;
 use rustc::hir::def::{self, *};
 use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
+use rustc::hir::map::definitions::FIRST_FREE_DEF_INDEX;
 use rustc::ty;
 use rustc::middle::cstore::CrateStore;
 use rustc_metadata::cstore::LoadedMacro;
@@ -757,11 +758,25 @@ impl<'a> Resolver<'a> {
         module
     }
 
+    crate fn is_builtin_macro(&self, def_id: DefId) -> bool {
+        // Built-in macros are supposed to occupy a continuous range of `DefIndex`es immediately
+        // following `GlobalMetaData` entries. This is ensured by calling
+        // `syntax_ext::register_builtins` immediately after initializing `Definitions`.
+        // This range is identical in both the local crate and other crates in cstore.
+        // Proc-macro "views" of other crates in cstore don't have this range, thus the last
+        // condition.
+        let index_match = def_id.index.index() < FIRST_FREE_DEF_INDEX + self.num_builtin_macros;
+        let crate_match = def_id.is_local() ||
+                          def_id.krate != CrateNum::LegacyProcMacros &&
+                          !self.cstore.is_proc_macro_untracked(def_id);
+        index_match && crate_match
+    }
+
     pub fn macro_def_scope(&mut self, expansion: Mark) -> Module<'a> {
         let def_id = self.macro_defs[&expansion];
         if let Some(id) = self.definitions.as_local_node_id(def_id) {
             self.local_macro_def_scopes[&id]
-        } else if def_id.krate == CrateNum::BuiltinMacros {
+        } else if self.is_builtin_macro(def_id) || def_id.krate == CrateNum::LegacyProcMacros {
             self.injected_crate.unwrap_or(self.graph_root)
         } else {
             let module_def_id = ty::DefIdTree::parent(&*self, def_id).unwrap();
@@ -777,6 +792,15 @@ impl<'a> Resolver<'a> {
             }),
             _ => panic!("expected `DefKind::Macro` or `Res::NonMacroAttr`"),
         };
+
+        // Built-in macro from another crate is the same as its local equivalent,
+        // which always can be found in the `macro_map`.
+        let def_id = if self.is_builtin_macro(def_id) {
+            DefId::local(def_id.index)
+        } else {
+            def_id
+        };
+
         if let Some(ext) = self.macro_map.get(&def_id) {
             return ext.clone();
         }
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index fec7bf3b273ee..f9ab26ccd6c69 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -1670,6 +1670,8 @@ pub struct Resolver<'a> {
     crate_loader: &'a mut CrateLoader<'a>,
     macro_names: FxHashSet<Ident>,
     builtin_macros: FxHashMap<Name, &'a NameBinding<'a>>,
+    /// Number of built-in macros excluding user extensions from `#![plugin]`.
+    num_builtin_macros: usize,
     macro_use_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
     pub all_macros: FxHashMap<Name, Res>,
     macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
@@ -2016,6 +2018,7 @@ impl<'a> Resolver<'a> {
             crate_loader,
             macro_names: FxHashSet::default(),
             builtin_macros: FxHashMap::default(),
+            num_builtin_macros: 0,
             macro_use_prelude: FxHashMap::default(),
             all_macros: FxHashMap::default(),
             macro_map: FxHashMap::default(),
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 2369bddf4f75f..c435bf900641f 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -8,7 +8,7 @@ use crate::build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport};
 use crate::resolve_imports::ImportResolver;
 use rustc::hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX};
 use rustc::hir::def::{self, DefKind, NonMacroAttrKind};
-use rustc::hir::map::{self, DefCollector};
+use rustc::hir::map::{self, DefCollector, DefPathData};
 use rustc::{ty, lint};
 use rustc::{bug, span_bug};
 use syntax::ast::{self, Ident};
@@ -169,10 +169,21 @@ impl<'a> base::Resolver for Resolver<'a> {
         invocation.output_legacy_scope.set(Some(visitor.current_legacy_scope));
     }
 
-    fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>) {
-        let def_id = DefId {
-            krate: CrateNum::BuiltinMacros,
-            index: DefIndex::from(self.macro_map.len()),
+    fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>, is_user_ext: bool) {
+        let def_id = if is_user_ext {
+            DefId {
+                krate: CrateNum::LegacyProcMacros,
+                index: DefIndex::from(self.macro_map.len()),
+            }
+        } else {
+            self.num_builtin_macros += 1;
+            DefId::local(self.definitions.create_def_with_parent(
+                CRATE_DEF_INDEX,
+                ast::DUMMY_NODE_ID,
+                DefPathData::MacroNs(ident.as_interned_str()),
+                Mark::root(),
+                DUMMY_SP,
+            ))
         };
         let kind = ext.kind();
         self.macro_map.insert(def_id, ext);
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index d24d8f8c2b5b1..fdbfcf15ef8e6 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -29,6 +29,7 @@ use rustc::{bug, span_bug};
 use syntax::ast::{self, Ident, Name, NodeId, CRATE_NODE_ID};
 use syntax::ext::base::Determinacy::{self, Determined, Undetermined};
 use syntax::ext::hygiene::Mark;
+use syntax::feature_gate::{emit_feature_err, GateIssue};
 use syntax::symbol::{kw, sym};
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax::{struct_span_err, unwrap_or};
@@ -1226,12 +1227,22 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
         self.per_ns(|this, ns| if let Some(binding) = source_bindings[ns].get().ok() {
             let mut res = binding.res();
             if let Res::Def(DefKind::Macro(_), def_id) = res {
-                // `DefId`s from the "built-in macro crate" should not leak from resolve because
+                // `DefId`s from the "legacy proc macro crate" should not leak from resolve because
                 // later stages are not ready to deal with them and produce lots of ICEs. Replace
-                // them with `Res::Err` until some saner scheme is implemented for built-in macros.
-                if def_id.krate == CrateNum::BuiltinMacros {
+                // them with `Res::Err` until legacy proc macros are removed.
+                if def_id.krate == CrateNum::LegacyProcMacros {
                     this.session.span_err(directive.span, "cannot import a built-in macro");
                     res = Res::Err;
+                } else if this.is_builtin_macro(def_id) {
+                    if !this.session.features_untracked().builtin_macro_imports {
+                        emit_feature_err(
+                            &this.session.parse_sess,
+                            sym::builtin_macro_imports,
+                            directive.span,
+                            GateIssue::Language,
+                            "imports of built-in macros are unstable",
+                        );
+                    }
                 }
             }
             this.import_res_map.entry(directive.id).or_default()[ns] = Some(res);
@@ -1398,7 +1409,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
                 let res = binding.res();
                 if res != Res::Err {
                     if let Some(def_id) = res.opt_def_id() {
-                        if !def_id.is_local() && def_id.krate != CrateNum::BuiltinMacros {
+                        if !def_id.is_local() && def_id.krate != CrateNum::LegacyProcMacros {
                             self.cstore.export_macros_untracked(def_id.krate);
                         }
                     }
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 38b7dee40c447..5fd3c06c9127e 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -674,7 +674,7 @@ pub trait Resolver {
     fn resolve_dollar_crates(&mut self, fragment: &AstFragment);
     fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFragment,
                                             derives: &[Mark]);
-    fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>);
+    fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>, is_user_ext: bool);
 
     fn resolve_imports(&mut self);
 
@@ -699,31 +699,6 @@ impl Determinacy {
     }
 }
 
-pub struct DummyResolver;
-
-impl Resolver for DummyResolver {
-    fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID }
-
-    fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() }
-
-    fn resolve_dollar_crates(&mut self, _fragment: &AstFragment) {}
-    fn visit_ast_fragment_with_placeholders(&mut self, _invoc: Mark, _fragment: &AstFragment,
-                                            _derives: &[Mark]) {}
-    fn add_builtin(&mut self, _ident: ast::Ident, _ext: Lrc<SyntaxExtension>) {}
-
-    fn resolve_imports(&mut self) {}
-    fn resolve_macro_invocation(&mut self, _invoc: &Invocation, _invoc_id: Mark, _force: bool)
-                                -> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
-        Err(Determinacy::Determined)
-    }
-    fn resolve_macro_path(&mut self, _path: &ast::Path, _kind: MacroKind, _invoc_id: Mark,
-                          _derives_in_scope: Vec<ast::Path>, _force: bool)
-                          -> Result<Lrc<SyntaxExtension>, Determinacy> {
-        Err(Determinacy::Determined)
-    }
-    fn check_unused_macros(&self) {}
-}
-
 #[derive(Clone)]
 pub struct ModuleData {
     pub mod_path: Vec<ast::Ident>,
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 004323301a22a..ec9a6a189ce3a 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -570,6 +570,9 @@ declare_features! (
     // #[repr(transparent)] on unions.
     (active, transparent_unions, "1.37.0", Some(60405), None),
 
+    // `use builtin_macro`.
+    (active, builtin_macro_imports, "1.37.0", Some(61875), None),
+
     // -------------------------------------------------------------------------
     // feature-group-end: actual feature gates
     // -------------------------------------------------------------------------
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs
index cf54eacc3d46c..aa46d90ae5ac8 100644
--- a/src/libsyntax_ext/deriving/mod.rs
+++ b/src/libsyntax_ext/deriving/mod.rs
@@ -71,7 +71,8 @@ macro_rules! derive_traits {
             $(
                 resolver.add_builtin(
                     ast::Ident::with_empty_ctxt(Symbol::intern($name)),
-                    Lrc::new(SyntaxExtension::LegacyDerive(Box::new(BuiltinDerive($func))))
+                    Lrc::new(SyntaxExtension::LegacyDerive(Box::new(BuiltinDerive($func)))),
+                    false,
                 );
             )*
         }
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index 3dd17207cb8e9..8ef1976f2f6ad 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -53,8 +53,11 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
                          edition: Edition) {
     deriving::register_builtin_derives(resolver);
 
+    let mut register_user = |name, ext, is_user_ext| {
+        resolver.add_builtin(ast::Ident::with_empty_ctxt(name), Lrc::new(ext), is_user_ext);
+    };
     let mut register = |name, ext| {
-        resolver.add_builtin(ast::Ident::with_empty_ctxt(name), Lrc::new(ext));
+        register_user(name, ext, false);
     };
     macro_rules! register {
         ($( $name:ident: $f:expr, )*) => { $(
@@ -126,6 +129,6 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
              });
 
     for (name, ext) in user_exts {
-        register(name, ext);
+        register_user(name, ext, true);
     }
 }
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 9ca64a1231f08..20b34a7ea2850 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -162,6 +162,7 @@ symbols! {
         box_patterns,
         box_syntax,
         braced_empty_structs,
+        builtin_macro_imports,
         C,
         cdylib,
         cfg,
diff --git a/src/test/mir-opt/graphviz.rs b/src/test/mir-opt/graphviz.rs
index 67a6d1d263bf5..3bdc5011a745e 100644
--- a/src/test/mir-opt/graphviz.rs
+++ b/src/test/mir-opt/graphviz.rs
@@ -7,7 +7,7 @@ fn main() {}
 
 // END RUST SOURCE
 // START rustc.main.mir_map.0.dot
-// digraph Mir_0_12 { // The name here MUST be an ASCII identifier.
+// digraph Mir_0_52 { // The name here MUST be an ASCII identifier.
 //     graph [fontname="monospace"];
 //     node [fontname="monospace"];
 //     edge [fontname="monospace"];
diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs
index 0e1db68f37255..d47de64879451 100644
--- a/src/test/mir-opt/inline-closure-borrows-arg.rs
+++ b/src/test/mir-opt/inline-closure-borrows-arg.rs
@@ -20,7 +20,7 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
 // ...
 // bb0: {
 //     ...
-//     _3 = [closure@HirId { owner: DefIndex(13), local_id: 31 }];
+//     _3 = [closure@HirId { owner: DefIndex(53), local_id: 31 }];
 //     ...
 //     _4 = &_3;
 //     ...
diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs
index fa8557f3b38a7..f7558a1365cff 100644
--- a/src/test/mir-opt/inline-closure.rs
+++ b/src/test/mir-opt/inline-closure.rs
@@ -16,7 +16,7 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
 // ...
 // bb0: {
 //     ...
-//     _3 = [closure@HirId { owner: DefIndex(13), local_id: 15 }];
+//     _3 = [closure@HirId { owner: DefIndex(53), local_id: 15 }];
 //     ...
 //     _4 = &_3;
 //     ...
diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs
index 33ee0fe61b288..34454830d7113 100644
--- a/src/test/mir-opt/retag.rs
+++ b/src/test/mir-opt/retag.rs
@@ -98,7 +98,7 @@ fn main() {
 // }
 // END rustc.main.EraseRegions.after.mir
 // START rustc.main-{{closure}}.EraseRegions.after.mir
-// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(20), local_id: 72 }], _2: &i32) -> &i32 {
+// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(60), local_id: 72 }], _2: &i32) -> &i32 {
 //     ...
 //     bb0: {
 //         Retag([fn entry] _1);
diff --git a/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs
index 039124f31ff42..b5aa6e00e31dd 100644
--- a/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs
+++ b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs
@@ -3,19 +3,25 @@
 #![feature(plugin_registrar)]
 #![feature(rustc_private)]
 
-extern crate syntax;
-
-extern crate rustc;
 extern crate rustc_plugin;
+extern crate syntax_pos;
+extern crate syntax;
 
-use syntax::symbol::Symbol;
-use syntax::feature_gate::AttributeType;
 use rustc_plugin::Registry;
+use syntax_pos::Span;
+use syntax::ext::base::{ExtCtxt, MacResult, MacEager};
+use syntax::feature_gate::AttributeType;
+use syntax::symbol::Symbol;
+use syntax::tokenstream::TokenTree;
 
+fn empty(_: &mut ExtCtxt, _: Span, _: &[TokenTree]) -> Box<dyn MacResult + 'static> {
+    MacEager::items(Default::default())
+}
 
 #[plugin_registrar]
 pub fn plugin_registrar(reg: &mut Registry) {
     reg.register_attribute(Symbol::intern("foo"), AttributeType::Normal);
     reg.register_attribute(Symbol::intern("bar"), AttributeType::CrateLevel);
     reg.register_attribute(Symbol::intern("baz"), AttributeType::Whitelisted);
+    reg.register_macro("empty", empty);
 }
diff --git a/src/test/ui-fulldeps/plugin-import.rs b/src/test/ui-fulldeps/plugin-import.rs
new file mode 100644
index 0000000000000..b8db1cb7e7163
--- /dev/null
+++ b/src/test/ui-fulldeps/plugin-import.rs
@@ -0,0 +1,10 @@
+// edition:2018
+// ignore-stage1
+// aux-build:attr-plugin-test.rs
+
+#![feature(plugin)]
+#![plugin(attr_plugin_test)]
+
+use empty as full; //~ ERROR cannot import a built-in macro
+
+fn main() {}
diff --git a/src/test/ui-fulldeps/plugin-import.stderr b/src/test/ui-fulldeps/plugin-import.stderr
new file mode 100644
index 0000000000000..23e1253a3b5f6
--- /dev/null
+++ b/src/test/ui-fulldeps/plugin-import.stderr
@@ -0,0 +1,8 @@
+error: cannot import a built-in macro
+  --> $DIR/plugin-import.rs:8:5
+   |
+LL | use empty as full;
+   |     ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
index cc5ffca10475e..7ca6e4cc0aa94 100644
--- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
@@ -4,7 +4,7 @@ note: No external requirements
 LL |         let mut closure = expect_sig(|p, y| *p = y);
    |                                      ^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:13 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:53 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) i32)),
            ]
@@ -30,7 +30,7 @@ LL | |     deref(p);
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:12 ~ escape_argument_callee[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:52 ~ escape_argument_callee[317d]::test[0]) with substs []
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr
index fdf95b8acebfc..3404bffca449e 100644
--- a/src/test/ui/nll/closure-requirements/escape-argument.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr
@@ -4,7 +4,7 @@ note: No external requirements
 LL |         let mut closure = expect_sig(|p, y| *p = y);
    |                                      ^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:13 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:53 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)),
            ]
@@ -21,7 +21,7 @@ LL | |     deref(p);
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:12 ~ escape_argument[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:52 ~ escape_argument[317d]::test[0]) with substs []
 
 error[E0597]: `y` does not live long enough
   --> $DIR/escape-argument.rs:27:25
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
index 186f25a3c89db..589e4fabaf8bd 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |             let mut closure1 = || p = &y;
    |                                ^^^^^^^^^
    |
-   = note: defining type: DefId(0:14 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:54 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
                i16,
                extern "rust-call" fn(()),
                &'_#1r i32,
@@ -23,7 +23,7 @@ LL | |             closure1();
 LL | |         };
    | |_________^
    |
-   = note: defining type: DefId(0:13 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:53 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                extern "rust-call" fn(()),
                &'_#1r i32,
@@ -44,7 +44,7 @@ LL | |     deref(p);
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:12 ~ escape_upvar_nested[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:52 ~ escape_upvar_nested[317d]::test[0]) with substs []
 
 error[E0597]: `y` does not live long enough
   --> $DIR/escape-upvar-nested.rs:21:40
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
index 0df2c0f69a71b..71479be3835fc 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |         let mut closure = || p = &y;
    |                           ^^^^^^^^^
    |
-   = note: defining type: DefId(0:13 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:53 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                extern "rust-call" fn(()),
                &'_#1r i32,
@@ -25,7 +25,7 @@ LL | |     deref(p);
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:12 ~ escape_upvar_ref[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:52 ~ escape_upvar_ref[317d]::test[0]) with substs []
 
 error[E0597]: `y` does not live long enough
   --> $DIR/escape-upvar-ref.rs:23:35
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
index 8916fdcfc88f1..c1a49ec22a96d 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
@@ -8,7 +8,7 @@ LL | |             demand_y(x, y, p)
 LL | |         },
    | |_________^
    |
-   = note: defining type: DefId(0:27 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:67 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
            ]
@@ -39,7 +39,7 @@ LL | |     );
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:23 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:63 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr
index fa8384311ea57..f484b930e3e69 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr
@@ -9,7 +9,7 @@ LL | |
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
            ]
@@ -30,7 +30,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
 
 error: lifetime may not live long enough
   --> $DIR/propagate-approximated-ref.rs:45:9
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
index cfaa75b8ef861..06947d2723101 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
@@ -8,7 +8,7 @@ LL | |
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:18 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:58 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
                i32,
                for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
            ]
@@ -35,7 +35,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:17 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
+   = note: defining type: DefId(0:57 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
 
 note: External requirements
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
@@ -46,7 +46,7 @@ LL | |         cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:20 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:60 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
                i32,
                for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
            ]
@@ -65,7 +65,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:19 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
+   = note: defining type: DefId(0:59 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
 
 error[E0597]: `a` does not live long enough
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
index 601b3577e0eec..aa6a28bc19ca1 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
@@ -10,7 +10,7 @@ LL | |         demand_y(x, y, x.get())
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) u32>)),
            ]
@@ -31,7 +31,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
 
 error[E0521]: borrowed data escapes outside of function
   --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
index 5b5440e7a9641..485d9a00a43c3 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
@@ -10,7 +10,7 @@ LL | |         demand_y(x, y, x.get())
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
            ]
@@ -31,7 +31,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
 
 error[E0521]: borrowed data escapes outside of function
   --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr
index a08cde2c9c635..db5dfe4aac709 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr
@@ -9,7 +9,7 @@ LL | |
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
            ]
@@ -30,7 +30,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_approximated_val[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_approximated_val[317d]::test[0]) with substs []
 
 error: lifetime may not live long enough
   --> $DIR/propagate-approximated-val.rs:38:9
diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
index 60847bb2e9290..658f20c0bf55c 100644
--- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
@@ -8,7 +8,7 @@ LL | |             demand_y(x, y, p)
 LL | |         },
    | |_________^
    |
-   = note: defining type: DefId(0:23 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:63 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
            ]
@@ -28,5 +28,5 @@ LL | |     );
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:21 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:61 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []
 
diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
index a660c763bff78..6d23a0820bea5 100644
--- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
@@ -9,7 +9,7 @@ LL | |
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
            ]
@@ -39,7 +39,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
index 9671b8ebff3a4..62bbd99216047 100644
--- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
@@ -9,7 +9,7 @@ LL | |
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:65 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
            ]
@@ -39,7 +39,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
+   = note: defining type: DefId(0:62 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr
index 457b5950b7ff0..8feb8f411dcb8 100644
--- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr
@@ -11,7 +11,7 @@ LL | |         require(value);
 LL | |     });
    | |_____^
    |
-   = note: defining type: DefId(0:23 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:63 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -32,7 +32,7 @@ LL | |     });
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:20 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
+   = note: defining type: DefId(0:60 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
                '_#1r,
                T,
            ]
diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
index 8aff6d5b89279..fb683f1dc002c 100644
--- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
+++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -4,7 +4,7 @@ note: No external requirements
 LL |     expect_sig(|a, b| b); // ought to return `a`
    |                ^^^^^^^^
    |
-   = note: defining type: DefId(0:13 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:53 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
                i16,
                for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32,
            ]
@@ -27,7 +27,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:12 ~ return_wrong_bound_region[317d]::test[0]) with substs []
+   = note: defining type: DefId(0:52 ~ return_wrong_bound_region[317d]::test[0]) with substs []
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
index 9fa54e83812f7..4cfa1ce64e07d 100644
--- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:62 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -25,7 +25,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:19 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
+   = note: defining type: DefId(0:59 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
                '_#1r,
                T,
            ]
@@ -44,7 +44,7 @@ note: External requirements
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:26 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:66 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -64,7 +64,7 @@ LL | |     with_signature(x, |mut y| Box::new(y.next()))
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:23 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
+   = note: defining type: DefId(0:63 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
                '_#1r,
                T,
            ]
@@ -75,7 +75,7 @@ note: External requirements
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:31 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:71 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -97,7 +97,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:27 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
+   = note: defining type: DefId(0:67 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -117,7 +117,7 @@ note: External requirements
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:36 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:76 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -139,7 +139,7 @@ LL | |     with_signature(x, |mut y| Box::new(y.next()))
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:32 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
+   = note: defining type: DefId(0:72 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
                '_#1r,
                '_#2r,
                T,
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
index 10b2bd1af4702..1d3afa8c4811e 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:28 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:68 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -27,7 +27,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [
+   = note: defining type: DefId(0:64 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [
                '_#1r,
                T,
            ]
@@ -38,7 +38,7 @@ error[E0309]: the parameter type `T` may not live long enough
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(25), 'a))`...
+   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:64 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(65), 'a))`...
 
 error: lifetime may not live long enough
   --> $DIR/projection-one-region-closure.rs:45:39
@@ -57,7 +57,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:33 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:73 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -80,7 +80,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:29 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
+   = note: defining type: DefId(0:69 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -111,7 +111,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:38 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:78 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -133,7 +133,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:34 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [
+   = note: defining type: DefId(0:74 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -145,7 +145,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:43 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:83 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -168,7 +168,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:39 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
+   = note: defining type: DefId(0:79 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
                '_#1r,
                '_#2r,
                T,
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
index b4b74bfc1284f..633f45d915e8f 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:68 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -26,7 +26,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
+   = note: defining type: DefId(0:64 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
                '_#1r,
                T,
            ]
@@ -48,7 +48,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:73 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -70,7 +70,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
+   = note: defining type: DefId(0:69 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -93,7 +93,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:78 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -115,7 +115,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
+   = note: defining type: DefId(0:74 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -127,7 +127,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:83 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -149,7 +149,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [
+   = note: defining type: DefId(0:79 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -161,7 +161,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:87 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -182,7 +182,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
+   = note: defining type: DefId(0:84 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
                '_#1r,
                T,
            ]
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
index a757a43499f4b..a5959309bbb54 100644
--- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
@@ -4,7 +4,7 @@ note: No external requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:68 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -23,7 +23,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [
+   = note: defining type: DefId(0:64 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [
                '_#1r,
                T,
            ]
@@ -34,7 +34,7 @@ note: No external requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:73 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -54,7 +54,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [
+   = note: defining type: DefId(0:69 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -66,7 +66,7 @@ note: No external requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:78 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -86,7 +86,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [
+   = note: defining type: DefId(0:74 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -98,7 +98,7 @@ note: No external requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:83 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -118,7 +118,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [
+   = note: defining type: DefId(0:79 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -130,7 +130,7 @@ note: No external requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:87 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -149,7 +149,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
+   = note: defining type: DefId(0:84 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
                '_#1r,
                T,
            ]
diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index a48766cd7340b..a98614f242b2c 100644
--- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:31 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:71 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -27,7 +27,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
+   = note: defining type: DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -39,7 +39,7 @@ error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(27), 'a))`...
+   = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(67), 'a))`...
 
 note: External requirements
   --> $DIR/projection-two-region-trait-bound-closure.rs:48:29
@@ -47,7 +47,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:37 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:77 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -70,7 +70,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:32 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
+   = note: defining type: DefId(0:72 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -91,7 +91,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:43 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:83 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -114,7 +114,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:38 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
+   = note: defining type: DefId(0:78 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -127,7 +127,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:49 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:89 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -150,7 +150,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:44 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [
+   = note: defining type: DefId(0:84 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -163,7 +163,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:55 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:95 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -186,7 +186,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:50 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [
+   = note: defining type: DefId(0:90 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [
                '_#1r,
                '_#2r,
                '_#3r,
@@ -199,7 +199,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:60 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:100 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -221,7 +221,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [
+   = note: defining type: DefId(0:96 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [
                '_#1r,
                T,
            ]
@@ -243,7 +243,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:65 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:105 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -265,7 +265,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:61 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [
+   = note: defining type: DefId(0:101 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [
                '_#1r,
                '_#2r,
                T,
@@ -277,7 +277,7 @@ note: External requirements
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:69 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:109 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -298,7 +298,7 @@ LL | |     with_signature(cell, t, |cell, t| require(cell, t));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
+   = note: defining type: DefId(0:106 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
                '_#1r,
                T,
            ]
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
index 2ed94df1f3478..e879044902895 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:20 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:60 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
                T,
                i16,
                for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@@ -21,7 +21,7 @@ LL | |     twice(cell, value, |a, b| invoke(a, b));
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:18 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
+   = note: defining type: DefId(0:58 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
                T,
            ]
 
@@ -31,7 +31,7 @@ note: External requirements
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
    |
-   = note: defining type: DefId(0:24 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:64 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
                T,
                i16,
                for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@@ -49,7 +49,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [
+   = note: defining type: DefId(0:61 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [
                T,
            ]
 
@@ -59,7 +59,7 @@ error[E0309]: the parameter type `T` may not live long enough
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                        ^^^^^^^^^^^^^^^^^^^
    |
-   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(22), 'a))`...
+   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:61 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(62), 'a))`...
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
index d689949969d7e..79661764d3073 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
@@ -4,7 +4,7 @@ note: External requirements
 LL |     with_signature(x, |y| y)
    |                       ^^^^^
    |
-   = note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:60 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -25,7 +25,7 @@ LL | |
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:17 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
+   = note: defining type: DefId(0:57 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
                '_#1r,
                T,
            ]
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
index 11444c9f72bef..6b1ba1252ab4d 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
@@ -11,7 +11,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:63 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [
                T,
                i32,
                extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)),
@@ -32,7 +32,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [
+   = note: defining type: DefId(0:60 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [
                T,
            ]
 
@@ -49,7 +49,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(21), 'a))`...
+   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:60 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(61), 'a))`...
 
 note: External requirements
   --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26
@@ -64,7 +64,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:27 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:67 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -85,7 +85,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:24 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [
+   = note: defining type: DefId(0:64 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [
                '_#1r,
                T,
            ]
@@ -101,7 +101,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:32 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:72 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                T,
                i32,
@@ -123,7 +123,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [
+   = note: defining type: DefId(0:68 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [
                '_#1r,
                T,
            ]
@@ -139,7 +139,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(29), 'a))`...
+   = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:68 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(69), 'a))`...
 
 note: External requirements
   --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26
@@ -151,7 +151,7 @@ LL | |         require(&x, &y)
 LL | |     })
    | |_____^
    |
-   = note: defining type: DefId(0:37 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
+   = note: defining type: DefId(0:77 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
                '_#1r,
                '_#2r,
                T,
@@ -173,7 +173,7 @@ LL | |     })
 LL | | }
    | |_^
    |
-   = note: defining type: DefId(0:33 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
+   = note: defining type: DefId(0:73 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
                '_#1r,
                '_#2r,
                T,
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
index dd21de75aaf75..9b07d6c2c8915 100644
--- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
@@ -1,9 +1,11 @@
 // edition:2018
 
+#![feature(builtin_macro_imports)]
+
 // Tests that arbitrary crates (other than `core`, `std` and `meta`)
 // aren't allowed without `--extern`, even if they're in the sysroot.
 use alloc; //~ ERROR unresolved import `alloc`
-use test; //~ ERROR cannot import a built-in macro
+use test; // OK, imports the built-in attribute macro `test`
 use proc_macro; // OK, imports the built-in `proc_macro` attribute, but not the `proc_macro` crate.
 
 fn main() {}
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
index 4e3fff98e6f4b..a06f24d9b1ba7 100644
--- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
@@ -1,15 +1,9 @@
-error: cannot import a built-in macro
-  --> $DIR/not-whitelisted.rs:6:5
-   |
-LL | use test;
-   |     ^^^^
-
 error[E0432]: unresolved import `alloc`
-  --> $DIR/not-whitelisted.rs:5:5
+  --> $DIR/not-whitelisted.rs:7:5
    |
 LL | use alloc;
    |     ^^^^^ no `alloc` external crate
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/rust-2018/uniform-paths/auxiliary/export-builtin-macros.rs b/src/test/ui/rust-2018/uniform-paths/auxiliary/export-builtin-macros.rs
new file mode 100644
index 0000000000000..32bff1b2104e9
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/auxiliary/export-builtin-macros.rs
@@ -0,0 +1,5 @@
+// edition:2018
+
+#![feature(builtin_macro_imports)]
+
+pub use concat as my_concat;
diff --git a/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.rs b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.rs
new file mode 100644
index 0000000000000..4af9cccffc19b
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.rs
@@ -0,0 +1,19 @@
+// edition:2018
+// aux-build:export-builtin-macros.rs
+
+#![feature(builtin_macro_imports)]
+
+extern crate export_builtin_macros;
+
+mod local {
+    pub use concat as my_concat;
+}
+
+use export_builtin_macros::*;
+use local::*;
+
+fn main() {
+    // `concat`s imported from different crates should ideally have the same `DefId`
+    // and not conflict with each other, but that's not the case right now.
+    my_concat!("x"); //~ ERROR `my_concat` is ambiguous
+}
diff --git a/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.stderr b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.stderr
new file mode 100644
index 0000000000000..fcf0d21ed9b3b
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.stderr
@@ -0,0 +1,22 @@
+error[E0659]: `my_concat` is ambiguous (glob import vs glob import in the same module)
+  --> $DIR/import-builtin-macros-bug.rs:18:5
+   |
+LL |     my_concat!("x");
+   |     ^^^^^^^^^ ambiguous name
+   |
+note: `my_concat` could refer to the macro imported here
+  --> $DIR/import-builtin-macros-bug.rs:12:5
+   |
+LL | use export_builtin_macros::*;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: consider adding an explicit import of `my_concat` to disambiguate
+note: `my_concat` could also refer to the macro imported here
+  --> $DIR/import-builtin-macros-bug.rs:13:5
+   |
+LL | use local::*;
+   |     ^^^^^^^^
+   = help: consider adding an explicit import of `my_concat` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.rs b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.rs
new file mode 100644
index 0000000000000..1d12a80d90ef1
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.rs
@@ -0,0 +1,10 @@
+// FIXME: Individual imports of built-in macros are not stability checked right now,
+// so the whole feature is gated instead.
+
+// edition:2018
+// gate-test-builtin_macro_imports
+
+use concat as stable; //~ ERROR imports of built-in macros are unstable
+use concat_idents as unstable; //~ ERROR imports of built-in macros are unstable
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.stderr b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.stderr
new file mode 100644
index 0000000000000..80d69890b1823
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros-stability.stderr
@@ -0,0 +1,21 @@
+error[E0658]: imports of built-in macros are unstable
+  --> $DIR/import-builtin-macros-stability.rs:7:5
+   |
+LL | use concat as stable;
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/61875
+   = help: add #![feature(builtin_macro_imports)] to the crate attributes to enable
+
+error[E0658]: imports of built-in macros are unstable
+  --> $DIR/import-builtin-macros-stability.rs:8:5
+   |
+LL | use concat_idents as unstable;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/61875
+   = help: add #![feature(builtin_macro_imports)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/rust-2018/uniform-paths/import-builtin-macros.rs b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros.rs
new file mode 100644
index 0000000000000..20bfcc360da9c
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/import-builtin-macros.rs
@@ -0,0 +1,20 @@
+// compile-pass
+// edition:2018
+// aux-build:export-builtin-macros.rs
+
+#![feature(builtin_macro_imports)]
+
+extern crate export_builtin_macros;
+
+mod local {
+    pub use concat as my_concat;
+}
+
+mod xcrate {
+    pub use export_builtin_macros::my_concat;
+}
+
+fn main() {
+    assert_eq!(local::my_concat!("a", "b"), "ab");
+    assert_eq!(xcrate::my_concat!("a", "b"), "ab");
+}
diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
index d717884c901b3..48c33d720dcad 100644
--- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
+++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
@@ -1,11 +1,6 @@
 // edition:2018
 
-// Built-in macro
-use env as env_imported; //~ ERROR cannot import a built-in macro
-
 // Tool attribute
 use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt`
 
-fn main() {
-    env_imported!("PATH");
-}
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
index 42daf7c6fb12f..97d4c736751aa 100644
--- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
+++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
@@ -1,15 +1,9 @@
-error: cannot import a built-in macro
-  --> $DIR/prelude-fail.rs:4:5
-   |
-LL | use env as env_imported;
-   |     ^^^^^^^^^^^^^^^^^^^
-
 error[E0432]: unresolved import `rustfmt`
-  --> $DIR/prelude-fail.rs:7:5
+  --> $DIR/prelude-fail.rs:4:5
    |
 LL | use rustfmt::skip as imported_rustfmt_skip;
    |     ^^^^^^^ `rustfmt` is a tool module, not a module
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/rust-2018/uniform-paths/prelude.rs b/src/test/ui/rust-2018/uniform-paths/prelude.rs
index 9a326b4c728bd..4ed6981e26494 100644
--- a/src/test/ui/rust-2018/uniform-paths/prelude.rs
+++ b/src/test/ui/rust-2018/uniform-paths/prelude.rs
@@ -1,6 +1,8 @@
 // compile-pass
 // edition:2018
 
+#![feature(builtin_macro_imports)]
+
 // Macro imported with `#[macro_use] extern crate`
 use vec as imported_vec;
 
@@ -10,9 +12,13 @@ use Vec as ImportedVec;
 // Built-in type
 use u8 as imported_u8;
 
+// Built-in macro
+use env as env_imported;
+
 type A = imported_u8;
 
 fn main() {
     imported_vec![0];
     ImportedVec::<u8>::new();
+    env_imported!("PATH");
 }