}
#[derive(Clone, PartialEq, Hash)]
-pub enum PgoGenerate {
+pub enum SwitchWithOptPath {
Enabled(Option<PathBuf>),
Disabled,
}
-impl PgoGenerate {
+impl SwitchWithOptPath {
pub fn enabled(&self) -> bool {
match *self {
- PgoGenerate::Enabled(_) => true,
- PgoGenerate::Disabled => false,
+ SwitchWithOptPath::Enabled(_) => true,
+ SwitchWithOptPath::Disabled => false,
}
}
}
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
+pub enum SymbolManglingVersion {
+ Legacy,
+ V0,
+}
+
+impl_stable_hash_via_hash!(SymbolManglingVersion);
+
#[derive(Clone, Copy, PartialEq, Hash)]
pub enum DebugInfo {
None,
pub const parse_linker_plugin_lto: Option<&str> =
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \
or the path to the linker plugin");
- pub const parse_pgo_generate: Option<&str> =
+ pub const parse_switch_with_opt_path: Option<&str> =
Some("an optional path to the profiling data output directory");
pub const parse_merge_functions: Option<&str> =
Some("one of: `disabled`, `trampolines`, or `aliases`");
+ pub const parse_symbol_mangling_version: Option<&str> =
+ Some("either `legacy` or `v0` (RFC 2603)");
}
#[allow(dead_code)]
mod $mod_set {
- use super::{$struct_name, Passes, Sanitizer, LtoCli, LinkerPluginLto, PgoGenerate};
+ use super::{$struct_name, Passes, Sanitizer, LtoCli, LinkerPluginLto, SwitchWithOptPath,
+ SymbolManglingVersion};
use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel};
use std::path::PathBuf;
use std::str::FromStr;
true
}
- fn parse_pgo_generate(slot: &mut PgoGenerate, v: Option<&str>) -> bool {
+ fn parse_switch_with_opt_path(slot: &mut SwitchWithOptPath, v: Option<&str>) -> bool {
*slot = match v {
- None => PgoGenerate::Enabled(None),
- Some(path) => PgoGenerate::Enabled(Some(PathBuf::from(path))),
+ None => SwitchWithOptPath::Enabled(None),
+ Some(path) => SwitchWithOptPath::Enabled(Some(PathBuf::from(path))),
};
true
}
}
true
}
+
+ fn parse_symbol_mangling_version(
+ slot: &mut SymbolManglingVersion,
+ v: Option<&str>,
+ ) -> bool {
+ *slot = match v {
+ Some("legacy") => SymbolManglingVersion::Legacy,
+ Some("v0") => SymbolManglingVersion::V0,
+ _ => return false,
+ };
+ true
+ }
}
) }
"measure time of each rustc pass"),
time: bool = (false, parse_bool, [UNTRACKED],
"measure time of rustc processes"),
- count_llvm_insns: bool = (false, parse_bool,
- [UNTRACKED_WITH_WARNING(true,
- "The output generated by `-Z count_llvm_insns` might not be reliable \
- when used with incremental compilation")],
- "count where LLVM instrs originate"),
time_llvm_passes: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true,
"The output of `-Z time-llvm-passes` will only reflect timings of \
re-codegened modules when used with incremental compilation" )],
"measure time of each LLVM pass"),
input_stats: bool = (false, parse_bool, [UNTRACKED],
"gather statistics about the input"),
- codegen_stats: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true,
- "The output of `-Z codegen-stats` might not be accurate when incremental \
- compilation is enabled")],
- "gather codegen statistics"),
asm_comments: bool = (false, parse_bool, [TRACKED],
"generate comments into the assembly (may change behavior)"),
verify_llvm_ir: bool = (false, parse_bool, [TRACKED],
"extra arguments to prepend to the linker invocation (space separated)"),
profile: bool = (false, parse_bool, [TRACKED],
"insert profiling code"),
- pgo_gen: PgoGenerate = (PgoGenerate::Disabled, parse_pgo_generate, [TRACKED],
+ pgo_gen: SwitchWithOptPath = (SwitchWithOptPath::Disabled,
+ parse_switch_with_opt_path, [TRACKED],
"Generate PGO profile data, to a given file, or to the default location if it's empty."),
pgo_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"Use PGO profile data from the given profile file."),
"don't interleave execution of lints; allows benchmarking individual lints"),
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
"inject the given attribute in the crate"),
- self_profile: bool = (false, parse_bool, [UNTRACKED],
+ self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled,
+ parse_switch_with_opt_path, [UNTRACKED],
"run the self profiler and output the raw event data"),
self_profile_events: Option<Vec<String>> = (None, parse_opt_comma_list, [UNTRACKED],
"specifies which kinds of events get recorded by the self profiler"),
"only allow the listed language features to be enabled in code (space separated)"),
emit_artifact_notifications: bool = (false, parse_bool, [UNTRACKED],
"emit notifications after each artifact has been output (only in the JSON format)"),
+ symbol_mangling_version: SymbolManglingVersion = (SymbolManglingVersion::Legacy,
+ parse_symbol_mangling_version, [TRACKED],
+ "which mangling version to use for symbol names"),
}
pub fn default_lib_output() -> CrateType {
match matches.opt_str("error-format").as_ref().map(|s| &s[..]) {
None |
Some("human") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color)),
+ Some("human-annotate-rs") => {
+ ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(color))
+ },
Some("json") => ErrorOutputType::Json { pretty: false, json_rendered },
Some("pretty-json") => ErrorOutputType::Json { pretty: true, json_rendered },
Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short(color)),
"--error-format=pretty-json is unstable",
);
}
+ if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(_)) =
+ error_format {
+ early_error(
+ ErrorOutputType::Json { pretty: false, json_rendered },
+ "--error-format=human-annotate-rs is unstable",
+ );
+ }
}
if debugging_opts.pgo_gen.enabled() && debugging_opts.pgo_use.is_some() {
use std::path::PathBuf;
use std::collections::hash_map::DefaultHasher;
use super::{CrateType, DebugInfo, ErrorOutputType, OptLevel, OutputTypes,
- Passes, Sanitizer, LtoCli, LinkerPluginLto, PgoGenerate};
+ Passes, Sanitizer, LtoCli, LinkerPluginLto, SwitchWithOptPath,
+ SymbolManglingVersion};
use syntax::feature_gate::UnstableFeatures;
use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel, TargetTriple};
use syntax::edition::Edition;
impl_dep_tracking_hash_via_hash!(TargetTriple);
impl_dep_tracking_hash_via_hash!(Edition);
impl_dep_tracking_hash_via_hash!(LinkerPluginLto);
- impl_dep_tracking_hash_via_hash!(PgoGenerate);
+ impl_dep_tracking_hash_via_hash!(SwitchWithOptPath);
+ impl_dep_tracking_hash_via_hash!(SymbolManglingVersion);
impl_dep_tracking_hash_for_sortable_vec_of!(String);
impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);
build_session_options_and_crate_config,
to_crate_config
};
- use crate::session::config::{LtoCli, LinkerPluginLto, PgoGenerate, ExternEntry};
+ use crate::session::config::{LtoCli, LinkerPluginLto, SwitchWithOptPath, ExternEntry};
use crate::session::build_session;
use crate::session::search_paths::SearchPath;
use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator;
use std::path::PathBuf;
- use super::{Externs, OutputType, OutputTypes};
+ use super::{Externs, OutputType, OutputTypes, SymbolManglingVersion};
use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel};
use syntax::symbol::sym;
use syntax::edition::{Edition, DEFAULT_EDITION};
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
- opts.debugging_opts.pgo_gen = PgoGenerate::Enabled(None);
+ opts.debugging_opts.pgo_gen = SwitchWithOptPath::Enabled(None);
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts = reference.clone();
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.time_passes = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.count_llvm_insns = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.time_llvm_passes = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.input_stats = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.codegen_stats = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.borrowck_stats = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.meta_stats = true;
opts = reference.clone();
opts.debugging_opts.allow_features = Some(vec![String::from("lang_items")]);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+
+ opts = reference.clone();
+ opts.debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
+ assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
}
#[test]