From fd302f46dcf80cc23358f0f31744d6083a6997c1 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 13 Nov 2019 13:01:43 +0100 Subject: [PATCH 1/7] Store `TokenStream` in `rmeta::MacroDef`. This removes a hack from `load_macro_untracked` in which parsing is used. --- Cargo.lock | 2 - src/librustc/dep_graph/dep_node.rs | 2 + src/librustc/lint.rs | 11 +---- src/librustc/middle/stability.rs | 2 +- src/librustc_errors/emitter.rs | 16 ++++---- src/librustc_expand/mbe/macro_rules.rs | 6 +-- src/librustc_macros/src/symbols.rs | 4 ++ src/librustc_metadata/Cargo.toml | 2 - src/librustc_metadata/rmeta/decoder.rs | 4 +- .../rmeta/decoder/cstore_impl.rs | 41 +++++++------------ src/librustc_metadata/rmeta/encoder.rs | 3 +- src/librustc_metadata/rmeta/mod.rs | 3 +- src/librustc_span/lib.rs | 22 +--------- src/librustc_span/source_map.rs | 6 +++ src/librustc_typeck/check/demand.rs | 6 +-- src/librustdoc/html/render.rs | 2 +- src/librustdoc/html/sources.rs | 2 +- 17 files changed, 51 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8505470a66306..aefd40bfaa59e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3891,14 +3891,12 @@ dependencies = [ "memmap", "rustc", "rustc_ast", - "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", "rustc_errors", "rustc_expand", "rustc_hir", "rustc_index", - "rustc_parse", "rustc_span", "rustc_target", "serialize", diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index eb7e2871bfcd8..3f0730169ecf6 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -111,6 +111,7 @@ macro_rules! define_dep_nodes { ) => ( #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] + #[allow(non_camel_case_types)] pub enum DepKind { $($variant),* } @@ -173,6 +174,7 @@ macro_rules! define_dep_nodes { pub struct DepConstructor; + #[allow(non_camel_case_types)] impl DepConstructor { $( #[inline(always)] diff --git a/src/librustc/lint.rs b/src/librustc/lint.rs index 004835b230ab4..dcc8dcbf21961 100644 --- a/src/librustc/lint.rs +++ b/src/librustc/lint.rs @@ -344,15 +344,8 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool { ExpnKind::Root | ExpnKind::Desugaring(DesugaringKind::ForLoop) => false, ExpnKind::AstPass(_) | ExpnKind::Desugaring(_) => true, // well, it's "external" ExpnKind::Macro(MacroKind::Bang, _) => { - if expn_data.def_site.is_dummy() { - // Dummy span for the `def_site` means it's an external macro. - return true; - } - match sess.source_map().span_to_snippet(expn_data.def_site) { - Ok(code) => !code.starts_with("macro_rules"), - // No snippet means external macro or compiler-builtin expansion. - Err(_) => true, - } + // Dummy span for the `def_site` means it's an external macro. + expn_data.def_site.is_dummy() || sess.source_map().is_imported(expn_data.def_site) } ExpnKind::Macro(..) => true, // definitely a plugin } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 9d3df9623bd62..cf917daef8388 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -110,7 +110,7 @@ pub fn report_unstable( let span_key = msp.primary_span().and_then(|sp: Span| { if !sp.is_dummy() { let file = sm.lookup_char_pos(sp.lo()).file; - if file.name.is_macros() { None } else { Some(span) } + if file.is_imported() { None } else { Some(span) } } else { None } diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index eb9d4b887ad1d..b38ea6b424191 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -414,8 +414,8 @@ pub trait Emitter { } // This does a small "fix" for multispans by looking to see if it can find any that - // point directly at <*macros>. Since these are often difficult to read, this - // will change the span to point at the use site. + // point directly at external macros. Since these are often difficult to read, + // this will change the span to point at the use site. fn fix_multispans_in_extern_macros( &self, source_map: &Option>, @@ -427,9 +427,9 @@ pub trait Emitter { } } - // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of - // <*macros>. Since these locations are often difficult to read, we move these Spans from - // <*macros> to their corresponding use site. + // This "fixes" MultiSpans that contain `Span`s pointing to locations inside of external macros. + // Since these locations are often difficult to read, + // we move these spans from the external macros to their corresponding use site. fn fix_multispan_in_extern_macros( &self, source_map: &Option>, @@ -440,14 +440,14 @@ pub trait Emitter { None => return, }; - // First, find all the spans in <*macros> and point instead at their use site + // First, find all the spans in external macros and point instead at their use site. let replacements: Vec<(Span, Span)> = span .primary_spans() .iter() .copied() .chain(span.span_labels().iter().map(|sp_label| sp_label.span)) .filter_map(|sp| { - if !sp.is_dummy() && sm.span_to_filename(sp).is_macros() { + if !sp.is_dummy() && sm.is_imported(sp) { let maybe_callsite = sp.source_callsite(); if sp != maybe_callsite { return Some((sp, maybe_callsite)); @@ -457,7 +457,7 @@ pub trait Emitter { }) .collect(); - // After we have them, make sure we replace these 'bad' def sites with their use sites + // After we have them, make sure we replace these 'bad' def sites with their use sites. for (from, to) in replacements { span.replace(from, to); } diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 51b172a21148c..3040a9aefbb30 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -105,10 +105,10 @@ impl<'a> ParserAnyMacro<'a> { if e.span.is_dummy() { // Get around lack of span in error (#30128) e.replace_span_with(site_span); - if parser.sess.source_map().span_to_filename(arm_span).is_real() { + if !parser.sess.source_map().is_imported(arm_span) { e.span_label(arm_span, "in this macro arm"); } - } else if !parser.sess.source_map().span_to_filename(parser.token.span).is_real() { + } else if parser.sess.source_map().is_imported(parser.token.span) { e.span_label(site_span, "in this macro invocation"); } match kind { @@ -297,7 +297,7 @@ fn generic_extension<'cx>( let span = token.span.substitute_dummy(sp); let mut err = cx.struct_span_err(span, &parse_failure_msg(&token)); err.span_label(span, label); - if !def_span.is_dummy() && cx.source_map().span_to_filename(def_span).is_real() { + if !def_span.is_dummy() && !cx.source_map().is_imported(def_span) { err.span_label(cx.source_map().def_span(def_span), "when calling this macro"); } diff --git a/src/librustc_macros/src/symbols.rs b/src/librustc_macros/src/symbols.rs index feddcd5f99429..0f8bc4323070b 100644 --- a/src/librustc_macros/src/symbols.rs +++ b/src/librustc_macros/src/symbols.rs @@ -103,6 +103,7 @@ pub fn symbols(input: TokenStream) -> TokenStream { #value, }); keyword_stream.extend(quote! { + #[allow(non_upper_case_globals)] pub const #name: Symbol = Symbol::new(#counter); }); counter += 1; @@ -120,6 +121,8 @@ pub fn symbols(input: TokenStream) -> TokenStream { #value, }); symbols_stream.extend(quote! { + #[allow(rustc::default_hash_types)] + #[allow(non_upper_case_globals)] pub const #name: Symbol = Symbol::new(#counter); }); counter += 1; @@ -149,6 +152,7 @@ pub fn symbols(input: TokenStream) -> TokenStream { () => { #symbols_stream + #[allow(non_upper_case_globals)] pub const digits_array: &[Symbol; 10] = &[ #digits_stream ]; diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 8abfb20965e48..a8e308c5c9e87 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -15,7 +15,6 @@ log = "0.4" memmap = "0.7" smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc = { path = "../librustc" } -rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_attr = { path = "../librustc_attr" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } @@ -26,7 +25,6 @@ rustc_serialize = { path = "../libserialize", package = "serialize" } stable_deref_trait = "1.0.0" rustc_ast = { path = "../librustc_ast" } rustc_expand = { path = "../librustc_expand" } -rustc_parse = { path = "../librustc_parse" } rustc_span = { path = "../librustc_span" } [target.'cfg(windows)'.dependencies] diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index a72ee0cbe4729..c2a306a0a0c94 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -1333,9 +1333,9 @@ impl<'a, 'tcx> CrateMetadata { } } - fn get_macro(&self, id: DefIndex) -> MacroDef { + fn get_macro(&self, id: DefIndex, sess: &Session) -> MacroDef { match self.kind(id) { - EntryKind::MacroDef(macro_def) => macro_def.decode(self), + EntryKind::MacroDef(macro_def) => macro_def.decode((self, sess)), _ => bug!(), } } diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index be229350f3bcc..8062252df969f 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -14,27 +14,22 @@ use rustc::session::{CrateDisambiguator, Session}; use rustc::ty::query::Providers; use rustc::ty::query::QueryConfig; use rustc::ty::{self, TyCtxt}; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::expand::allocator::AllocatorKind; +use rustc_ast::ptr::P; +use rustc_ast::tokenstream::DelimSpan; use rustc_data_structures::svh::Svh; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc_parse::parser::emit_unclosed_delims; -use rustc_parse::source_file_to_stream; +use rustc_span::source_map::{self, Span, Spanned}; +use rustc_span::symbol::Symbol; use rustc_data_structures::sync::Lrc; use smallvec::SmallVec; use std::any::Any; use std::sync::Arc; -use rustc_ast::ast; -use rustc_ast::attr; -use rustc_ast::expand::allocator::AllocatorKind; -use rustc_ast::ptr::P; -use rustc_ast::tokenstream::DelimSpan; -use rustc_span::source_map; -use rustc_span::source_map::Spanned; -use rustc_span::symbol::Symbol; -use rustc_span::{FileName, Span}; - macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { @@ -419,15 +414,9 @@ impl CStore { return LoadedMacro::ProcMacro(data.load_proc_macro(id.index, sess)); } - let def = data.get_macro(id.index); - let macro_full_name = data.def_path(id.index).to_string_friendly(|_| data.root.name); - let source_name = FileName::Macros(macro_full_name); - - let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body); - let local_span = Span::with_root_ctxt(source_file.start_pos, source_file.end_pos); - let dspan = DelimSpan::from_single(local_span); - let (body, mut errors) = source_file_to_stream(&sess.parse_sess, source_file, None); - emit_unclosed_delims(&mut errors, &sess.parse_sess); + let span = data.get_span(id.index, sess); + let dspan = DelimSpan::from_single(span); + let rmeta::MacroDef { body, legacy } = data.get_macro(id.index, sess); // Mark the attrs as used let attrs = data.get_item_attrs(id.index, sess); @@ -441,22 +430,20 @@ impl CStore { .data .get_opt_name() .expect("no name in load_macro"); - sess.imported_macro_spans - .borrow_mut() - .insert(local_span, (name.to_string(), data.get_span(id.index, sess))); + sess.imported_macro_spans.borrow_mut().insert(span, (name.to_string(), span)); LoadedMacro::MacroDef( ast::Item { // FIXME: cross-crate hygiene ident: ast::Ident::with_dummy_span(name), id: ast::DUMMY_NODE_ID, - span: local_span, + span, attrs: attrs.iter().cloned().collect(), kind: ast::ItemKind::MacroDef(ast::MacroDef { body: P(ast::MacArgs::Delimited(dspan, ast::MacDelimiter::Brace, body)), - legacy: def.legacy, + legacy, }), - vis: source_map::respan(local_span.shrink_to_lo(), ast::VisibilityKind::Inherited), + vis: source_map::respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited), tokens: None, }, data.root.edition, diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 7624b1d562f08..2b04918296d06 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -1235,10 +1235,9 @@ impl EncodeContext<'tcx> { /// Serialize the text of exported macros fn encode_info_for_macro_def(&mut self, macro_def: &hir::MacroDef<'_>) { - use rustc_ast_pretty::pprust; let def_id = self.tcx.hir().local_def_id(macro_def.hir_id); record!(self.per_def.kind[def_id] <- EntryKind::MacroDef(self.lazy(MacroDef { - body: pprust::tts_to_string(macro_def.body.clone()), + body: macro_def.body.clone(), legacy: macro_def.legacy, }))); record!(self.per_def.visibility[def_id] <- ty::Visibility::Public); diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 1553b6cf0affd..89e26b15d502b 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -11,6 +11,7 @@ use rustc::session::config::SymbolManglingVersion; use rustc::session::CrateDisambiguator; use rustc::ty::{self, ReprOptions, Ty}; use rustc_ast::ast; +use rustc_ast::tokenstream::TokenStream; use rustc_attr as attr; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; @@ -324,7 +325,7 @@ struct ModData { #[derive(RustcEncodable, RustcDecodable)] struct MacroDef { - body: String, + body: TokenStream, legacy: bool, } diff --git a/src/librustc_span/lib.rs b/src/librustc_span/lib.rs index 502ea64aab9b5..1d493da9e5b11 100644 --- a/src/librustc_span/lib.rs +++ b/src/librustc_span/lib.rs @@ -83,8 +83,6 @@ scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); )] pub enum FileName { Real(PathBuf), - /// A macro. This includes the full name of the macro, so that there are no clashes. - Macros(String), /// Call to `quote!`. QuoteExpansion(u64), /// Command line. @@ -107,7 +105,6 @@ impl std::fmt::Display for FileName { use FileName::*; match *self { Real(ref path) => write!(fmt, "{}", path.display()), - Macros(ref name) => write!(fmt, "<{} macros>", name), QuoteExpansion(_) => write!(fmt, ""), MacroExpansion(_) => write!(fmt, ""), Anon(_) => write!(fmt, ""), @@ -132,8 +129,7 @@ impl FileName { use FileName::*; match *self { Real(_) => true, - Macros(_) - | Anon(_) + Anon(_) | MacroExpansion(_) | ProcMacroSourceCode(_) | CfgSpec(_) @@ -144,22 +140,6 @@ impl FileName { } } - pub fn is_macros(&self) -> bool { - use FileName::*; - match *self { - Real(_) - | Anon(_) - | MacroExpansion(_) - | ProcMacroSourceCode(_) - | CfgSpec(_) - | CliCrateAttr(_) - | Custom(_) - | QuoteExpansion(_) - | DocTest(_, _) => false, - Macros(_) => true, - } - } - pub fn quote_expansion_source_code(src: &str) -> FileName { let mut hasher = StableHasher::new(); src.hash(&mut hasher); diff --git a/src/librustc_span/source_map.rs b/src/librustc_span/source_map.rs index cd2d2c4c3d768..65095c6f1317c 100644 --- a/src/librustc_span/source_map.rs +++ b/src/librustc_span/source_map.rs @@ -975,6 +975,12 @@ impl SourceMap { _ => None, }) } + + pub fn is_imported(&self, sp: Span) -> bool { + let source_file_index = self.lookup_source_file_idx(sp.lo()); + let source_file = &self.files()[source_file_index]; + source_file.is_imported() + } } #[derive(Clone)] diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 3a2a315a1027d..6df9d0541952c 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -373,7 +373,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> Option<(Span, &'static str, String)> { let sm = self.sess().source_map(); let sp = expr.span; - if !sm.span_to_filename(sp).is_real() { + if sm.is_imported(sp) { // Ignore if span is from within a macro #41858, #58298. We previously used the macro // call span, but that breaks down when the type error comes from multiple calls down. return None; @@ -523,7 +523,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // We have `&T`, check if what was expected was `T`. If so, // we may want to suggest removing a `&`. - if !sm.span_to_filename(expr.span).is_real() { + if sm.is_imported(expr.span) { if let Ok(code) = sm.span_to_snippet(sp) { if code.starts_with('&') { return Some(( @@ -601,7 +601,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // FIXME(estebank): modify once we decide to suggest `as` casts return false; } - if !self.tcx.sess.source_map().span_to_filename(expr.span).is_real() { + if self.tcx.sess.source_map().is_imported(expr.span) { // Ignore if span is from within a macro. return false; } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index c64c476970862..31e91dac4d19c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1565,7 +1565,7 @@ impl Context { let mut path = String::new(); - // We can safely ignore macros from other libraries + // We can safely ignore synthetic `SourceFile`s. let file = match item.source.filename { FileName::Real(ref path) => path, _ => return None, diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 79e7d3d783b80..86f46b2d7e154 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -35,7 +35,7 @@ impl<'a> DocFolder for SourceCollector<'a> { // If we're including source files, and we haven't seen this file yet, // then we need to render it out to the filesystem. if self.scx.include_sources - // skip all invalid or macro spans + // skip all synthetic "files" && item.source.filename.is_real() // skip non-local items && item.def_id.is_local() From 192d134e804e7d1c0cb9cb7a87c89de55f662f2f Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 14 Nov 2019 11:40:01 +0100 Subject: [PATCH 2/7] pacify rustdoc by using better url --- src/test/rustdoc/issue-26606.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/issue-26606.rs b/src/test/rustdoc/issue-26606.rs index 6de419ec571df..d2aa4bbbd1251 100644 --- a/src/test/rustdoc/issue-26606.rs +++ b/src/test/rustdoc/issue-26606.rs @@ -7,5 +7,5 @@ extern crate issue_26606_macro; // @has issue_26606/constant.FOO.html -// @!has - '//a/@href' '../src/' +// @has - '//a/@href' '../src/issue_26606/auxiliary/issue-26606-macro.rs.html#3' make_item!(FOO); From b3bc4272287f1d245236d92fe1ab3c1f41e967de Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 10 Feb 2020 17:38:51 +0100 Subject: [PATCH 3/7] adjust span-api-tests.rs --- src/test/ui/proc-macro/span-api-tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/ui/proc-macro/span-api-tests.rs b/src/test/ui/proc-macro/span-api-tests.rs index 3667e14c9e058..cbceea1b4f35a 100644 --- a/src/test/ui/proc-macro/span-api-tests.rs +++ b/src/test/ui/proc-macro/span-api-tests.rs @@ -11,7 +11,7 @@ extern crate span_test_macros; extern crate span_api_tests; -use span_api_tests::{reemit, assert_fake_source_file, assert_source_file, macro_stringify}; +use span_api_tests::{reemit, assert_source_file, macro_stringify}; macro_rules! say_hello { ($macname:ident) => ( $macname! { "Hello, world!" }) @@ -25,7 +25,7 @@ reemit_legacy! { assert_source_file! { "Hello, world!" } } -say_hello_extern! { assert_fake_source_file } +say_hello_extern! { assert_source_file } reemit! { assert_source_file! { "Hello, world!" } From cf2d4236eb311b80407678b0527b810ecdd335b7 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 10 Feb 2020 17:37:12 +0100 Subject: [PATCH 4/7] --bless some tests --- ...dition-keywords-2015-2018-expansion.stderr | 4 +- .../edition-keywords-2018-2015-parsing.stderr | 6 +- ...dition-keywords-2018-2018-expansion.stderr | 4 +- .../edition-keywords-2018-2018-parsing.stderr | 6 +- .../main.-Zmacro-backtrace.stderr | 104 +++++++------- src/test/ui/macros/unknown-builtin.stderr | 10 +- .../method-on-ambiguous-numeric-type.stderr | 7 +- src/test/ui/proc-macro/mixed-site-span.stderr | 19 +-- src/test/ui/proc-macro/multispan.stderr | 133 ++++-------------- src/test/ui/proc-macro/three-equals.stderr | 19 +-- 10 files changed, 112 insertions(+), 200 deletions(-) diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index f44f81fce7134..46db5dbc8b3c5 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -7,8 +7,8 @@ LL | produces_async! {} = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: you can escape reserved keywords to use them as identifiers | -LL | () => (pub fn r#async () { }) - | ^^^^^^^ +LL | r#async + | error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index 22a7495ca234a..e12d1a48463d7 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -33,10 +33,10 @@ LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> <::edition_kw_macro_2015::passes_ident macros>:1:22 + --> $DIR/auxiliary/edition-kw-macro-2015.rs:27:23 | -LL | ($ i : ident) => ($ i) - | ^ expected one of `move`, `|`, or `||` +LL | ($i: ident) => ($i) + | ^ expected one of `move`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2015-parsing.rs:16:8 | diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index a8fc58fc0cb8d..2de383d0bcaed 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -7,8 +7,8 @@ LL | produces_async! {} = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: you can escape reserved keywords to use them as identifiers | -LL | () => (pub fn r#async () { }) - | ^^^^^^^ +LL | r#async + | error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index 7488fcc2e584e..110165fc077ca 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -33,10 +33,10 @@ LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> <::edition_kw_macro_2018::passes_ident macros>:1:22 + --> $DIR/auxiliary/edition-kw-macro-2018.rs:27:23 | -LL | ($ i : ident) => ($ i) - | ^ expected one of `move`, `|`, or `||` +LL | ($i: ident) => ($i) + | ^ expected one of `move`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2018-parsing.rs:16:8 | diff --git a/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr index 41ed545cf1687..2f3d48bf03907 100644 --- a/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr +++ b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr @@ -13,66 +13,70 @@ LL | pong!(); error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:10:20 | -LL | / macro_rules! pong { -LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens -LL | | } - | |_- in this expansion of `pong!` +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |__- in this expansion of `pong!` ... -LL | ping!(); - | -------- in this macro invocation +LL | ping!(); + | -------- in this macro invocation | - ::: <::ping::ping macros>:1:1 + ::: $DIR/auxiliary/ping.rs:5:1 | -LL | () => { pong ! () ; } - | --------------------- - | | | - | | in this macro invocation - | in this expansion of `ping!` +LL | / macro_rules! ping { +LL | | () => { +LL | | pong!(); + | | -------- in this macro invocation +LL | | } +LL | | } + | |_- in this expansion of `ping!` error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:10:20 | -LL | / macro_rules! pong { -LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens -LL | | } - | |_- in this expansion of `pong!` (#5) +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |__- in this expansion of `pong!` (#5) ... -LL | deep!(); - | -------- in this macro invocation (#1) +LL | deep!(); + | -------- in this macro invocation (#1) | - ::: <::ping::deep macros>:1:1 + ::: $DIR/auxiliary/ping.rs:5:1 | -LL | () => { foo ! () ; } - | -------------------- - | | | - | | in this macro invocation (#2) - | in this expansion of `deep!` (#1) - | - ::: <::ping::foo macros>:1:1 - | -LL | () => { bar ! () ; } - | -------------------- - | | | - | | in this macro invocation (#3) - | in this expansion of `foo!` (#2) - | - ::: <::ping::bar macros>:1:1 - | -LL | () => { ping ! () ; } - | --------------------- - | | | - | | in this macro invocation (#4) - | in this expansion of `bar!` (#3) - | - ::: <::ping::ping macros>:1:1 - | -LL | () => { pong ! () ; } - | --------------------- - | | | - | | in this macro invocation (#5) - | in this expansion of `ping!` (#4) +LL | / macro_rules! ping { +LL | | () => { +LL | | pong!(); + | | -------- in this macro invocation (#5) +LL | | } +LL | | } + | |_- in this expansion of `ping!` (#4) +... +LL | / macro_rules! deep { +LL | | () => { +LL | | foo!(); + | | ------- in this macro invocation (#2) +LL | | } +LL | | } + | |__- in this expansion of `deep!` (#1) +... +LL | / macro_rules! foo { +LL | | () => { +LL | | bar!(); + | | ------- in this macro invocation (#3) +LL | | } +LL | | } + | |__- in this expansion of `foo!` (#2) +... +LL | / macro_rules! bar { +LL | | () => { +LL | | ping!(); + | | -------- in this macro invocation (#4) +LL | | } +LL | | } + | |__- in this expansion of `bar!` (#3) error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/unknown-builtin.stderr b/src/test/ui/macros/unknown-builtin.stderr index f1e828a46d8f2..665e92f242418 100644 --- a/src/test/ui/macros/unknown-builtin.stderr +++ b/src/test/ui/macros/unknown-builtin.stderr @@ -5,10 +5,14 @@ LL | macro_rules! unknown { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot find a built-in macro with name `line` - --> <::core::macros::builtin::line macros>:1:1 + --> $SRC_DIR/libcore/macros/mod.rs:LL:COL | -LL | () => { } ; - | ^^^^^^^^^^^ +LL | / macro_rules! line { +LL | | () => { +LL | | /* compiler built-in */ +LL | | }; +LL | | } + | |_____^ error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr index 10950834ad345..c6dde67cfeba6 100644 --- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -42,10 +42,13 @@ LL | ($ident:ident) => { let $ident: i32 = 42; } error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` --> $DIR/method-on-ambiguous-numeric-type.rs:30:9 | -LL | mac!(bar); - | ---------- you must specify a type for this binding, like `i32` LL | bar.pow(2); | ^^^ + | +help: you must specify a type for this binding, like `i32` + | +LL | ($ident:ident) => { let $ident: i32 = 42; } + | ^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr index c344147ed93ca..30a4cd7c116a6 100644 --- a/src/test/ui/proc-macro/mixed-site-span.stderr +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -21,21 +21,10 @@ LL | local_def; | ^^^^^^^^^ not found in this scope error[E0412]: cannot find type `ItemUse` in crate `$crate` - --> $DIR/auxiliary/mixed-site-span.rs:14:1 - | -LL | / pub fn proc_macro_rules(input: TokenStream) -> TokenStream { -LL | | if input.is_empty() { -LL | | let id = |s| TokenTree::from(Ident::new(s, Span::mixed_site())); -LL | | let item_def = id("ItemDef"); -... | -LL | | } -LL | | } - | |_^ not found in `$crate` - | - ::: $DIR/mixed-site-span.rs:26:1 - | -LL | pass_dollar_crate!(); - | --------------------- in this macro invocation + --> $DIR/mixed-site-span.rs:26:1 + | +LL | pass_dollar_crate!(); + | ^^^^^^^^^^^^^^^^^^^^^ not found in `$crate` | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: possible candidate is found in another module, you can import it into scope diff --git a/src/test/ui/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr index c9390a04b9e24..4405278528eeb 100644 --- a/src/test/ui/proc-macro/multispan.stderr +++ b/src/test/ui/proc-macro/multispan.stderr @@ -1,19 +1,8 @@ error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:14:5 - | -LL | hello!(hi); - | ----------- in this macro invocation + --> $DIR/multispan.rs:14:5 + | +LL | hello!(hi); + | ^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:14:12 @@ -23,21 +12,10 @@ LL | hello!(hi); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:17:5 - | -LL | hello!(hi hi); - | -------------- in this macro invocation + --> $DIR/multispan.rs:17:5 + | +LL | hello!(hi hi); + | ^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:17:12 @@ -47,21 +25,10 @@ LL | hello!(hi hi); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:20:5 - | -LL | hello!(hi hi hi); - | ----------------- in this macro invocation + --> $DIR/multispan.rs:20:5 + | +LL | hello!(hi hi hi); + | ^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:20:12 @@ -71,21 +38,10 @@ LL | hello!(hi hi hi); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:23:5 - | -LL | hello!(hi hey hi yo hi beep beep hi hi); - | ---------------------------------------- in this macro invocation + --> $DIR/multispan.rs:23:5 + | +LL | hello!(hi hey hi yo hi beep beep hi hi); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:23:12 @@ -95,21 +51,10 @@ LL | hello!(hi hey hi yo hi beep beep hi hi); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:24:5 - | -LL | hello!(hi there, hi how are you? hi... hi.); - | -------------------------------------------- in this macro invocation + --> $DIR/multispan.rs:24:5 + | +LL | hello!(hi there, hi how are you? hi... hi.); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:24:12 @@ -119,21 +64,10 @@ LL | hello!(hi there, hi how are you? hi... hi.); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:25:5 - | -LL | hello!(whoah. hi di hi di ho); - | ------------------------------ in this macro invocation + --> $DIR/multispan.rs:25:5 + | +LL | hello!(whoah. hi di hi di ho); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:25:19 @@ -143,21 +77,10 @@ LL | hello!(whoah. hi di hi di ho); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: hello to you, too! - --> $DIR/auxiliary/multispan.rs:31:1 - | -LL | / pub fn hello(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | } -LL | | -LL | | TokenStream::new() -LL | | } - | |_^ - | - ::: $DIR/multispan.rs:26:5 - | -LL | hello!(hi good hi and good bye); - | -------------------------------- in this macro invocation + --> $DIR/multispan.rs:26:5 + | +LL | hello!(hi good hi and good bye); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:26:12 diff --git a/src/test/ui/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr index 82c4167262fdd..ca82a34534525 100644 --- a/src/test/ui/proc-macro/three-equals.stderr +++ b/src/test/ui/proc-macro/three-equals.stderr @@ -1,19 +1,8 @@ error: found 2 equal signs, need exactly 3 - --> $DIR/auxiliary/three-equals.rs:42:1 - | -LL | / pub fn three_equals(input: TokenStream) -> TokenStream { -LL | | if let Err(diag) = parse(input) { -LL | | diag.emit(); -LL | | return TokenStream::new(); -... | -LL | | "3".parse().unwrap() -LL | | } - | |_^ - | - ::: $DIR/three-equals.rs:15:5 - | -LL | three_equals!(==); - | ------------------ in this macro invocation + --> $DIR/three-equals.rs:15:5 + | +LL | three_equals!(==); + | ^^^^^^^^^^^^^^^^^^ | = help: input must be: `===` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) From 4809be0137d86a1a6a74848640ab5c08eeba8515 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalache Date: Thu, 5 Mar 2020 15:31:11 +0000 Subject: [PATCH 5/7] rustc_errors: Use ensure_source_file_source_present where necessary. --- src/librustc_errors/emitter.rs | 6 +++++- src/librustc_errors/json.rs | 5 +++++ src/librustc_errors/lib.rs | 5 +++++ src/test/ui/consts/miri_unleashed/mutable_const2.stderr | 2 +- .../ui/editions/edition-keywords-2015-2018-expansion.stderr | 4 ++-- .../ui/editions/edition-keywords-2018-2018-expansion.stderr | 4 ++-- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index b38ea6b424191..03f83e616365b 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -422,9 +422,11 @@ pub trait Emitter { span: &mut MultiSpan, children: &mut Vec, ) { - for span in iter::once(span).chain(children.iter_mut().map(|child| &mut child.span)) { + debug!("fix_multispans_in_extern_macros: before: span={:?} children={:?}", span, children); + for span in iter::once(&mut *span).chain(children.iter_mut().map(|child| &mut child.span)) { self.fix_multispan_in_extern_macros(source_map, span); } + debug!("fix_multispans_in_extern_macros: after: span={:?} children={:?}", span, children); } // This "fixes" MultiSpans that contain `Span`s pointing to locations inside of external macros. @@ -472,6 +474,7 @@ impl Emitter for EmitterWriter { fn emit_diagnostic(&mut self, diag: &Diagnostic) { let mut children = diag.children.clone(); let (mut primary_span, suggestions) = self.primary_span_formatted(&diag); + debug!("emit_diagnostic: suggestions={:?}", suggestions); self.fix_multispans_in_extern_macros_and_render_macro_backtrace( &self.sm, @@ -1533,6 +1536,7 @@ impl EmitterWriter { // Render the replacements for each suggestion let suggestions = suggestion.splice_lines(&**sm); + debug!("emit_suggestion_default: suggestions={:?}", suggestions); if suggestions.is_empty() { // Suggestions coming from macros can have malformed spans. This is a heavy handed diff --git a/src/librustc_errors/json.rs b/src/librustc_errors/json.rs index 0767b8dda9b8e..1382825922b0e 100644 --- a/src/librustc_errors/json.rs +++ b/src/librustc_errors/json.rs @@ -394,6 +394,11 @@ impl DiagnosticSpanLine { je.sm .span_to_lines(span) .map(|lines| { + // We can't get any lines if the source is unavailable. + if !je.sm.ensure_source_file_source_present(lines.file.clone()) { + return vec![]; + } + let sf = &*lines.file; lines .lines diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index f0e388a597b40..bed26c3736b83 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -196,6 +196,11 @@ impl CodeSuggestion { let lines = sm.span_to_lines(bounding_span).ok()?; assert!(!lines.lines.is_empty()); + // We can't splice anything if the source is unavailable. + if !sm.ensure_source_file_source_present(lines.file.clone()) { + return None; + } + // To build up the result, we do this for each span: // - push the line segment trailing the previous span // (at the beginning a "phantom" span pointing at the start of the line) diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr index 3eb8e0ec18288..dda9ddf1f487f 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr @@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:355:17 +thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:360:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index 46db5dbc8b3c5..88a1f5dc6736d 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -7,8 +7,8 @@ LL | produces_async! {} = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: you can escape reserved keywords to use them as identifiers | -LL | r#async - | +LL | () => (pub fn r#async() {}) + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index 2de383d0bcaed..5eaa1d03a4a5f 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -7,8 +7,8 @@ LL | produces_async! {} = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: you can escape reserved keywords to use them as identifiers | -LL | r#async - | +LL | () => (pub fn r#async() {}) + | ^^^^^^^ error: aborting due to previous error From 87b6bc35181ac7ae36128585fbfdc42966a04ed1 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 6 Mar 2020 14:35:21 +0100 Subject: [PATCH 6/7] span-api-tests: leave FIXME --- src/test/ui/proc-macro/span-api-tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/ui/proc-macro/span-api-tests.rs b/src/test/ui/proc-macro/span-api-tests.rs index cbceea1b4f35a..5c0cbd77a8da7 100644 --- a/src/test/ui/proc-macro/span-api-tests.rs +++ b/src/test/ui/proc-macro/span-api-tests.rs @@ -11,6 +11,8 @@ extern crate span_test_macros; extern crate span_api_tests; +// FIXME(69775): Investigate `assert_fake_source_file`. + use span_api_tests::{reemit, assert_source_file, macro_stringify}; macro_rules! say_hello { From bafa5cc9ba35228115560b0b6f3038eb83f161e8 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 10 Mar 2020 08:30:07 +0100 Subject: [PATCH 7/7] macros/unknown-builtin: use hack for musl problems --- src/test/ui/macros/unknown-builtin.rs | 5 +++++ src/test/ui/macros/unknown-builtin.stderr | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/ui/macros/unknown-builtin.rs b/src/test/ui/macros/unknown-builtin.rs index a96b99ae4ff78..716a0005ba3e4 100644 --- a/src/test/ui/macros/unknown-builtin.rs +++ b/src/test/ui/macros/unknown-builtin.rs @@ -1,3 +1,8 @@ +// FIXME: missing sysroot spans (#53081) +// ignore-i586-unknown-linux-gnu +// ignore-i586-unknown-linux-musl +// ignore-i686-unknown-linux-musl + // error-pattern: cannot find a built-in macro with name `line` #![feature(rustc_attrs)] diff --git a/src/test/ui/macros/unknown-builtin.stderr b/src/test/ui/macros/unknown-builtin.stderr index 665e92f242418..ed163750a6ea4 100644 --- a/src/test/ui/macros/unknown-builtin.stderr +++ b/src/test/ui/macros/unknown-builtin.stderr @@ -1,5 +1,5 @@ error: cannot find a built-in macro with name `unknown` - --> $DIR/unknown-builtin.rs:6:1 + --> $DIR/unknown-builtin.rs:11:1 | LL | macro_rules! unknown { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^