]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_session/src/errors.rs
7aa8d66824103764a03baa29f531521b199b8cd9
[rust.git] / compiler / rustc_session / src / errors.rs
1 use std::num::NonZeroU32;
2
3 use crate::cgu_reuse_tracker::CguReuse;
4 use crate::{self as rustc_session};
5 use rustc_errors::MultiSpan;
6 use rustc_macros::SessionDiagnostic;
7 use rustc_span::{Span, Symbol};
8
9 #[derive(SessionDiagnostic)]
10 #[diag(session::incorrect_cgu_reuse_type)]
11 pub struct IncorrectCguReuseType<'a> {
12     #[primary_span]
13     pub span: Span,
14     pub cgu_user_name: &'a str,
15     pub actual_reuse: CguReuse,
16     pub expected_reuse: CguReuse,
17     pub at_least: u8,
18 }
19
20 #[derive(SessionDiagnostic)]
21 #[diag(session::cgu_not_recorded)]
22 pub struct CguNotRecorded<'a> {
23     pub cgu_user_name: &'a str,
24     pub cgu_name: &'a str,
25 }
26
27 #[derive(SessionDiagnostic)]
28 #[diag(session::feature_gate_error, code = "E0658")]
29 pub struct FeatureGateError<'a> {
30     #[primary_span]
31     pub span: MultiSpan,
32     pub explain: &'a str,
33 }
34
35 #[derive(SessionSubdiagnostic)]
36 #[note(session::feature_diagnostic_for_issue)]
37 pub struct FeatureDiagnosticForIssue {
38     pub n: NonZeroU32,
39 }
40
41 #[derive(SessionSubdiagnostic)]
42 #[help(session::feature_diagnostic_help)]
43 pub struct FeatureDiagnosticHelp {
44     pub feature: Symbol,
45 }
46
47 #[derive(SessionDiagnostic)]
48 #[diag(session::target_data_layout_parse_error)]
49 pub struct TargetDataLayoutParseError {
50     pub err: String,
51 }
52
53 #[derive(SessionDiagnostic)]
54 #[diag(session::not_circumvent_feature)]
55 pub struct NotCircumventFeature;
56
57 #[derive(SessionDiagnostic)]
58 #[diag(session::linker_plugin_lto_windows_not_supported)]
59 pub struct LinkerPluginToWindowsNotSupported;
60
61 #[derive(SessionDiagnostic)]
62 #[diag(session::profile_use_file_does_not_exist)]
63 pub struct ProfileUseFileDoesNotExist<'a> {
64     pub path: &'a std::path::Path,
65 }
66
67 #[derive(SessionDiagnostic)]
68 #[diag(session::profile_sample_use_file_does_not_exist)]
69 pub struct ProfileSampleUseFileDoesNotExist<'a> {
70     pub path: &'a std::path::Path,
71 }
72
73 #[derive(SessionDiagnostic)]
74 #[diag(session::target_requires_unwind_tables)]
75 pub struct TargetRequiresUnwindTables;
76
77 #[derive(SessionDiagnostic)]
78 #[diag(session::sanitizer_not_supported)]
79 pub struct SanitizerNotSupported {
80     pub us: String,
81 }
82
83 #[derive(SessionDiagnostic)]
84 #[diag(session::sanitizers_not_supported)]
85 pub struct SanitizersNotSupported {
86     pub us: String,
87 }
88
89 #[derive(SessionDiagnostic)]
90 #[diag(session::cannot_mix_and_match_sanitizers)]
91 pub struct CannotMixAndMatchSanitizers {
92     pub first: String,
93     pub second: String,
94 }
95
96 #[derive(SessionDiagnostic)]
97 #[diag(session::cannot_enable_crt_static_linux)]
98 pub struct CannotEnableCrtStaticLinux;
99
100 #[derive(SessionDiagnostic)]
101 #[diag(session::sanitizer_cfi_enabled)]
102 pub struct SanitizerCfiEnabled;
103
104 #[derive(SessionDiagnostic)]
105 #[diag(session::unstable_virtual_function_elimination)]
106 pub struct UnstableVirtualFunctionElimination;
107
108 #[derive(SessionDiagnostic)]
109 #[diag(session::unsupported_dwarf_version)]
110 pub struct UnsupportedDwarfVersion {
111     pub dwarf_version: u32,
112 }