Skip to content

Commit ea96681

Browse files
Convert to inline diagnostics in rustc_hir_analysis
1 parent f889772 commit ea96681

File tree

9 files changed

+564
-992
lines changed

9 files changed

+564
-992
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3959,7 +3959,6 @@ dependencies = [
39593959
"rustc_data_structures",
39603960
"rustc_errors",
39613961
"rustc_feature",
3962-
"rustc_fluent_macro",
39633962
"rustc_hir",
39643963
"rustc_index",
39653964
"rustc_infer",

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
116116
// tidy-alphabetical-start
117117
rustc_borrowck::DEFAULT_LOCALE_RESOURCE,
118118
rustc_const_eval::DEFAULT_LOCALE_RESOURCE,
119-
rustc_hir_analysis::DEFAULT_LOCALE_RESOURCE,
120119
rustc_lint::DEFAULT_LOCALE_RESOURCE,
121120
rustc_mir_build::DEFAULT_LOCALE_RESOURCE,
122121
rustc_parse::DEFAULT_LOCALE_RESOURCE,

compiler/rustc_hir_analysis/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ rustc_ast = { path = "../rustc_ast" }
1616
rustc_data_structures = { path = "../rustc_data_structures" }
1717
rustc_errors = { path = "../rustc_errors" }
1818
rustc_feature = { path = "../rustc_feature" }
19-
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
2019
rustc_hir = { path = "../rustc_hir" }
2120
rustc_index = { path = "../rustc_index" }
2221
rustc_infer = { path = "../rustc_infer" }

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 0 additions & 605 deletions
This file was deleted.

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use hir::intravisit::{self, Visitor};
55
use rustc_abi::{ExternAbi, ScalableElt};
66
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
77
use rustc_errors::codes::*;
8-
use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
8+
use rustc_errors::{
9+
Applicability, ErrorGuaranteed, inline_fluent, pluralize, struct_span_code_err,
10+
};
911
use rustc_hir::attrs::{AttributeKind, EiiDecl, EiiImpl, EiiImplResolution};
1012
use rustc_hir::def::{DefKind, Res};
1113
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -42,8 +44,8 @@ use {rustc_ast as ast, rustc_hir as hir};
4244
use super::compare_eii::compare_eii_function_types;
4345
use crate::autoderef::Autoderef;
4446
use crate::constrained_generic_params::{Parameter, identify_constrained_generic_params};
47+
use crate::errors;
4548
use crate::errors::InvalidReceiverTyHint;
46-
use crate::{errors, fluent_generated as fluent};
4749

4850
pub(super) struct WfCheckingCtxt<'a, 'tcx> {
4951
pub(super) ocx: ObligationCtxt<'a, 'tcx, FulfillmentError<'tcx>>,
@@ -1740,7 +1742,7 @@ fn check_method_receiver<'tcx>(
17401742
the `arbitrary_self_types` feature",
17411743
),
17421744
)
1743-
.with_help(fluent::hir_analysis_invalid_receiver_ty_help)
1745+
.with_help(inline_fluent!("consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`"))
17441746
.emit()
17451747
}
17461748
None | Some(ArbitrarySelfTypesLevel::Basic)
@@ -1764,7 +1766,7 @@ fn check_method_receiver<'tcx>(
17641766
the `arbitrary_self_types_pointers` feature",
17651767
),
17661768
)
1767-
.with_help(fluent::hir_analysis_invalid_receiver_ty_help)
1769+
.with_help(inline_fluent!("consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`"))
17681770
.emit()
17691771
}
17701772
_ =>
@@ -2442,8 +2444,8 @@ fn lint_redundant_lifetimes<'tcx>(
24422444
}
24432445

24442446
#[derive(LintDiagnostic)]
2445-
#[diag(hir_analysis_redundant_lifetime_args)]
2446-
#[note]
2447+
#[diag("unnecessary lifetime parameter `{$victim}`")]
2448+
#[note("you can use the `{$candidate}` lifetime directly, in place of `{$victim}`")]
24472449
struct RedundantLifetimeArgsLint<'tcx> {
24482450
/// The lifetime we have found to be redundant.
24492451
victim: ty::Region<'tcx>,

0 commit comments

Comments
 (0)