about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-12-16 20:23:27 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-12-27 15:51:36 +0300
commitfff01ccfa805ccef67827bf1ea84e21d61d13e6f (patch)
tree9ef9748b8f3257c362077a8b3a6c421ae851d020 /src
parenta5c52c72ae3c1d8b3896756541b115a1d5ea94b7 (diff)
downloadrust-fff01ccfa805ccef67827bf1ea84e21d61d13e6f.tar.gz
rust-fff01ccfa805ccef67827bf1ea84e21d61d13e6f.zip
Do not abort compilation if expansion produces errors
Fix a number of uncovered deficiencies in diagnostics
Diffstat (limited to 'src')
-rw-r--r--src/librustc_driver/driver.rs10
-rw-r--r--src/librustc_passes/ast_validation.rs30
-rw-r--r--src/librustc_resolve/lib.rs7
-rw-r--r--src/librustc_resolve/macros.rs31
-rw-r--r--src/libsyntax/ext/base.rs9
-rw-r--r--src/libsyntax/ext/expand.rs16
-rw-r--r--src/libsyntax/feature_gate.rs19
-rw-r--r--src/libsyntax_ext/deriving/default.rs4
-rw-r--r--src/libsyntax_ext/format.rs4
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs2
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs2
-rw-r--r--src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs2
-rw-r--r--src/test/ui/derives/derive-on-trait-item-or-impl-item.rs2
-rw-r--r--src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr1
-rw-r--r--src/test/ui/did_you_mean/issue-40396.rs19
-rw-r--r--src/test/ui/did_you_mean/issue-40396.stderr87
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2015-parsing.rs6
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr1
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2018-expansion.rs2
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2018-parsing.rs6
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr1
-rw-r--r--src/test/ui/editions/edition-keywords-2018-2018-expansion.rs2
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs2
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-derive.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-macros_in_extern.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-rustc-attrs.rs4
-rw-r--r--src/test/ui/issues/issue-10536.rs7
-rw-r--r--src/test/ui/issues/issue-10536.stderr25
-rw-r--r--src/test/ui/issues/issue-11692-1.rs1
-rw-r--r--src/test/ui/issues/issue-11692-1.stderr8
-rw-r--r--src/test/ui/issues/issue-11692-2.rs1
-rw-r--r--src/test/ui/issues/issue-11692-2.stderr10
-rw-r--r--src/test/ui/issues/issue-32950.rs1
-rw-r--r--src/test/ui/issues/issue-32950.stderr9
-rw-r--r--src/test/ui/issues/issue-33571.rs2
-rw-r--r--src/test/ui/issues/issue-35677.rs2
-rw-r--r--src/test/ui/issues/issue-35677.stderr9
-rw-r--r--src/test/ui/issues/issue-36617.rs2
-rw-r--r--src/test/ui/issues/issue-43023.rs2
-rw-r--r--src/test/ui/issues/issue-46438.rs2
-rw-r--r--src/test/ui/issues/issue-49074.rs2
-rw-r--r--src/test/ui/issues/issue-49074.stderr10
-rw-r--r--src/test/ui/issues/issue-51279.rs1
-rw-r--r--src/test/ui/issues/issue-51279.stderr11
-rw-r--r--src/test/ui/issues/issue-55796.rs2
-rw-r--r--src/test/ui/issues/issue-55796.stderr9
-rw-r--r--src/test/ui/issues/issue-6596-1.rs1
-rw-r--r--src/test/ui/issues/issue-6596-1.stderr12
-rw-r--r--src/test/ui/issues/issue-6596-2.rs1
-rw-r--r--src/test/ui/macro_backtrace/main.rs2
-rw-r--r--src/test/ui/macros/macro-comma-behavior.core.stderr8
-rw-r--r--src/test/ui/malformed/malformed-derive-entry.rs2
-rw-r--r--src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs2
-rw-r--r--src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr7
-rw-r--r--src/test/ui/parser/macro/pub-item-macro.rs2
-rw-r--r--src/test/ui/parser/macro/pub-item-macro.stderr9
-rw-r--r--src/test/ui/proc-macro/issue-41211.rs1
-rw-r--r--src/test/ui/proc-macro/issue-41211.stderr8
-rw-r--r--src/test/ui/proc-macro/lifetimes.rs2
-rw-r--r--src/test/ui/proc-macro/more-gates.rs2
-rw-r--r--src/test/ui/proc-macro/parent-source-spans.rs3
-rw-r--r--src/test/ui/proc-macro/parent-source-spans.stderr30
-rw-r--r--src/test/ui/proc-macro/proc-macro-attributes.rs9
-rw-r--r--src/test/ui/proc-macro/proc-macro-attributes.stderr79
-rw-r--r--src/test/ui/quote-with-interpolated.rs7
-rw-r--r--src/test/ui/quote-with-interpolated.stderr33
-rw-r--r--src/test/ui/reserved/reserved-attr-on-macro.rs5
-rw-r--r--src/test/ui/reserved/reserved-attr-on-macro.stderr12
-rw-r--r--src/test/ui/self/self_type_keyword.rs1
-rw-r--r--src/test/ui/self/self_type_keyword.stderr11
-rw-r--r--src/test/ui/span/issue-36530.rs2
-rw-r--r--src/test/ui/span/macro-ty-params.rs4
-rw-r--r--src/test/ui/span/macro-ty-params.stderr17
-rw-r--r--src/test/ui/span/visibility-ty-params.rs1
-rw-r--r--src/test/ui/span/visibility-ty-params.stderr11
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test2.rs4
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test2.stderr11
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test3.rs4
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test3.stderr11
80 files changed, 538 insertions, 167 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index f19ca5ed030..62dc8691e65 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -987,7 +987,6 @@ where
         };
 
         let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver);
-        let err_count = ecx.parse_sess.span_diagnostic.err_count();
 
         // Expand macros now!
         let krate = time(sess, "expand crate", || {
@@ -1013,9 +1012,6 @@ where
             let msg = "missing fragment specifier";
             sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg);
         }
-        if ecx.parse_sess.span_diagnostic.err_count() - ecx.resolve_err_count > err_count {
-            ecx.parse_sess.span_diagnostic.abort_if_errors();
-        }
         if cfg!(windows) {
             env::set_var("PATH", &old_path);
         }
@@ -1119,12 +1115,6 @@ where
         })
     })?;
 
-    // Unresolved macros might be due to mistyped `#[macro_use]`,
-    // so abort after checking for unknown attributes. (#49074)
-    if resolver.found_unresolved_macro {
-        sess.diagnostic().abort_if_errors();
-    }
-
     // Lower ast -> hir.
     // First, we need to collect the dep_graph.
     let dep_graph = match future_dep_graph {
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index ce5db51dfb5..584f0ba0449 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -278,25 +278,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
         visit::walk_ty(self, ty)
     }
 
-    fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
-        // Check if the path in this `use` is not generic, such as `use foo::bar<T>;` While this
-        // can't happen normally thanks to the parser, a generic might sneak in if the `use` is
-        // built using a macro.
-        //
-        // macro_use foo {
-        //     ($p:path) => { use $p; }
-        // }
-        // foo!(bar::baz<T>);
-        use_tree.prefix.segments.iter().find(|segment| {
-            segment.args.is_some()
-        }).map(|segment| {
-            self.err_handler().span_err(segment.args.as_ref().unwrap().span(),
-                                        "generic arguments in import path");
-        });
-
-        visit::walk_use_tree(self, use_tree, id);
-    }
-
     fn visit_label(&mut self, label: &'a Label) {
         self.check_label(label.ident);
         visit::walk_label(self, label);
@@ -433,17 +414,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
         visit::walk_foreign_item(self, fi)
     }
 
