2022-08-22 06:28:50 +00:00
|
|
|
use std::num::NonZeroU32;
|
|
|
|
|
2022-08-19 13:34:13 +00:00
|
|
|
use crate::cgu_reuse_tracker::CguReuse;
|
2022-10-14 12:25:43 +00:00
|
|
|
use rustc_errors::MultiSpan;
|
2022-09-15 04:01:44 +00:00
|
|
|
use rustc_macros::Diagnostic;
|
2022-08-22 06:28:50 +00:00
|
|
|
use rustc_span::{Span, Symbol};
|
2022-09-08 06:15:37 +00:00
|
|
|
use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};
|
2022-08-19 13:34:13 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_incorrect_cgu_reuse_type)]
|
2022-08-19 13:34:13 +00:00
|
|
|
pub struct IncorrectCguReuseType<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub cgu_user_name: &'a str,
|
|
|
|
pub actual_reuse: CguReuse,
|
|
|
|
pub expected_reuse: CguReuse,
|
2022-08-24 15:15:08 +00:00
|
|
|
pub at_least: u8,
|
2022-08-19 13:34:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_cgu_not_recorded)]
|
2022-08-24 15:15:08 +00:00
|
|
|
pub struct CguNotRecorded<'a> {
|
|
|
|
pub cgu_user_name: &'a str,
|
|
|
|
pub cgu_name: &'a str,
|
|
|
|
}
|
2022-08-22 06:28:50 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_feature_gate_error, code = "E0658")]
|
2022-08-22 06:28:50 +00:00
|
|
|
pub struct FeatureGateError<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: MultiSpan,
|
|
|
|
pub explain: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[note(session_feature_diagnostic_for_issue)]
|
2022-08-22 06:28:50 +00:00
|
|
|
pub struct FeatureDiagnosticForIssue {
|
|
|
|
pub n: NonZeroU32,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[help(session_feature_diagnostic_help)]
|
2022-08-22 06:28:50 +00:00
|
|
|
pub struct FeatureDiagnosticHelp {
|
|
|
|
pub feature: Symbol,
|
|
|
|
}
|
2022-08-26 14:06:27 +00:00
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_not_circumvent_feature)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct NotCircumventFeature;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_linker_plugin_lto_windows_not_supported)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct LinkerPluginToWindowsNotSupported;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_profile_use_file_does_not_exist)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct ProfileUseFileDoesNotExist<'a> {
|
|
|
|
pub path: &'a std::path::Path,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_profile_sample_use_file_does_not_exist)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct ProfileSampleUseFileDoesNotExist<'a> {
|
|
|
|
pub path: &'a std::path::Path,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_target_requires_unwind_tables)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct TargetRequiresUnwindTables;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_sanitizer_not_supported)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct SanitizerNotSupported {
|
|
|
|
pub us: String,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_sanitizers_not_supported)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct SanitizersNotSupported {
|
|
|
|
pub us: String,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_cannot_mix_and_match_sanitizers)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct CannotMixAndMatchSanitizers {
|
|
|
|
pub first: String,
|
|
|
|
pub second: String,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_cannot_enable_crt_static_linux)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct CannotEnableCrtStaticLinux;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_sanitizer_cfi_enabled)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct SanitizerCfiEnabled;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_unstable_virtual_function_elimination)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct UnstableVirtualFunctionElimination;
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_unsupported_dwarf_version)]
|
2022-08-26 14:06:27 +00:00
|
|
|
pub struct UnsupportedDwarfVersion {
|
|
|
|
pub dwarf_version: u32,
|
|
|
|
}
|
2022-09-08 06:15:37 +00:00
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_target_stack_protector_not_supported)]
|
2022-09-08 06:15:37 +00:00
|
|
|
pub struct StackProtectorNotSupportedForTarget<'a> {
|
|
|
|
pub stack_protector: StackProtector,
|
|
|
|
pub target_triple: &'a TargetTriple,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_split_debuginfo_unstable_platform)]
|
2022-09-08 06:15:37 +00:00
|
|
|
pub struct SplitDebugInfoUnstablePlatform {
|
|
|
|
pub debuginfo: SplitDebuginfo,
|
|
|
|
}
|
2022-09-01 06:03:47 +00:00
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_file_is_not_writeable)]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub struct FileIsNotWriteable<'a> {
|
|
|
|
pub file: &'a std::path::Path,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_crate_name_does_not_match)]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub struct CrateNameDoesNotMatch<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub s: &'a str,
|
|
|
|
pub name: Symbol,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_crate_name_invalid)]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub struct CrateNameInvalid<'a> {
|
|
|
|
pub s: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-15 04:01:44 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_crate_name_empty)]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub struct CrateNameEmpty {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
2022-10-14 12:25:43 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_invalid_character_in_create_name)]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub struct InvalidCharacterInCrateName<'a> {
|
2022-10-14 12:25:43 +00:00
|
|
|
#[primary_span]
|
2022-09-01 06:03:47 +00:00
|
|
|
pub span: Option<Span>,
|
|
|
|
pub character: char,
|
|
|
|
pub crate_name: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-08-25 08:58:53 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[multipart_suggestion(session_expr_parentheses_needed, applicability = "machine-applicable")]
|
2022-08-25 08:58:53 +00:00
|
|
|
pub struct ExprParenthesesNeeded {
|
|
|
|
#[suggestion_part(code = "(")]
|
|
|
|
pub left: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
pub right: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ExprParenthesesNeeded {
|
|
|
|
pub fn surrounding(s: Span) -> Self {
|
|
|
|
ExprParenthesesNeeded { left: s.shrink_to_lo(), right: s.shrink_to_hi() }
|
|
|
|
}
|
|
|
|
}
|
2022-10-14 12:25:43 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(session_skipping_const_checks)]
|
2022-10-14 12:25:43 +00:00
|
|
|
pub struct SkippingConstChecks {
|
|
|
|
#[subdiagnostic(eager)]
|
|
|
|
pub unleashed_features: Vec<UnleashedFeatureHelp>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
pub enum UnleashedFeatureHelp {
|
2022-10-22 09:07:54 +00:00
|
|
|
#[help(session_unleashed_feature_help_named)]
|
2022-10-14 12:25:43 +00:00
|
|
|
Named {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
gate: Symbol,
|
|
|
|
},
|
2022-10-22 09:07:54 +00:00
|
|
|
#[help(session_unleashed_feature_help_unnamed)]
|
2022-10-14 12:25:43 +00:00
|
|
|
Unnamed {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|