Skip to content

Commit f46ce66

Browse files
committed
Auto merge of #143267 - matthiaskrgr:rollup-suvzar6, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #143125 (Disable f16 on Aarch64 without neon for llvm < 20.1.1) - #143156 (inherit `#[align]` from trait method prototypes) - #143178 (rustdoc default faviocon) - #143234 (Replace `ItemCtxt::report_placeholder_type_error` match with a call to `TyCtxt::def_descr`) - #143245 (mbe: Add tests and restructure metavariable expressions) - #143257 (Upgrade dependencies in run-make-support) - #143263 (linkify CodeSuggestion in doc comments) - #143264 (fix: Emit suggestion filename if primary diagnostic span is dummy) Failed merges: - #143251 (bootstrap: add build.tidy-extra-checks option) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6988a8f + 3944c8c commit f46ce66

File tree

74 files changed

+977
-812
lines changed

Some content is hidden

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

74 files changed

+977
-812
lines changed

Cargo.lock

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version = "0.24.2"
88
source = "registry+https://github.com/rust-lang/crates.io-index"
99
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
1010
dependencies = [
11-
"gimli",
11+
"gimli 0.31.1",
1212
]
1313

1414
[[package]]
@@ -1483,6 +1483,17 @@ dependencies = [
14831483
"stable_deref_trait",
14841484
]
14851485

1486+
[[package]]
1487+
name = "gimli"
1488+
version = "0.32.0"
1489+
source = "registry+https://github.com/rust-lang/crates.io-index"
1490+
checksum = "93563d740bc9ef04104f9ed6f86f1e3275c2cdafb95664e26584b9ca807a8ffe"
1491+
dependencies = [
1492+
"fallible-iterator",
1493+
"indexmap",
1494+
"stable_deref_trait",
1495+
]
1496+
14861497
[[package]]
14871498
name = "glob"
14881499
version = "0.3.2"
@@ -2568,7 +2579,7 @@ dependencies = [
25682579
"hashbrown",
25692580
"indexmap",
25702581
"memchr",
2571-
"ruzstd",
2582+
"ruzstd 0.7.3",
25722583
]
25732584

25742585
[[package]]
@@ -2578,9 +2589,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
25782589
checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a"
25792590
dependencies = [
25802591
"crc32fast",
2592+
"flate2",
25812593
"hashbrown",
25822594
"indexmap",
25832595
"memchr",
2596+
"ruzstd 0.8.1",
25842597
"wasmparser 0.234.0",
25852598
]
25862599

@@ -3194,9 +3207,9 @@ version = "0.2.0"
31943207
dependencies = [
31953208
"bstr",
31963209
"build_helper",
3197-
"gimli",
3210+
"gimli 0.32.0",
31983211
"libc",
3199-
"object 0.36.7",
3212+
"object 0.37.1",
32003213
"regex",
32013214
"serde_json",
32023215
"similar",
@@ -3498,7 +3511,7 @@ name = "rustc_codegen_llvm"
34983511
version = "0.0.0"
34993512
dependencies = [
35003513
"bitflags",
3501-
"gimli",
3514+
"gimli 0.31.1",
35023515
"itertools",
35033516
"libc",
35043517
"measureme",
@@ -4473,7 +4486,7 @@ dependencies = [
44734486
"rustc_target",
44744487
"rustc_trait_selection",
44754488
"tracing",
4476-
"twox-hash",
4489+
"twox-hash 1.6.3",
44774490
]
44784491

44794492
[[package]]
@@ -4857,7 +4870,16 @@ version = "0.7.3"
48574870
source = "registry+https://github.com/rust-lang/crates.io-index"
48584871
checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f"
48594872
dependencies = [
4860-
"twox-hash",
4873+
"twox-hash 1.6.3",
4874+
]
4875+
4876+
[[package]]
4877+
name = "ruzstd"
4878+
version = "0.8.1"
4879+
source = "registry+https://github.com/rust-lang/crates.io-index"
4880+
checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c"
4881+
dependencies = [
4882+
"twox-hash 2.1.1",
48614883
]
48624884

48634885
[[package]]
@@ -5338,7 +5360,7 @@ version = "0.9.0"
53385360
source = "registry+https://github.com/rust-lang/crates.io-index"
53395361
checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
53405362
dependencies = [
5341-
"gimli",
5363+
"gimli 0.31.1",
53425364
"hashbrown",
53435365
"object 0.36.7",
53445366
"tracing",
@@ -5580,6 +5602,12 @@ dependencies = [
55805602
"static_assertions",
55815603
]
55825604

5605+
[[package]]
5606+
name = "twox-hash"
5607+
version = "2.1.1"
5608+
source = "registry+https://github.com/rust-lang/crates.io-index"
5609+
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
5610+
55835611
[[package]]
55845612
name = "type-map"
55855613
version = "0.5.1"

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,18 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
370370
let target_env = sess.target.options.env.as_ref();
371371
let target_abi = sess.target.options.abi.as_ref();
372372
let target_pointer_width = sess.target.pointer_width;
373+
let version = get_version();
373374

374375
cfg.has_reliable_f16 = match (target_arch, target_os) {
375376
// Selection failure <https://github.com/llvm/llvm-project/issues/50374>
376377
("s390x", _) => false,
378+
// LLVM crash without neon <https://github.com/llvm/llvm-project/issues/129394> (now fixed)
379+
("aarch64", _)
380+
if !cfg.target_features.iter().any(|f| f.as_str() == "neon")
381+
&& version < (20, 1, 1) =>
382+
{
383+
false
384+
}
377385
// Unsupported <https://github.com/llvm/llvm-project/issues/94434>
378386
("arm64ec", _) => false,
379387
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::str::FromStr;
22

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

398+
// On trait methods, inherit the `#[align]` of the trait's method prototype.
399+
codegen_fn_attrs.alignment = Ord::max(codegen_fn_attrs.alignment, tcx.inherited_align(did));
400+
398401
let inline_span;
399402
(codegen_fn_attrs.inline, inline_span) = if let Some((inline_attr, span)) =
400403
find_attr!(attrs, AttributeKind::Inline(i, span) => (*i, *span))
@@ -549,17 +552,26 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
549552
codegen_fn_attrs
550553
}
551554

555+
/// If the provided DefId is a method in a trait impl, return the DefId of the method prototype.
556+
fn opt_trait_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
557+
let impl_item = tcx.opt_associated_item(def_id)?;
558+
match impl_item.container {
559+
ty::AssocItemContainer::Impl => impl_item.trait_item_def_id,
560+
_ => None,
561+
}
562+
}
563+
552564
/// Checks if the provided DefId is a method in a trait impl for a trait which has track_caller
553565
/// applied to the method prototype.
554566
fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
555-
if let Some(impl_item) = tcx.opt_associated_item(def_id)
556-
&& let ty::AssocItemContainer::Impl = impl_item.container
557-
&& let Some(trait_item) = impl_item.trait_item_def_id
558-
{
559-
return tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER);
560-
}
567+
let Some(trait_item) = opt_trait_item(tcx, def_id) else { return false };
568+
tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER)
569+
}
561570

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

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

