diff options
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_session/src/search_paths.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 17 | 
5 files changed, 26 insertions, 35 deletions
| diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index dadbcff6f68..61a220428b0 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1,6 +1,8 @@ //! Contains infrastructure for configuring the compiler, including parsing //! command-line options. +#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable + pub use crate::options::*; use crate::errors::FileWriteFail; @@ -146,8 +148,10 @@ pub enum LtoCli { /// unless the function has type parameters. #[derive(Clone, Copy, PartialEq, Hash, Debug)] pub enum InstrumentCoverage { - /// Default `-C instrument-coverage` or `-C instrument-coverage=statement` - All, + /// `-C instrument-coverage=no` (or `off`, `false` etc.) + No, + /// `-C instrument-coverage` or `-C instrument-coverage=yes` + Yes, /// Additionally, instrument branches and output branch coverage. /// `-Zunstable-options -C instrument-coverage=branch` Branch, @@ -155,8 +159,6 @@ pub enum InstrumentCoverage { ExceptUnusedGenerics, /// `-Zunstable-options -C instrument-coverage=except-unused-functions` ExceptUnusedFunctions, - /// `-C instrument-coverage=off` (or `no`, etc.) - Off, } /// Settings for `-Z instrument-xray` flag. @@ -2468,9 +2470,7 @@ pub fn parse_externs( )); let adjusted_name = name.replace('-', "_"); if is_ascii_ident(&adjusted_name) { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] + #[allow(rustc::diagnostic_outside_of_impl)] // FIXME error.help(format!( "consider replacing the dashes with underscores: `{adjusted_name}`" )); @@ -2722,7 +2722,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M // This is what prevents them from being used on stable compilers. match cg.instrument_coverage { // Stable values: - InstrumentCoverage::All | InstrumentCoverage::Off => {} + InstrumentCoverage::Yes | InstrumentCoverage::No => {} // Unstable values: InstrumentCoverage::Branch | InstrumentCoverage::ExceptUnusedFunctions @@ -2736,7 +2736,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M } } - if cg.instrument_coverage != InstrumentCoverage::Off { + if cg.instrument_coverage != InstrumentCoverage::No { if cg.profile_generate.enabled() || cg.profile_use.is_some() { early_dcx.early_fatal( "option `-C instrument-coverage` is not compatible with either `-C profile-use` \ diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 55e1556cdf8..93bef82e4ba 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -320,6 +320,7 @@ macro_rules! redirect_field { type OptionSetter<O> = fn(&mut O, v: Option<&str>) -> bool; type OptionDescrs<O> = &'static [(&'static str, OptionSetter<O>, &'static str, &'static str)]; +#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn build_options<O: Default>( early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, @@ -394,8 +395,7 @@ mod desc { pub const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of(); pub const parse_optimization_fuel: &str = "crate=integer"; pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`"; - pub const parse_instrument_coverage: &str = - "`all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off`"; + pub const parse_instrument_coverage: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions`"; pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; pub const parse_unpretty: &str = "`string` or `string=string`"; pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; @@ -918,18 +918,18 @@ mod parse { if v.is_some() { let mut bool_arg = false; if parse_bool(&mut bool_arg, v) { - *slot = if bool_arg { InstrumentCoverage::All } else { InstrumentCoverage::Off }; + *slot = if bool_arg { InstrumentCoverage::Yes } else { InstrumentCoverage::No }; return true; } } let Some(v) = v else { - *slot = InstrumentCoverage::All; + *slot = InstrumentCoverage::Yes; return true; }; *slot = match v { - "all" => InstrumentCoverage::All, + "all" => InstrumentCoverage::Yes, "branch" => InstrumentCoverage::Branch, "except-unused-generics" | "except_unused_generics" => { InstrumentCoverage::ExceptUnusedGenerics @@ -937,7 +937,7 @@ mod parse { "except-unused-functions" | "except_unused_functions" => { InstrumentCoverage::ExceptUnusedFunctions } - "off" | "no" | "n" | "false" | "0" => InstrumentCoverage::Off, + "0" => InstrumentCoverage::No, _ => return false, }; true @@ -1444,15 +1444,15 @@ options! { inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED], "set the threshold for inlining a function"), #[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")] - instrument_coverage: InstrumentCoverage = (InstrumentCoverage::Off, parse_instrument_coverage, [TRACKED], + instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED], "instrument the generated code to support LLVM source-based code coverage \ reports (note, the compiler build config must include `profiler = true`); \ implies `-C symbol-mangling-version=v0`. Optional values are: - `=all` (implicit value) - `=branch` - `=except-unused-generics` - `=except-unused-functions` - `=off` (default)"), + `=no` `=n` `=off` `=false` (default) + `=yes` `=y` `=on` `=true` (implicit value) + `=branch` (unstable) + `=except-unused-generics` (unstable) + `=except-unused-functions` (unstable)"), link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED], "a single extra argument to append to the linker invocation (can be used several times)"), link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED], diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 506bd5d5dbd..398138d7e1f 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -168,6 +168,7 @@ pub fn add_feature_diagnostics<G: EmissionGuarantee>( /// This variant allows you to control whether it is a library or language feature. /// Almost always, you want to use this for a language feature. If so, prefer /// `add_feature_diagnostics`. +#[allow(rustc::diagnostic_outside_of_impl)] // FIXME pub fn add_feature_diagnostics_for_issue<G: EmissionGuarantee>( err: &mut Diag<'_, G>, sess: &Session, diff --git a/compiler/rustc_session/src/search_paths.rs b/compiler/rustc_session/src/search_paths.rs index 9b913c76998..32d5e430717 100644 --- a/compiler/rustc_session/src/search_paths.rs +++ b/compiler/rustc_session/src/search_paths.rs @@ -61,6 +61,7 @@ impl SearchPath { (PathKind::All, path) }; if path.is_empty() { + #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable early_dcx.early_fatal("empty search path given via `-L`"); } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 4f4d8fabb72..ae1dbd13204 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -312,6 +312,7 @@ impl Session { ) -> Diag<'a> { let mut err = self.dcx().create_err(err); if err.code.is_none() { + #[allow(rustc::diagnostic_outside_of_impl)] err.code(E0658); } add_feature_diagnostics(&mut err, self, feature); @@ -352,7 +353,7 @@ impl Session { } pub fn instrument_coverage(&self) -> bool { - self.opts.cg.instrument_coverage() != InstrumentCoverage::Off + self.opts.cg.instrument_coverage() != InstrumentCoverage::No } pub fn instrument_coverage_branch(&self) -> bool { @@ -898,19 +899,6 @@ impl Session { } pub fn should_prefer_remapped_for_codegen(&self) -> bool { - // bail out, if any of the requested crate types aren't: - // "compiled executables or libraries" - for crate_type in &self.opts.crate_types { - match crate_type { - CrateType::Executable - | CrateType::Dylib - | CrateType::Rlib - | CrateType::Staticlib - | CrateType::Cdylib => continue, - CrateType::ProcMacro => return false, - } - } - let has_split_debuginfo = match self.split_debuginfo() { SplitDebuginfo::Off => false, SplitDebuginfo::Packed => true, @@ -1022,6 +1010,7 @@ fn default_emitter( // JUSTIFICATION: literally session construction #[allow(rustc::bad_opt_access)] +#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable pub fn build_session( early_dcx: EarlyDiagCtxt, sopts: config::Options, | 
