Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Auto merge of rust-lang#134349 - jieyouxu:rollup-zqn0jox, r=jieyouxu
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

 - rust-lang#134111 (Fix `--nocapture` for run-make tests)
 - rust-lang#134329 (Add m68k_target_feature)
 - rust-lang#134331 (bootstrap: make ./x test error-index work)
 - rust-lang#134339 (Pass `TyCtxt` to early diagostics decoration)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 15, 2024
2 parents d185062 + 56545ca commit c26db43
Show file tree
Hide file tree
Showing 18 changed files with 184 additions and 171 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ declare_features! (
(unstable, hexagon_target_feature, "1.27.0", Some(44839)),
(unstable, lahfsahf_target_feature, "1.78.0", Some(44839)),
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
(unstable, m68k_target_feature, "CURRENT_RUSTC_VERSION", Some(134328)),
(unstable, mips_target_feature, "1.27.0", Some(44839)),
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ fn pre_expansion_lint<'a>(
|| {
rustc_lint::check_ast_node(
sess,
None,
features,
true,
lint_store,
Expand Down Expand Up @@ -310,6 +311,7 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) {
let lint_store = unerased_lint_store(tcx.sess);
rustc_lint::check_ast_node(
sess,
Some(tcx),
tcx.features(),
false,
lint_store,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ lint_unexpected_cfg_add_build_rs_println = or consider adding `{$build_rs_printl
lint_unexpected_cfg_add_cargo_feature = consider using a Cargo feature instead
lint_unexpected_cfg_add_cargo_toml_lint_cfg = or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}
lint_unexpected_cfg_add_cmdline_arg = to expect this configuration use `{$cmdline_arg}`
lint_unexpected_cfg_cargo_update = the {$macro_kind} `{$macro_name}` may come from an old version of it's defining crate, try updating your dependencies with `cargo update`
lint_unexpected_cfg_cargo_update = the {$macro_kind} `{$macro_name}` may come from an old version of the `{$crate_name}` crate, try updating your dependency with `cargo update -p {$crate_name}`
lint_unexpected_cfg_define_features = consider defining some features in `Cargo.toml`
lint_unexpected_cfg_doc_cargo = see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
Expand Down
36 changes: 1 addition & 35 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
use rustc_middle::ty::print::{PrintError, PrintTraitRefExt as _, Printer, with_no_trimmed_paths};
use rustc_middle::ty::{self, GenericArg, RegisteredTools, Ty, TyCtxt, TypingEnv, TypingMode};
use rustc_session::lint::{
BuiltinLintDiag, FutureIncompatibleInfo, Level, Lint, LintBuffer, LintExpectationId, LintId,
FutureIncompatibleInfo, Level, Lint, LintBuffer, LintExpectationId, LintId,
};
use rustc_session::{LintStoreMarker, Session};
use rustc_span::Span;
Expand All @@ -33,8 +33,6 @@ use self::TargetLint::*;
use crate::levels::LintLevelsBuilder;
use crate::passes::{EarlyLintPassObject, LateLintPassObject};

mod diagnostics;

type EarlyLintPassFactory = dyn Fn() -> EarlyLintPassObject + sync::DynSend + sync::DynSync;
type LateLintPassFactory =
dyn for<'tcx> Fn(TyCtxt<'tcx>) -> LateLintPassObject<'tcx> + sync::DynSend + sync::DynSync;
Expand Down Expand Up @@ -511,38 +509,6 @@ pub struct EarlyContext<'a> {
pub buffered: LintBuffer,
}

impl EarlyContext<'_> {
/// Emit a lint at the appropriate level, with an associated span and an existing
/// diagnostic.
///
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
#[rustc_lint_diagnostics]
pub fn span_lint_with_diagnostics(
&self,
lint: &'static Lint,
span: MultiSpan,
diagnostic: BuiltinLintDiag,
) {
self.opt_span_lint_with_diagnostics(lint, Some(span), diagnostic);
}

/// Emit a lint at the appropriate level, with an optional associated span and an existing
/// diagnostic.
///
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
#[rustc_lint_diagnostics]
pub fn opt_span_lint_with_diagnostics(
&self,
lint: &'static Lint,
span: Option<MultiSpan>,
diagnostic: BuiltinLintDiag,
) {
self.opt_span_lint(lint, span, |diag| {
diagnostics::decorate_lint(self.sess(), diagnostic, diag);
});
}
}

pub trait LintContext {
fn sess(&self) -> &Session;

Expand Down
Loading

0 comments on commit c26db43

Please sign in to comment.