diff options
| author | Luis Cardoso <61982523+LuisCardosoOliveira@users.noreply.github.com> | 2022-08-22 08:28:50 +0200 |
|---|---|---|
| committer | Luis Cardoso <61982523+LuisCardosoOliveira@users.noreply.github.com> | 2022-08-26 16:10:11 +0200 |
| commit | d5262a945246a624113faaadbbdae4ec5013c862 (patch) | |
| tree | 5a822b5196246bfdbc3dbb9a7574ace5730946d6 /compiler/rustc_session/src/errors.rs | |
| parent | 706452eba74026c51e8d0fa30aee2497c69eafc0 (diff) | |
| download | rust-d5262a945246a624113faaadbbdae4ec5013c862.tar.gz rust-d5262a945246a624113faaadbbdae4ec5013c862.zip | |
translations(rustc_session): migrate 80% of the file parse.rs
This commit migrates around 80% of the parse file to use SsessionDiagnostic We still have to migrate struct_err and struct_warn.
Diffstat (limited to 'compiler/rustc_session/src/errors.rs')
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index ef78d1c9836..54e5fe82f5c 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -1,10 +1,13 @@ +use std::num::NonZeroU32; + use crate as rustc_session; use crate::cgu_reuse_tracker::CguReuse; +use rustc_errors::MultiSpan; use rustc_macros::SessionDiagnostic; -use rustc_span::Span; +use rustc_span::{Span, Symbol}; #[derive(SessionDiagnostic)] -#[error(session::incorrect_cgu_reuse_type)] +#[diag(session::incorrect_cgu_reuse_type)] pub struct IncorrectCguReuseType<'a> { #[primary_span] pub span: Span, @@ -14,9 +17,30 @@ pub struct IncorrectCguReuseType<'a> { pub at_least: &'a str, } +//FIXME: Uncomment this once PR #100694 that implements `[fatal(..)]` is merged // #[derive(SessionDiagnostic)] // #[fatal(session::cgu_not_recorded)] // pub struct CguNotRecorded<'a> { // pub cgu_user_name: &'a str, // pub cgu_name: &'a str, // } + +#[derive(SessionDiagnostic)] +#[diag(session::feature_gate_error, code = "E0658")] +pub struct FeatureGateError<'a> { + #[primary_span] + pub span: MultiSpan, + pub explain: &'a str, +} + +#[derive(SessionSubdiagnostic)] +#[note(session::feature_diagnostic_for_issue)] +pub struct FeatureDiagnosticForIssue { + pub n: NonZeroU32, +} + +#[derive(SessionSubdiagnostic)] +#[help(session::feature_diagnostic_help)] +pub struct FeatureDiagnosticHelp { + pub feature: Symbol, +} |
