Skip to content

Commit e7e90dc

Browse files
authored
Merge pull request rust-lang#4795 from rust-lang/rustup-2025-12-29
Automatic Rustup
2 parents 2fdaee2 + 00af23f commit e7e90dc

File tree

51 files changed

+1036
-363
lines changed

Some content is hidden

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

51 files changed

+1036
-363
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,8 +4144,8 @@ version = "0.0.0"
41444144
dependencies = [
41454145
"expect-test",
41464146
"memchr",
4147+
"unicode-ident",
41474148
"unicode-properties",
4148-
"unicode-xid",
41494149
]
41504150

41514151
[[package]]
@@ -5981,24 +5981,24 @@ checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
59815981

59825982
[[package]]
59835983
name = "unicode-ident"
5984-
version = "1.0.18"
5984+
version = "1.0.22"
59855985
source = "registry+https://github.com/rust-lang/crates.io-index"
5986-
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
5986+
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
59875987

59885988
[[package]]
59895989
name = "unicode-normalization"
5990-
version = "0.1.24"
5990+
version = "0.1.25"
59915991
source = "registry+https://github.com/rust-lang/crates.io-index"
5992-
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
5992+
checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
59935993
dependencies = [
59945994
"tinyvec",
59955995
]
59965996

59975997
[[package]]
59985998
name = "unicode-properties"
5999-
version = "0.1.3"
5999+
version = "0.1.4"
60006000
source = "registry+https://github.com/rust-lang/crates.io-index"
6001-
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
6001+
checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
60026002

60036003
[[package]]
60046004
name = "unicode-script"

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ast_lowering_abi_specified_multiple_times =
66
ast_lowering_arbitrary_expression_in_pattern =
77
arbitrary expressions aren't allowed in patterns
88
.pattern_from_macro_note = the `expr` fragment specifier forces the metavariable's content to be an expression
9+
.const_block_in_pattern_help = use a named `const`-item or an `if`-guard (`x if x == const {"{ ... }"}`) instead
910
1011
ast_lowering_argument = argument
1112

compiler/rustc_ast_lowering/src/errors.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ pub(crate) struct ArbitraryExpressionInPattern {
357357
pub span: Span,
358358
#[note(ast_lowering_pattern_from_macro_note)]
359359
pub pattern_from_macro_note: bool,
360+
#[help(ast_lowering_const_block_in_pattern_help)]
361+
pub const_block_in_pattern_help: bool,
360362
}
361363

362364
#[derive(Diagnostic)]

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
399399
ExprKind::Lit(lit) => {
400400
hir::PatExprKind::Lit { lit: self.lower_lit(lit, span), negated: false }
401401
}
402-
ExprKind::ConstBlock(c) => hir::PatExprKind::ConstBlock(self.lower_const_block(c)),
403402
ExprKind::IncludedBytes(byte_sym) => hir::PatExprKind::Lit {
404403
lit: respan(span, LitKind::ByteStr(*byte_sym, StrStyle::Cooked)),
405404
negated: false,
@@ -419,10 +418,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
419418
hir::PatExprKind::Lit { lit: self.lower_lit(lit, span), negated: true }
420419
}
421420
_ => {
421+
let is_const_block = matches!(expr.kind, ExprKind::ConstBlock(_));
422422
let pattern_from_macro = expr.is_approximately_pattern();
423423
let guar = self.dcx().emit_err(ArbitraryExpressionInPattern {
424424
span,
425425
pattern_from_macro_note: pattern_from_macro,
426+
const_block_in_pattern_help: is_const_block,
426427
});
427428
err(guar)
428429
}

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,6 @@ pub enum PatExprKind<'hir> {
19441944
// once instead of matching on unop neg expressions everywhere.
19451945
negated: bool,
19461946
},
1947-
ConstBlock(ConstBlock),
19481947
/// A path pattern for a unit struct/variant or a (maybe-associated) constant.
19491948
Path(QPath<'hir>),
19501949
}

compiler/rustc_hir/src/intravisit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ pub fn walk_pat_expr<'v, V: Visitor<'v>>(visitor: &mut V, expr: &'v PatExpr<'v>)
792792
try_visit!(visitor.visit_id(*hir_id));
793793
match kind {
794794
PatExprKind::Lit { lit, negated } => visitor.visit_lit(*hir_id, *lit, *negated),
795-
PatExprKind::ConstBlock(c) => visitor.visit_inline_const(c),
796795
PatExprKind::Path(qpath) => visitor.visit_qpath(qpath, *hir_id, *span),
797796
}
798797
}

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,6 @@ impl<'a> State<'a> {
18801880
}
18811881
self.print_literal(lit);
18821882
}
1883-
hir::PatExprKind::ConstBlock(c) => self.print_inline_const(c),
18841883
hir::PatExprKind::Path(qpath) => self.print_qpath(qpath, true),
18851884
}
18861885
}

compiler/rustc_hir_typeck/src/pat.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -925,9 +925,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
925925
}
926926
ty
927927
}
928-
rustc_hir::PatExprKind::ConstBlock(c) => {
929-
self.check_expr_const_block(c, Expectation::NoExpectation)
930-
}
931928
rustc_hir::PatExprKind::Path(qpath) => {
932929
let (res, opt_ty, segments) =
933930
self.resolve_ty_and_res_fully_qualified_call(qpath, lt.hir_id, lt.span);

compiler/rustc_lexer/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Rust lexer used by rustc. No stability guarantees are provided.
1515
# Note that this crate purposefully does not depend on other rustc crates
1616
[dependencies]
1717
memchr = "2.7.6"
18-
unicode-properties = { version = "0.1.0", default-features = false, features = ["emoji"] }
19-
unicode-xid = "0.2.0"
18+
unicode-properties = { version = "0.1.4", default-features = false, features = ["emoji"] }
19+
unicode-ident = "1.0.22"
2020

2121
[dev-dependencies]
2222
expect-test = "1.4.0"

compiler/rustc_lexer/src/lib.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,25 @@ use LiteralKind::*;
3434
use TokenKind::*;
3535
use cursor::EOF_CHAR;
3636
pub use cursor::{Cursor, FrontmatterAllowed};
37+
pub use unicode_ident::UNICODE_VERSION;
3738
use unicode_properties::UnicodeEmoji;
38-
pub use unicode_xid::UNICODE_VERSION as UNICODE_XID_VERSION;
39+
40+
// Make sure that the Unicode version of the dependencies is the same.
41+
const _: () = {
42+
let properties = unicode_properties::UNICODE_VERSION;
43+
let ident = unicode_ident::UNICODE_VERSION;
44+
45+
if properties.0 != ident.0 as u64
46+
|| properties.1 != ident.1 as u64
47+
|| properties.2 != ident.2 as u64
48+
{
49+
panic!(
50+
"unicode-properties and unicode-ident must use the same Unicode version, \
51+
`unicode_properties::UNICODE_VERSION` and `unicode_ident::UNICODE_VERSION` are \
52+
different."
53+
);
54+
}
55+
};
3956

4057
/// Parsed token.
4158
/// It doesn't contain information about data that has been parsed,
@@ -370,14 +387,14 @@ pub fn is_horizontal_whitespace(c: char) -> bool {
370387
/// a formal definition of valid identifier name.
371388
pub fn is_id_start(c: char) -> bool {
372389
// This is XID_Start OR '_' (which formally is not a XID_Start).
373-
c == '_' || unicode_xid::UnicodeXID::is_xid_start(c)
390+
c == '_' || unicode_ident::is_xid_start(c)
374391
}
375392

376393
/// True if `c` is valid as a non-first character of an identifier.
377394
/// See [Rust language reference](https://doc.rust-lang.org/reference/identifiers.html) for
378395
/// a formal definition of valid identifier name.
379396
pub fn is_id_continue(c: char) -> bool {
380-
unicode_xid::UnicodeXID::is_xid_continue(c)
397+
unicode_ident::is_xid_continue(c)
381398
}
382399

383400
/// The passed string is lexically an identifier.

0 commit comments

Comments
 (0)