diff options
| author | bors <bors@rust-lang.org> | 2023-02-17 01:14:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-17 01:14:39 +0000 |
| commit | ea218392a4ce119c4dfcd8fb94a7fee77f76f2c5 (patch) | |
| tree | 78b5939c0ed6ee6449bb4d7c904d25edd3f05098 /compiler/rustc_session/src/errors.rs | |
| parent | 947b696ce0ce42c98b8fb82ffa0735ade051466c (diff) | |
| parent | ecdb7bcee855107f5edaf29a00dadeed3a23caaa (diff) | |
| download | rust-ea218392a4ce119c4dfcd8fb94a7fee77f76f2c5.tar.gz rust-ea218392a4ce119c4dfcd8fb94a7fee77f76f2c5.zip | |
Auto merge of #108145 - matthiaskrgr:rollup-bgadak1, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #104068 (rustdoc: Add PartialOrd trait to doc comment explanation) - #107489 (Implement partial support for non-lifetime binders) - #107905 (Pass arguments to `x` subcommands with `--`) - #108009 (Move some tests) - #108086 (wasm: Register the `relaxed-simd` target feature) - #108104 (don't into self) - #108133 (Small cleanups around `EarlyBinder`) - #108136 (Do not ICE on unmet trait alias impl bounds) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_session/src/errors.rs')
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 093698f3b35..bd32adbbdbb 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -4,7 +4,7 @@ use crate::cgu_reuse_tracker::CguReuse; use crate::parse::ParseSess; use rustc_ast::token; use rustc_ast::util::literal::LitError; -use rustc_errors::MultiSpan; +use rustc_errors::{error_code, DiagnosticMessage, EmissionGuarantee, IntoDiagnostic, MultiSpan}; use rustc_macros::Diagnostic; use rustc_span::{Span, Symbol}; use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple}; @@ -27,12 +27,22 @@ pub struct CguNotRecorded<'a> { pub cgu_name: &'a str, } -#[derive(Diagnostic)] -#[diag(session_feature_gate_error, code = "E0658")] -pub struct FeatureGateError<'a> { - #[primary_span] +pub struct FeatureGateError { pub span: MultiSpan, - pub explain: &'a str, + pub explain: DiagnosticMessage, +} + +impl<'a, T: EmissionGuarantee> IntoDiagnostic<'a, T> for FeatureGateError { + #[track_caller] + fn into_diagnostic( + self, + handler: &'a rustc_errors::Handler, + ) -> rustc_errors::DiagnosticBuilder<'a, T> { + let mut diag = handler.struct_diagnostic(self.explain); + diag.set_span(self.span); + diag.code(error_code!(E0658)); + diag + } } #[derive(Subdiagnostic)] |
