Skip to content

Commit 958d1f9

Browse files
Rollup merge of rust-lang#150879 - remove_diag_lints, r=Kivooeo
Remove the diagnostic lints Removes the `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints These lints are allowed for a while already. Per rust-lang/compiler-team#959, we no longer want to enforce struct diagnostics for all usecases, so this is no longer useful. r? @Kivooeo I recommend reviewing commit by commit (also feel free to wait with reviewing until the MCP is accepted) @rustbot +S-blocked Blocked by rust-lang/compiler-team#959
2 parents a66a2e3 + 0fa5589 commit 958d1f9

File tree

91 files changed

+33
-790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+33
-790
lines changed

compiler/rustc_ast_lowering/src/stability.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub(crate) fn extern_abi_enabled(
2929
})
3030
}
3131

32-
#[allow(rustc::untranslatable_diagnostic)]
3332
pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, abi: ExternAbi) {
3433
match extern_abi_enabled(features, span, abi) {
3534
Ok(_) => (),

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@ use crate::errors;
1313
macro_rules! gate {
1414
($visitor:expr, $feature:ident, $span:expr, $explain:expr) => {{
1515
if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) {
16-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
1716
feature_err(&$visitor.sess, sym::$feature, $span, $explain).emit();
1817
}
1918
}};
2019
($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{
2120
if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) {
22-
// FIXME: make this translatable
23-
#[allow(rustc::diagnostic_outside_of_impl)]
24-
#[allow(rustc::untranslatable_diagnostic)]
2521
feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit();
2622
}
2723
}};
@@ -31,13 +27,11 @@ macro_rules! gate {
3127
macro_rules! gate_alt {
3228
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr) => {{
3329
if !$has_feature && !$span.allows_unstable($name) {
34-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
3530
feature_err(&$visitor.sess, $name, $span, $explain).emit();
3631
}
3732
}};
3833
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr, $notes: expr) => {{
3934
if !$has_feature && !$span.allows_unstable($name) {
40-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
4135
let mut diag = feature_err(&$visitor.sess, $name, $span, $explain);
4236
for note in $notes {
4337
diag.note(*note);
@@ -491,7 +485,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
491485
&& (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks))
492486
&& (!visitor.features.yield_expr() && !span.allows_unstable(sym::yield_expr))
493487
{
494-
#[allow(rustc::untranslatable_diagnostic)]
495488
// Emit yield_expr as the error, since that will be sufficient. You can think of it
496489
// as coroutines and gen_blocks imply yield_expr.
497490
feature_err(&visitor.sess, sym::yield_expr, *span, "yield syntax is experimental")
@@ -523,7 +516,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
523516
if !visitor.features.min_generic_const_args()
524517
&& !span.allows_unstable(sym::min_generic_const_args)
525518
{
526-
#[allow(rustc::untranslatable_diagnostic)]
527519
feature_err(
528520
&visitor.sess,
529521
sym::min_generic_const_args,
@@ -559,7 +551,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
559551
if let Ok(snippet) = sm.span_to_snippet(span)
560552
&& snippet == "!"
561553
{
562-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
563554
feature_err(sess, sym::never_patterns, span, "`!` patterns are experimental")
564555
.emit();
565556
} else {

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ fn try_gate_cfg(name: Symbol, span: Span, sess: &Session, features: Option<&Feat
412412
}
413413
}
414414

415-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
416415
fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &Session, features: &Features) {
417416
let (cfg, feature, has_feature) = gated_cfg;
418417
if !has_feature(features) && !cfg_span.allows_unstable(*feature) {

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
141141

142142
macro report_unstable_modifier($feature: ident) {
143143
if !features.$feature() {
144-
// FIXME: make this translatable
145-
#[expect(rustc::untranslatable_diagnostic)]
146144
feature_err(
147145
sess,
148146
sym::$feature,

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,6 @@ impl<S: Stage> SingleAttributeParser<S> for RustcLegacyConstGenericsParser {
164164
}
165165
}
166166

167-
pub(crate) struct RustcLintDiagnosticsParser;
168-
169-
impl<S: Stage> NoArgsAttributeParser<S> for RustcLintDiagnosticsParser {
170-
const PATH: &[Symbol] = &[sym::rustc_lint_diagnostics];
171-
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
172-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
173-
Allow(Target::Fn),
174-
Allow(Target::Method(MethodKind::Inherent)),
175-
Allow(Target::Method(MethodKind::Trait { body: false })),
176-
Allow(Target::Method(MethodKind::Trait { body: true })),
177-
Allow(Target::Method(MethodKind::TraitImpl)),
178-
]);
179-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcLintDiagnostics;
180-
}
181-
182167
pub(crate) struct RustcLintOptDenyFieldAccessParser;
183168

184169
impl<S: Stage> SingleAttributeParser<S> for RustcLintOptDenyFieldAccessParser {

compiler/rustc_attr_parsing/src/attributes/transparency.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ use super::prelude::*;
44

55
pub(crate) struct TransparencyParser;
66

7-
// FIXME(jdonszelmann): make these proper diagnostics
8-
#[allow(rustc::untranslatable_diagnostic)]
9-
#[allow(rustc::diagnostic_outside_of_impl)]
107
impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
118
const PATH: &[Symbol] = &[sym::rustc_macro_transparency];
129
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ use crate::attributes::rustc_dump::{
7575
use crate::attributes::rustc_internal::{
7676
RustcHasIncoherentInherentImplsParser, RustcLayoutScalarValidRangeEndParser,
7777
RustcLayoutScalarValidRangeStartParser, RustcLegacyConstGenericsParser,
78-
RustcLintDiagnosticsParser, RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser,
79-
RustcLintQueryInstabilityParser, RustcLintUntrackedQueryInformationParser, RustcMainParser,
80-
RustcMustImplementOneOfParser, RustcNeverReturnsNullPointerParser,
81-
RustcNoImplicitAutorefsParser, RustcNounwindParser, RustcObjectLifetimeDefaultParser,
82-
RustcOffloadKernelParser, RustcScalableVectorParser, RustcSimdMonomorphizeLaneLimitParser,
78+
RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser, RustcLintQueryInstabilityParser,
79+
RustcLintUntrackedQueryInformationParser, RustcMainParser, RustcMustImplementOneOfParser,
80+
RustcNeverReturnsNullPointerParser, RustcNoImplicitAutorefsParser, RustcNounwindParser,
81+
RustcObjectLifetimeDefaultParser, RustcOffloadKernelParser, RustcScalableVectorParser,
82+
RustcSimdMonomorphizeLaneLimitParser,
8383
};
8484
use crate::attributes::semantics::MayDangleParser;
8585
use crate::attributes::stability::{
@@ -289,7 +289,6 @@ attribute_parsers!(
289289
Single<WithoutArgs<RustcDumpUserArgs>>,
290290
Single<WithoutArgs<RustcDumpVtable>>,
291291
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
292-
Single<WithoutArgs<RustcLintDiagnosticsParser>>,
293292
Single<WithoutArgs<RustcLintOptTyParser>>,
294293
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
295294
Single<WithoutArgs<RustcLintUntrackedQueryInformationParser>>,

compiler/rustc_borrowck/src/borrowck_errors.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#![allow(rustc::diagnostic_outside_of_impl)]
2-
#![allow(rustc::untranslatable_diagnostic)]
3-
41
use rustc_errors::codes::*;
52
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, struct_span_code_err};
63
use rustc_hir as hir;

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// ignore-tidy-filelength
22

3-
#![allow(rustc::diagnostic_outside_of_impl)]
4-
#![allow(rustc::untranslatable_diagnostic)]
5-
63
use std::iter;
74
use std::ops::ControlFlow;
85

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Print diagnostics to explain why values are borrowed.
22
3-
#![allow(rustc::diagnostic_outside_of_impl)]
4-
#![allow(rustc::untranslatable_diagnostic)]
5-
63
use rustc_data_structures::assert_matches;
74
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
85
use rustc_hir as hir;

0 commit comments

Comments
 (0)