Skip to content

Rollup of 8 pull requests #143267

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
Jul 1, 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
cf5eb27
mbe: Restructure `macro_metavar_expr` tests
tgross35 Jun 20, 2025
c702055
Update the-doc-attribute.md (#1)
eeshvardasikcm Jun 29, 2025
bcf5105
inherit `#[align]` from trait method prototypes
folkertdev Jun 28, 2025
4fd37c7
Disable f16 on Aarch64 without neon for llvm < 20.1.1
tgross35 Jun 28, 2025
76df265
Replace `ItemCtxt::report_placeholder_type_error` `match` with a call…
GuillaumeGomez Jun 30, 2025
74fda50
Remove unused `descr` methods
GuillaumeGomez Jun 30, 2025
876835d
mbe: Split metavariable usage tests off from syntax tests
tgross35 Jun 23, 2025
b3d74da
mbe: Extend metavariable expression tests
tgross35 Jun 23, 2025
128945f
mbe: Shorten `MetaVarExpr` -> `Mve` in structural diagnostics
tgross35 Jun 21, 2025
3d9e510
mbe: Factor `concat` metavariable handling out
tgross35 Jun 20, 2025
a1a0669
mbe: Move `MetaVarExprConcatElem` closer to where it is used
tgross35 Jun 20, 2025
18a621a
Upgrade dependencies in run-make-support
tgross35 Jun 30, 2025
4e83298
linkify CodeSuggestion in doc comments
ComputerDruid Jun 30, 2025
c8fac77
fix: Emit suggestion filename if primary diagnostic span is dummy
Muscraft Jun 27, 2025
74d1d59
Rollup merge of #143125 - tgross35:aarch64-neon-llvm19-f16, r=cuviper
matthiaskrgr Jul 1, 2025
96fd669
Rollup merge of #143156 - folkertdev:fn-align-inherit-from-trait, r=w…
matthiaskrgr Jul 1, 2025
79e96c0
Rollup merge of #143178 - eeshvardasikcm:master, r=notriddle
matthiaskrgr Jul 1, 2025
e2ea213
Rollup merge of #143234 - GuillaumeGomez:ice-143128, r=oli-obk
matthiaskrgr Jul 1, 2025
cfe1942
Rollup merge of #143245 - tgross35:metavariable-expr-organization, r=…
matthiaskrgr Jul 1, 2025
b6cd765
Rollup merge of #143257 - tgross35:run-make-deps, r=jieyouxu
matthiaskrgr Jul 1, 2025
bce7454
Rollup merge of #143263 - ComputerDruid:linkify_CodeSuggestion, r=com…
matthiaskrgr Jul 1, 2025
3944c8c
Rollup merge of #143264 - Muscraft:fix-suggestion-filename, r=compile…
matthiaskrgr Jul 1, 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
44 changes: 36 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
dependencies = [
"gimli",
"gimli 0.31.1",
]

[[package]]
Expand Down Expand Up @@ -1483,6 +1483,17 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "gimli"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93563d740bc9ef04104f9ed6f86f1e3275c2cdafb95664e26584b9ca807a8ffe"
dependencies = [
"fallible-iterator",
"indexmap",
"stable_deref_trait",
]

[[package]]
name = "glob"
version = "0.3.2"
Expand Down Expand Up @@ -2568,7 +2579,7 @@ dependencies = [
"hashbrown",
"indexmap",
"memchr",
"ruzstd",
"ruzstd 0.7.3",
]

[[package]]
Expand All @@ -2578,9 +2589,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a"
dependencies = [
"crc32fast",
"flate2",
"hashbrown",
"indexmap",
"memchr",
"ruzstd 0.8.1",
"wasmparser 0.234.0",
]

Expand Down Expand Up @@ -3194,9 +3207,9 @@ version = "0.2.0"
dependencies = [
"bstr",
"build_helper",
"gimli",
"gimli 0.32.0",
"libc",
"object 0.36.7",
"object 0.37.1",
"regex",
"serde_json",
"similar",
Expand Down Expand Up @@ -3498,7 +3511,7 @@ name = "rustc_codegen_llvm"
version = "0.0.0"
dependencies = [
"bitflags",
"gimli",
"gimli 0.31.1",
"itertools",
"libc",
"measureme",
Expand Down Expand Up @@ -4473,7 +4486,7 @@ dependencies = [
"rustc_target",
"rustc_trait_selection",
"tracing",
"twox-hash",
"twox-hash 1.6.3",
]

[[package]]
Expand Down Expand Up @@ -4857,7 +4870,16 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f"
dependencies = [
"twox-hash",
"twox-hash 1.6.3",
]

[[package]]
name = "ruzstd"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c"
dependencies = [
"twox-hash 2.1.1",
]

[[package]]
Expand Down Expand Up @@ -5338,7 +5360,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
dependencies = [
"gimli",
"gimli 0.31.1",
"hashbrown",
"object 0.36.7",
"tracing",
Expand Down Expand Up @@ -5580,6 +5602,12 @@ dependencies = [
"static_assertions",
]

[[package]]
name = "twox-hash"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"

[[package]]
name = "type-map"
version = "0.5.1"
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,18 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
let target_env = sess.target.options.env.as_ref();
let target_abi = sess.target.options.abi.as_ref();
let target_pointer_width = sess.target.pointer_width;
let version = get_version();

cfg.has_reliable_f16 = match (target_arch, target_os) {
// Selection failure <https://github.com/llvm/llvm-project/issues/50374>
("s390x", _) => false,
// LLVM crash without neon <https://github.com/llvm/llvm-project/issues/129394> (now fixed)
("aarch64", _)
if !cfg.target_features.iter().any(|f| f.as_str() == "neon")
&& version < (20, 1, 1) =>
{
false
}
// Unsupported <https://github.com/llvm/llvm-project/issues/94434>
("arm64ec", _) => false,
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
Expand Down
31 changes: 22 additions & 9 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use rustc_abi::ExternAbi;
use rustc_abi::{Align, ExternAbi};
use rustc_ast::expand::autodiff_attrs::{AutoDiffAttrs, DiffActivity, DiffMode};
use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr};
use rustc_attr_data_structures::{
Expand Down Expand Up @@ -395,6 +395,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
codegen_fn_attrs.alignment =
Ord::max(codegen_fn_attrs.alignment, tcx.sess.opts.unstable_opts.min_function_alignment);

// On trait methods, inherit the `#[align]` of the trait's method prototype.
codegen_fn_attrs.alignment = Ord::max(codegen_fn_attrs.alignment, tcx.inherited_align(did));

let inline_span;
(codegen_fn_attrs.inline, inline_span) = if let Some((inline_attr, span)) =
find_attr!(attrs, AttributeKind::Inline(i, span) => (*i, *span))
Expand Down Expand Up @@ -549,17 +552,26 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
codegen_fn_attrs
}

/// If the provided DefId is a method in a trait impl, return the DefId of the method prototype.
fn opt_trait_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
let impl_item = tcx.opt_associated_item(def_id)?;
match impl_item.container {
ty::AssocItemContainer::Impl => impl_item.trait_item_def_id,
_ => None,
}
}

/// Checks if the provided DefId is a method in a trait impl for a trait which has track_caller
/// applied to the method prototype.
fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
if let Some(impl_item) = tcx.opt_associated_item(def_id)
&& let ty::AssocItemContainer::Impl = impl_item.container
&& let Some(trait_item) = impl_item.trait_item_def_id
{
return tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER);
}
let Some(trait_item) = opt_trait_item(tcx, def_id) else { return false };
tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER)
}

