Skip to content

Commit 3177c00

Browse files
committed
Auto merge of #145351 - jdonszelmann:rollup-gzg4kca, r=jdonszelmann
Rollup of 9 pull requests Successful merges: - #122661 (Change the desugaring of `assert!` for better error output) - #138736 (Sanitizers target modificators) - #144955 (search graph: lazily update parent goals) - #145120 (llvm: Accept new LLVM lifetime format) - #145153 (Handle macros with multiple kinds, and improve errors) - #145189 (Weekly `cargo update`) - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145331 (Make std use the edition 2024 prelude) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 350d0ef + 4eb209b commit 3177c00

File tree

151 files changed

+1169
-446
lines changed

Some content is hidden

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

151 files changed

+1169
-446
lines changed

Cargo.lock

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ dependencies = [
8080

8181
[[package]]
8282
name = "anstream"
83-
version = "0.6.19"
83+
version = "0.6.20"
8484
source = "registry+https://github.com/rust-lang/crates.io-index"
85-
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
85+
checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
8686
dependencies = [
8787
"anstyle",
8888
"anstyle-parse",
@@ -119,18 +119,18 @@ dependencies = [
119119

120120
[[package]]
121121
name = "anstyle-query"
122-
version = "1.1.3"
122+
version = "1.1.4"
123123
source = "registry+https://github.com/rust-lang/crates.io-index"
124-
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
124+
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
125125
dependencies = [
126-
"windows-sys 0.59.0",
126+
"windows-sys 0.60.2",
127127
]
128128

129129
[[package]]
130130
name = "anstyle-svg"
131-
version = "0.1.9"
131+
version = "0.1.10"
132132
source = "registry+https://github.com/rust-lang/crates.io-index"
133-
checksum = "0a43964079ef399480603125d5afae2b219aceffb77478956e25f17b9bc3435c"
133+
checksum = "dc03a770ef506fe1396c0e476120ac0e6523cf14b74218dd5f18cd6833326fa9"
134134
dependencies = [
135135
"anstyle",
136136
"anstyle-lossy",
@@ -141,13 +141,13 @@ dependencies = [
141141

142142
[[package]]
143143
name = "anstyle-wincon"
144-
version = "3.0.9"
144+
version = "3.0.10"
145145
source = "registry+https://github.com/rust-lang/crates.io-index"
146-
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
146+
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
147147
dependencies = [
148148
"anstyle",
149149
"once_cell_polyfill",
150-
"windows-sys 0.59.0",
150+
"windows-sys 0.60.2",
151151
]
152152

153153
[[package]]
@@ -353,9 +353,9 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
353353

354354
[[package]]
355355
name = "camino"
356-
version = "1.1.10"
356+
version = "1.1.11"
357357
source = "registry+https://github.com/rust-lang/crates.io-index"
358-
checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab"
358+
checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0"
359359
dependencies = [
360360
"serde",
361361
]
@@ -518,9 +518,9 @@ dependencies = [
518518

519519
[[package]]
520520
name = "clap"
521-
version = "4.5.42"
521+
version = "4.5.43"
522522
source = "registry+https://github.com/rust-lang/crates.io-index"
523-
checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882"
523+
checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f"
524524
dependencies = [
525525
"clap_builder",
526526
"clap_derive",
@@ -538,9 +538,9 @@ dependencies = [
538538

539539
[[package]]
540540
name = "clap_builder"
541-
version = "4.5.42"
541+
version = "4.5.43"
542542
source = "registry+https://github.com/rust-lang/crates.io-index"
543-
checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966"
543+
checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65"
544544
dependencies = [
545545
"anstream",
546546
"anstyle",
@@ -937,9 +937,9 @@ dependencies = [
937937

938938
[[package]]
939939
name = "cxx"
940-
version = "1.0.161"
940+
version = "1.0.166"
941941
source = "registry+https://github.com/rust-lang/crates.io-index"
942-
checksum = "a3523cc02ad831111491dd64b27ad999f1ae189986728e477604e61b81f828df"
942+
checksum = "b5287274dfdf7e7eaa3d97d460eb2a94922539e6af214bda423f292105011ee2"
943943
dependencies = [
944944
"cc",
945945
"cxxbridge-cmd",
@@ -951,9 +951,9 @@ dependencies = [
951951

952952
[[package]]
953953
name = "cxx-build"
954-
version = "1.0.161"
954+
version = "1.0.166"
955955
source = "registry+https://github.com/rust-lang/crates.io-index"
956-
checksum = "212b754247a6f07b10fa626628c157593f0abf640a3dd04cce2760eca970f909"
956+
checksum = "65f3ce027a744135db10a1ebffa0863dab685aeef48f40a02c201f5e70c667d3"
957957
dependencies = [
958958
"cc",
959959
"codespan-reporting",
@@ -966,9 +966,9 @@ dependencies = [
966966

967967
[[package]]
968968
name = "cxxbridge-cmd"
969-
version = "1.0.161"
969+
version = "1.0.166"
970970
source = "registry+https://github.com/rust-lang/crates.io-index"
971-
checksum = "f426a20413ec2e742520ba6837c9324b55ffac24ead47491a6e29f933c5b135a"
971+
checksum = "a07dc23f2eea4774297f4c9a17ae4065fecb63127da556e6c9fadb0216d93595"
972972
dependencies = [
973973
"clap",
974974
"codespan-reporting",
@@ -980,15 +980,15 @@ dependencies = [
980980

981981
[[package]]
982982
name = "cxxbridge-flags"
983-
version = "1.0.161"
983+
version = "1.0.166"
984984
source = "registry+https://github.com/rust-lang/crates.io-index"
985-
checksum = "a258b6069020b4e5da6415df94a50ee4f586a6c38b037a180e940a43d06a070d"
985+
checksum = "f7a4dbad6171f763c4066c83dcd27546b6e93c5c5ae2229f9813bda7233f571d"
986986

987987
[[package]]
988988
name = "cxxbridge-macro"
989-
version = "1.0.161"
989+
version = "1.0.166"
990990
source = "registry+https://github.com/rust-lang/crates.io-index"
991-
checksum = "e8dec184b52be5008d6eaf7e62fc1802caf1ad1227d11b3b7df2c409c7ffc3f4"
991+
checksum = "a9be4b527950fc42db06163705e78e73eedc8fd723708e942afe3572a9a2c366"
992992
dependencies = [
993993
"indexmap",
994994
"proc-macro2",
@@ -1055,9 +1055,9 @@ version = "0.1.91"
10551055

10561056
[[package]]
10571057
name = "derive-where"
1058-
version = "1.5.0"
1058+
version = "1.6.0"
10591059
source = "registry+https://github.com/rust-lang/crates.io-index"
1060-
checksum = "510c292c8cf384b1a340b816a9a6cf2599eb8f566a44949024af88418000c50b"
1060+
checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f"
10611061
dependencies = [
10621062
"proc-macro2",
10631063
"quote",
@@ -1567,9 +1567,9 @@ dependencies = [
15671567

15681568
[[package]]
15691569
name = "hashbrown"
1570-
version = "0.15.4"
1570+
version = "0.15.5"
15711571
source = "registry+https://github.com/rust-lang/crates.io-index"
1572-
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
1572+
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
15731573
dependencies = [
15741574
"allocator-api2",
15751575
"equivalent",
@@ -1688,7 +1688,7 @@ dependencies = [
16881688
"potential_utf",
16891689
"yoke 0.8.0",
16901690
"zerofrom",
1691-
"zerovec 0.11.2",
1691+
"zerovec 0.11.4",
16921692
]
16931693

16941694
[[package]]
@@ -1721,7 +1721,7 @@ dependencies = [
17211721
"litemap 0.8.0",
17221722
"tinystr 0.8.1",
17231723
"writeable 0.6.1",
1724-
"zerovec 0.11.2",
1724+
"zerovec 0.11.4",
17251725
]
17261726

17271727
[[package]]
@@ -1769,7 +1769,7 @@ dependencies = [
17691769
"icu_properties",
17701770
"icu_provider 2.0.0",
17711771
"smallvec",
1772-
"zerovec 0.11.2",
1772+
"zerovec 0.11.4",
17731773
]
17741774

17751775
[[package]]
@@ -1791,7 +1791,7 @@ dependencies = [
17911791
"icu_provider 2.0.0",
17921792
"potential_utf",
17931793
"zerotrie",
1794-
"zerovec 0.11.2",
1794+
"zerovec 0.11.4",
17951795
]
17961796

17971797
[[package]]
@@ -1831,7 +1831,7 @@ dependencies = [
18311831
"yoke 0.8.0",
18321832
"zerofrom",
18331833
"zerotrie",
1834-
"zerovec 0.11.2",
1834+
"zerovec 0.11.4",
18351835
]
18361836

18371837
[[package]]
@@ -1909,9 +1909,9 @@ dependencies = [
19091909

19101910
[[package]]
19111911
name = "indenter"
1912-
version = "0.3.3"
1912+
version = "0.3.4"
19131913
source = "registry+https://github.com/rust-lang/crates.io-index"
1914-
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
1914+
checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
19151915

19161916
[[package]]
19171917
name = "indexmap"
@@ -2971,7 +2971,7 @@ version = "0.1.2"
29712971
source = "registry+https://github.com/rust-lang/crates.io-index"
29722972
checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585"
29732973
dependencies = [
2974-
"zerovec 0.11.2",
2974+
"zerovec 0.11.4",
29752975
]
29762976

29772977
[[package]]
@@ -3889,6 +3889,7 @@ dependencies = [
38893889
name = "rustc_hir"
38903890
version = "0.0.0"
38913891
dependencies = [
3892+
"bitflags",
38923893
"odht",
38933894
"rustc_abi",
38943895
"rustc_arena",
@@ -4918,9 +4919,9 @@ dependencies = [
49184919

49194920
[[package]]
49204921
name = "rustversion"
4921-
version = "1.0.21"
4922+
version = "1.0.22"
49224923
source = "registry+https://github.com/rust-lang/crates.io-index"
4923-
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
4924+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
49244925

49254926
[[package]]
49264927
name = "ruzstd"
@@ -4978,9 +4979,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
49784979

49794980
[[package]]
49804981
name = "scratch"
4981-
version = "1.0.8"
4982+
version = "1.0.9"
49824983
source = "registry+https://github.com/rust-lang/crates.io-index"
4983-
checksum = "9f6280af86e5f559536da57a45ebc84948833b3bee313a7dd25232e09c878a52"
4984+
checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"
49844985

49854986
[[package]]
49864987
name = "self_cell"
@@ -5506,7 +5507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
55065507
checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
55075508
dependencies = [
55085509
"displaydoc",
5509-
"zerovec 0.11.2",
5510+
"zerovec 0.11.4",
55105511
]
55115512

55125513
[[package]]
@@ -6852,9 +6853,9 @@ dependencies = [
68526853

68536854
[[package]]
68546855
name = "zerovec"
6855-
version = "0.11.2"
6856+
version = "0.11.4"
68566857
source = "registry+https://github.com/rust-lang/crates.io-index"
6857-
checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428"
6858+
checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
68586859
dependencies = [
68596860
"yoke 0.8.0",
68606861
"zerofrom",

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
436436
let body = Box::new(self.lower_delim_args(body));
437437
let def_id = self.local_def_id(id);
438438
let def_kind = self.tcx.def_kind(def_id);
439-
let DefKind::Macro(macro_kind) = def_kind else {
439+
let DefKind::Macro(macro_kinds) = def_kind else {
440440
unreachable!(
441441
"expected DefKind::Macro for macro item, found {}",
442442
def_kind.descr(def_id.to_def_id())
443443
);
444444
};
445445
let macro_def = self.arena.alloc(ast::MacroDef { body, macro_rules: *macro_rules });
446-
hir::ItemKind::Macro(ident, macro_def, macro_kind)
446+
hir::ItemKind::Macro(ident, macro_def, macro_kinds)
447447
}
448448
ItemKind::Delegation(box delegation) => {
449449
let delegation_results = self.lower_delegation(delegation, id, false);

compiler/rustc_builtin_macros/src/assert.rs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mod context;
22

3-
use rustc_ast::token::Delimiter;
3+
use rustc_ast::token::{self, Delimiter};
44
use rustc_ast::tokenstream::{DelimSpan, TokenStream};
5-
use rustc_ast::{DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment, UnOp, token};
5+
use rustc_ast::{DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment};
66
use rustc_ast_pretty::pprust;
77
use rustc_errors::PResult;
88
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
@@ -29,7 +29,7 @@ pub(crate) fn expand_assert<'cx>(
2929

3030
// `core::panic` and `std::panic` are different macros, so we use call-site
3131
// context to pick up whichever is currently in scope.
32-
let call_site_span = cx.with_call_site_ctxt(span);
32+
let call_site_span = cx.with_call_site_ctxt(cond_expr.span);
3333

3434
let panic_path = || {
3535
if use_panic_2021(span) {
@@ -63,7 +63,7 @@ pub(crate) fn expand_assert<'cx>(
6363
}),
6464
})),
6565
);
66-
expr_if_not(cx, call_site_span, cond_expr, then, None)
66+
assert_cond_check(cx, call_site_span, cond_expr, then)
6767
}
6868
// If `generic_assert` is enabled, generates rich captured outputs
6969
//
@@ -88,26 +88,33 @@ pub(crate) fn expand_assert<'cx>(
8888
)),
8989
)],
9090
);
91-
expr_if_not(cx, call_site_span, cond_expr, then, None)
91+
assert_cond_check(cx, call_site_span, cond_expr, then)
9292
};
9393

9494
ExpandResult::Ready(MacEager::expr(expr))
9595
}
9696

97+
/// `assert!($cond_expr, $custom_message)`
9798
struct Assert {
9899
cond_expr: Box<Expr>,
99100
custom_message: Option<TokenStream>,
100101
}
101102

102-
// if !{ ... } { ... } else { ... }
103-
fn expr_if_not(
104-
cx: &ExtCtxt<'_>,
105-
span: Span,
106-
cond: Box<Expr>,
107-
then: Box<Expr>,
108-
els: Option<Box<Expr>>,
109-
) -> Box<Expr> {
110-
cx.expr_if(span, cx.expr(span, ExprKind::Unary(UnOp::Not, cond)), then, els)
103+
/// `match <cond> { true => {} _ => <then> }`
104+
fn assert_cond_check(cx: &ExtCtxt<'_>, span: Span, cond: Box<Expr>, then: Box<Expr>) -> Box<Expr> {
105+
// Instead of expanding to `if !<cond> { <then> }`, we expand to
106+
// `match <cond> { true => {} _ => <then> }`.
107+
// This allows us to always complain about mismatched types instead of "cannot apply unary
108+
// operator `!` to type `X`" when passing an invalid `<cond>`, while also allowing `<cond>` to
109+
// be `&true`.
110+
let els = cx.expr_block(cx.block(span, thin_vec![]));
111+
let mut arms = thin_vec![];
112+
arms.push(cx.arm(span, cx.pat_lit(span, cx.expr_bool(span, true)), els));
113+
arms.push(cx.arm(span, cx.pat_wild(span), then));
114+
115+
// We wrap the `match` in a statement to limit the length of any borrows introduced in the
116+
// condition.
117+
cx.expr_block(cx.block(span, [cx.stmt_expr(cx.expr_match(span, cond, arms))].into()))
111118
}
112119

113120
fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,11 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16961696
return;
16971697
}
16981698

1699-
self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[self.cx.const_u64(size), ptr]);
1699+
if crate::llvm_util::get_version() >= (22, 0, 0) {
1700+
self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[ptr]);
1701+
} else {
1702+
self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[self.cx.const_u64(size), ptr]);
1703+
}
17001704
}
17011705
}
17021706
impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {

0 commit comments

Comments
 (0)