diff options
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_session/src/filesearch.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_session/src/utils.rs | 2 |
6 files changed, 24 insertions, 14 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 25d84506efa..e72b76cfee9 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -116,6 +116,10 @@ pub struct StackProtectorNotSupportedForTarget<'a> { } #[derive(Diagnostic)] +#[diag(session_branch_protection_requires_aarch64)] +pub(crate) struct BranchProtectionRequiresAArch64; + +#[derive(Diagnostic)] #[diag(session_split_debuginfo_unstable_platform)] pub struct SplitDebugInfoUnstablePlatform { pub debuginfo: SplitDebuginfo, diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs index 1855a49c1ec..6f1b31ff9c3 100644 --- a/compiler/rustc_session/src/filesearch.rs +++ b/compiler/rustc_session/src/filesearch.rs @@ -122,7 +122,7 @@ pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> { let target = crate::config::host_triple(); let mut sysroot_candidates: SmallVec<[PathBuf; 2]> = smallvec![get_or_default_sysroot().expect("Failed finding sysroot")]; - let path = current_dll_path().and_then(|s| Ok(s.canonicalize().map_err(|e| e.to_string())?)); + let path = current_dll_path().and_then(|s| s.canonicalize().map_err(|e| e.to_string())); if let Ok(dll) = path { // use `parent` twice to chop off the file name and then also the // directory containing the dll which should be either `lib` or `bin`. @@ -165,7 +165,7 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> { } fn default_from_rustc_driver_dll() -> Result<PathBuf, String> { - let dll = current_dll_path().and_then(|s| Ok(canonicalize(s)))?; + let dll = current_dll_path().map(|s| canonicalize(s))?; // `dll` will be in one of the following two: // - compiler's libdir: $sysroot/lib/*.dll diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 9e130287104..40bc669707a 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1421,6 +1421,8 @@ options! { "run all passes except codegen; no output"), no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED], "omit DWARF address ranges that give faster lookups"), + no_jump_tables: bool = (false, parse_no_flag, [TRACKED], + "disable the jump tables and lookup tables that can be generated from a switch case lowering"), no_leak_check: bool = (false, parse_no_flag, [UNTRACKED], "disable the 'leak check' for subtyping; unsound, but useful for tests"), no_link: bool = (false, parse_no_flag, [TRACKED], diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index f9f4f2979c4..2aa8ca9e4a9 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -122,7 +122,7 @@ pub fn feature_err_issue<'a>( /// Construct a future incompatibility diagnostic for a feature gate. /// /// This diagnostic is only a warning and *does not cause compilation to fail*. -pub fn feature_warn<'a>(sess: &'a ParseSess, feature: Symbol, span: Span, explain: &str) { +pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &str) { feature_warn_issue(sess, feature, span, GateIssue::Language, explain); } @@ -134,8 +134,8 @@ pub fn feature_warn<'a>(sess: &'a ParseSess, feature: Symbol, span: Span, explai /// Almost always, you want to use this for a language feature. If so, prefer `feature_warn`. #[allow(rustc::diagnostic_outside_of_impl)] #[allow(rustc::untranslatable_diagnostic)] -pub fn feature_warn_issue<'a>( - sess: &'a ParseSess, +pub fn feature_warn_issue( + sess: &ParseSess, feature: Symbol, span: Span, issue: GateIssue, @@ -160,7 +160,7 @@ pub fn feature_warn_issue<'a>( } /// Adds the diagnostics for a feature to an existing error. -pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, feature: Symbol) { +pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &ParseSess, feature: Symbol) { add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language); } @@ -169,9 +169,9 @@ pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, fe /// 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`. -pub fn add_feature_diagnostics_for_issue<'a>( +pub fn add_feature_diagnostics_for_issue( err: &mut Diagnostic, - sess: &'a ParseSess, + sess: &ParseSess, feature: Symbol, issue: GateIssue, ) { diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 8859b76d289..01a9b100088 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -3,10 +3,10 @@ use crate::code_stats::CodeStats; pub use crate::code_stats::{DataTypeKind, FieldInfo, SizeKind, VariantInfo}; use crate::config::{self, CrateType, InstrumentCoverage, OptLevel, OutputType, SwitchWithOptPath}; use crate::errors::{ - CannotEnableCrtStaticLinux, CannotMixAndMatchSanitizers, LinkerPluginToWindowsNotSupported, - NotCircumventFeature, ProfileSampleUseFileDoesNotExist, ProfileUseFileDoesNotExist, - SanitizerCfiEnabled, SanitizerNotSupported, SanitizersNotSupported, SkippingConstChecks, - SplitDebugInfoUnstablePlatform, StackProtectorNotSupportedForTarget, + BranchProtectionRequiresAArch64, CannotEnableCrtStaticLinux, CannotMixAndMatchSanitizers, + LinkerPluginToWindowsNotSupported, NotCircumventFeature, ProfileSampleUseFileDoesNotExist, + ProfileUseFileDoesNotExist, SanitizerCfiEnabled, SanitizerNotSupported, SanitizersNotSupported, + SkippingConstChecks, SplitDebugInfoUnstablePlatform, StackProtectorNotSupportedForTarget, TargetRequiresUnwindTables, UnleashedFeatureHelp, UnstableVirtualFunctionElimination, UnsupportedDwarfVersion, }; @@ -1323,7 +1323,7 @@ pub fn build_session( let warnings_allow = sopts .lint_opts .iter() - .rfind(|&&(ref key, _)| *key == "warnings") + .rfind(|&(key, _)| *key == "warnings") .map_or(false, |&(_, level)| level == lint::Allow); let cap_lints_allow = sopts.lint_cap.map_or(false, |cap| cap == lint::Allow); let can_emit_warnings = !(warnings_allow || cap_lints_allow); @@ -1565,6 +1565,10 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } + if sess.opts.unstable_opts.branch_protection.is_some() && sess.target.arch != "aarch64" { + sess.emit_err(BranchProtectionRequiresAArch64); + } + if let Some(dwarf_version) = sess.opts.unstable_opts.dwarf_version { if dwarf_version > 5 { sess.emit_err(UnsupportedDwarfVersion { dwarf_version }); diff --git a/compiler/rustc_session/src/utils.rs b/compiler/rustc_session/src/utils.rs index e65b6891e32..b996d36a318 100644 --- a/compiler/rustc_session/src/utils.rs +++ b/compiler/rustc_session/src/utils.rs @@ -3,7 +3,7 @@ use rustc_data_structures::profiling::VerboseTimingGuard; use std::path::{Path, PathBuf}; impl Session { - pub fn timer<'a>(&'a self, what: &'static str) -> VerboseTimingGuard<'a> { + pub fn timer(&self, what: &'static str) -> VerboseTimingGuard<'_> { self.prof.verbose_generic_activity(what) } pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R { |
