Skip to content

removes syntax diagnostic err code uniqueness check #25603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/libsyntax/diagnostics/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

use std::cell::RefCell;
use std::collections::BTreeMap;
use std::error::Error;

use ast;
use ast::{Ident, Name, TokenTree};
use codemap::Span;
use diagnostics::metadata::{check_uniqueness, output_metadata, Duplicate};
use diagnostics::metadata::{output_metadata};
use ext::base::{ExtCtxt, MacEager, MacResult};
use ext::build::AstBuilder;
use parse::token;
Expand Down Expand Up @@ -158,20 +159,22 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
_ => unreachable!()
};

// Check uniqueness of errors and output metadata.
// Output metadata.
with_registered_diagnostics(|diagnostics| {
match check_uniqueness(crate_name, &*diagnostics) {
Ok(Duplicate(err, location)) => {
ecx.span_err(span, &format!(
"error {} from `{}' also found in `{}'",
err, crate_name, location
));
},
Ok(_) => (),
Err(e) => panic!("{}", e.description())
// FIXME (25364, 25592): used to ensure error code uniqueness
// here, but the approach employed was too brittle. Need to
// put such a check back in (e.g. in `make tidy`).
match output_metadata(&*ecx, crate_name, &*diagnostics) {
Ok(()) => {}
Err(error) => {
ecx.span_err(span, &format!("metadata output error {}", error.description()));
let mut error: &Error = &*error;
while let Some(cause) = error.cause() {
error = cause;
ecx.span_err(span, &format!("caused by error {}", error.description()));
}
}
}

output_metadata(&*ecx, crate_name, &*diagnostics).ok().expect("metadata output error");
});

// Construct the output expression.
Expand Down