diff options
| author | bors <bors@rust-lang.org> | 2019-09-16 15:35:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-16 15:35:48 +0000 |
| commit | a44881d892fb4f4a8ed93f8f392bab942fac7a41 (patch) | |
| tree | 0a4bb12a62fa76fd7946b4efec9a2b3d0cd35cc9 /src/librustc | |
| parent | 16c401167366d7c6deb9268058fc5f254f9d9371 (diff) | |
| parent | f4ff4189ae01b6c2a775c63f24b51b708b74ec02 (diff) | |
| download | rust-a44881d892fb4f4a8ed93f8f392bab942fac7a41.tar.gz rust-a44881d892fb4f4a8ed93f8f392bab942fac7a41.zip | |
Auto merge of #64510 - Centril:rollup-m03zsq8, r=Centril
Rollup of 10 pull requests
Successful merges:
- #63955 (Make sure interned constants are immutable)
- #64028 (Stabilize `Vec::new` and `String::new` as `const fn`s)
- #64119 (ci: ensure all tool maintainers are assignable on issues)
- #64444 (fix building libstd without backtrace feature)
- #64446 (Fix build script sanitizer check.)
- #64451 (when Miri tests are not passing, do not add Miri component)
- #64467 (Hide diagnostics emitted during --cfg parsing)
- #64497 (Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given)
- #64499 (Use `Symbol` in two more functions.)
- #64504 (use println!() instead of println!(""))
Failed merges:
r? @ghost
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/session/config.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index c74b2fee41d..723855c7c29 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -7,6 +7,7 @@ use crate::session::{early_error, early_warn, Session}; use crate::session::search_paths::SearchPath; use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::sync::Lrc; use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel}; use rustc_target::spec::{Target, TargetTriple}; @@ -19,6 +20,7 @@ use syntax::parse::{ParseSess, new_parser_from_source_str}; use syntax::parse::token; use syntax::symbol::{sym, Symbol}; use syntax::feature_gate::UnstableFeatures; +use syntax::source_map::SourceMap; use errors::emitter::HumanReadableErrorType; use errors::{ColorConfig, FatalError, Handler}; @@ -1850,11 +1852,20 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> { opts } +struct NullEmitter; + +impl errors::emitter::Emitter for NullEmitter { + fn emit_diagnostic(&mut self, _: &errors::DiagnosticBuilder<'_>) {} +} + // Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`. pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String>)> { syntax::with_default_globals(move || { let cfg = cfgspecs.into_iter().map(|s| { - let sess = ParseSess::new(FilePathMapping::empty()); + + let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); + let handler = Handler::with_emitter(false, None, Box::new(NullEmitter)); + let sess = ParseSess::with_span_handler(handler, cm); let filename = FileName::cfg_spec_source_code(&s); let mut parser = new_parser_from_source_str(&sess, filename, s.to_string()); |
