diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-21 11:52:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-21 11:52:20 +0200 |
| commit | d7c162aefd8bcb28a00be5dff019bf345e4ccbbe (patch) | |
| tree | 653946e99c5091be7adc163bae3d0a794a416a1b /src/libsyntax/diagnostics/plugin.rs | |
| parent | bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008 (diff) | |
| parent | 72e2cfd93438ef0109cbaca9f961efa5ac6d4f84 (diff) | |
| download | rust-d7c162aefd8bcb28a00be5dff019bf345e4ccbbe.tar.gz rust-d7c162aefd8bcb28a00be5dff019bf345e4ccbbe.zip | |
Rollup merge of #63721 - Mark-Simulacrum:decouple-error-index, r=matthewjasper
Do not emit JSON dumps of diagnostic codes This decouples the error index generator from libsyntax for the most part (though it still depends on librustdoc for the markdown parsing and generation). Fixes #34588
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| { |
