diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-12 14:16:06 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-13 10:09:40 +0200 |
| commit | 2c482d8d41a7c4424583f2abe62be85b188ddeb8 (patch) | |
| tree | 8124a7161fdf01aa3c67aee2b93bee790188caa0 | |
| parent | 9a1de086e4e5d46259c46128d17848cabbe7b8de (diff) | |
| download | rust-2c482d8d41a7c4424583f2abe62be85b188ddeb8.tar.gz rust-2c482d8d41a7c4424583f2abe62be85b188ddeb8.zip | |
rustc/driver: use Cow<str> where applicable
| -rw-r--r-- | src/librustc_driver/lib.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 8d886d8c040..a01e2d4f845 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -90,6 +90,7 @@ use rustc_codegen_utils::codegen_backend::CodegenBackend; use serialize::json::ToJson; use std::any::Any; +use std::borrow::Cow; use std::cmp::max; use std::default::Default; use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; @@ -1678,25 +1679,25 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) -> Result<(), CompilationFail errors::Level::Bug); } - let mut xs = vec![ - "the compiler unexpectedly panicked. this is a bug.".to_string(), - format!("we would appreciate a bug report: {}", BUG_REPORT_URL), + let mut xs: Vec<Cow<'static, str>> = vec![ + "the compiler unexpectedly panicked. this is a bug.".into(), + format!("we would appreciate a bug report: {}", BUG_REPORT_URL).into(), format!("rustc {} running on {}", option_env!("CFG_VERSION").unwrap_or("unknown_version"), - config::host_triple()), + config::host_triple()).into(), ]; if let Some((flags, excluded_cargo_defaults)) = extra_compiler_flags() { - xs.push(format!("compiler flags: {}", flags.join(" "))); + xs.push(format!("compiler flags: {}", flags.join(" ")).into()); if excluded_cargo_defaults { - xs.push("some of the compiler flags provided by cargo are hidden".to_string()); + xs.push("some of the compiler flags provided by cargo are hidden".into()); } } for note in &xs { handler.emit(&MultiSpan::new(), - ¬e, + note, errors::Level::Note); } |
