diff options
| author | bors <bors@rust-lang.org> | 2019-08-21 11:40:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-21 11:40:23 +0000 |
| commit | 7b0085a613e69cb69fc9e4eb5d422fa4a39d5de1 (patch) | |
| tree | 72512acc5978c56d76351fa7af4f9ff9103db06a /src/libsyntax/diagnostics/plugin.rs | |
| parent | bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008 (diff) | |
| parent | b25ec0438430f32b6278c9fa2ba0cfb697eb70b5 (diff) | |
| download | rust-7b0085a613e69cb69fc9e4eb5d422fa4a39d5de1.tar.gz rust-7b0085a613e69cb69fc9e4eb5d422fa4a39d5de1.zip | |
Auto merge of #63779 - Centril:rollup-sx96dli, r=Centril
Rollup of 7 pull requests Successful merges: - #63721 (Do not emit JSON dumps of diagnostic codes) - #63753 (Bump toml dependency.) - #63755 (Use dedicated type for spans in pre-expansion gating.) - #63759 (Allow 'default async fn' to parse.) - #63760 (Update books) - #63762 (`async_await` was stabilized in 1.39.0, not 1.38.0.) - #63766 (Remove some duplication when resolving constants) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax/diagnostics/plugin.rs')
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 9618b5acfb0..e9a55af52e8 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -1,5 +1,4 @@ use std::collections::BTreeMap; -use std::env; use crate::ast::{self, Ident, Name}; use crate::source_map; @@ -12,8 +11,6 @@ use crate::tokenstream::{TokenTree}; use smallvec::smallvec; use syntax_pos::Span; -use crate::diagnostics::metadata::output_metadata; - pub use errors::*; // Maximum width of any line in an extended error description (inclusive). @@ -127,36 +124,13 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt<'_>, token_tree: &[TokenTree]) -> Box<dyn MacResult+'cx> { assert_eq!(token_tree.len(), 3); - let (crate_name, ident) = match (&token_tree[0], &token_tree[2]) { - ( - // Crate name. - &TokenTree::Token(Token { kind: token::Ident(crate_name, _), .. }), - // DIAGNOSTICS ident. - &TokenTree::Token(Token { kind: token::Ident(name, _), span }) - ) => (crate_name, Ident::new(name, span)), + let ident = match &token_tree[2] { + // DIAGNOSTICS ident. + &TokenTree::Token(Token { kind: token::Ident(name, _), span }) + => Ident::new(name, span), _ => unreachable!() }; - // Output error metadata to `tmp/extended-errors/<target arch>/<crate name>.json` - if let Ok(target_triple) = env::var("CFG_COMPILER_HOST_TRIPLE") { - ecx.parse_sess.registered_diagnostics.with_lock(|diagnostics| { - if let Err(e) = output_metadata(ecx, - &target_triple, - &crate_name.as_str(), - diagnostics) { - ecx.span_bug(span, &format!( - "error writing metadata for triple `{}` and crate `{}`, error: {}, \ - cause: {:?}", - target_triple, crate_name, e.description(), e.source() - )); - } - }); - } else { - ecx.span_err(span, &format!( - "failed to write metadata for crate `{}` because $CFG_COMPILER_HOST_TRIPLE is not set", - crate_name)); - } - // Construct the output expression. let (count, expr) = ecx.parse_sess.registered_diagnostics.with_lock(|diagnostics| { |
