@@ -17,10 +17,9 @@ use std::sync::{Arc, Mutex};
17
17
use syntax:: { self , parse} ;
18
18
use syntax:: ast:: { self , MetaItemKind } ;
19
19
use syntax:: parse:: token;
20
- use syntax:: source_map:: { FileName , FilePathMapping , FileLoader , SourceMap } ;
20
+ use syntax:: source_map:: { FileName , FileLoader , SourceMap } ;
21
21
use syntax:: sess:: ParseSess ;
22
22
use syntax_pos:: edition;
23
- use rustc_errors:: { Diagnostic , emitter:: Emitter , Handler , SourceMapperDyn } ;
24
23
25
24
pub type Result < T > = result:: Result < T , ErrorReported > ;
26
25
@@ -63,18 +62,9 @@ impl Compiler {
63
62
64
63
/// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`.
65
64
pub fn parse_cfgspecs ( cfgspecs : Vec < String > ) -> FxHashSet < ( String , Option < String > ) > {
66
- struct NullEmitter ;
67
- impl Emitter for NullEmitter {
68
- fn emit_diagnostic ( & mut self , _: & Diagnostic ) { }
69
- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > { None }
70
- }
71
-
72
65
syntax:: with_default_globals ( move || {
73
66
let cfg = cfgspecs. into_iter ( ) . map ( |s| {
74
-
75
- let cm = Lrc :: new ( SourceMap :: new ( FilePathMapping :: empty ( ) ) ) ;
76
- let handler = Handler :: with_emitter ( false , None , Box :: new ( NullEmitter ) ) ;
77
- let sess = ParseSess :: with_span_handler ( handler, cm) ;
67
+ let sess = ParseSess :: with_silent_emitter ( ) ;
78
68
let filename = FileName :: cfg_spec_source_code ( & s) ;
79
69
let mut parser = parse:: new_parser_from_source_str ( & sess, filename, s. to_string ( ) ) ;
80
70
0 commit comments