mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-17 01:38:05 +00:00

This commit migrates the errors in the function check_expected_reuse to use the new SessionDiagnostic. It also does some small refactor for the IncorrectCguReuseType to include the 'at least' word in the fluent translation file
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
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,
|
|
}
|