forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#100753 - LuisCardosoOliveira:translation-mi…
…grate-session, r=davidtwco translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1 ## Description This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](rust-lang#100717 (comment)). The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
- Loading branch information
Showing
7 changed files
with
110 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
session_incorrect_cgu_reuse_type = | ||
CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least -> | ||
[one] {"at least "} | ||
*[other] {""} | ||
}`{$expected_reuse}` | ||
session_cgu_not_recorded = | ||
CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded` | ||
session_feature_gate_error = {$explain} | ||
session_feature_diagnostic_for_issue = | ||
see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information | ||
session_feature_diagnostic_help = | ||
add `#![feature({$feature})]` to the crate attributes to enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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, Symbol}; | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[diag(session::incorrect_cgu_reuse_type)] | ||
pub struct IncorrectCguReuseType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub cgu_user_name: &'a str, | ||
pub actual_reuse: CguReuse, | ||
pub expected_reuse: CguReuse, | ||
pub at_least: u8, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[diag(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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
#[macro_use] | ||
extern crate rustc_macros; | ||
pub mod errors; | ||
|
||
pub mod cgu_reuse_tracker; | ||
pub mod utils; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters