Skip to content

Commit ad60608

Browse files
committed
Merge from rustc
2 parents 9ffd3f9 + f78369b commit ad60608

File tree

514 files changed

+10719
-7818
lines changed

Some content is hidden

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

514 files changed

+10719
-7818
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ jobs:
201201
- name: dist-i686-linux
202202
os: ubuntu-20.04-8core-32gb
203203
env: {}
204+
- name: dist-loongarch64-linux
205+
os: ubuntu-20.04-8core-32gb
206+
env: {}
204207
- name: dist-mips-linux
205208
os: ubuntu-20.04-8core-32gb
206209
env: {}

Cargo.lock

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ dependencies = [
246246
"serde",
247247
]
248248

249+
[[package]]
250+
name = "bincode"
251+
version = "1.3.3"
252+
source = "registry+https://github.com/rust-lang/crates.io-index"
253+
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
254+
dependencies = [
255+
"serde",
256+
]
257+
249258
[[package]]
250259
name = "bitflags"
251260
version = "1.3.2"
@@ -717,9 +726,9 @@ dependencies = [
717726

718727
[[package]]
719728
name = "compiler_builtins"
720-
version = "0.1.91"
729+
version = "0.1.92"
721730
source = "registry+https://github.com/rust-lang/crates.io-index"
722-
checksum = "571298a3cce7e2afbd3d61abb91a18667d5ab25993ec577a88ee8ac45f00cc3a"
731+
checksum = "64518f1ae689f74db058bbfb3238dfe6eb53f59f4ae712f1ff4348628522e190"
723732
dependencies = [
724733
"cc",
725734
"rustc-std-workspace-core",
@@ -2770,9 +2779,9 @@ dependencies = [
27702779

27712780
[[package]]
27722781
name = "pulldown-cmark"
2773-
version = "0.9.2"
2782+
version = "0.9.3"
27742783
source = "registry+https://github.com/rust-lang/crates.io-index"
2775-
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
2784+
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
27762785
dependencies = [
27772786
"bitflags",
27782787
"memchr",
@@ -4374,6 +4383,7 @@ dependencies = [
43744383
name = "rustdoc-json-types"
43754384
version = "0.1.0"
43764385
dependencies = [
4386+
"bincode",
43774387
"rustc-hash",
43784388
"serde",
43794389
"serde_json",

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,10 +2391,10 @@ pub struct FnDecl {
23912391

23922392
impl FnDecl {
23932393
pub fn has_self(&self) -> bool {
2394-
self.inputs.get(0).map_or(false, Param::is_self)
2394+
self.inputs.get(0).is_some_and(Param::is_self)
23952395
}
23962396
pub fn c_variadic(&self) -> bool {
2397-
self.inputs.last().map_or(false, |arg| matches!(arg.ty.kind, TyKind::CVarArgs))
2397+
self.inputs.last().is_some_and(|arg| matches!(arg.ty.kind, TyKind::CVarArgs))
23982398
}
23992399
}
24002400

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl Attribute {
149149
}
150150

151151
pub fn may_have_doc_links(&self) -> bool {
152-
self.doc_str().map_or(false, |s| comments::may_have_doc_links(s.as_str()))
152+
self.doc_str().is_some_and(|s| comments::may_have_doc_links(s.as_str()))
153153
}
154154

155155
pub fn is_proc_macro_attr(&self) -> bool {
@@ -441,12 +441,12 @@ impl NestedMetaItem {
441441

442442
/// Returns `true` if this list item is a MetaItem with a name of `name`.
443443
pub fn has_name(&self, name: Symbol) -> bool {
444-
self.meta_item().map_or(false, |meta_item| meta_item.has_name(name))
444+
self.meta_item().is_some_and(|meta_item| meta_item.has_name(name))
445445
}
446446

447447
/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
448448
pub fn is_word(&self) -> bool {
449-
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
449+
self.meta_item().is_some_and(|meta_item| meta_item.is_word())
450450
}
451451

452452
/// Gets a list of inner meta items from a list `MetaItem` type.

compiler/rustc_ast/src/expand/allocator.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
use rustc_span::symbol::{sym, Symbol};
22

3-
#[derive(Clone, Debug, Copy, HashStable_Generic)]
3+
#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)]
44
pub enum AllocatorKind {
55
Global,
66
Default,
77
}
88

9-
impl AllocatorKind {
10-
pub fn fn_name(&self, base: Symbol) -> String {
11-
match *self {
12-
AllocatorKind::Global => format!("__rg_{base}"),
13-
AllocatorKind::Default => format!("__rdl_{base}"),
14-
}
9+
pub fn global_fn_name(base: Symbol) -> String {
10+
format!("__rust_{base}")
11+
}
12+
13+
pub fn default_fn_name(base: Symbol) -> String {
14+
format!("__rdl_{base}")
15+
}
16+
17+
pub fn alloc_error_handler_name(alloc_error_handler_kind: AllocatorKind) -> &'static str {
18+
match alloc_error_handler_kind {
19+
AllocatorKind::Global => "__rg_oom",
20+
AllocatorKind::Default => "__rdl_oom",
1521
}
1622
}
1723

24+
pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable";
25+
1826
pub enum AllocatorTy {
1927
Layout,
2028
Ptr,

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl Token {
607607
/// Returns `true` if the token is an identifier whose name is the given
608608
/// string slice.
609609
pub fn is_ident_named(&self, name: Symbol) -> bool {
610-
self.ident().map_or(false, |(ident, _)| ident.name == name)
610+
self.ident().is_some_and(|(ident, _)| ident.name == name)
611611
}
612612

613613
/// Returns `true` if the token is an interpolated path.

compiler/rustc_ast/src/util/literal.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ fn integer_lit(symbol: Symbol, suffix: Option<Symbol>) -> Result<LitKind, LitErr
392392
// Small bases are lexed as if they were base 10, e.g, the string
393393
// might be `0b10201`. This will cause the conversion above to fail,
394394
// but these kinds of errors are already reported by the lexer.
395-
let from_lexer =
396-
base < 10 && s.chars().any(|c| c.to_digit(10).map_or(false, |d| d >= base));
395+
let from_lexer = base < 10 && s.chars().any(|c| c.to_digit(10).is_some_and(|d| d >= base));
397396
if from_lexer { LitError::LexerError } else { LitError::IntTooLarge(base) }
398397
})
399398
}
Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,121 @@
1-
ast_lowering_generic_type_with_parentheses =
2-
parenthesized type parameters may only be used with a `Fn` trait
3-
.label = only `Fn` traits may use parentheses
4-
5-
ast_lowering_use_angle_brackets = use angle brackets instead
1+
ast_lowering_abi_specified_multiple_times =
2+
`{$prev_name}` ABI specified multiple times
3+
.label = previously specified here
4+
.note = these ABIs are equivalent on the current target
65
7-
ast_lowering_invalid_abi =
8-
invalid ABI: found `{$abi}`
9-
.label = invalid ABI
10-
.note = invoke `{$command}` for a full list of supported calling conventions.
6+
ast_lowering_arbitrary_expression_in_pattern =
7+
arbitrary expressions aren't allowed in patterns
118
12-
ast_lowering_invalid_abi_suggestion = did you mean
9+
ast_lowering_argument = argument
1310
1411
ast_lowering_assoc_ty_parentheses =
1512
parenthesized generic arguments cannot be used in associated type constraints
1613
17-
ast_lowering_remove_parentheses = remove these parentheses
18-
19-
ast_lowering_misplaced_impl_trait =
20-
`impl Trait` only allowed in function and inherent method return types, not in {$position}
21-
22-
ast_lowering_misplaced_assoc_ty_binding =
23-
associated type bounds are only allowed in where clauses and function signatures, not in {$position}
14+
ast_lowering_async_generators_not_supported =
15+
`async` generators are not yet supported
2416
25-
ast_lowering_underscore_expr_lhs_assign =
26-
in expressions, `_` can only be used on the left-hand side of an assignment
27-
.label = `_` not allowed here
17+
ast_lowering_async_non_move_closure_not_supported =
18+
`async` non-`move` closures with parameters are not currently supported
19+
.help = consider using `let` statements to manually capture variables by reference before entering an `async move` closure
2820
29-
ast_lowering_base_expression_double_dot =
30-
base expression required after `..`
31-
.label = add a base expression here
21+
ast_lowering_att_syntax_only_x86 =
22+
the `att_syntax` option is only supported on x86
3223
3324
ast_lowering_await_only_in_async_fn_and_blocks =
3425
`await` is only allowed inside `async` functions and blocks
3526
.label = only allowed inside `async` functions and blocks
3627
37-
ast_lowering_this_not_async = this is not `async`
28+
ast_lowering_bad_return_type_notation_inputs =
29+
argument types not allowed with return type notation
30+
.suggestion = remove the input types
3831
39-
ast_lowering_generator_too_many_parameters =
40-
too many parameters for a generator (expected 0 or 1 parameters)
32+
ast_lowering_bad_return_type_notation_needs_dots =
33+
return type notation arguments must be elided with `..`
34+
.suggestion = add `..`
35+
36+
ast_lowering_bad_return_type_notation_output =
37+
return type not allowed with return type notation
38+
.suggestion = remove the return type
39+
40+
ast_lowering_base_expression_double_dot =
41+
base expression required after `..`
42+
.label = add a base expression here
43+
44+
ast_lowering_clobber_abi_not_supported =
45+
`clobber_abi` is not supported on this target
4146
4247
ast_lowering_closure_cannot_be_static = closures cannot be static
4348
44-
ast_lowering_async_non_move_closure_not_supported =
45-
`async` non-`move` closures with parameters are not currently supported
46-
.help = consider using `let` statements to manually capture variables by reference before entering an `async move` closure
49+
ast_lowering_does_not_support_modifiers =
50+
the `{$class_name}` register class does not support template modifiers
51+
52+
ast_lowering_extra_double_dot =
53+
`..` can only be used once per {$ctx} pattern
54+
.label = can only be used once per {$ctx} pattern
4755
4856
ast_lowering_functional_record_update_destructuring_assignment =
4957
functional record updates are not allowed in destructuring assignments
5058
.suggestion = consider removing the trailing pattern
5159
52-
ast_lowering_async_generators_not_supported =
53-
`async` generators are not yet supported
60+
ast_lowering_generator_too_many_parameters =
61+
too many parameters for a generator (expected 0 or 1 parameters)
5462
55-
ast_lowering_inline_asm_unsupported_target =
56-
inline assembly is unsupported on this target
63+
ast_lowering_generic_type_with_parentheses =
64+
parenthesized type parameters may only be used with a `Fn` trait
65+
.label = only `Fn` traits may use parentheses
5766
58-
ast_lowering_att_syntax_only_x86 =
59-
the `att_syntax` option is only supported on x86
67+
ast_lowering_inclusive_range_with_no_end = inclusive range with no end
6068
61-
ast_lowering_abi_specified_multiple_times =
62-
`{$prev_name}` ABI specified multiple times
63-
.label = previously specified here
64-
.note = these ABIs are equivalent on the current target
69+
ast_lowering_inline_asm_unsupported_target =
70+
inline assembly is unsupported on this target
6571
66-
ast_lowering_clobber_abi_not_supported =
67-
`clobber_abi` is not supported on this target
72+
ast_lowering_invalid_abi =
73+
invalid ABI: found `{$abi}`
74+
.label = invalid ABI
75+
.note = invoke `{$command}` for a full list of supported calling conventions.
6876
6977
ast_lowering_invalid_abi_clobber_abi =
7078
invalid ABI for `clobber_abi`
7179
.note = the following ABIs are supported on this target: {$supported_abis}
7280
81+
ast_lowering_invalid_abi_suggestion = did you mean
82+
83+
ast_lowering_invalid_asm_template_modifier_const =
84+
asm template modifiers are not allowed for `const` arguments
85+
86+
ast_lowering_invalid_asm_template_modifier_reg_class =
87+
invalid asm template modifier for this register class
88+
89+
ast_lowering_invalid_asm_template_modifier_sym =
90+
asm template modifiers are not allowed for `sym` arguments
91+
7392
ast_lowering_invalid_register =
7493
invalid register `{$reg}`: {$error}
7594
7695
ast_lowering_invalid_register_class =
7796
invalid register class `{$reg_class}`: {$error}
7897
79-
ast_lowering_invalid_asm_template_modifier_reg_class =
80-
invalid asm template modifier for this register class
98+
ast_lowering_misplaced_assoc_ty_binding =
99+
associated type bounds are only allowed in where clauses and function signatures, not in {$position}
81100
82-
ast_lowering_argument = argument
101+
ast_lowering_misplaced_double_dot =
102+
`..` patterns are not allowed here
103+
.note = only allowed in tuple, tuple struct, and slice patterns
83104
84-
ast_lowering_template_modifier = template modifier
105+
ast_lowering_misplaced_impl_trait =
106+
`impl Trait` only allowed in function and inherent method return types, not in {$position}
85107
86-
ast_lowering_support_modifiers =
87-
the `{$class_name}` register class supports the following template modifiers: {$modifiers}
108+
ast_lowering_misplaced_relax_trait_bound =
109+
`?Trait` bounds are only permitted at the point where a type parameter is declared
88110
89-
ast_lowering_does_not_support_modifiers =
90-
the `{$class_name}` register class does not support template modifiers
111+
ast_lowering_not_supported_for_lifetime_binder_async_closure =
112+
`for<...>` binders on `async` closures are not currently supported
91113
92-
ast_lowering_invalid_asm_template_modifier_const =
93-
asm template modifiers are not allowed for `const` arguments
114+
ast_lowering_previously_used_here = previously used here
94115
95-
ast_lowering_invalid_asm_template_modifier_sym =
96-
asm template modifiers are not allowed for `sym` arguments
116+
ast_lowering_register1 = register `{$reg1_name}`
117+
118+
ast_lowering_register2 = register `{$reg2_name}`
97119
98120
ast_lowering_register_class_only_clobber =
99121
register class `{$reg_class_name}` can only be used as a clobber, not as an input or output
@@ -102,9 +124,7 @@ ast_lowering_register_conflict =
102124
register `{$reg1_name}` conflicts with register `{$reg2_name}`
103125
.help = use `lateout` instead of `out` to avoid conflict
104126
105-
ast_lowering_register1 = register `{$reg1_name}`
106-
107-
ast_lowering_register2 = register `{$reg2_name}`
127+
ast_lowering_remove_parentheses = remove these parentheses
108128
109129
ast_lowering_sub_tuple_binding =
110130
`{$ident_name} @` is not allowed in a {$ctx}
@@ -113,41 +133,21 @@ ast_lowering_sub_tuple_binding =
113133
114134
ast_lowering_sub_tuple_binding_suggestion = if you don't need to use the contents of {$ident}, discard the tuple's remaining fields
115135
116-
ast_lowering_extra_double_dot =
117-
`..` can only be used once per {$ctx} pattern
118-
.label = can only be used once per {$ctx} pattern
119-
120-
ast_lowering_previously_used_here = previously used here
121-
122-
ast_lowering_misplaced_double_dot =
123-
`..` patterns are not allowed here
124-
.note = only allowed in tuple, tuple struct, and slice patterns
125-
126-
ast_lowering_misplaced_relax_trait_bound =
127-
`?Trait` bounds are only permitted at the point where a type parameter is declared
128-
129-
ast_lowering_not_supported_for_lifetime_binder_async_closure =
130-
`for<...>` binders on `async` closures are not currently supported
136+
ast_lowering_support_modifiers =
137+
the `{$class_name}` register class supports the following template modifiers: {$modifiers}
131138
132-
ast_lowering_arbitrary_expression_in_pattern =
133-
arbitrary expressions aren't allowed in patterns
139+
ast_lowering_template_modifier = template modifier
134140
135-
ast_lowering_inclusive_range_with_no_end = inclusive range with no end
141+
ast_lowering_this_not_async = this is not `async`
136142
137143
ast_lowering_trait_fn_async =
138144
functions in traits cannot be declared `async`
139145
.label = `async` because of this
140146
.note = `async` trait functions are not currently supported
141147
.note2 = consider using the `async-trait` crate: https://crates.io/crates/async-trait
142148
143-
ast_lowering_bad_return_type_notation_inputs =
144-
argument types not allowed with return type notation
145-
.suggestion = remove the input types
146-
147-
ast_lowering_bad_return_type_notation_needs_dots =
148-
return type notation arguments must be elided with `..`
149-
.suggestion = add `..`
149+
ast_lowering_underscore_expr_lhs_assign =
150+
in expressions, `_` can only be used on the left-hand side of an assignment
151+
.label = `_` not allowed here
150152
151-
ast_lowering_bad_return_type_notation_output =
152-
return type not allowed with return type notation
153-
.suggestion = remove the return type
153+
ast_lowering_use_angle_brackets = use angle brackets instead

0 commit comments

Comments
 (0)