Skip to content

Commit 2c39ff4

Browse files
committed
Auto merge of #161196 - JonathanBrouwer:rollup-JHCyFaw, r=JonathanBrouwer
Rollup of 17 pull requests Successful merges: - #161017 (Library: enforce clippy deref lints in CI) - #160416 (std: fix unix socket address truncation without a trailing NUL) - #161006 ([CI] Build newer `binutils` before building `gcc`) - #161141 (Add documentation for BPF targets) - #161157 (bootstrap: Move several items out of the crate root) - #161185 (std: guard against unwinds in queue-based `Once`) - #161186 (miri subtree update) - #159855 (std: retry waitid on EINTR in the pidfd wait path) - #160478 (diagnostics: Suggest fn binding type for unstable closure for<> binders) - #161053 (Add regression test for borrow of array drop type in const) - #161073 (Add regression test for path printing with infinitely many visible names) - #161099 (Add regression test for unstable def_ident_span fingerprint with incremental recompilation) - #161103 (cleanup: rip out unnecessary `iter().last()` and `iter().next()`) - #161136 (Add BPF test for Rust ABI stack arguments) - #161146 (Switch to c8a EC2 runner for auto merges) - #161148 ([rustdoc] Put back one removed flaky GUI test (which hopefully isn't flaky anymore)) - #161181 (Add back flaky gui rustdoc test `tests/rustdoc-gui/headers-color.goml`)
2 parents 34baba5 + 9692358 commit 2c39ff4

131 files changed

Lines changed: 1455 additions & 459 deletions

File tree

Some content is hidden

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

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ impl<'a> AstValidator<'a> {
11801180
self.dcx().emit_err(diagnostics::ArgsBeforeConstraint {
11811181
arg_spans: arg_spans.clone(),
11821182
constraints: constraint_spans[0],
1183-
args: *arg_spans.iter().last().unwrap(),
1183+
args: *arg_spans.last().unwrap(),
11841184
data: data.span,
11851185
constraint_spans: diagnostics::EmptyLabelManySpans(constraint_spans),
11861186
arg_spans2: diagnostics::EmptyLabelManySpans(arg_spans),

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
505505
gate_all!(
506506
closure_lifetime_binder,
507507
"`for<...>` binders for closures are experimental",
508-
"consider removing `for<...>`"
508+
"consider using a type annotation instead: \
509+
`let closure: for<...> fn(...) -> ... = /* closure */;`"
509510
);
510511
gate_all!(
511512
half_open_range_patterns_in_slices,

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ fn extend_err_with_const_context(
324324
{
325325
// `foo<N>()`, point at the const parameter in the definition of `foo`.
326326
if let Some(i) =
327-
path.segments.iter().last().and_then(|segment| segment.args).and_then(|args| {
327+
path.segments.last().and_then(|segment| segment.args).and_then(|args| {
328328
args.args.iter().position(|arg| {
329329
matches!(arg, hir::GenericArg::Const(arg) if arg.hir_id == parent.hir_id)
330330
})

compiler/rustc_parse/src/parser/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ impl<'a> Parser<'a> {
16881688
/// If the user writes `S { ref field: name }` instead of `S { field: ref name }`, we suggest
16891689
/// the correct code.
16901690
fn recover_misplaced_pattern_modifiers(&self, fields: &ThinVec<PatField>, err: &mut Diag<'a>) {
1691-
if let Some(last) = fields.iter().last()
1691+
if let Some(last) = fields.last()
16921692
&& last.is_shorthand
16931693
&& let PatKind::Ident(binding, ident, None) = last.pat.kind
16941694
&& binding != BindingMode::NONE

compiler/rustc_resolve/src/diagnostics/impls.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
256256
for note in notes {
257257
diag.note(note);
258258
}
259-
} else if let Some((_, UnresolvedImportError { note: Some(note), .. })) =
260-
errors.iter().last()
261-
{
259+
} else if let Some((_, UnresolvedImportError { note: Some(note), .. })) = errors.last() {
262260
diag.note(note.clone());
263261
}
264262

@@ -2876,7 +2874,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
28762874
if struct_expr.fields.is_empty() {
28772875
return;
28782876
}
2879-
let last_span = struct_expr.fields.iter().last().unwrap().span;
2877+
let last_span = struct_expr.fields.last().unwrap().span;
28802878
let mut iter = struct_expr.fields.iter().peekable();
28812879
let mut prev: Option<Span> = None;
28822880
while let Some(field) = iter.next() {

compiler/rustc_resolve/src/late.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,7 +4092,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
40924092
v.could_be_path = false;
40934093
}
40944094
self.report_error(
4095-
v.origin.iter().next().unwrap().0,
4095+
v.origin.first().unwrap().0,
40964096
ResolutionError::VariableNotBoundInPattern(v, self.parent_scope),
40974097
);
40984098
}
@@ -4757,8 +4757,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
47574757
self.resolve_path(&std_path, Some(ns), None, source)
47584758
{
47594759
// Check if we wrote `str::from_utf8` instead of `std::str::from_utf8`
4760-
let item_span =
4761-
path.iter().last().map_or(path_span, |segment| segment.ident.span);
4760+
let item_span = path.last().map_or(path_span, |segment| segment.ident.span);
47624761

47634762
self.r.confused_type_with_std_module.insert(item_span, path_span);
47644763
self.r.confused_type_with_std_module.insert(path_span, path_span);

library/alloc/src/borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<'a, B: ?Sized + ToOwned> Borrow<B> for Cow<'a, B>
188188
// B::Owned: [const] Borrow<B>,
189189
{
190190
fn borrow(&self) -> &B {
191-
&**self
191+
self
192192
}
193193
}
194194

library/alloc/src/boxed.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,7 +2144,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
21442144
/// ```
21452145
fn clone_from(&mut self, source: &Self) {
21462146
if self.len() == source.len() {
2147-
self.clone_from_slice(&source);
2147+
self.clone_from_slice(source);
21482148
} else {
21492149
*self = source.clone();
21502150
}
@@ -2295,14 +2295,14 @@ impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
22952295
type Target = T;
22962296

22972297
fn deref(&self) -> &T {
2298-
&**self
2298+
self
22992299
}
23002300
}
23012301

23022302
#[stable(feature = "rust1", since = "1.0.0")]
23032303
impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
23042304
fn deref_mut(&mut self) -> &mut T {
2305-
&mut **self
2305+
self
23062306
}
23072307
}
23082308

@@ -2398,28 +2398,28 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global
23982398
#[stable(feature = "box_borrow", since = "1.1.0")]
23992399
impl<T: ?Sized, A: Allocator> Borrow<T> for Box<T, A> {
24002400
fn borrow(&self) -> &T {
2401-
&**self
2401+
self
24022402
}
24032403
}
24042404

24052405
#[stable(feature = "box_borrow", since = "1.1.0")]
24062406
impl<T: ?Sized, A: Allocator> BorrowMut<T> for Box<T, A> {
24072407
fn borrow_mut(&mut self) -> &mut T {
2408-
&mut **self
2408+
self
24092409
}
24102410
}
24112411

24122412
#[stable(since = "1.5.0", feature = "smart_ptr_as_ref")]
24132413
impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
24142414
fn as_ref(&self) -> &T {
2415-
&**self
2415+
self
24162416
}
24172417
}
24182418

24192419
#[stable(since = "1.5.0", feature = "smart_ptr_as_ref")]
24202420
impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
24212421
fn as_mut(&mut self) -> &mut T {
2422-
&mut **self
2422+
self
24232423
}
24242424
}
24252425

library/alloc/src/collections/btree/map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
15721572

15731573
let right_root = left_root.split_off(key, (*self.alloc).clone());
15741574

1575-
let (new_left_len, right_len) = Root::calc_split_length(total_num, &left_root, &right_root);
1575+
let (new_left_len, right_len) = Root::calc_split_length(total_num, left_root, &right_root);
15761576
self.length = new_left_len;
15771577

15781578
BTreeMap {
@@ -2208,8 +2208,8 @@ impl<'a, K, V, R> ExtractIfInner<'a, K, V, R> {
22082208
// On creation, we navigated directly to the left bound, so we need only check the
22092209
// right bound here to decide whether to stop.
22102210
match self.range.end_bound() {
2211-
Bound::Included(ref end) if (*k).le(end) => (),
2212-
Bound::Excluded(ref end) if (*k).lt(end) => (),
2211+
Bound::Included(end) if (*k).le(end) => (),
2212+
Bound::Excluded(end) if (*k).lt(end) => (),
22132213
Bound::Unbounded => (),
22142214
_ => return None,
22152215
}

library/alloc/src/collections/btree/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
14301430
left_node.val_area_mut(old_left_len + 1..new_left_len),
14311431
);
14321432

1433-
slice_remove(&mut parent_node.edge_area_mut(..old_parent_len + 1), parent_idx + 1);
1433+
slice_remove(parent_node.edge_area_mut(..old_parent_len + 1), parent_idx + 1);
14341434
parent_node.correct_childrens_parent_links(parent_idx + 1..old_parent_len);
14351435
*parent_node.len_mut() -= 1;
14361436

0 commit comments

Comments
 (0)