Skip to content

Commit 31656e7

Browse files
committed
Auto merge of rust-lang#110458 - matthiaskrgr:rollup-1xcxmgc, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#104055 (Migrate diagnostics in `rustc_borrowck`) - rust-lang#110257 (fix false positives for `unused_parens` around unary and binary operations) - rust-lang#110313 (allow `repr(align = x)` on inherent methods) - rust-lang#110337 (Correct default value for default-linker-libraries) - rust-lang#110386 (Clean up traversal macros) - rust-lang#110394 (Various minor Idx-related tweaks) - rust-lang#110425 (Encode def span for `ConstParam`) - rust-lang#110434 (Check freeze with right param-env in `deduced_param_attrs`) - rust-lang#110455 (tests: adapt for LLVM change 5b386b8) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents e49122f + c81e8b8 commit 31656e7

Some content is hidden

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

50 files changed

+973
-569
lines changed

compiler/rustc_abi/src/layout.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ pub trait LayoutCalculator {
461461
let all_indices = variants.indices();
462462
let needs_disc =
463463
|index: VariantIdx| index != largest_variant_index && !absent(&variants[index]);
464-
let niche_variants = all_indices.clone().find(|v| needs_disc(*v)).unwrap().index()
465-
..=all_indices.rev().find(|v| needs_disc(*v)).unwrap().index();
464+
let niche_variants = all_indices.clone().find(|v| needs_disc(*v)).unwrap()
465+
..=all_indices.rev().find(|v| needs_disc(*v)).unwrap();
466466

467467
let count = niche_variants.size_hint().1.unwrap() as u128;
468468

@@ -560,8 +560,7 @@ pub trait LayoutCalculator {
560560
tag: niche_scalar,
561561
tag_encoding: TagEncoding::Niche {
562562
untagged_variant: largest_variant_index,
563-
niche_variants: (VariantIdx::new(*niche_variants.start())
564-
..=VariantIdx::new(*niche_variants.end())),
563+
niche_variants,
565564
niche_start,
566565
},
567566
tag_field: 0,

compiler/rustc_abi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use bitflags::bitflags;
1111
use rustc_data_structures::intern::Interned;
1212
#[cfg(feature = "nightly")]
1313
use rustc_data_structures::stable_hasher::StableOrd;
14-
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
14+
use rustc_index::vec::{IndexSlice, IndexVec};
1515
#[cfg(feature = "nightly")]
1616
use rustc_macros::HashStable_Generic;
1717
#[cfg(feature = "nightly")]

compiler/rustc_ast/src/node_id.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ rustc_index::newtype_index! {
99
///
1010
/// [`DefId`]: rustc_span::def_id::DefId
1111
#[debug_format = "NodeId({})"]
12-
pub struct NodeId {}
12+
pub struct NodeId {
13+
/// The [`NodeId`] used to represent the root of the crate.
14+
const CRATE_NODE_ID = 0;
15+
}
1316
}
1417

1518
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId);
1619

17-
/// The [`NodeId`] used to represent the root of the crate.
18-
pub const CRATE_NODE_ID: NodeId = NodeId::from_u32(0);
19-
2020
/// When parsing and at the beginning of doing expansions, we initially give all AST nodes
2121
/// this dummy AST [`NodeId`]. Then, during a later phase of expansion, we renumber them
2222
/// to have small, positive IDs.

compiler/rustc_borrowck/messages.ftl

+138-12
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,6 @@ borrowck_returned_lifetime_short =
5656
borrowck_used_impl_require_static =
5757
the used `impl` has a `'static` requirement
5858
59-
borrowck_capture_kind_label =
60-
capture is {$kind_desc} because of use here
61-
62-
borrowck_var_borrow_by_use_place_in_generator =
63-
borrow occurs due to use of {$place} in closure in generator
64-
65-
borrowck_var_borrow_by_use_place_in_closure =
66-
borrow occurs due to use of {$place} in closure
67-
68-
borrowck_var_borrow_by_use_place =
69-
borrow occurs due to use of {$place}
70-
7159
borrowck_borrow_due_to_use_generator =
7260
borrow occurs due to use in generator
7361
@@ -101,12 +89,63 @@ borrowck_capture_mut =
10189
borrowck_capture_move =
10290
capture is moved because of use here
10391
92+
borrowck_var_borrow_by_use_place_in_generator =
93+
{$is_single_var ->
94+
*[true] borrow occurs
95+
[false] borrows occur
96+
} due to use of {$place} in generator
97+
98+
borrowck_var_borrow_by_use_place_in_closure =
99+
{$is_single_var ->
100+
*[true] borrow occurs
101+
[false] borrows occur
102+
} due to use of {$place} in closure
103+
104+
borrowck_var_borrow_by_use_in_generator =
105+
borrow occurs due to use in generator
106+
107+
borrowck_var_borrow_by_use_in_closure =
108+
borrow occurs due to use in closure
109+
104110
borrowck_var_move_by_use_place_in_generator =
105111
move occurs due to use of {$place} in generator
106112
107113
borrowck_var_move_by_use_place_in_closure =
108114
move occurs due to use of {$place} in closure
109115
116+
borrowck_var_move_by_use_in_generator =
117+
move occurs due to use in generator
118+
119+
borrowck_var_move_by_use_in_closure =
120+
move occurs due to use in closure
121+
122+
borrowck_partial_var_move_by_use_in_generator =
123+
variable {$is_partial ->
124+
[true] partially moved
125+
*[false] moved
126+
} due to use in generator
127+
128+
borrowck_partial_var_move_by_use_in_closure =
129+
variable {$is_partial ->
130+
[true] partially moved
131+
*[false] moved
132+
} due to use in closure
133+
134+
borrowck_var_first_borrow_by_use_place_in_generator =
135+
first borrow occurs due to use of {$place} in generator
136+
137+
borrowck_var_first_borrow_by_use_place_in_closure =
138+
first borrow occurs due to use of {$place} in closure
139+
140+
borrowck_var_second_borrow_by_use_place_in_generator =
141+
second borrow occurs due to use of {$place} in generator
142+
143+
borrowck_var_second_borrow_by_use_place_in_closure =
144+
second borrow occurs due to use of {$place} in closure
145+
146+
borrowck_var_mutable_borrow_by_use_place_in_closure =
147+
mutable borrow occurs due to use of {$place} in closure
148+
110149
borrowck_cannot_move_when_borrowed =
111150
cannot move out of {$place ->
112151
[value] value
@@ -127,3 +166,90 @@ borrowck_opaque_type_non_generic_param =
127166
[true] cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
128167
*[other] this generic parameter must be used with a generic {$kind} parameter
129168
}
169+
170+
borrowck_moved_due_to_call =
171+
{$place_name} {$is_partial ->
172+
[true] partially moved
173+
*[false] moved
174+
} due to this {$is_loop_message ->
175+
[true] call, in previous iteration of loop
176+
*[false] call
177+
}
178+
179+
borrowck_moved_due_to_usage_in_operator =
180+
{$place_name} {$is_partial ->
181+
[true] partially moved
182+
*[false] moved
183+
} due to usage in {$is_loop_message ->
184+
[true] operator, in previous iteration of loop
185+
*[false] operator
186+
}
187+
188+
borrowck_moved_due_to_implicit_into_iter_call =
189+
{$place_name} {$is_partial ->
190+
[true] partially moved
191+
*[false] moved
192+
} due to this implicit call to {$is_loop_message ->
193+
[true] `.into_iter()`, in previous iteration of loop
194+
*[false] `.into_iter()`
195+
}
196+
197+
borrowck_moved_due_to_method_call =
198+
{$place_name} {$is_partial ->
199+
[true] partially moved
200+
*[false] moved
201+
} due to this method {$is_loop_message ->
202+
[true] call, in previous iteration of loop
203+
*[false] call
204+
}
205+
206+
borrowck_value_moved_here =
207+
value {$is_partial ->
208+
[true] partially moved
209+
*[false] moved
210+
} {$is_move_msg ->
211+
[true] into closure here
212+
*[false] here
213+
}{$is_loop_message ->
214+
[true] , in previous iteration of loop
215+
*[false] {""}
216+
}
217+
218+
borrowck_consider_borrow_type_contents =
219+
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
220+
221+
borrowck_moved_a_fn_once_in_call =
222+
this value implements `FnOnce`, which causes it to be moved when called
223+
224+
borrowck_calling_operator_moves_lhs =
225+
calling this operator moves the left-hand side
226+
227+
borrowck_func_take_self_moved_place =
228+
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
229+
230+
borrowck_suggest_iterate_over_slice =
231+
consider iterating over a slice of the `{$ty}`'s content to avoid moving into the `for` loop
232+
233+
borrowck_suggest_create_freash_reborrow =
234+
consider reborrowing the `Pin` instead of moving it
235+
236+
borrowck_value_capture_here =
237+
value captured {$is_within ->
238+
[true] here by generator
239+
*[false] here
240+
}
241+
242+
borrowck_move_out_place_here =
243+
{$place} is moved here
244+
245+
borrowck_closure_invoked_twice =
246+
closure cannot be invoked more than once because it moves the variable `{$place_name}` out of its environment
247+
248+
borrowck_closure_moved_twice =
249+
closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place_name}` out of its environment
250+
251+
borrowck_ty_no_impl_copy =
252+
{$is_partial_move ->
253+
[true] partial move
254+
*[false] move
255+
} occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait

0 commit comments

Comments
 (0)