Skip to content

Rollup of 8 pull requests #141668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
be5d6c5
gvn: bail out unavoidable non-ssa locals in repeat
dianqk May 19, 2025
4ef35bc
rustdoc: use descriptive tooltip if doctest is conditionally ignored
lolbinarycat May 24, 2025
a8ae2af
hir_body_const_context should take LocalDefId
compiler-errors May 25, 2025
5370c57
Make PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS into a HIR lint
compiler-errors May 25, 2025
295a8d5
Make UNNECESSARY_TRANSMUTES into a HIR lint
compiler-errors May 25, 2025
6ec41a7
ci: fix llvm test coverage
marcoieni May 26, 2025
f9931d1
rustdoc: refactor Tooltip rendering logic
lolbinarycat May 26, 2025
e33fe61
Add custom trait for emitting lint within `cfg_matches`
Urgau May 10, 2025
93f3db2
Expose `rustc_lint::decorate_builtin_lint` for use in `rustdoc`
Urgau May 10, 2025
3fd0265
rustdoc: use custom `CfgMatchesLintEmitter` to make check-cfg work
Urgau May 10, 2025
e3bbbee
support `#[cfg(...)]` on arguments to the `asm!` macros
folkertdev Apr 30, 2025
c7c0194
move asm parsing code into `rustc_parse`
folkertdev May 5, 2025
2490bba
Bump master `stage0` compiler
jieyouxu May 27, 2025
eed0659
✨ feat: map_or_default for result and option
tkr-sh May 27, 2025
743d252
Rollup merge of #140367 - folkertdev:asm-cfg, r=nnethercote
tgross35 May 28, 2025
0c2fbe5
Rollup merge of #140894 - Urgau:check-cfg-rustdoc, r=GuillaumeGomez
tgross35 May 28, 2025
ee4efa1
Rollup merge of #141252 - dianqk:gvn-repeat-index, r=saethlin
tgross35 May 28, 2025
a8c7a1e
Rollup merge of #141517 - lolbinarycat:rustdoc-doctest-tooltip-ignore…
tgross35 May 28, 2025
e0278ed
Rollup merge of #141551 - compiler-errors:hir-lints, r=BoxyUwU
tgross35 May 28, 2025
77ddf1a
Rollup merge of #141591 - marcoieni:fix-llvm-test-coverage, r=Kobzol
tgross35 May 28, 2025
f953c6d
Rollup merge of #141647 - jieyouxu:bump-master-stage0, r=pietroalbini
tgross35 May 28, 2025
da61494
Rollup merge of #141659 - tkr-sh:map-or-default, r=Amanieu
tgross35 May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@ use rustc_attr_data_structures::RustcVersion;
use rustc_feature::{Features, GatedCfg, find_gated_cfg};
use rustc_session::Session;
use rustc_session::config::ExpectedValues;
use rustc_session::lint::BuiltinLintDiag;
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
use rustc_session::lint::{BuiltinLintDiag, Lint};
use rustc_session::parse::feature_err;
use rustc_span::{Span, Symbol, sym};

use crate::session_diagnostics::{self, UnsupportedLiteralReason};
use crate::{fluent_generated, parse_version};

