Skip to content

Commit dc11c26

Browse files
authored
Merge pull request rust-lang#2461 from rust-lang/rustc-pull
Rustc pull update
2 parents 2196926 + ccbb9a8 commit dc11c26

20 files changed

+62
-51
lines changed

clippy_lints/src/unnested_or_patterns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn drain_matching(
426426
// Check if we should extract, but only if `idx >= start`.
427427
if idx > start && predicate(&alternatives[i].kind) {
428428
let pat = alternatives.remove(i);
429-
tail_or.push(extract(pat.into_inner().kind));
429+
tail_or.push(extract(pat.kind));
430430
} else {
431431
i += 1;
432432
}

clippy_utils/src/ast_utils/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,5 +960,7 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
960960
}
961961

962962
pub fn eq_delim_args(l: &DelimArgs, r: &DelimArgs) -> bool {
963-
l.delim == r.delim && l.tokens.eq_unspanned(&r.tokens)
963+
l.delim == r.delim
964+
&& l.tokens.len() == r.tokens.len()
965+
&& l.tokens.iter().zip(r.tokens.iter()).all(|(a, b)| a.eq_unspanned(b))
964966
}

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
439439
tcx,
440440
ObligationCause::dummy_with_span(body.span),
441441
param_env,
442-
TraitRef::new(tcx, tcx.require_lang_item(LangItem::Destruct, Some(body.span)), [ty]),
442+
TraitRef::new(tcx, tcx.require_lang_item(LangItem::Destruct, body.span), [ty]),
443443
);
444444

445445
let mut selcx = SelectionContext::new(&infcx);

tests/ui/explicit_iter_loop.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ fn main() {
7777

7878
struct NoIntoIter();
7979
impl NoIntoIter {
80-
fn iter(&self) -> slice::Iter<u8> {
80+
fn iter(&self) -> slice::Iter<'_, u8> {
8181
unimplemented!()
8282
}
8383

84-
fn iter_mut(&mut self) -> slice::IterMut<u8> {
84+
fn iter_mut(&mut self) -> slice::IterMut<'_, u8> {
8585
unimplemented!()
8686
}
8787
}

tests/ui/explicit_iter_loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ fn main() {
7777

7878
struct NoIntoIter();
7979
impl NoIntoIter {
80-
fn iter(&self) -> slice::Iter<u8> {
80+
fn iter(&self) -> slice::Iter<'_, u8> {
8181
unimplemented!()
8282
}
8383

84-
fn iter_mut(&mut self) -> slice::IterMut<u8> {
84+
fn iter_mut(&mut self) -> slice::IterMut<'_, u8> {
8585
unimplemented!()
8686
}
8787
}

tests/ui/indexing_slicing_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn main() {
6868
// This should be linted, since `suppress-restriction-lint-in-const` default is false.
6969
const { &ARR[idx4()] };
7070
//~^ ERROR: indexing may panic
71-
//~| ERROR: evaluation of `main
71+
//~| ERROR: index out of bounds
7272

7373
let y = &x;
7474
// Ok, referencing shouldn't affect this lint. See the issue 6021

tests/ui/indexing_slicing_index.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
99
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
1010
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
1111

12-
error[E0080]: evaluation of `main::{constant#3}` failed
12+
error[E0080]: index out of bounds: the length is 2 but the index is 4
1313
--> tests/ui/indexing_slicing_index.rs:69:14
1414
|
1515
LL | const { &ARR[idx4()] };
16-
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
16+
| ^^^^^^^^^^^ evaluation of `main::{constant#3}` failed here
1717

1818
note: erroneous constant encountered
1919
--> tests/ui/indexing_slicing_index.rs:69:5

tests/ui/iter_next_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88

99
struct Unrelated(&'static [u8]);
1010
impl Unrelated {
11-
fn next(&self) -> std::slice::Iter<u8> {
11+
fn next(&self) -> std::slice::Iter<'_, u8> {
1212
self.0.iter()
1313
}
1414
}

tests/ui/iter_not_returning_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl S {
7171

7272
struct S2([u8]);
7373
impl S2 {
74-
fn iter(&self) -> core::slice::Iter<u8> {
74+
fn iter(&self) -> core::slice::Iter<'_, u8> {
7575
self.0.iter()
7676
}
7777
}

tests/ui/methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct Lt2<'a> {
4949

5050
impl<'a> Lt2<'a> {
5151
// The lifetime is different, but that’s irrelevant; see issue #734.
52-
pub fn new(s: &str) -> Lt2 {
52+
pub fn new(s: &str) -> Lt2<'_> {
5353
unimplemented!()
5454
}
5555
}

0 commit comments

Comments
 (0)