-    fn visit_vis(&mut self, vis: &'a Visibility) {
-        if let VisibilityKind::Restricted { ref path, .. } = vis.node {
-            path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| {
-                self.err_handler().span_err(segment.args.as_ref().unwrap().span(),
-                                            "generic arguments in visibility path");
-            });
-        }
-
-        visit::walk_vis(self, vis)
-    }
-
     fn visit_generics(&mut self, generics: &'a Generics) {
         let mut seen_non_lifetime_param = false;
         let mut seen_default = None;
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index cc9c6d8c516..0db6dbafb6c 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -1576,7 +1576,6 @@ pub struct Resolver<'a> {
     macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
     macro_defs: FxHashMap<Mark, DefId>,
     local_macro_def_scopes: FxHashMap<NodeId, Module<'a>>,
-    pub found_unresolved_macro: bool,
 
     /// List of crate local macros that we need to warn about as being unused.
     /// Right now this only includes macro_rules! macros, and macros 2.0.
@@ -1911,7 +1910,6 @@ impl<'a> Resolver<'a> {
             name_already_seen: FxHashMap::default(),
             potentially_unused_imports: Vec::new(),
             struct_constructors: Default::default(),
-            found_unresolved_macro: false,
             unused_macros: FxHashSet::default(),
             current_type_ascription: Vec::new(),
             injected_crate: None,
@@ -2024,8 +2022,10 @@ impl<'a> Resolver<'a> {
                                       record_used_id: Option<NodeId>,
                                       path_span: Span)
                                       -> Option<LexicalScopeBinding<'a>> {
-        let record_used = record_used_id.is_some();
         assert!(ns == TypeNS  || ns == ValueNS);
+        if ident.name == keywords::Invalid.name() {
+            return Some(LexicalScopeBinding::Def(Def::Err));
+        }
         if ns == TypeNS {
             ident.span = if ident.name == keywords::SelfUpper.name() {
                 // FIXME(jseyfried) improve `Self` hygiene
@@ -2038,6 +2038,7 @@ impl<'a> Resolver<'a> {
         }
 
         // Walk backwards up the ribs in scope.
+        let record_used = record_used_id.is_some();
         let mut module = self.graph_root;
         for i in (0 .. self.ribs[ns].len()).rev() {
             if let Some(def) = self.ribs[ns][i].bindings.get(&ident).cloned() {
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 98c6773cec3..9c0c8a6016f 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -182,7 +182,14 @@ impl<'a> base::Resolver for Resolver<'a> {
         };
 
         let parent_scope = self.invoc_parent_scope(invoc_id, derives_in_scope);
-        let (def, ext) = self.resolve_macro_to_def(path, kind, &parent_scope, true, force)?;
+        let (def, ext) = match self.resolve_macro_to_def(path, kind, &parent_scope, true, force) {
+            Ok((def, ext)) => (def, ext),
+            Err(Determinacy::Determined) if kind == MacroKind::Attr => {
+                // Replace unresolved attributes with used inert attributes for better recovery.
+                return Ok(Some(self.get_macro(Def::NonMacroAttr(NonMacroAttrKind::Tool))));
+            }
+            Err(determinacy) => return Err(determinacy),
+        };
 
         if let Def::Macro(def_id, _) = def {
             if after_derive {
@@ -337,7 +344,6 @@ impl<'a> Resolver<'a> {
                 }
                 PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined),
                 PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => {
-                    self.found_unresolved_macro = true;
                     Err(Determinacy::Determined)
                 }
                 PathResult::Module(..) => unreachable!(),
@@ -353,10 +359,8 @@ impl<'a> Resolver<'a> {
             let binding = self.early_resolve_ident_in_lexical_scope(
                 path[0].ident, ScopeSet::Macro(kind), parent_scope, false, force, path_span
             );
-            match binding {
-                Ok(..) => {}
-                Err(Determinacy::Determined) => self.found_unresolved_macro = true,
-                Err(Determinacy::Undetermined) => return Err(Determinacy::Undetermined),
+            if let Err(Determinacy::Undetermined) = binding {
+                return Err(Determinacy::Undetermined);
             }
 
             if trace {
@@ -858,14 +862,23 @@ impl<'a> Resolver<'a> {
     pub fn finalize_current_module_macro_resolutions(&mut self) {
         let module = self.current_module;
 
-        let check_consistency = |this: &mut Self, path: &[Segment], span,
-                                 kind: MacroKind, initial_def, def| {
+        let check_consistency = |this: &mut Self, path: &[Segment], span, kind: MacroKind,
+                                 initial_def: Option<Def>, def: Def| {
             if let Some(initial_def) = initial_def {
                 if def != initial_def && def != Def::Err && this.ambiguity_errors.is_empty() {
                     // Make sure compilation does not succeed if preferred macro resolution
                     // has changed after the macro had been expanded. In theory all such
                     // situations should be reported as ambiguity errors, so this is a bug.
-                    span_bug!(span, "inconsistent resolution for a macro");
+                    if initial_def == Def::NonMacroAttr(NonMacroAttrKind::Custom) {
+                        // Yeah, legacy custom attributes are implemented using forced resolution
+                        // (which is a best effort error recovery tool, basically), so we can't
+                        // promise their resolution won't change later.
+                        let msg = format!("inconsistent resolution for a macro: first {}, then {}",
+                                          initial_def.kind_name(), def.kind_name());
+                        this.session.span_err(span, &msg);
+                    } else {
+                        span_bug!(span, "inconsistent resolution for a macro");
+                    }
                 }
             } else {
                 // It's possible that the macro was unresolved (indeterminate) and silently
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index d576397c942..84aa57d7d86 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -2,7 +2,7 @@ pub use self::SyntaxExtension::*;
 
 use ast::{self, Attribute, Name, PatKind, MetaItem};
 use attr::HasAttrs;
-use source_map::{self, SourceMap, Spanned, respan};
+use source_map::{SourceMap, Spanned, respan};
 use syntax_pos::{Span, MultiSpan, DUMMY_SP};
 use edition::Edition;
 use errors::{DiagnosticBuilder, DiagnosticId};
@@ -481,7 +481,7 @@ impl DummyResult {
     pub fn raw_expr(sp: Span) -> P<ast::Expr> {
         P(ast::Expr {
             id: ast::DUMMY_NODE_ID,
-            node: ast::ExprKind::Lit(source_map::respan(sp, ast::LitKind::Bool(false))),
+            node: ast::ExprKind::Err,
             span: sp,
             attrs: ThinVec::new(),
         })
@@ -496,10 +496,11 @@ impl DummyResult {
         }
     }
 
+    /// A plain dummy type.
     pub fn raw_ty(sp: Span) -> P<ast::Ty> {
         P(ast::Ty {
             id: ast::DUMMY_NODE_ID,
-            node: ast::TyKind::Infer,
+            node: ast::TyKind::Err,
             span: sp
         })
     }
@@ -796,7 +797,6 @@ pub struct ExtCtxt<'a> {
     pub ecfg: expand::ExpansionConfig<'a>,
     pub root_path: PathBuf,
     pub resolver: &'a mut dyn Resolver,
-    pub resolve_err_count: usize,
     pub current_expansion: ExpansionData,
     pub expansions: FxHashMap<Span, Vec<String>>,
 }
@@ -811,7 +811,6 @@ impl<'a> ExtCtxt<'a> {
             ecfg,
             root_path: PathBuf::new(),
             resolver,
-            resolve_err_count: 0,
             current_expansion: ExpansionData {
                 mark: Mark::root(),
                 depth: 0,
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 55012bb7f5a..f8f1e830770 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -344,8 +344,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
             // FIXME(jseyfried): Refactor out the following logic
             let (expanded_fragment, new_invocations) = if let Some(ext) = ext {
                 if let Some(ext) = ext {
-                    let dummy = invoc.fragment_kind.dummy(invoc.span()).unwrap();
-                    let fragment = self.expand_invoc(invoc, &*ext).unwrap_or(dummy);
+                    let (invoc_fragment_kind, invoc_span) = (invoc.fragment_kind, invoc.span());
+                    let fragment = self.expand_invoc(invoc, &*ext).unwrap_or_else(|| {
+                        invoc_fragment_kind.dummy(invoc_span).unwrap()
+                    });
                     self.collect_invocations(fragment, &[])
                 } else if let InvocationKind::Attr { attr: None, traits, item, .. } = invoc.kind {
                     if !item.derive_allowed() {
@@ -431,9 +433,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
 
     fn resolve_imports(&mut self) {
         if self.monotonic {
-            let err_count = self.cx.parse_sess.span_diagnostic.err_count();
             self.cx.resolver.resolve_imports();
-            self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count;
         }
     }
 
@@ -457,11 +457,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
         };
 
         if self.monotonic {
-            let err_count = self.cx.parse_sess.span_diagnostic.err_count();
-            let mark = self.cx.current_expansion.mark;
-            self.cx.resolver.visit_ast_fragment_with_placeholders(mark, &fragment_with_placeholders,
-                                                                  derives);
-            self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count;
+            self.cx.resolver.visit_ast_fragment_with_placeholders(
+                self.cx.current_expansion.mark, &fragment_with_placeholders, derives
+            );
         }
 
         (fragment_with_placeholders, invocations)
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 62269a8f163..70df403d0c2 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1272,16 +1272,15 @@ impl<'a> Context<'a> {
                 return;
             }
         }
-        if name.starts_with("rustc_") {
-            gate_feature!(self, rustc_attrs, attr.span,
-                          "unless otherwise specified, attributes \
-                           with the prefix `rustc_` \
-                           are reserved for internal compiler diagnostics");
-        } else if !attr::is_known(attr) {
-            // Only run the custom attribute lint during regular feature gate
-            // checking. Macro gating runs before the plugin attributes are
-            // registered, so we skip this in that case.
-            if !is_macro {
+        if !attr::is_known(attr) {
+            if name.starts_with("rustc_") {
+                let msg = "unless otherwise specified, attributes with the prefix `rustc_` \
+                           are reserved for internal compiler diagnostics";
+                gate_feature!(self, rustc_attrs, attr.span, msg);
+            } else if !is_macro {
+                // Only run the custom attribute lint during regular feature gate
+                // checking. Macro gating runs before the plugin attributes are
+                // registered, so we skip this in that case.
                 let msg = format!("The attribute `{}` is currently unknown to the compiler and \
                                    may have meaning added to it in the future", attr.path);
                 gate_feature!(self, custom_attribute, attr.span, &msg);
diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs
index c26c4bb6274..771a559b37c 100644
--- a/src/libsyntax_ext/deriving/default.rs
+++ b/src/libsyntax_ext/deriving/default.rs
@@ -3,7 +3,7 @@ use deriving::generic::*;
 use deriving::generic::ty::*;
 
 use syntax::ast::{Expr, MetaItem};
-use syntax::ext::base::{Annotatable, ExtCtxt};
+use syntax::ext::base::{Annotatable, DummyResult, ExtCtxt};
 use syntax::ext::build::AstBuilder;
 use syntax::ptr::P;
 use syntax::symbol::Symbol;
@@ -69,7 +69,7 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
             span_err!(cx, trait_span, E0665,
                       "`Default` cannot be derived for enums, only structs");
             // let compilation continue
-            cx.expr_usize(trait_span, 0)
+            DummyResult::raw_expr(trait_span)
         }
         _ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`"),
     };
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs
index 220765fd8c7..c6f427e63cd 100644
--- a/src/libsyntax_ext/format.rs
+++ b/src/libsyntax_ext/format.rs
@@ -666,7 +666,7 @@ impl<'a, 'b> Context<'a, 'b> {
                     "X" => "UpperHex",
                     _ => {
                         ecx.span_err(sp, &format!("unknown format trait `{}`", *tyname));
-                        "Dummy"
+                        return DummyResult::raw_expr(sp);
                     }
                 }
             }
@@ -713,7 +713,7 @@ pub fn expand_format_args_nl<'cx>(
                                        sp,
                                        feature_gate::GateIssue::Language,
                                        feature_gate::EXPLAIN_FORMAT_ARGS_NL);
-        return base::DummyResult::expr(sp);
+        return DummyResult::expr(sp);
     }
     sp = sp.apply_mark(ecx.current_expansion.mark);
     match parse_args(ecx, sp, tts) {
diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs
index 9d8842eee81..496d196c94a 100644
--- a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs
+++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs
@@ -1,2 +1,4 @@
 #[cfg(foo(bar))] //~ ERROR invalid predicate `foo`
+fn check() {}
+
 fn main() {}
diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs
index 83e162e0871..c7e1b4435e4 100644
--- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs
+++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs
@@ -33,3 +33,5 @@ macro_rules! generate_s10 {
 }
 
 generate_s10!(concat!("nonexistent"));
+
+fn main() {}
diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs b/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
index 7c9ecb5d621..fbda3dbe948 100644
--- a/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
+++ b/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
@@ -4,7 +4,7 @@ pub fn print(_args: std::fmt::Arguments) {}
 
 #[macro_export]
 macro_rules! myprint {
-    ($($arg:tt)*) => (print(format_args!($($arg)*)));
+    ($($arg:tt)*) => ($crate::print(format_args!($($arg)*)));
 }
 
 #[macro_export]
diff --git a/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs b/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs
index 2530e75111b..b847000a81d 100644
--- a/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs
+++ b/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs
@@ -4,6 +4,8 @@ trait Foo {
     type Bar;
 }
 
+struct Bar;
+
 impl Bar {
     #[derive(Clone)]
     //~^ ERROR `derive` may only be applied to structs, enums and unions
diff --git a/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr
index dd7af830414..0088add7e7f 100644
--- a/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr
+++ b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr
@@ -11,4 +11,3 @@ LL |     #[derive(Clone)]
    |     ^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/did_you_mean/issue-40396.rs b/src/test/ui/did_you_mean/issue-40396.rs
index 978b5d14483..63eec50c2d2 100644
--- a/src/test/ui/did_you_mean/issue-40396.rs
+++ b/src/test/ui/did_you_mean/issue-40396.rs
@@ -1,14 +1,27 @@
 fn foo() {
-    println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
+    (0..13).collect<Vec<i32>>();
+    //~^ ERROR chained comparison
+    //~| ERROR expected value, found struct `Vec`
+    //~| ERROR expected value, found builtin type `i32`
+    //~| ERROR attempted to take value of method `collect`
 }
 
 fn bar() {
-    println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
+    Vec<i32>::new();
+    //~^ ERROR chained comparison
+    //~| ERROR expected value, found struct `Vec`
+    //~| ERROR expected value, found builtin type `i32`
+    //~| ERROR cannot find function `new` in the crate root
 }
 
 fn qux() {
-    println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
+    (0..13).collect<Vec<i32>();
     //~^ ERROR chained comparison
+    //~| ERROR chained comparison
+    //~| ERROR expected value, found struct `Vec`
+    //~| ERROR expected value, found builtin type `i32`
+    //~| ERROR attempted to take value of method `collect`
+    //~| ERROR mismatched types
 }
 
 fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-40396.stderr b/src/test/ui/did_you_mean/issue-40396.stderr
index 3b086d8d4d0..33884bbfecf 100644
--- a/src/test/ui/did_you_mean/issue-40396.stderr
+++ b/src/test/ui/did_you_mean/issue-40396.stderr
@@ -1,8 +1,8 @@
 error: chained comparison operators require parentheses
   --> $DIR/issue-40396.rs:2:37
    |
-LL |     println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
-   |                                     ^^^^^^^^
+LL |     (0..13).collect<Vec<i32>>();
+   |                    ^^^^^^^^
    |
    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
    = help: or use `(...)` if you meant to specify fn arguments
@@ -10,8 +10,8 @@ LL |     println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained compar
 error: chained comparison operators require parentheses
   --> $DIR/issue-40396.rs:6:25
    |
-LL |     println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
-   |                         ^^^^^^^
+LL |     Vec<i32>::new();
+   |        ^^^^^^^
    |
    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
    = help: or use `(...)` if you meant to specify fn arguments
@@ -19,8 +19,8 @@ LL |     println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
 error: chained comparison operators require parentheses
   --> $DIR/issue-40396.rs:10:37
    |
-LL |     println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
-   |                                     ^^^^^^^^
+LL |     (0..13).collect<Vec<i32>();
+   |                    ^^^^^^^^
    |
    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
    = help: or use `(...)` if you meant to specify fn arguments
@@ -28,11 +28,80 @@ LL |     println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained compari
 error: chained comparison operators require parentheses
   --> $DIR/issue-40396.rs:10:41
    |
-LL |     println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
-   |                                         ^^^^^^
+LL |     (0..13).collect<Vec<i32>();
+   |                        ^^^^^^
    |
    = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
    = help: or use `(...)` if you meant to specify fn arguments
 
-error: aborting due to 4 previous errors
+error[E0423]: expected value, found struct `Vec`
+  --> $DIR/issue-40396.rs:12:21
+   |
+LL |     (0..13).collect<Vec<i32>>();
+   |                     ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+  --> $DIR/issue-40396.rs:12:25
+   |
+LL |     (0..13).collect<Vec<i32>>();
+   |                         ^^^ not a value
+
+error[E0423]: expected value, found struct `Vec`
+  --> $DIR/issue-40396.rs:20:5
+   |
+LL |     Vec<i32>::new();
+   |     ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+  --> $DIR/issue-40396.rs:20:9
+   |
+LL |     Vec<i32>::new();
+   |         ^^^ not a value
+
+error[E0425]: cannot find function `new` in the crate root
+  --> $DIR/issue-40396.rs:20:15
+   |
+LL |     Vec<i32>::new();
+   |               ^^^ not found in the crate root
+
+error[E0423]: expected value, found struct `Vec`
+  --> $DIR/issue-40396.rs:28:21
+   |
+LL |     (0..13).collect<Vec<i32>();
+   |                     ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+  --> $DIR/issue-40396.rs:28:25
+   |
+LL |     (0..13).collect<Vec<i32>();
+   |                         ^^^ not a value
+
+error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>`
+  --> $DIR/issue-40396.rs:12:13
+   |
+LL |     (0..13).collect<Vec<i32>>();
+   |             ^^^^^^^
+   |
+   = help: maybe a `()` to call it is missing?
+
+error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>`
+  --> $DIR/issue-40396.rs:28:13
+   |
+LL |     (0..13).collect<Vec<i32>();
+   |             ^^^^^^^
+   |
+   = help: maybe a `()` to call it is missing?
+
+error[E0308]: mismatched types
+  --> $DIR/issue-40396.rs:28:29
+   |
+LL |     (0..13).collect<Vec<i32>();
+   |                             ^^ expected bool, found ()
+   |
+   = note: expected type `bool`
+              found type `()`
+
+error: aborting due to 14 previous errors
 
+Some errors occurred: E0308, E0423, E0425, E0615.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs
index e65eed0a0e6..d1752a7ec71 100644
--- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs
+++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs
@@ -4,6 +4,10 @@
 #[macro_use]
 extern crate edition_kw_macro_2015;
 
+mod module {
+    pub fn async() {}
+}
+
 pub fn check_async() {
     let mut async = 1; // OK
     let mut r#async = 1; // OK
@@ -18,3 +22,5 @@ pub fn check_async() {
     module::async(); // OK
     module::r#async(); // OK
 }
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr
index 377e8ae0825..06901ad6ef0 100644
--- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr
@@ -11,4 +11,3 @@ LL |     r#async = consumes_async_raw!(async); //~ ERROR no rules expected the t
    |                                   ^^^^^ no rules expected this token in macro call
 
 error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs
index 8aafeefa56c..2684c8e00b2 100644
--- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs
+++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs
@@ -10,3 +10,5 @@ mod one_async {
 mod two_async {
     produces_async_raw! {} // OK
 }
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs
index 76739603129..44455f43856 100644
--- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs
+++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs
@@ -4,6 +4,10 @@
 #[macro_use]
 extern crate edition_kw_macro_2018;
 
+mod module {
+    pub fn async() {}
+}
+
 pub fn check_async() {
     let mut async = 1; // OK
     let mut r#async = 1; // OK
@@ -18,3 +22,5 @@ pub fn check_async() {
     module::async(); // OK
     module::r#async(); // OK
 }
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr
index c6e4d01a649..98fa2493940 100644
--- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr
@@ -11,4 +11,3 @@ LL |     r#async = consumes_async_raw!(async); //~ ERROR no rules expected the t
    |                                   ^^^^^ no rules expected this token in macro call
 
 error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs
index 2db0a2dde2e..6f766550d47 100644
--- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs
+++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs
@@ -10,3 +10,5 @@ mod one_async {
 mod two_async {
     produces_async_raw! {} // OK
 }
+
+fn main() {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs
index 352f56f7aca..5f276f6b65e 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs
@@ -13,3 +13,5 @@ mod derive {
     //~^ ERROR cannot find derive macro `x3300` in this scope
     struct S;
 }
+
+fn main() {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs
index 8bac49816ad..13974129884 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs
@@ -31,3 +31,5 @@ mod derive {
     //~^ ERROR `derive` may only be applied to structs, enums and unions
     impl S { }
 }
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
index 1786ec246ab..db1a7dad06b 100644
--- a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
+++ b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
@@ -1,3 +1,5 @@
+#![feature(intrinsics, lang_items, no_core)]
+
 #![crate_type="rlib"]
 #![no_core]
 
diff --git a/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs b/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs
index 8f8147a7423..125af64fef0 100644
--- a/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs
+++ b/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs
@@ -23,3 +23,5 @@ extern {
     emits_nothing!();
     //~^ ERROR macro invocations in `extern {}` blocks are experimental
 }
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
index 993daca0756..5ec413cc71d 100644
--- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
+++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
@@ -1,8 +1,6 @@
-// ignore-tidy-linelength
-
 // Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
 
 #[rustc_foo]
-//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics
+//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-10536.rs b/src/test/ui/issues/issue-10536.rs
index f8695caca5b..a2df2913afb 100644
--- a/src/test/ui/issues/issue-10536.rs
+++ b/src/test/ui/issues/issue-10536.rs
@@ -1,8 +1,6 @@
 // We only want to assert that this doesn't ICE, we don't particularly care
 // about whether it nor it fails to compile.
 
-// error-pattern:
-
 macro_rules! foo{
     () => {{
         macro_rules! bar{() => (())}
@@ -15,9 +13,12 @@ pub fn main() {
 
     assert!({one! two()});
     //~^ ERROR macros that expand to items must either be surrounded with braces or followed by a
+    //~| ERROR cannot find macro `one!` in this scope
+    //~| ERROR mismatched types
 
     // regardless of whether nested macro_rules works, the following should at
     // least throw a conventional error.
     assert!({one! two});
-    //~^ ERROR expected
+    //~^ ERROR expected `(` or `{`, found `}`
+    //~| ERROR cannot apply unary operator `!` to type `!`
 }
diff --git a/src/test/ui/issues/issue-10536.stderr b/src/test/ui/issues/issue-10536.stderr
index bc542ce35c0..6b2424d3a45 100644
--- a/src/test/ui/issues/issue-10536.stderr
+++ b/src/test/ui/issues/issue-10536.stderr
@@ -10,5 +10,28 @@ error: expected `(` or `{`, found `}`
 LL |     assert!({one! two});
    |                      ^ expected `(` or `{`
 
-error: aborting due to 2 previous errors
+error: cannot find macro `one!` in this scope
+  --> $DIR/issue-10536.rs:24:14
+   |
+LL |     assert!({one! two()});
+   |              ^^^
+
+error[E0308]: mismatched types
+  --> $DIR/issue-10536.rs:24:13
+   |
+LL |     assert!({one! two()});
+   |             ^^^^^^^^^^^^ expected bool, found ()
+   |
+   = note: expected type `bool`
+              found type `()`
+
+error[E0600]: cannot apply unary operator `!` to type `!`
+  --> $DIR/issue-10536.rs:31:5
+   |
+LL |     assert!({one! two});
+   |     ^^^^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+
+error: aborting due to 5 previous errors
 
+Some errors occurred: E0308, E0600.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-11692-1.rs b/src/test/ui/issues/issue-11692-1.rs
index eae555ad83c..22777780402 100644
--- a/src/test/ui/issues/issue-11692-1.rs
+++ b/src/test/ui/issues/issue-11692-1.rs
@@ -1,4 +1,5 @@
 fn main() {
     print!(testo!());
     //~^ ERROR: format argument must be a string literal
+    //~| ERROR: cannot find macro `testo!` in this scope
 }
diff --git a/src/test/ui/issues/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr
index 1173e056321..e0c4642ea60 100644
--- a/src/test/ui/issues/issue-11692-1.stderr
+++ b/src/test/ui/issues/issue-11692-1.stderr
@@ -8,5 +8,11 @@ help: you might be missing a string literal to format with
 LL |     print!("{}", testo!());
    |            ^^^^^
 
-error: aborting due to previous error
+error: cannot find macro `testo!` in this scope
+  --> $DIR/issue-11692-1.rs:12:12
+   |
+LL |     print!(testo!());
+   |            ^^^^^
+
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-11692-2.rs b/src/test/ui/issues/issue-11692-2.rs
index 61be284d732..61039316573 100644
--- a/src/test/ui/issues/issue-11692-2.rs
+++ b/src/test/ui/issues/issue-11692-2.rs
@@ -1,3 +1,4 @@
 fn main() {
     concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
+                      //~| ERROR expected a literal
 }
diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr
index 5d4467080f1..16cf7b0dca7 100644
--- a/src/test/ui/issues/issue-11692-2.stderr
+++ b/src/test/ui/issues/issue-11692-2.stderr
@@ -1,8 +1,16 @@
+error: expected a literal
+  --> $DIR/issue-11692-2.rs:12:13
+   |
+LL |     concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
+   |             ^^^^^^^
+   |
+   = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()`
+
 error: cannot find macro `test!` in this scope
   --> $DIR/issue-11692-2.rs:2:13
    |
 LL |     concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
    |             ^^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-32950.rs b/src/test/ui/issues/issue-32950.rs
index dc5b063ada4..27d68a11c1f 100644
--- a/src/test/ui/issues/issue-32950.rs
+++ b/src/test/ui/issues/issue-32950.rs
@@ -3,6 +3,7 @@
 #[derive(Debug)]
 struct Baz<T>(
     concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
+                             //~^ ERROR cannot find type `FooBar` in this scope
 );
 
 fn main() {}
diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr
index e8e3347af2e..af148cbb5c6 100644
--- a/src/test/ui/issues/issue-32950.stderr
+++ b/src/test/ui/issues/issue-32950.stderr
@@ -4,5 +4,12 @@ error: `derive` cannot be used on items with type macros
 LL |     concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to previous error
+error[E0412]: cannot find type `FooBar` in this scope
+  --> $DIR/issue-32950.rs:15:5
+   |
+LL |     concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/issues/issue-33571.rs b/src/test/ui/issues/issue-33571.rs
index 5f9c514addb..223bbc3ff5e 100644
--- a/src/test/ui/issues/issue-33571.rs
+++ b/src/test/ui/issues/issue-33571.rs
@@ -2,3 +2,5 @@
          Sync, //~ ERROR this unsafe trait should be implemented explicitly
          Copy)]
 enum Foo {}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-35677.rs b/src/test/ui/issues/issue-35677.rs
index 46d3f7e4af0..71e2125ffd2 100644
--- a/src/test/ui/issues/issue-35677.rs
+++ b/src/test/ui/issues/issue-35677.rs
@@ -3,3 +3,5 @@ fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
     this.drain()
     //~^ ERROR no method named
 }
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-35677.stderr b/src/test/ui/issues/issue-35677.stderr
index dca096b93f5..61ddb75b3b5 100644
--- a/src/test/ui/issues/issue-35677.stderr
+++ b/src/test/ui/issues/issue-35677.stderr
@@ -1,7 +1,3 @@
-error[E0601]: `main` function not found in crate `issue_35677`
-   |
-   = note: consider adding a `main` function to `$DIR/issue-35677.rs`
-
 error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
   --> $DIR/issue-35677.rs:3:10
    |
@@ -12,7 +8,6 @@ LL |     this.drain()
            `K : std::cmp::Eq`
            `K : std::hash::Hash`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0599, E0601.
-For more information about an error, try `rustc --explain E0599`.
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issues/issue-36617.rs b/src/test/ui/issues/issue-36617.rs
index 846efac41c8..87092689a28 100644
--- a/src/test/ui/issues/issue-36617.rs
+++ b/src/test/ui/issues/issue-36617.rs
@@ -1 +1,3 @@
 #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-43023.rs b/src/test/ui/issues/issue-43023.rs
index 32bd66f5a93..072243d881c 100644
--- a/src/test/ui/issues/issue-43023.rs
+++ b/src/test/ui/issues/issue-43023.rs
@@ -16,3 +16,5 @@ trait Tr2 {
     #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
     type F;
 }
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-46438.rs b/src/test/ui/issues/issue-46438.rs
index a16c4c31d81..d78b958463f 100644
--- a/src/test/ui/issues/issue-46438.rs
+++ b/src/test/ui/issues/issue-46438.rs
@@ -4,7 +4,7 @@ macro_rules! m {
     }
 }
 
-trait Trait {}
+trait Tr {}
 
 m!(Tr);
 
diff --git a/src/test/ui/issues/issue-49074.rs b/src/test/ui/issues/issue-49074.rs
index dbd96e96191..ad66e421c6b 100644
--- a/src/test/ui/issues/issue-49074.rs
+++ b/src/test/ui/issues/issue-49074.rs
@@ -9,5 +9,5 @@ mod foo {
 }
 
 fn main() {
-   bar!();
+   bar!(); //~ ERROR cannot find macro `bar!` in this scope
 }
diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr
index 8de4d081413..6b5e979082e 100644
--- a/src/test/ui/issues/issue-49074.stderr
+++ b/src/test/ui/issues/issue-49074.stderr
@@ -6,6 +6,14 @@ LL | #[marco_use] // typo
    |
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error: aborting due to previous error
+error: cannot find macro `bar!` in this scope
+  --> $DIR/issue-49074.rs:22:4
+   |
+LL |    bar!(); //~ ERROR cannot find macro `bar!` in this scope
+   |    ^^^
+   |
+   = help: have you added the `#[macro_use]` on the module/import?
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issues/issue-51279.rs b/src/test/ui/issues/issue-51279.rs
index caef23043cb..ad5438fbd46 100644
--- a/src/test/ui/issues/issue-51279.rs
+++ b/src/test/ui/issues/issue-51279.rs
@@ -22,3 +22,4 @@ unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
 
 type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
 //~^ ERROR #[cfg] cannot be applied on a generic parameter
+//~| ERROR attribute `ignored` is currently unknown to the compiler
diff --git a/src/test/ui/issues/issue-51279.stderr b/src/test/ui/issues/issue-51279.stderr
index 89786f72e18..33afac39865 100644
--- a/src/test/ui/issues/issue-51279.stderr
+++ b/src/test/ui/issues/issue-51279.stderr
@@ -46,5 +46,14 @@ error: #[cfg] cannot be applied on a generic parameter
 LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
    |                       ^^^^^^^^^^^^
 
-error: aborting due to 8 previous errors
+error[E0658]: The attribute `ignored` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+  --> $DIR/issue-51279.rs:33:8
+   |
+LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
+   |        ^^^^^^^^^^
+   |
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to 9 previous errors
 
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs
index a172f6a7bfa..efdea5c9b1e 100644
--- a/src/test/ui/issues/issue-55796.rs
+++ b/src/test/ui/issues/issue-55796.rs
@@ -22,3 +22,5 @@ pub trait Graph<'a> {
 //~^ ERROR cannot infer
     }
 }
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr
index f8ca0727efb..c05f8b85d0e 100644
--- a/src/test/ui/issues/issue-55796.stderr
+++ b/src/test/ui/issues/issue-55796.stderr
@@ -1,7 +1,3 @@
-error[E0601]: `main` function not found in crate `issue_55796`
-   |
-   = note: consider adding a `main` function to `$DIR/issue-55796.rs`
-
 error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
   --> $DIR/issue-55796.rs:16:9
    |
@@ -44,7 +40,6 @@ LL |         Box::new(self.in_edges(u).map(|e| e.target()))
            expected std::boxed::Box<(dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node> + 'static)>
               found std::boxed::Box<dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node>>
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors occurred: E0495, E0601.
-For more information about an error, try `rustc --explain E0495`.
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/issues/issue-6596-1.rs b/src/test/ui/issues/issue-6596-1.rs
index 5da54451346..6a5986c355e 100644
--- a/src/test/ui/issues/issue-6596-1.rs
+++ b/src/test/ui/issues/issue-6596-1.rs
@@ -2,6 +2,7 @@ macro_rules! e {
     ($inp:ident) => (
         $nonexistent
         //~^ ERROR unknown macro variable `nonexistent`
+        //~| ERROR cannot find value `nonexistent` in this scope
     );
 }
 
diff --git a/src/test/ui/issues/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr
index 2a4ece2f242..face8725914 100644
--- a/src/test/ui/issues/issue-6596-1.stderr
+++ b/src/test/ui/issues/issue-6596-1.stderr
@@ -7,5 +7,15 @@ LL |         $nonexistent
 LL |     e!(foo);
    |     -------- in this macro invocation
 
-error: aborting due to previous error
+error[E0425]: cannot find value `nonexistent` in this scope
+  --> $DIR/issue-6596-1.rs:14:9
+   |
+LL |         $nonexistent
+   |         ^^^^^^^^^^^^ not found in this scope
+...
+LL |     e!(foo);
+   |     -------- in this macro invocation
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/issues/issue-6596-2.rs b/src/test/ui/issues/issue-6596-2.rs
index 056a720bc5c..4ff7cfe3865 100644
--- a/src/test/ui/issues/issue-6596-2.rs
+++ b/src/test/ui/issues/issue-6596-2.rs
@@ -9,5 +9,6 @@ macro_rules! g {
 }
 
 fn main() {
+    let foo = 0;
     g!(foo);
 }
diff --git a/src/test/ui/macro_backtrace/main.rs b/src/test/ui/macro_backtrace/main.rs
index fd2f1b7a286..2c11ce56f8b 100644
--- a/src/test/ui/macro_backtrace/main.rs
+++ b/src/test/ui/macro_backtrace/main.rs
@@ -12,6 +12,8 @@ macro_rules! pong {
 //~| ERROR expected one of
 //~| ERROR expected one of
 
+struct syntax;
+
 fn main() {
     pong!();
     ping!();
diff --git a/src/test/ui/macros/macro-comma-behavior.core.stderr b/src/test/ui/macros/macro-comma-behavior.core.stderr
index b3988717b37..7a4b9278e0a 100644
--- a/src/test/ui/macros/macro-comma-behavior.core.stderr
+++ b/src/test/ui/macros/macro-comma-behavior.core.stderr
@@ -40,5 +40,11 @@ error: 1 positional argument in format string, but no arguments were given
 LL |             write!(f, "{}",)?;
    |                        ^^
 
-error: aborting due to 7 previous errors
+error: `#[panic_handler]` function required, but not found
+
+error: language item required, but not found: `eh_personality`
+
+error: language item required, but not found: `eh_unwind_resume`
+
+error: aborting due to 10 previous errors
 
diff --git a/src/test/ui/malformed/malformed-derive-entry.rs b/src/test/ui/malformed/malformed-derive-entry.rs
index 5978258b5d8..2c8ebc49772 100644
--- a/src/test/ui/malformed/malformed-derive-entry.rs
+++ b/src/test/ui/malformed/malformed-derive-entry.rs
@@ -13,3 +13,5 @@ struct Test3;
 #[derive]
 //~^ WARNING empty trait list
 struct Test4;
+
+fn main() {}
diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
index 60f8684968f..866c5b2e34b 100644
--- a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
+++ b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
@@ -3,3 +3,5 @@
 // error-pattern:cannot depend on a crate that needs a panic runtime
 
 extern crate depends;
+
+fn main() {}
diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr
index 0e68c9b806d..27e27dda5ef 100644
--- a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr
+++ b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr
@@ -1,9 +1,4 @@
 error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`
 
-error[E0601]: `main` function not found in crate `runtime_depend_on_needs_runtime`
-   |
-   = note: consider adding a `main` function to `$DIR/runtime-depend-on-needs-runtime.rs`
+error: aborting due to previous error
 
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/parser/macro/pub-item-macro.rs b/src/test/ui/parser/macro/pub-item-macro.rs
index 7bab8653982..bae90227c62 100644
--- a/src/test/ui/parser/macro/pub-item-macro.rs
+++ b/src/test/ui/parser/macro/pub-item-macro.rs
@@ -14,5 +14,5 @@ mod foo {
 }
 
 fn main() {
-    let y: u32 = foo::x;
+    let y: u32 = foo::x; //~ ERROR static `x` is private
 }
diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr
index a801986ed4e..fb7a1fce549 100644
--- a/src/test/ui/parser/macro/pub-item-macro.stderr
+++ b/src/test/ui/parser/macro/pub-item-macro.stderr
@@ -9,5 +9,12 @@ LL |     pub_x!();
    |
    = help: try adjusting the macro to put `pub` inside the invocation
 
-error: aborting due to previous error
+error[E0603]: static `x` is private
+  --> $DIR/pub-item-macro.rs:27:23
+   |
+LL |     let y: u32 = foo::x; //~ ERROR static `x` is private
+   |                       ^
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs
index 50678818bf8..0b082f4818f 100644
--- a/src/test/ui/proc-macro/issue-41211.rs
+++ b/src/test/ui/proc-macro/issue-41211.rs
@@ -7,6 +7,7 @@
 
 #![emit_unchanged]
 //~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
+//~| ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro
 extern crate issue_41211;
 use issue_41211::emit_unchanged;
 
diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr
index 41f51aea6fc..2c702c7871d 100644
--- a/src/test/ui/proc-macro/issue-41211.stderr
+++ b/src/test/ui/proc-macro/issue-41211.stderr
@@ -6,6 +6,12 @@ LL | #![emit_unchanged]
    |
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error: aborting due to previous error
+error: inconsistent resolution for a macro: first custom attribute, then attribute macro
+  --> $DIR/issue-41211.rs:18:4
+   |
+LL | #![emit_unchanged]
+   |    ^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/lifetimes.rs b/src/test/ui/proc-macro/lifetimes.rs
index 44700ca447d..d0dd1b4603b 100644
--- a/src/test/ui/proc-macro/lifetimes.rs
+++ b/src/test/ui/proc-macro/lifetimes.rs
@@ -7,3 +7,5 @@ extern crate lifetimes;
 use lifetimes::*;
 
 type A = single_quote_alone!(); //~ ERROR expected type, found `'`
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/more-gates.rs b/src/test/ui/proc-macro/more-gates.rs
index e3fb96b90ed..b870b438a65 100644
--- a/src/test/ui/proc-macro/more-gates.rs
+++ b/src/test/ui/proc-macro/more-gates.rs
@@ -1,5 +1,7 @@
 // aux-build:more-gates.rs
 
+#![feature(decl_macro)]
+
 extern crate more_gates as foo;
 
 use foo::*;
diff --git a/src/test/ui/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs
index 2e12c34b99b..799f1de586e 100644
--- a/src/test/ui/proc-macro/parent-source-spans.rs
+++ b/src/test/ui/proc-macro/parent-source-spans.rs
@@ -28,6 +28,9 @@ macro three($($tokens:tt)*) {
 
 macro four($($tokens:tt)*) {
     parent_source_spans!($($tokens)*);
+    //~^ ERROR cannot find value `ok` in this scope
+    //~| ERROR cannot find value `ok` in this scope
+    //~| ERROR cannot find value `ok` in this scope
 }
 
 fn main() {
diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr
index c39d4c19eb5..2d9ebff88cb 100644
--- a/src/test/ui/proc-macro/parent-source-spans.stderr
+++ b/src/test/ui/proc-macro/parent-source-spans.stderr
@@ -124,5 +124,33 @@ error: second source: "hop"
 LL |     three!("hip", "hop");
    |                   ^^^^^
 
-error: aborting due to 18 previous errors
+error[E0425]: cannot find value `ok` in this scope
+  --> $DIR/parent-source-spans.rs:40:5
+   |
+LL |     parent_source_spans!($($tokens)*);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL |     one!("hello", "world");
+   |     ----------------------- in this macro invocation
+
+error[E0425]: cannot find value `ok` in this scope
+  --> $DIR/parent-source-spans.rs:40:5
+   |
+LL |     parent_source_spans!($($tokens)*);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL |     two!("yay", "rust");
+   |     -------------------- in this macro invocation
+
+error[E0425]: cannot find value `ok` in this scope
+  --> $DIR/parent-source-spans.rs:40:5
+   |
+LL |     parent_source_spans!($($tokens)*);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL |     three!("hip", "hop");
+   |     --------------------- in this macro invocation
+
+error: aborting due to 21 previous errors
 
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs
index e05828209ad..1cc824e943c 100644
--- a/src/test/ui/proc-macro/proc-macro-attributes.rs
+++ b/src/test/ui/proc-macro/proc-macro-attributes.rs
@@ -3,11 +3,12 @@
 #[macro_use]
 extern crate derive_b;
 
-#[B]
+#[B] //~ ERROR `B` is ambiguous
 #[C] //~ ERROR attribute `C` is currently unknown to the compiler
-#[B(D)]
-#[B(E = "foo")]
-#[B(arbitrary tokens)]
+#[B(D)] //~ ERROR `B` is ambiguous
+#[B(E = "foo")] //~ ERROR `B` is ambiguous
+#[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+                       //~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens`
 #[derive(B)]
 struct B;
 
diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr
index ecdc5558851..8b87e482282 100644
--- a/src/test/ui/proc-macro/proc-macro-attributes.stderr
+++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr
@@ -6,6 +6,81 @@ LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler
    |
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/proc-macro-attributes.rs:16:3
+   |
+LL | #[B] //~ ERROR `B` is ambiguous
+   |   ^ ambiguous name
+   |
+note: `B` could refer to the derive helper attribute defined here
+  --> $DIR/proc-macro-attributes.rs:22:10
+   |
+LL | #[derive(B)]
+   |          ^
+note: `B` could also refer to the derive macro imported here
+  --> $DIR/proc-macro-attributes.rs:13:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/proc-macro-attributes.rs:18:3
+   |
+LL | #[B(D)] //~ ERROR `B` is ambiguous
+   |   ^ ambiguous name
+   |
+note: `B` could refer to the derive helper attribute defined here
+  --> $DIR/proc-macro-attributes.rs:22:10
+   |
+LL | #[derive(B)]
+   |          ^
+note: `B` could also refer to the derive macro imported here
+  --> $DIR/proc-macro-attributes.rs:13:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/proc-macro-attributes.rs:19:3
+   |
+LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous
+   |   ^ ambiguous name
+   |
+note: `B` could refer to the derive helper attribute defined here
+  --> $DIR/proc-macro-attributes.rs:22:10
+   |
+LL | #[derive(B)]
+   |          ^
+note: `B` could also refer to the derive macro imported here
+  --> $DIR/proc-macro-attributes.rs:13:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/proc-macro-attributes.rs:20:3
+   |
+LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+   |   ^ ambiguous name
+   |
+note: `B` could refer to the derive helper attribute defined here
+  --> $DIR/proc-macro-attributes.rs:22:10
+   |
+LL | #[derive(B)]
+   |          ^
+note: `B` could also refer to the derive macro imported here
+  --> $DIR/proc-macro-attributes.rs:13:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^
+
+error: expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens`
+  --> $DIR/proc-macro-attributes.rs:20:15
+   |
+LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+   |               ^^^^^^ expected one of `(`, `)`, `,`, `::`, or `=` here
+
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0658`.
+Some errors occurred: E0658, E0659.
+For more information about an error, try `rustc --explain E0658`.
diff --git a/src/test/ui/quote-with-interpolated.rs b/src/test/ui/quote-with-interpolated.rs
index dd79d2b3e4a..b948226652b 100644
--- a/src/test/ui/quote-with-interpolated.rs
+++ b/src/test/ui/quote-with-interpolated.rs
@@ -2,7 +2,12 @@
 fn main() {
     macro_rules! foo {
         ($bar:expr)  => {
-            quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token
+            quote_expr!(cx, $bar)
+            //~^ ERROR quote! with interpolated token
+            //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`?
+            //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`?
+            //~| ERROR cannot find value `cx` in this scope
+            //~| ERROR cannot find function `new_parser_from_tts` in this scope
         }
     }
     foo!(bar);
diff --git a/src/test/ui/quote-with-interpolated.stderr b/src/test/ui/quote-with-interpolated.stderr
index 89f4db0ad3c..3c582286662 100644
--- a/src/test/ui/quote-with-interpolated.stderr
+++ b/src/test/ui/quote-with-interpolated.stderr
@@ -1,11 +1,40 @@
 error: quote! with interpolated token
   --> $DIR/quote-with-interpolated.rs:5:29
    |
-LL |             quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token
+LL |             quote_expr!(cx, $bar)
    |                             ^^^^
 ...
 LL |     foo!(bar);
    |     ---------- in this macro invocation
 
-error: aborting due to previous error
+error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`?
+  --> $DIR/quote-with-interpolated.rs:15:13
+   |
+LL |             quote_expr!(cx, $bar)
+   |             ^^^^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate syntax;`?
+
+error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`?
+  --> $DIR/quote-with-interpolated.rs:15:29
+   |
+LL |             quote_expr!(cx, $bar)
+   |                             ^^^^ maybe a missing `extern crate syntax;`?
+
+error[E0425]: cannot find value `cx` in this scope
+  --> $DIR/quote-with-interpolated.rs:15:25
+   |
+LL |             quote_expr!(cx, $bar)
+   |                         ^^ not found in this scope
+...
+LL |     foo!(bar);
+   |     ---------- in this macro invocation
+
+error[E0425]: cannot find function `new_parser_from_tts` in this scope
+  --> $DIR/quote-with-interpolated.rs:15:13
+   |
+LL |             quote_expr!(cx, $bar)
+   |             ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 5 previous errors
 
+Some errors occurred: E0425, E0433.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/reserved/reserved-attr-on-macro.rs b/src/test/ui/reserved/reserved-attr-on-macro.rs
index 0b00d711036..96c63ba4db8 100644
--- a/src/test/ui/reserved/reserved-attr-on-macro.rs
+++ b/src/test/ui/reserved/reserved-attr-on-macro.rs
@@ -1,8 +1,9 @@
-#[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
+#[rustc_attribute_should_be_reserved]
+//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved
 macro_rules! foo {
     () => (());
 }
 
 fn main() {
-    foo!();
+    foo!(); //~ ERROR cannot determine resolution for the macro `foo`
 }
diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr
index 0d7fa707722..4f1c0e1aa70 100644
--- a/src/test/ui/reserved/reserved-attr-on-macro.stderr
+++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr
@@ -1,11 +1,19 @@
 error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
   --> $DIR/reserved-attr-on-macro.rs:1:3
    |
-LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
+LL | #[rustc_attribute_should_be_reserved]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(rustc_attrs)] to the crate attributes to enable
 
-error: aborting due to previous error
+error: cannot determine resolution for the macro `foo`
+  --> $DIR/reserved-attr-on-macro.rs:18:5
+   |
+LL |     foo!(); //~ ERROR cannot determine resolution for the macro `foo`
+   |     ^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/self/self_type_keyword.rs b/src/test/ui/self/self_type_keyword.rs
index 742318d1e95..4a1681e4e2b 100644
--- a/src/test/ui/self/self_type_keyword.rs
+++ b/src/test/ui/self/self_type_keyword.rs
@@ -7,6 +7,7 @@ mod foo {
 
 struct Bar<'Self>;
 //~^ ERROR lifetimes cannot use keyword names
+//~| ERROR parameter `'Self` is never used
 
 struct Foo;
 
diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr
index 3b095b78418..1981e23c88a 100644
--- a/src/test/ui/self/self_type_keyword.stderr
+++ b/src/test/ui/self/self_type_keyword.stderr
@@ -58,5 +58,14 @@ error: cannot find macro `Self!` in this scope
 LL |         Self!() => (),
    |         ^^^^
 
-error: aborting due to 10 previous errors
+error[E0392]: parameter `'Self` is never used
+  --> $DIR/self_type_keyword.rs:18:12
+   |
+LL | struct Bar<'Self>;
+   |            ^^^^^ unused type parameter
+   |
+   = help: consider removing `'Self` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 11 previous errors
 
+For more information about this error, try `rustc --explain E0392`.
diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs
index 663e5207519..e11be9e17f2 100644
--- a/src/test/ui/span/issue-36530.rs
+++ b/src/test/ui/span/issue-36530.rs
@@ -5,3 +5,5 @@ mod foo {
     #![foo] //~ ERROR is currently unknown to the compiler
             //~| ERROR non-builtin inner attributes are unstable
 }
+
+fn main() {}
diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs
index f36574e2b3d..b077d590915 100644
--- a/src/test/ui/span/macro-ty-params.rs
+++ b/src/test/ui/span/macro-ty-params.rs
@@ -4,9 +4,11 @@ macro_rules! m {
     }
 }
 
+macro_rules! foo { () => () }
+
 fn main() {
     foo::<T>!(); //~ ERROR generic arguments in macro path
     foo::<>!(); //~ ERROR generic arguments in macro path
-    m!(MyTrait<>); //~ ERROR generic arguments in macro path
+    m!(Default<>); //~ ERROR generic arguments in macro path
     //~^ ERROR unexpected generic arguments in path
 }
diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr
index 79ae4a7e784..c1dcc513f3a 100644
--- a/src/test/ui/span/macro-ty-params.stderr
+++ b/src/test/ui/span/macro-ty-params.stderr
@@ -1,26 +1,25 @@
 error: unexpected generic arguments in path
   --> $DIR/macro-ty-params.rs:10:8
    |
-LL |     m!(MyTrait<>); //~ ERROR generic arguments in macro path
-   |        ^^^^^^^^^
+LL |     foo::<T>!(); //~ ERROR generic arguments in macro path
+   |        ^^^^^
 
 error: generic arguments in macro path
   --> $DIR/macro-ty-params.rs:10:15
    |
-LL |     m!(MyTrait<>); //~ ERROR generic arguments in macro path
-   |               ^^
+LL |     foo::<>!(); //~ ERROR generic arguments in macro path
+   |        ^^^^
 
 error: generic arguments in macro path
   --> $DIR/macro-ty-params.rs:8:8
    |
-LL |     foo::<T>!(); //~ ERROR generic arguments in macro path
-   |        ^^^^^
+LL |     m!(Default<>); //~ ERROR generic arguments in macro path
+   |        ^^^^^^^^^
 
 error: generic arguments in macro path
   --> $DIR/macro-ty-params.rs:9:8
    |
-LL |     foo::<>!(); //~ ERROR generic arguments in macro path
-   |        ^^^^
+LL |     m!(Default<>); //~ ERROR generic arguments in macro path
+   |               ^^
 
 error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/span/visibility-ty-params.rs b/src/test/ui/span/visibility-ty-params.rs
index a9aaabad95c..d77febe0aa2 100644
--- a/src/test/ui/span/visibility-ty-params.rs
+++ b/src/test/ui/span/visibility-ty-params.rs
@@ -4,6 +4,7 @@ macro_rules! m {
 
 struct S<T>(T);
 m!{ S<u8> } //~ ERROR unexpected generic arguments in path
+            //~| ERROR expected module, found struct `S`
 
 mod m {
     m!{ m<> } //~ ERROR unexpected generic arguments in path
diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr
index 52b8042ba45..9a11eea6532 100644
--- a/src/test/ui/span/visibility-ty-params.stderr
+++ b/src/test/ui/span/visibility-ty-params.stderr
@@ -10,5 +10,14 @@ error: unexpected generic arguments in path
 LL |     m!{ m<> } //~ ERROR unexpected generic arguments in path
    |         ^^^
 
-error: aborting due to 2 previous errors
+error[E0577]: expected module, found struct `S`
+  --> $DIR/visibility-ty-params.rs:16:5
+   |
+LL | m!{ S<u8> } //~ ERROR unexpected generic arguments in path
+   |     -^^^^
+   |     |
+   |     did you mean `m`?
+
+error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0577`.
diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.rs b/src/test/ui/tuple/tuple-struct-fields/test2.rs
index 7c8e9bbb23c..fc0f78b12c9 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test2.rs
+++ b/src/test/ui/tuple/tuple-struct-fields/test2.rs
@@ -8,5 +8,7 @@ macro_rules! define_struct {
 }
 
 mod foo {
-    define_struct! { (foo) }
+    define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
 }
+
+fn main() {}
diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
index 9aba84046a1..baca625b0bd 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test2.stderr
+++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
@@ -4,8 +4,15 @@ error: expected one of `)` or `,`, found `(`
 LL |         struct S3(pub $t ());
    |                          ^ expected one of `)` or `,` here
 ...
-LL |     define_struct! { (foo) }
+LL |     define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
    |     ------------------------ in this macro invocation
 
-error: aborting due to previous error
+error[E0412]: cannot find type `foo` in this scope
+  --> $DIR/test2.rs:21:23
+   |
+LL |     define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
+   |                       ^^^ not found in this scope
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.rs b/src/test/ui/tuple/tuple-struct-fields/test3.rs
index 8d7c7c35caf..6b8534b4524 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test3.rs
+++ b/src/test/ui/tuple/tuple-struct-fields/test3.rs
@@ -8,5 +8,7 @@ macro_rules! define_struct {
 }
 
 mod foo {
-    define_struct! { foo }
+    define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
 }
+
+fn main() {}
diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
index fc71354a9d6..2da34fff53d 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test3.stderr
+++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
@@ -4,8 +4,15 @@ error: expected one of `)` or `,`, found `(`
 LL |         struct S3(pub($t) ());
    |                           ^ expected one of `)` or `,` here
 ...
-LL |     define_struct! { foo }
+LL |     define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
    |     ---------------------- in this macro invocation
 
-error: aborting due to previous error
+error[E0412]: cannot find type `foo` in this scope
+  --> $DIR/test3.rs:21:22
+   |
+LL |     define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
+   |                      ^^^ not found in this scope
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0412`.