/// Emitter of a builtin lint from `cfg_matches`.
///
/// Used to support emiting a lint (currently on check-cfg), either:
/// - as an early buffered lint (in `rustc`)
/// - or has a "normal" lint from HIR (in `rustdoc`)
pub trait CfgMatchesLintEmitter {
fn emit_span_lint(&self, sess: &Session, lint: &'static Lint, sp: Span, diag: BuiltinLintDiag);
}

impl CfgMatchesLintEmitter for NodeId {
fn emit_span_lint(&self, sess: &Session, lint: &'static Lint, sp: Span, diag: BuiltinLintDiag) {
sess.psess.buffer_lint(lint, sp, *self, diag);
}
}

#[derive(Clone, Debug)]
pub struct Condition {
pub name: Symbol,
Expand All @@ -25,28 +40,28 @@ pub struct Condition {
pub fn cfg_matches(
cfg: &MetaItemInner,
sess: &Session,
lint_node_id: NodeId,
lint_emitter: impl CfgMatchesLintEmitter,
features: Option<&Features>,
) -> bool {
eval_condition(cfg, sess, features, &mut |cfg| {
try_gate_cfg(cfg.name, cfg.span, sess, features);
match sess.psess.check_config.expecteds.get(&cfg.name) {
Some(ExpectedValues::Some(values)) if !values.contains(&cfg.value) => {
sess.psess.buffer_lint(
lint_emitter.emit_span_lint(
sess,
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
BuiltinLintDiag::UnexpectedCfgValue(
(cfg.name, cfg.name_span),
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
),
);
}
None if sess.psess.check_config.exhaustive_names => {
sess.psess.buffer_lint(
lint_emitter.emit_span_lint(
sess,
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
BuiltinLintDiag::UnexpectedCfgName(
(cfg.name, cfg.name_span),
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
Expand Down
32 changes: 9 additions & 23 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
builtin_macros_alloc_error_must_be_fn = alloc_error_handler must be a function
builtin_macros_alloc_must_statics = allocators must be statics

builtin_macros_asm_attribute_not_supported =
this attribute is not supported on assembly
builtin_macros_asm_cfg =
the `#[cfg(/* ... */)]` and `#[cfg_attr(/* ... */)]` attributes on assembly are unstable

builtin_macros_asm_clobber_abi = clobber_abi
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs
builtin_macros_asm_clobber_outputs = generic outputs
Expand All @@ -9,17 +14,6 @@ builtin_macros_asm_duplicate_arg = duplicate argument named `{$name}`
.label = previously here
.arg = duplicate argument

builtin_macros_asm_expected_comma = expected token: `,`
.label = expected `,`

builtin_macros_asm_expected_other = expected operand, {$is_inline_asm ->
[false] options
*[true] clobber_abi, options
}, or additional template string

builtin_macros_asm_expected_string_literal = expected string literal
.label = not a string literal

builtin_macros_asm_explicit_register_name = explicit register arguments cannot have names

builtin_macros_asm_mayunwind = asm labels are not allowed with the `may_unwind` option
Expand All @@ -45,17 +39,8 @@ builtin_macros_asm_pure_combine = the `pure` option must be combined with either

builtin_macros_asm_pure_no_output = asm with the `pure` option must have at least one output

builtin_macros_asm_requires_template = requires at least a template string argument

builtin_macros_asm_sym_no_path = expected a path for argument to `sym`

builtin_macros_asm_underscore_input = _ cannot be used for input operands

builtin_macros_asm_unsupported_clobber_abi = `clobber_abi` cannot be used with `{$macro_name}!`

builtin_macros_asm_unsupported_operand = the `{$symbol}` operand cannot be used with `{$macro_name}!`
.label = the `{$symbol}` operand is not meaningful for global-scoped inline assembly, remove it

builtin_macros_asm_unsupported_option = the `{$symbol}` option cannot be used with `{$macro_name}!`
.label = the `{$symbol}` option is not meaningful for global-scoped inline assembly
.suggestion = remove this option
Expand Down Expand Up @@ -162,7 +147,10 @@ builtin_macros_expected_comma_in_list = expected token: `,`

builtin_macros_expected_one_cfg_pattern = expected 1 cfg-pattern

builtin_macros_expected_register_class_or_explicit_register = expected register class or explicit register
builtin_macros_expected_other = expected operand, {$is_inline_asm ->
[false] options
*[true] clobber_abi, options
}, or additional template string

builtin_macros_export_macro_rules = cannot export macro_rules! macros from a `proc-macro` crate type currently

Expand Down Expand Up @@ -255,8 +243,6 @@ builtin_macros_no_default_variant = `#[derive(Default)]` on enum with no `#[defa
.label = this enum needs a unit variant marked with `#[default]`
.suggestion = make this unit variant default by placing `#[default]` on it

builtin_macros_non_abi = at least one abi must be provided as an argument to `clobber_abi`

builtin_macros_non_exhaustive_default = default variant must be exhaustive
.label = declared `#[non_exhaustive]` here
.help = consider a manual implementation of `Default`
Expand Down
Loading
Loading