Reduce pub usage in rustc_session.

In particular, almost none of the errors in `errors.rs` are used outside
the crate.
This commit is contained in:
Nicholas Nethercote 2024-03-19 13:31:28 +11:00
parent eb45c84440
commit de38888256
2 changed files with 130 additions and 132 deletions

View File

@ -313,7 +313,7 @@ pub struct LocationDetail {
} }
impl LocationDetail { impl LocationDetail {
pub fn all() -> Self { pub(crate) fn all() -> Self {
Self { file: true, line: true, column: true } Self { file: true, line: true, column: true }
} }
} }
@ -549,7 +549,7 @@ impl OutputTypes {
OutputTypes(BTreeMap::from_iter(entries.iter().map(|&(k, ref v)| (k, v.clone())))) OutputTypes(BTreeMap::from_iter(entries.iter().map(|&(k, ref v)| (k, v.clone()))))
} }
pub fn get(&self, key: &OutputType) -> Option<&Option<OutFileName>> { pub(crate) fn get(&self, key: &OutputType) -> Option<&Option<OutFileName>> {
self.0.get(key) self.0.get(key)
} }
@ -662,10 +662,6 @@ impl Externs {
pub fn iter(&self) -> BTreeMapIter<'_, String, ExternEntry> { pub fn iter(&self) -> BTreeMapIter<'_, String, ExternEntry> {
self.0.iter() self.0.iter()
} }
pub fn len(&self) -> usize {
self.0.len()
}
} }
impl ExternEntry { impl ExternEntry {
@ -854,13 +850,13 @@ impl OutFileName {
#[derive(Clone, Hash, Debug, HashStable_Generic, Encodable, Decodable)] #[derive(Clone, Hash, Debug, HashStable_Generic, Encodable, Decodable)]
pub struct OutputFilenames { pub struct OutputFilenames {
pub out_directory: PathBuf, pub(crate) out_directory: PathBuf,
/// Crate name. Never contains '-'. /// Crate name. Never contains '-'.
crate_stem: String, crate_stem: String,
/// Typically based on `.rs` input file name. Any '-' is preserved. /// Typically based on `.rs` input file name. Any '-' is preserved.
filestem: String, filestem: String,
pub single_output_file: Option<OutFileName>, pub single_output_file: Option<OutFileName>,
pub temps_directory: Option<PathBuf>, temps_directory: Option<PathBuf>,
pub outputs: OutputTypes, pub outputs: OutputTypes,
} }
@ -898,7 +894,7 @@ impl OutputFilenames {
/// Gets the output path where a compilation artifact of the given type /// Gets the output path where a compilation artifact of the given type
/// should be placed on disk. /// should be placed on disk.
pub fn output_path(&self, flavor: OutputType) -> PathBuf { fn output_path(&self, flavor: OutputType) -> PathBuf {
let extension = flavor.extension(); let extension = flavor.extension();
match flavor { match flavor {
OutputType::Metadata => { OutputType::Metadata => {
@ -1092,7 +1088,7 @@ impl Options {
|| self.unstable_opts.query_dep_graph || self.unstable_opts.query_dep_graph
} }
pub fn file_path_mapping(&self) -> FilePathMapping { pub(crate) fn file_path_mapping(&self) -> FilePathMapping {
file_path_mapping(self.remap_path_prefix.clone(), &self.unstable_opts) file_path_mapping(self.remap_path_prefix.clone(), &self.unstable_opts)
} }
@ -1173,14 +1169,14 @@ pub enum Passes {
} }
impl Passes { impl Passes {
pub fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
match *self { match *self {
Passes::Some(ref v) => v.is_empty(), Passes::Some(ref v) => v.is_empty(),
Passes::All => false, Passes::All => false,
} }
} }
pub fn extend(&mut self, passes: impl IntoIterator<Item = String>) { pub(crate) fn extend(&mut self, passes: impl IntoIterator<Item = String>) {
match *self { match *self {
Passes::Some(ref mut v) => v.extend(passes), Passes::Some(ref mut v) => v.extend(passes),
Passes::All => {} Passes::All => {}
@ -1206,7 +1202,7 @@ pub struct BranchProtection {
pub pac_ret: Option<PacRet>, pub pac_ret: Option<PacRet>,
} }
pub const fn default_lib_output() -> CrateType { pub(crate) const fn default_lib_output() -> CrateType {
CrateType::Rlib CrateType::Rlib
} }
@ -1584,15 +1580,15 @@ pub fn build_target_config(
} }
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum OptionStability { enum OptionStability {
Stable, Stable,
Unstable, Unstable,
} }
pub struct RustcOptGroup { pub struct RustcOptGroup {
pub apply: Box<dyn Fn(&mut getopts::Options) -> &mut getopts::Options>, pub apply: Box<dyn Fn(&mut getopts::Options) -> &mut getopts::Options>,
pub name: &'static str, name: &'static str,
pub stability: OptionStability, stability: OptionStability,
} }
impl RustcOptGroup { impl RustcOptGroup {
@ -1628,8 +1624,8 @@ mod opt {
use super::RustcOptGroup; use super::RustcOptGroup;
pub type R = RustcOptGroup; type R = RustcOptGroup;
pub type S = &'static str; type S = &'static str;
fn stable<F>(name: S, f: F) -> R fn stable<F>(name: S, f: F) -> R
where where
@ -1649,32 +1645,34 @@ mod opt {
if a.len() > b.len() { a } else { b } if a.len() > b.len() { a } else { b }
} }
pub fn opt_s(a: S, b: S, c: S, d: S) -> R { pub(crate) fn opt_s(a: S, b: S, c: S, d: S) -> R {
stable(longer(a, b), move |opts| opts.optopt(a, b, c, d)) stable(longer(a, b), move |opts| opts.optopt(a, b, c, d))
} }
pub fn multi_s(a: S, b: S, c: S, d: S) -> R { pub(crate) fn multi_s(a: S, b: S, c: S, d: S) -> R {
stable(longer(a, b), move |opts| opts.optmulti(a, b, c, d)) stable(longer(a, b), move |opts| opts.optmulti(a, b, c, d))
} }
pub fn flag_s(a: S, b: S, c: S) -> R { pub(crate) fn flag_s(a: S, b: S, c: S) -> R {
stable(longer(a, b), move |opts| opts.optflag(a, b, c)) stable(longer(a, b), move |opts| opts.optflag(a, b, c))
} }
pub fn flagmulti_s(a: S, b: S, c: S) -> R { pub(crate) fn flagmulti_s(a: S, b: S, c: S) -> R {
stable(longer(a, b), move |opts| opts.optflagmulti(a, b, c)) stable(longer(a, b), move |opts| opts.optflagmulti(a, b, c))
} }
pub fn opt(a: S, b: S, c: S, d: S) -> R { fn opt(a: S, b: S, c: S, d: S) -> R {
unstable(longer(a, b), move |opts| opts.optopt(a, b, c, d)) unstable(longer(a, b), move |opts| opts.optopt(a, b, c, d))
} }
pub fn multi(a: S, b: S, c: S, d: S) -> R { pub(crate) fn multi(a: S, b: S, c: S, d: S) -> R {
unstable(longer(a, b), move |opts| opts.optmulti(a, b, c, d)) unstable(longer(a, b), move |opts| opts.optmulti(a, b, c, d))
} }
} }
static EDITION_STRING: LazyLock<String> = LazyLock::new(|| { static EDITION_STRING: LazyLock<String> = LazyLock::new(|| {
format!( format!(
"Specify which edition of the compiler to use when compiling code. \ "Specify which edition of the compiler to use when compiling code. \
The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE_EDITION}." The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE_EDITION}."
) )
}); });
/// Returns the "short" subset of the rustc command line options, /// Returns the "short" subset of the rustc command line options,
/// including metadata for each option, such as whether the option is /// including metadata for each option, such as whether the option is
/// part of the stable long-term interface for rustc. /// part of the stable long-term interface for rustc.
@ -1864,9 +1862,9 @@ pub fn parse_color(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Col
/// Possible json config files /// Possible json config files
pub struct JsonConfig { pub struct JsonConfig {
pub json_rendered: HumanReadableErrorType, pub json_rendered: HumanReadableErrorType,
pub json_artifact_notifications: bool, json_artifact_notifications: bool,
pub json_unused_externs: JsonUnusedExterns, pub json_unused_externs: JsonUnusedExterns,
pub json_future_incompat: bool, json_future_incompat: bool,
} }
/// Report unused externs in event stream /// Report unused externs in event stream
@ -2992,7 +2990,7 @@ pub mod nightly_options {
is_nightly_build(matches.opt_str("crate-name").as_deref()) is_nightly_build(matches.opt_str("crate-name").as_deref())
} }
pub fn is_nightly_build(krate: Option<&str>) -> bool { fn is_nightly_build(krate: Option<&str>) -> bool {
UnstableFeatures::from_environment(krate).is_nightly_build() UnstableFeatures::from_environment(krate).is_nightly_build()
} }
@ -3199,7 +3197,7 @@ pub(crate) mod dep_tracking {
use std::num::NonZero; use std::num::NonZero;
use std::path::PathBuf; use std::path::PathBuf;
pub trait DepTrackingHash { pub(crate) trait DepTrackingHash {
fn hash( fn hash(
&self, &self,
hasher: &mut DefaultHasher, hasher: &mut DefaultHasher,

View File

@ -12,9 +12,9 @@ use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};
use crate::{config::CrateType, parse::ParseSess}; use crate::{config::CrateType, parse::ParseSess};
pub struct FeatureGateError { pub(crate) struct FeatureGateError {
pub span: MultiSpan, pub(crate) span: MultiSpan,
pub explain: DiagMessage, pub(crate) explain: DiagMessage,
} }
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError { impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError {
@ -26,22 +26,22 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(session_feature_diagnostic_for_issue)] #[note(session_feature_diagnostic_for_issue)]
pub struct FeatureDiagnosticForIssue { pub(crate) struct FeatureDiagnosticForIssue {
pub n: NonZero<u32>, pub(crate) n: NonZero<u32>,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(session_feature_suggest_upgrade_compiler)] #[note(session_feature_suggest_upgrade_compiler)]
pub struct SuggestUpgradeCompiler { pub(crate) struct SuggestUpgradeCompiler {
date: &'static str, date: &'static str,
} }
impl SuggestUpgradeCompiler { impl SuggestUpgradeCompiler {
pub fn ui_testing() -> Self { pub(crate) fn ui_testing() -> Self {
Self { date: "YYYY-MM-DD" } Self { date: "YYYY-MM-DD" }
} }
pub fn new() -> Option<Self> { pub(crate) fn new() -> Option<Self> {
let date = option_env!("CFG_VER_DATE")?; let date = option_env!("CFG_VER_DATE")?;
Some(Self { date }) Some(Self { date })
@ -50,108 +50,108 @@ impl SuggestUpgradeCompiler {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(session_feature_diagnostic_help)] #[help(session_feature_diagnostic_help)]
pub struct FeatureDiagnosticHelp { pub(crate) struct FeatureDiagnosticHelp {
pub feature: Symbol, pub(crate) feature: Symbol,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(session_cli_feature_diagnostic_help)] #[help(session_cli_feature_diagnostic_help)]
pub struct CliFeatureDiagnosticHelp { pub(crate) struct CliFeatureDiagnosticHelp {
pub feature: Symbol, pub(crate) feature: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_not_circumvent_feature)] #[diag(session_not_circumvent_feature)]
pub struct NotCircumventFeature; pub(crate) struct NotCircumventFeature;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_linker_plugin_lto_windows_not_supported)] #[diag(session_linker_plugin_lto_windows_not_supported)]
pub struct LinkerPluginToWindowsNotSupported; pub(crate) struct LinkerPluginToWindowsNotSupported;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_profile_use_file_does_not_exist)] #[diag(session_profile_use_file_does_not_exist)]
pub struct ProfileUseFileDoesNotExist<'a> { pub(crate) struct ProfileUseFileDoesNotExist<'a> {
pub path: &'a std::path::Path, pub(crate) path: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_profile_sample_use_file_does_not_exist)] #[diag(session_profile_sample_use_file_does_not_exist)]
pub struct ProfileSampleUseFileDoesNotExist<'a> { pub(crate) struct ProfileSampleUseFileDoesNotExist<'a> {
pub path: &'a std::path::Path, pub(crate) path: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_target_requires_unwind_tables)] #[diag(session_target_requires_unwind_tables)]
pub struct TargetRequiresUnwindTables; pub(crate) struct TargetRequiresUnwindTables;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_instrumentation_not_supported)] #[diag(session_instrumentation_not_supported)]
pub struct InstrumentationNotSupported { pub(crate) struct InstrumentationNotSupported {
pub us: String, pub(crate) us: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_not_supported)] #[diag(session_sanitizer_not_supported)]
pub struct SanitizerNotSupported { pub(crate) struct SanitizerNotSupported {
pub us: String, pub(crate) us: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizers_not_supported)] #[diag(session_sanitizers_not_supported)]
pub struct SanitizersNotSupported { pub(crate) struct SanitizersNotSupported {
pub us: String, pub(crate) us: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_cannot_mix_and_match_sanitizers)] #[diag(session_cannot_mix_and_match_sanitizers)]
pub struct CannotMixAndMatchSanitizers { pub(crate) struct CannotMixAndMatchSanitizers {
pub first: String, pub(crate) first: String,
pub second: String, pub(crate) second: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_cannot_enable_crt_static_linux)] #[diag(session_cannot_enable_crt_static_linux)]
pub struct CannotEnableCrtStaticLinux; pub(crate) struct CannotEnableCrtStaticLinux;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_cfi_requires_lto)] #[diag(session_sanitizer_cfi_requires_lto)]
pub struct SanitizerCfiRequiresLto; pub(crate) struct SanitizerCfiRequiresLto;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_cfi_requires_single_codegen_unit)] #[diag(session_sanitizer_cfi_requires_single_codegen_unit)]
pub struct SanitizerCfiRequiresSingleCodegenUnit; pub(crate) struct SanitizerCfiRequiresSingleCodegenUnit;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_cfi_canonical_jump_tables_requires_cfi)] #[diag(session_sanitizer_cfi_canonical_jump_tables_requires_cfi)]
pub struct SanitizerCfiCanonicalJumpTablesRequiresCfi; pub(crate) struct SanitizerCfiCanonicalJumpTablesRequiresCfi;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_cfi_generalize_pointers_requires_cfi)] #[diag(session_sanitizer_cfi_generalize_pointers_requires_cfi)]
pub struct SanitizerCfiGeneralizePointersRequiresCfi; pub(crate) struct SanitizerCfiGeneralizePointersRequiresCfi;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_sanitizer_cfi_normalize_integers_requires_cfi)] #[diag(session_sanitizer_cfi_normalize_integers_requires_cfi)]
pub struct SanitizerCfiNormalizeIntegersRequiresCfi; pub(crate) struct SanitizerCfiNormalizeIntegersRequiresCfi;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_split_lto_unit_requires_lto)] #[diag(session_split_lto_unit_requires_lto)]
pub struct SplitLtoUnitRequiresLto; pub(crate) struct SplitLtoUnitRequiresLto;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_unstable_virtual_function_elimination)] #[diag(session_unstable_virtual_function_elimination)]
pub struct UnstableVirtualFunctionElimination; pub(crate) struct UnstableVirtualFunctionElimination;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_unsupported_dwarf_version)] #[diag(session_unsupported_dwarf_version)]
pub struct UnsupportedDwarfVersion { pub(crate) struct UnsupportedDwarfVersion {
pub dwarf_version: u32, pub(crate) dwarf_version: u32,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_target_stack_protector_not_supported)] #[diag(session_target_stack_protector_not_supported)]
pub struct StackProtectorNotSupportedForTarget<'a> { pub(crate) struct StackProtectorNotSupportedForTarget<'a> {
pub stack_protector: StackProtector, pub(crate) stack_protector: StackProtector,
pub target_triple: &'a TargetTriple, pub(crate) target_triple: &'a TargetTriple,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -160,58 +160,58 @@ pub(crate) struct BranchProtectionRequiresAArch64;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_split_debuginfo_unstable_platform)] #[diag(session_split_debuginfo_unstable_platform)]
pub struct SplitDebugInfoUnstablePlatform { pub(crate) struct SplitDebugInfoUnstablePlatform {
pub debuginfo: SplitDebuginfo, pub(crate) debuginfo: SplitDebuginfo,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_file_is_not_writeable)] #[diag(session_file_is_not_writeable)]
pub struct FileIsNotWriteable<'a> { pub(crate) struct FileIsNotWriteable<'a> {
pub file: &'a std::path::Path, pub(crate) file: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_file_write_fail)] #[diag(session_file_write_fail)]
pub(crate) struct FileWriteFail<'a> { pub(crate) struct FileWriteFail<'a> {
pub path: &'a std::path::Path, pub(crate) path: &'a std::path::Path,
pub err: String, pub(crate) err: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_crate_name_does_not_match)] #[diag(session_crate_name_does_not_match)]
pub struct CrateNameDoesNotMatch { pub(crate) struct CrateNameDoesNotMatch {
#[primary_span] #[primary_span]
pub span: Span, pub(crate) span: Span,
pub s: Symbol, pub(crate) s: Symbol,
pub name: Symbol, pub(crate) name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_crate_name_invalid)] #[diag(session_crate_name_invalid)]
pub struct CrateNameInvalid<'a> { pub(crate) struct CrateNameInvalid<'a> {
pub s: &'a str, pub(crate) s: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_crate_name_empty)] #[diag(session_crate_name_empty)]
pub struct CrateNameEmpty { pub(crate) struct CrateNameEmpty {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub(crate) span: Option<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_character_in_create_name)] #[diag(session_invalid_character_in_create_name)]
pub struct InvalidCharacterInCrateName { pub(crate) struct InvalidCharacterInCrateName {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub(crate) span: Option<Span>,
pub character: char, pub(crate) character: char,
pub crate_name: Symbol, pub(crate) crate_name: Symbol,
#[subdiagnostic] #[subdiagnostic]
pub crate_name_help: Option<InvalidCrateNameHelp>, pub(crate) crate_name_help: Option<InvalidCrateNameHelp>,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum InvalidCrateNameHelp { pub(crate) enum InvalidCrateNameHelp {
#[help(session_invalid_character_in_create_name_help)] #[help(session_invalid_character_in_create_name_help)]
AddCrateName, AddCrateName,
} }
@ -220,9 +220,9 @@ pub enum InvalidCrateNameHelp {
#[multipart_suggestion(session_expr_parentheses_needed, applicability = "machine-applicable")] #[multipart_suggestion(session_expr_parentheses_needed, applicability = "machine-applicable")]
pub struct ExprParenthesesNeeded { pub struct ExprParenthesesNeeded {
#[suggestion_part(code = "(")] #[suggestion_part(code = "(")]
pub left: Span, left: Span,
#[suggestion_part(code = ")")] #[suggestion_part(code = ")")]
pub right: Span, right: Span,
} }
impl ExprParenthesesNeeded { impl ExprParenthesesNeeded {
@ -233,13 +233,13 @@ impl ExprParenthesesNeeded {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_skipping_const_checks)] #[diag(session_skipping_const_checks)]
pub struct SkippingConstChecks { pub(crate) struct SkippingConstChecks {
#[subdiagnostic] #[subdiagnostic]
pub unleashed_features: Vec<UnleashedFeatureHelp>, pub(crate) unleashed_features: Vec<UnleashedFeatureHelp>,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum UnleashedFeatureHelp { pub(crate) enum UnleashedFeatureHelp {
#[help(session_unleashed_feature_help_named)] #[help(session_unleashed_feature_help_named)]
Named { Named {
#[primary_span] #[primary_span]
@ -255,101 +255,101 @@ pub enum UnleashedFeatureHelp {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_literal_suffix)] #[diag(session_invalid_literal_suffix)]
pub(crate) struct InvalidLiteralSuffix<'a> { struct InvalidLiteralSuffix<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, span: Span,
// FIXME(#100717) // FIXME(#100717)
pub kind: &'a str, kind: &'a str,
pub suffix: Symbol, suffix: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_int_literal_width)] #[diag(session_invalid_int_literal_width)]
#[help] #[help]
pub(crate) struct InvalidIntLiteralWidth { struct InvalidIntLiteralWidth {
#[primary_span] #[primary_span]
pub span: Span, span: Span,
pub width: String, width: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_num_literal_base_prefix)] #[diag(session_invalid_num_literal_base_prefix)]
#[note] #[note]
pub(crate) struct InvalidNumLiteralBasePrefix { struct InvalidNumLiteralBasePrefix {
#[primary_span] #[primary_span]
#[suggestion(applicability = "maybe-incorrect", code = "{fixed}")] #[suggestion(applicability = "maybe-incorrect", code = "{fixed}")]
pub span: Span, span: Span,
pub fixed: String, fixed: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_num_literal_suffix)] #[diag(session_invalid_num_literal_suffix)]
#[help] #[help]
pub(crate) struct InvalidNumLiteralSuffix { struct InvalidNumLiteralSuffix {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, span: Span,
pub suffix: String, suffix: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_float_literal_width)] #[diag(session_invalid_float_literal_width)]
#[help] #[help]
pub(crate) struct InvalidFloatLiteralWidth { struct InvalidFloatLiteralWidth {
#[primary_span] #[primary_span]
pub span: Span, span: Span,
pub width: String, width: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_invalid_float_literal_suffix)] #[diag(session_invalid_float_literal_suffix)]
#[help] #[help]
pub(crate) struct InvalidFloatLiteralSuffix { struct InvalidFloatLiteralSuffix {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, span: Span,
pub suffix: String, suffix: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_int_literal_too_large)] #[diag(session_int_literal_too_large)]
#[note] #[note]
pub(crate) struct IntLiteralTooLarge { struct IntLiteralTooLarge {
#[primary_span] #[primary_span]
pub span: Span, span: Span,
pub limit: String, limit: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_hexadecimal_float_literal_not_supported)] #[diag(session_hexadecimal_float_literal_not_supported)]
pub(crate) struct HexadecimalFloatLiteralNotSupported { struct HexadecimalFloatLiteralNotSupported {
#[primary_span] #[primary_span]
#[label(session_not_supported)] #[label(session_not_supported)]
pub span: Span, span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_octal_float_literal_not_supported)] #[diag(session_octal_float_literal_not_supported)]
pub(crate) struct OctalFloatLiteralNotSupported { struct OctalFloatLiteralNotSupported {
#[primary_span] #[primary_span]
#[label(session_not_supported)] #[label(session_not_supported)]
pub span: Span, span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_binary_float_literal_not_supported)] #[diag(session_binary_float_literal_not_supported)]
pub(crate) struct BinaryFloatLiteralNotSupported { struct BinaryFloatLiteralNotSupported {
#[primary_span] #[primary_span]
#[label(session_not_supported)] #[label(session_not_supported)]
pub span: Span, span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_unsupported_crate_type_for_target)] #[diag(session_unsupported_crate_type_for_target)]
pub struct UnsupportedCrateTypeForTarget<'a> { pub(crate) struct UnsupportedCrateTypeForTarget<'a> {
pub crate_type: CrateType, pub(crate) crate_type: CrateType,
pub target_triple: &'a TargetTriple, pub(crate) target_triple: &'a TargetTriple,
} }
pub fn report_lit_error( pub fn report_lit_error(
@ -431,16 +431,16 @@ pub fn report_lit_error(
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_optimization_fuel_exhausted)] #[diag(session_optimization_fuel_exhausted)]
pub struct OptimisationFuelExhausted { pub(crate) struct OptimisationFuelExhausted {
pub msg: String, pub(crate) msg: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_incompatible_linker_flavor)] #[diag(session_incompatible_linker_flavor)]
#[note] #[note]
pub struct IncompatibleLinkerFlavor { pub(crate) struct IncompatibleLinkerFlavor {
pub flavor: &'static str, pub(crate) flavor: &'static str,
pub compatible_list: String, pub(crate) compatible_list: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -453,6 +453,6 @@ pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session_failed_to_create_profiler)] #[diag(session_failed_to_create_profiler)]
pub struct FailedToCreateProfiler { pub(crate) struct FailedToCreateProfiler {
pub err: String, pub(crate) err: String,
} }