false
/// If the provided DefId is a method in a trait impl, return the value of the `#[align]`
/// attribute on the method prototype (if any).
fn inherited_align<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Align> {
tcx.codegen_fn_attrs(opt_trait_item(tcx, def_id)?).alignment
}

fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &hir::Attribute) -> Option<u16> {
Expand Down Expand Up @@ -727,5 +739,6 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
}

pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { codegen_fn_attrs, should_inherit_track_caller, ..*providers };
*providers =
Providers { codegen_fn_attrs, should_inherit_track_caller, inherited_align, ..*providers };
}
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
/// * may look like "to do xyz, use" or "to do xyz, use abc"
/// * may contain a name of a function, variable, or type, but not whole expressions
///
/// See `CodeSuggestion` for more information.
/// See [`CodeSuggestion`] for more information.
#[rustc_lint_diagnostics]
pub fn span_suggestion(
&mut self,
Expand Down Expand Up @@ -1166,7 +1166,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
/// Prints out a message with a suggested edit of the code. If the suggestion is presented
/// inline, it will only show the message and not the suggestion.
///
/// See `CodeSuggestion` for more information.
/// See [`CodeSuggestion`] for more information.
#[rustc_lint_diagnostics]
pub fn span_suggestion_short(
&mut self,
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,9 @@ impl HumanEmitter {
// file name, saving in verbosity, but if it *isn't* we do need it, otherwise we're
// telling users to make a change but not clarifying *where*.
let loc = sm.lookup_char_pos(parts[0].span.lo());
if loc.file.name != sm.span_to_filename(span) && loc.file.name.is_real() {
if (span.is_dummy() || loc.file.name != sm.span_to_filename(span))
&& loc.file.name.is_real()
{
// --> file.rs:line:col
// |
let arrow = self.file_start();
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ expand_malformed_feature_attribute =

expand_meta_var_dif_seq_matchers = {$msg}

expand_meta_var_expr_unrecognized_var =
variable `{$key}` is not recognized in meta-variable expression

expand_missing_fragment_specifier = missing fragment specifier
.note = fragment specifiers must be provided
.suggestion_add_fragspec = try adding a specifier here
Expand All @@ -136,6 +133,9 @@ expand_module_multiple_candidates =
expand_must_repeat_once =
this must repeat at least once

expand_mve_unrecognized_var =
variable `{$key}` is not recognized in meta-variable expression

expand_non_inline_modules_in_proc_macro_input_are_unstable =
non-inline modules in proc macro input are unstable

Expand Down
21 changes: 13 additions & 8 deletions compiler/rustc_expand/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ pub(crate) struct CountRepetitionMisplaced {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(expand_meta_var_expr_unrecognized_var)]
pub(crate) struct MetaVarExprUnrecognizedVar {
#[primary_span]
pub span: Span,
pub key: MacroRulesNormalizedIdent,
}

#[derive(Diagnostic)]
#[diag(expand_var_still_repeating)]
pub(crate) struct VarStillRepeating {
Expand Down Expand Up @@ -499,3 +491,16 @@ pub(crate) struct ProcMacroBackCompat {
pub crate_name: String,
pub fixed_version: String,
}

pub(crate) use metavar_exprs::*;
mod metavar_exprs {
use super::*;

#[derive(Diagnostic)]
#[diag(expand_mve_unrecognized_var)]
pub(crate) struct MveUnrecognizedVar {
#[primary_span]
pub span: Span,
pub key: MacroRulesNormalizedIdent,
}
}
Loading
Loading