729741
pub(crate) fn provide(providers: &mut Providers) {
730-
*providers = Providers { codegen_fn_attrs, should_inherit_track_caller, ..*providers };
742+
*providers =
743+
Providers { codegen_fn_attrs, should_inherit_track_caller, inherited_align, ..*providers };
731744
}

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10051005
/// * may look like "to do xyz, use" or "to do xyz, use abc"
10061006
/// * may contain a name of a function, variable, or type, but not whole expressions
10071007
///
1008-
/// See `CodeSuggestion` for more information.
1008+
/// See [`CodeSuggestion`] for more information.
10091009
#[rustc_lint_diagnostics]
10101010
pub fn span_suggestion(
10111011
&mut self,
@@ -1166,7 +1166,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11661166
/// Prints out a message with a suggested edit of the code. If the suggestion is presented
11671167
/// inline, it will only show the message and not the suggestion.
11681168
///
1169-
/// See `CodeSuggestion` for more information.
1169+
/// See [`CodeSuggestion`] for more information.
11701170
#[rustc_lint_diagnostics]
11711171
pub fn span_suggestion_short(
11721172
&mut self,

compiler/rustc_errors/src/emitter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,9 @@ impl HumanEmitter {
20782078
// file name, saving in verbosity, but if it *isn't* we do need it, otherwise we're
20792079
// telling users to make a change but not clarifying *where*.
20802080
let loc = sm.lookup_char_pos(parts[0].span.lo());
2081-
if loc.file.name != sm.span_to_filename(span) && loc.file.name.is_real() {
2081+
if (span.is_dummy() || loc.file.name != sm.span_to_filename(span))
2082+
&& loc.file.name.is_real()
2083+
{
20822084
// --> file.rs:line:col
20832085
// |
20842086
let arrow = self.file_start();

compiler/rustc_expand/messages.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ expand_malformed_feature_attribute =
109109
110110
expand_meta_var_dif_seq_matchers = {$msg}
111111
112-
expand_meta_var_expr_unrecognized_var =
113-
variable `{$key}` is not recognized in meta-variable expression
114-
115112
expand_missing_fragment_specifier = missing fragment specifier
116113
.note = fragment specifiers must be provided
117114
.suggestion_add_fragspec = try adding a specifier here
@@ -136,6 +133,9 @@ expand_module_multiple_candidates =
136133
expand_must_repeat_once =
137134
this must repeat at least once
138135
136+
expand_mve_unrecognized_var =
137+
variable `{$key}` is not recognized in meta-variable expression
138+
139139
expand_non_inline_modules_in_proc_macro_input_are_unstable =
140140
non-inline modules in proc macro input are unstable
141141

compiler/rustc_expand/src/errors.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ pub(crate) struct CountRepetitionMisplaced {
2727
pub span: Span,
2828
}
2929

30-
#[derive(Diagnostic)]
31-
#[diag(expand_meta_var_expr_unrecognized_var)]
32-
pub(crate) struct MetaVarExprUnrecognizedVar {
33-
#[primary_span]
34-
pub span: Span,
35-
pub key: MacroRulesNormalizedIdent,
36-
}
37-
3830
#[derive(Diagnostic)]
3931
#[diag(expand_var_still_repeating)]
4032
pub(crate) struct VarStillRepeating {
@@ -499,3 +491,16 @@ pub(crate) struct ProcMacroBackCompat {
499491
pub crate_name: String,
500492
pub fixed_version: String,
501493
}
494+
495+
pub(crate) use metavar_exprs::*;
496+
mod metavar_exprs {
497+
use super::*;
498+
499+
#[derive(Diagnostic)]
500+
#[diag(expand_mve_unrecognized_var)]
501+
pub(crate) struct MveUnrecognizedVar {
502+
#[primary_span]
503+
pub span: Span,
504+
pub key: MacroRulesNormalizedIdent,
505+
}
506+
}

0 commit comments

Comments
 (0)