Auto merge of #56897 - euclio:parse-fatal, r=estebank
make `panictry!` private to libsyntax This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
This commit is contained in:
commit
f381a96255
22 changed files with 451 additions and 134 deletions
|
|
@ -23,7 +23,7 @@ use syntax::json::JsonEmitter;
|
|||
use syntax::ptr::P;
|
||||
use syntax::symbol::keywords;
|
||||
use syntax_pos::DUMMY_SP;
|
||||
use errors;
|
||||
use errors::{self, FatalError};
|
||||
use errors::emitter::{Emitter, EmitterWriter};
|
||||
use parking_lot::ReentrantMutex;
|
||||
|
||||
|
|
@ -429,7 +429,13 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||
|
||||
let control = &driver::CompileController::basic();
|
||||
|
||||
let krate = panictry!(driver::phase_1_parse_input(control, &sess, &input));
|
||||
let krate = match driver::phase_1_parse_input(control, &sess, &input) {
|
||||
Ok(krate) => krate,
|
||||
Err(mut e) => {
|
||||
e.emit();
|
||||
FatalError.raise();
|
||||
}
|
||||
};
|
||||
|
||||
let name = match crate_name {
|
||||
Some(ref crate_name) => crate_name.clone(),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ extern crate rustc_metadata;
|
|||
extern crate rustc_target;
|
||||
extern crate rustc_typeck;
|
||||
extern crate serialize;
|
||||
#[macro_use] extern crate syntax;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
extern crate test as testing;
|
||||
#[macro_use] extern crate log;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use errors;
|
||||
use errors::{self, FatalError};
|
||||
use errors::emitter::ColorConfig;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_lint;
|
||||
|
|
@ -84,9 +84,14 @@ pub fn run(mut options: Options) -> isize {
|
|||
target_features::add_configuration(&mut cfg, &sess, &*codegen_backend);
|
||||
sess.parse_sess.config = cfg;
|
||||
|
||||
let krate = panictry!(driver::phase_1_parse_input(&driver::CompileController::basic(),
|
||||
&sess,
|
||||
&input));
|
||||
let krate =
|
||||
match driver::phase_1_parse_input(&driver::CompileController::basic(), &sess, &input) {
|
||||
Ok(krate) => krate,
|
||||
Err(mut e) => {
|
||||
e.emit();
|
||||
FatalError.raise();
|
||||
}
|
||||
};
|
||||
let driver::ExpansionResult { defs, mut hir_forest, .. } = {
|
||||
phase_2_configure_and_expand(
|
||||
&sess,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue