Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PredicateKind and instead only use Binder<PredicateAtom> #80679

Merged
merged 15 commits into from
Jan 17, 2021

Conversation

jackh726
Copy link
Member

@jackh726 jackh726 commented Jan 4, 2021

Originally brought up in #76814 (comment)

r? @lcnr

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 4, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  EXTRA_VARIABLES: {
 "CI_ONLY_WHEN_SUBMODULES_CHANGED": 1
##[endgroup]
adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED
linux builder detected, using docker to run the build
##[group]Run src/ci/scripts/should-skip-this.sh
---
  CACHE_DOMAIN: ci-caches.rust-lang.org
  CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
  IMAGE: x86_64-gnu-tools
##[endgroup]
Executing the job since clippy subtree was updated
with:
  github_token: ***
  check_every_seconds: 60
env:
---
normalized stderr:
error: redundant closure found
  --> $DIR/eta.rs:20:27
   |
LL |     let a = Some(1u8).map(|a| foo(a));
   |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
   |
   = note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:21:10
   |
   |
LL |     meta(|a| foo(a));
   |          ^^^^^^^^^^ help: remove closure as shown: `foo`

error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
  --> $DIR/eta.rs:24:21
   |
LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
   |                     ^^^ help: change this to: `&2`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:31:27
   |
   |
LL |     let e = Some(1u8).map(|a| generic(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: redundant closure found
  --> $DIR/eta.rs:74:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
   |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
   |
   = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:76:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
   |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
error: redundant closure found
  --> $DIR/eta.rs:79:42
   |
   |
LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
   |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
error: redundant closure found
  --> $DIR/eta.rs:84:29
   |
   |
LL |     let e = Some("str").map(|s| s.to_string());
   |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
error: redundant closure found
  --> $DIR/eta.rs:86:27
   |
   |
LL |     let e = Some('a').map(|s| s.to_uppercase());
   |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:89:65
   |
   |
LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
   |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`

thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(&X, &X)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (1c0146a 2021-01-04)
query stack during panic:
query stack during panic:
#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(&X, &X)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (&X, &X)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, bool)), Binder(TraitPredicate(<F as std::ops::Fn<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(&X, &X)>>)), Binder(TraitPredicate(<F as std::marker::Sized>)), Binder(TraitPredicate(<X as std::marker::Sized>))], reveal: UserFacing })`
#1 [analysis] running analysis passes on this crate
end of query stack



expected stderr:
expected stderr:
error: redundant closure found
  --> $DIR/eta.rs:20:27
   |
LL |     let a = Some(1u8).map(|a| foo(a));
   |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
   |
   = note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:21:10
   |
   |
LL |     meta(|a| foo(a));
   |          ^^^^^^^^^^ help: remove closure as shown: `foo`

error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
  --> $DIR/eta.rs:24:21
   |
LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
   |                     ^^^ help: change this to: `&2`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:31:27
   |
   |
LL |     let e = Some(1u8).map(|a| generic(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: redundant closure found
  --> $DIR/eta.rs:74:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
   |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
   |
   = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:76:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
   |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
error: redundant closure found
  --> $DIR/eta.rs:79:42
   |
   |
LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
   |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
error: redundant closure found
  --> $DIR/eta.rs:84:29
   |
   |
LL |     let e = Some("str").map(|s| s.to_string());
   |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
error: redundant closure found
  --> $DIR/eta.rs:86:27
   |
   |
LL |     let e = Some('a').map(|s| s.to_uppercase());
   |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:89:65
   |
   |
LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
   |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:172:27
   |
   |
LL |     let a = Some(1u8).map(|a| foo_ptr(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `foo_ptr`
error: redundant closure found
  --> $DIR/eta.rs:177:27
   |
   |
LL |     let a = Some(1u8).map(|a| closure(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
error: aborting due to 12 previous errors




diff of stderr:

 error: redundant closure found
   --> $DIR/eta.rs:20:27
    |
 LL |     let a = Some(1u8).map(|a| foo(a));
    |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
    |
    = note: `-D clippy::redundant-closure` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:21:10
    |
    |
 LL |     meta(|a| foo(a));
    |          ^^^^^^^^^^ help: remove closure as shown: `foo`
 
 error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
   --> $DIR/eta.rs:24:21
    |
 LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
    |                     ^^^ help: change this to: `&2`
    |
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:31:27
    |
    |
 LL |     let e = Some(1u8).map(|a| generic(a));
    |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
 error: redundant closure found
   --> $DIR/eta.rs:74:51
    |
    |
 LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
    |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
    |
    = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:76:51
    |
    |
 LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
    |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
 error: redundant closure found
   --> $DIR/eta.rs:79:42
    |
    |
 LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
    |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
 error: redundant closure found
   --> $DIR/eta.rs:84:29
    |
    |
 LL |     let e = Some("str").map(|s| s.to_string());
    |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
 error: redundant closure found
   --> $DIR/eta.rs:86:27
    |
    |
 LL |     let e = Some('a').map(|s| s.to_uppercase());
    |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
 error: redundant closure found
   --> $DIR/eta.rs:89:65
    |
    |
 LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
-error: redundant closure found
-  --> $DIR/eta.rs:172:27
-   |
-   |
-LL |     let a = Some(1u8).map(|a| foo_ptr(a));
-   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `foo_ptr`
+thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(&X, &X)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-error: redundant closure found
-  --> $DIR/eta.rs:177:27
-   |
-   |
-LL |     let a = Some(1u8).map(|a| closure(a));
-   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
 
-error: aborting due to 12 previous errors
+note: the compiler unexpectedly panicked. this is a bug.
+
+
+note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
+
+note: Clippy version: clippy 0.1.51 (1c0146a 2021-01-04)
+query stack during panic:
+query stack during panic:
+#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(&X, &X)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (&X, &X)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, bool)), Binder(TraitPredicate(<F as std::ops::Fn<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(&X, &X)>>)), Binder(TraitPredicate(<F as std::marker::Sized>)), Binder(TraitPredicate(<X as std::marker::Sized>))], reveal: UserFacing })`
+#1 [analysis] running analysis passes on this crate
+end of query stack
 
 

The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-58613e8381df8652/out/test_build_base/eta.stderr
thread '[ui] ui/eta.rs' panicked at 'Could not retrieve suggestions from JSON: Error("expected ident", line: 11, column: 2)', /cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.5.0/src/runtest.rs:2311:15
normalized stderr:
normalized stderr:
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:4:1
   |
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
   |
   |
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:6:1
   |
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:16:1
   |
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:45:1
   |
LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:50:1
   |
LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:62:1
   |
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:86:1
   |
LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>


thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(Lt<'x, I>,)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (1c0146a 2021-01-04)
query stack during panic:
query stack during panic:
#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(Lt<'x, I>,)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (Lt<'x, I>,)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, Lt<'x, I>)), Binder(TraitPredicate(<F as std::ops::Fn<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<I as std::marker::Sized>)), Binder(TraitPredicate(<F as std::marker::Sized>))], reveal: UserFacing })`
#1 [analysis] running analysis passes on this crate
end of query stack



expected stderr:
expected stderr:
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:4:1
   |
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
   |
   |
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:6:1
   |
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:16:1
   |
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:45:1
   |
LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:50:1
   |
LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:62:1
   |
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:86:1
   |
LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:120:5
   |
LL |     fn self_and_out<'s>(&'s self) -> &'s u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:129:5
   |
LL |     fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:148:1
   |
LL | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:178:1
   |
LL | fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:184:1
   |
LL | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:203:1
   |
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:211:1
   |
LL | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:247:1
   |
LL | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:254:9
   |
LL |         fn needless_lt<'a>(x: &'a u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:258:9
   |
LL |         fn needless_lt<'a>(_x: &'a u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:271:9
   |
LL |         fn baz<'a>(&'a self) -> impl Foo + 'a {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:300:5
   |
LL |     fn impl_trait_elidable_nested_named_lifetimes<'a>(i: &'a i32, f: impl for<'b> Fn(&'b i32) -> &'b i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:303:5
   |
LL |     fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:312:5
   |
LL |     fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:324:5
   |
LL |     fn where_clause_elidadable<'a, T>(i: &'a i32, f: T) -> &'a i32


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:339:5
   |
LL |     fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:352:5
   |
LL |     fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:355:5
   |
LL |     fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) {

error: aborting due to 25 previous errors




diff of stderr:

 error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
   --> $DIR/needless_lifetimes.rs:4:1
    |
 LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
    |
    |

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  EXTRA_VARIABLES: {
 "CI_ONLY_WHEN_SUBMODULES_CHANGED": 1
##[endgroup]
adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED
linux builder detected, using docker to run the build
##[group]Run src/ci/scripts/should-skip-this.sh
---
  CACHE_DOMAIN: ci-caches.rust-lang.org
  CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
  IMAGE: x86_64-gnu-tools
##[endgroup]
Executing the job since clippy subtree was updated
with:
  github_token: ***
  check_every_seconds: 60
env:
---
normalized stderr:
error: redundant closure found
  --> $DIR/eta.rs:20:27
   |
LL |     let a = Some(1u8).map(|a| foo(a));
   |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
   |
   = note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:21:10
   |
   |
LL |     meta(|a| foo(a));
   |          ^^^^^^^^^^ help: remove closure as shown: `foo`

error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
  --> $DIR/eta.rs:24:21
   |
LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
   |                     ^^^ help: change this to: `&2`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:31:27
   |
   |
LL |     let e = Some(1u8).map(|a| generic(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: test failed, to rerun pass '--test compile-test'
error: redundant closure found
  --> $DIR/eta.rs:74:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
   |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
   |
   = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:76:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
   |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
error: redundant closure found
  --> $DIR/eta.rs:79:42
   |
   |
LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
   |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
error: redundant closure found
  --> $DIR/eta.rs:84:29
   |
   |
LL |     let e = Some("str").map(|s| s.to_string());
   |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
error: redundant closure found
  --> $DIR/eta.rs:86:27
   |
   |
LL |     let e = Some('a').map(|s| s.to_uppercase());
   |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:89:65
   |
   |
LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
   |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`

thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(&X, &X)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (a8920a9 2021-01-04)
query stack during panic:
query stack during panic:
#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(&X, &X)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (&X, &X)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, bool)), Binder(TraitPredicate(<F as std::ops::Fn<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(&X, &X)>>)), Binder(TraitPredicate(<F as std::marker::Sized>)), Binder(TraitPredicate(<X as std::marker::Sized>))], reveal: UserFacing })`
#1 [analysis] running analysis passes on this crate
end of query stack



expected stderr:
expected stderr:
error: redundant closure found
  --> $DIR/eta.rs:20:27
   |
LL |     let a = Some(1u8).map(|a| foo(a));
   |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
   |
   = note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:21:10
   |
   |
LL |     meta(|a| foo(a));
   |          ^^^^^^^^^^ help: remove closure as shown: `foo`

error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
  --> $DIR/eta.rs:24:21
   |
LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
   |                     ^^^ help: change this to: `&2`
   |
   = note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:31:27
   |
   |
LL |     let e = Some(1u8).map(|a| generic(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: redundant closure found
  --> $DIR/eta.rs:74:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
   |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
   |
   = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
error: redundant closure found
  --> $DIR/eta.rs:76:51
   |
   |
LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
   |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
error: redundant closure found
  --> $DIR/eta.rs:79:42
   |
   |
LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
   |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
error: redundant closure found
  --> $DIR/eta.rs:84:29
   |
   |
LL |     let e = Some("str").map(|s| s.to_string());
   |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
error: redundant closure found
  --> $DIR/eta.rs:86:27
   |
   |
LL |     let e = Some('a').map(|s| s.to_uppercase());
   |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:89:65
   |
   |
LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
   |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
error: redundant closure found
  --> $DIR/eta.rs:172:27
   |
   |
LL |     let a = Some(1u8).map(|a| foo_ptr(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `foo_ptr`
error: redundant closure found
  --> $DIR/eta.rs:177:27
   |
   |
LL |     let a = Some(1u8).map(|a| closure(a));
   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
error: aborting due to 12 previous errors




diff of stderr:

 error: redundant closure found
   --> $DIR/eta.rs:20:27
    |
 LL |     let a = Some(1u8).map(|a| foo(a));
    |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
    |
    = note: `-D clippy::redundant-closure` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:21:10
    |
    |
 LL |     meta(|a| foo(a));
    |          ^^^^^^^^^^ help: remove closure as shown: `foo`
 
 error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
   --> $DIR/eta.rs:24:21
    |
 LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
    |                     ^^^ help: change this to: `&2`
    |
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:31:27
    |
    |
 LL |     let e = Some(1u8).map(|a| generic(a));
    |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
 error: redundant closure found
   --> $DIR/eta.rs:74:51
    |
    |
 LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
    |                                                   ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
    |
    = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
 error: redundant closure found
   --> $DIR/eta.rs:76:51
    |
    |
 LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
    |                                                   ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
 error: redundant closure found
   --> $DIR/eta.rs:79:42
    |
    |
 LL |     let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
    |                                          ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
 error: redundant closure found
   --> $DIR/eta.rs:84:29
    |
    |
 LL |     let e = Some("str").map(|s| s.to_string());
    |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
 error: redundant closure found
   --> $DIR/eta.rs:86:27
    |
    |
 LL |     let e = Some('a').map(|s| s.to_uppercase());
    |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
 error: redundant closure found
   --> $DIR/eta.rs:89:65
    |
    |
 LL |     let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
-error: redundant closure found
-  --> $DIR/eta.rs:172:27
-   |
-   |
-LL |     let a = Some(1u8).map(|a| foo_ptr(a));
-   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `foo_ptr`
+thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(&X, &X)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-error: redundant closure found
-  --> $DIR/eta.rs:177:27
-   |
-   |
-LL |     let a = Some(1u8).map(|a| closure(a));
-   |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
 
-error: aborting due to 12 previous errors
+note: the compiler unexpectedly panicked. this is a bug.
+
+
+note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
+
+note: Clippy version: clippy 0.1.51 (a8920a9 2021-01-04)
+query stack during panic:
+query stack during panic:
+#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(&X, &X)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (&X, &X)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, bool)), Binder(TraitPredicate(<F as std::ops::Fn<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(&X, &X)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(&X, &X)>>)), Binder(TraitPredicate(<F as std::marker::Sized>)), Binder(TraitPredicate(<X as std::marker::Sized>))], reveal: UserFacing })`
+#1 [analysis] running analysis passes on this crate
+end of query stack
 
 

The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-58613e8381df8652/out/test_build_base/eta.stderr
thread '[ui] ui/eta.rs' panicked at 'Could not retrieve suggestions from JSON: Error("expected ident", line: 11, column: 2)', /cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.5.0/src/runtest.rs:2311:15
normalized stderr:
normalized stderr:
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:4:1
   |
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
   |
   |
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:6:1
   |
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:16:1
   |
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:45:1
   |
LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:50:1
   |
LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:62:1
   |
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:86:1
   |
LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>


thread 'rustc' panicked at 'escaping bound vars for TraitPredicate(<&F as std::ops::FnOnce<(Lt<'x, I>,)>>)', compiler/rustc_middle/src/ty/mod.rs:1361:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (a8920a9 2021-01-04)
query stack during panic:
query stack during panic:
#0 [type_implements_trait] evaluating `type_implements_trait` `(DefId(2:2304 ~ core[8e42]::ops::function::FnOnce), &F, [(Lt<'x, I>,)], ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [F, (Lt<'x, I>,)], item_def_id: DefId(2:2306 ~ core[8e42]::ops::function::FnOnce::Output) }, Lt<'x, I>)), Binder(TraitPredicate(<F as std::ops::Fn<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<F as std::ops::FnMut<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<F as std::ops::FnOnce<(Lt<'x, I>,)>>)), Binder(TraitPredicate(<I as std::marker::Sized>)), Binder(TraitPredicate(<F as std::marker::Sized>))], reveal: UserFacing })`
#1 [analysis] running analysis passes on this crate
end of query stack



expected stderr:
expected stderr:
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:4:1
   |
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
   |
   |
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:6:1
   |
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:16:1
   |
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:45:1
   |
LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:50:1
   |
LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:62:1
   |
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:86:1
   |
LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:120:5
   |
LL |     fn self_and_out<'s>(&'s self) -> &'s u8 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:129:5
   |
LL |     fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:148:1
   |
LL | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:178:1
   |
LL | fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:184:1
   |
LL | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:203:1
   |
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:211:1
   |
LL | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:247:1
   |
LL | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:254:9
   |
LL |         fn needless_lt<'a>(x: &'a u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:258:9
   |
LL |         fn needless_lt<'a>(_x: &'a u8) {}


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:271:9
   |
LL |         fn baz<'a>(&'a self) -> impl Foo + 'a {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:300:5
   |
LL |     fn impl_trait_elidable_nested_named_lifetimes<'a>(i: &'a i32, f: impl for<'b> Fn(&'b i32) -> &'b i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:303:5
   |
LL |     fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:312:5
   |
LL |     fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:324:5
   |
LL |     fn where_clause_elidadable<'a, T>(i: &'a i32, f: T) -> &'a i32


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:339:5
   |
LL |     fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:352:5
   |
LL |     fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 {


error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> $DIR/needless_lifetimes.rs:355:5
   |
LL |     fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) {

error: aborting due to 25 previous errors




diff of stderr:

 error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
   --> $DIR/needless_lifetimes.rs:4:1
    |
 LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
    |

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's still some cleanup to do, but the changes look promising to me.

I do want @nikomatsakis to take a quick look here. Do you mind writing a short MCP for this?

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
error[E0061]: this function takes 0 arguments but 1 argument was supplied
    --> src/librustdoc/clean/mod.rs:1690:53
     |
1690 |                         let bound_predicate = bound.bound_atom(cx.tcx);
     |                                                     |
     |                                                     expected 0 arguments

error[E0061]: this function takes 0 arguments but 1 argument was supplied
error[E0061]: this function takes 0 arguments but 1 argument was supplied
    --> src/librustdoc/clean/mod.rs:1715:43
     |
1715 | ...                   bound.bound_atom(cx.tcx).skip_binder()
     |                             |
     |                             expected 0 arguments

error: aborting due to 2 previous errors

@jackh726
Copy link
Member Author

jackh726 commented Jan 4, 2021

#73503 had a slight perf regression and this does decrease the size of PredicateInner a bit; I'm going to start a perf run in case there's an effect

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@bors
Copy link
Contributor

bors commented Jan 4, 2021

⌛ Trying commit 9d576a88e2601faffad5957dcad230bc42c23b2f with merge 030cb70ea034a6fb30a1e496542752e37585c946...

@bors
Copy link
Contributor

bors commented Jan 4, 2021

☀️ Try build successful - checks-actions
Build commit: 030cb70ea034a6fb30a1e496542752e37585c946 (030cb70ea034a6fb30a1e496542752e37585c946)

@rust-timer
Copy link
Collaborator

Queued 030cb70ea034a6fb30a1e496542752e37585c946 with parent 9a22f99, future comparison URL.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 4, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (030cb70ea034a6fb30a1e496542752e37585c946): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 5, 2021
@jackh726
Copy link
Member Author

jackh726 commented Jan 5, 2021

This does seem to basically revert the perf changes seen in ##73503

compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_trait_selection/src/traits/fulfill.rs Outdated Show resolved Hide resolved
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking url v2.1.1
    Checking toml v0.5.7
    Checking cargo_metadata v0.12.0
    Checking clippy_lints v0.1.51 (/checkout/src/tools/clippy/clippy_lints)
error: expected one of `,` or `}`, found `(`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:120:29
    |
119 |                     Some(ty::PredicateKind::Trait(pred, _)) if pred.def_id() != sized_trait {
    |                                                                                 ----------- while parsing this struct
120 |                         Some(pred)
    |                             ^ expected one of `,` or `}`

error: expected one of `.`, `=>`, `?`, or an operator, found `,`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:121:22
121 |                     },
121 |                     },
    |                      ^ expected one of `.`, `=>`, `?`, or an operator

error[E0282]: type annotations needed for `&&T`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:165:50
    |
165 |                 let preds = preds.iter().filter(|t| t.self_ty() == ty).collect::<Vec<_>>();
    |                                                  ^ consider giving this closure parameter the explicit type `&&T`, where the type parameter `T` is specified
    |
    = note: type must be known at this point
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0282`.
error: could not compile `clippy_lints`

compiler/rustc_infer/src/infer/outlives/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/codec.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/context.rs Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/print/pretty.rs Outdated Show resolved Hide resolved
compiler/rustc_ty_utils/src/ty.rs Show resolved Hide resolved
src/librustdoc/clean/mod.rs Outdated Show resolved Hide resolved
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking url v2.1.1
    Checking toml v0.5.7
    Checking cargo_metadata v0.12.0
    Checking clippy_lints v0.1.51 (/checkout/src/tools/clippy/clippy_lints)
error: expected one of `,` or `}`, found `(`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:120:29
    |
119 |                     Some(ty::PredicateKind::Trait(pred, _)) if pred.def_id() != sized_trait {
    |                                                                                 ----------- while parsing this struct
120 |                         Some(pred)
    |                             ^ expected one of `,` or `}`

error: expected one of `.`, `=>`, `?`, or an operator, found `,`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:121:22
121 |                     },
121 |                     },
    |                      ^ expected one of `.`, `=>`, `?`, or an operator

error[E0282]: type annotations needed for `&&T`
   --> src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs:165:50
    |
165 |                 let preds = preds.iter().filter(|t| t.self_ty() == ty).collect::<Vec<_>>();
    |                                                  ^ consider giving this closure parameter the explicit type `&&T`, where the type parameter `T` is specified
    |
    = note: type must be known at this point
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0282`.
error: could not compile `clippy_lints`

@bors
Copy link
Contributor

bors commented Jan 12, 2021

☔ The latest upstream changes (presumably #80499) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Jan 14, 2021

☔ The latest upstream changes (presumably #79328) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Jan 17, 2021

⌛ Trying commit c76f478 with merge 87554a65d9da075171df1642c8b1708dd8782a8e...

@bors
Copy link
Contributor

bors commented Jan 17, 2021

☀️ Try build successful - checks-actions
Build commit: 87554a65d9da075171df1642c8b1708dd8782a8e (87554a65d9da075171df1642c8b1708dd8782a8e)

@rust-timer
Copy link
Collaborator

Queued 87554a65d9da075171df1642c8b1708dd8782a8e with parent 49d7889, future comparison URL.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 17, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (87554a65d9da075171df1642c8b1708dd8782a8e): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 17, 2021
@lcnr
Copy link
Contributor

lcnr commented Jan 17, 2021

r=me after that, perf looks good enough

@jyn514
Copy link
Member

jyn514 commented Jan 17, 2021

@bors delegate=jackh726

@bors
Copy link
Contributor

bors commented Jan 17, 2021

✌️ @jackh726 can now approve this pull request

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Checking which error codes lack tests...
Found 435 error codes
Found 0 error codes with no tests
Done!
tidy error: /checkout/compiler/rustc_middle/src/ty/sty.rs:959: trailing whitespace
some tidy checks failed

command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build"
expected success, got: exit code: 1

@jackh726
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 17, 2021

📌 Commit c4376ba has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2021
@bors
Copy link
Contributor

bors commented Jan 17, 2021

⌛ Testing commit c4376ba with merge 4253153...

@bors
Copy link
Contributor

bors commented Jan 17, 2021

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 4253153 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 17, 2021
@bors bors merged commit 4253153 into rust-lang:master Jan 17, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 17, 2021
@jackh726 jackh726 deleted the predicate-kind-take2 branch January 17, 2021 23:53
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 30, 2021
Remove PredicateKind and instead only use Binder<PredicateAtom>

Originally brought up in rust-lang#76814 (comment)

r? `@lcnr`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants