Increase verbosity when suggesting subtle code changes

This commit is contained in:
Esteban Küber 2020-03-11 20:38:21 -07:00
parent 5ae85f43f4
commit 52fbd3e569
32 changed files with 360 additions and 239 deletions

View file

@ -2,7 +2,12 @@ error[E0615]: attempted to take value of method `method` on type `Foo`
--> $DIR/E0615.rs:11:7
|
LL | f.method;
| ^^^^^^ help: use parentheses to call the method: `method()`
| ^^^^^^
|
help: use parentheses to call the method
|
LL | f.method();
| ^^
error: aborting due to previous error

View file

@ -2,15 +2,17 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
--> $DIR/extern-types-unsized.rs:22:20
|
LL | fn assert_sized<T>() { }
| ------------ -- help: consider relaxing the implicit `Sized` restriction: `: ?Sized`
| |
| required by this bound in `assert_sized`
| ------------ - required by this bound in `assert_sized`
...
LL | assert_sized::<A>();
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `A`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn assert_sized<T: ?Sized>() { }
| ^^^^^^^^
error[E0277]: the size for values of type `A` cannot be known at compilation time
--> $DIR/extern-types-unsized.rs:25:5

View file

@ -2,7 +2,12 @@ error[E0615]: attempted to take value of method `abs` on type `i32`
--> $DIR/implicit-method-bind.rs:2:20
|
LL | let _f = 10i32.abs;
| ^^^ help: use parentheses to call the method: `abs()`
| ^^^
|
help: use parentheses to call the method
|
LL | let _f = 10i32.abs();
| ^^
error: aborting due to previous error

View file

@ -2,7 +2,12 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(
--> $DIR/issue-13853-2.rs:5:43
|
LL | fn foo(res : Box<dyn ResponseHook>) { res.get }
| ^^^ help: use parentheses to call the method: `get()`
| ^^^
|
help: use parentheses to call the method
|
LL | fn foo(res : Box<dyn ResponseHook>) { res.get() }
| ^^
error: aborting due to previous error

View file

@ -2,9 +2,12 @@ error[E0616]: field `len` of struct `sub::S` is private
--> $DIR/issue-26472.rs:11:13
|
LL | let v = s.len;
| ^^---
| |
| help: a method `len` also exists, call it with parentheses: `len()`
| ^^^^^
|
help: a method `len` also exists, call it with parentheses
|
LL | let v = s.len();
| ^^
error[E0616]: field `len` of struct `sub::S` is private
--> $DIR/issue-26472.rs:12:5

View file

@ -5,14 +5,16 @@ LL | struct Foo(u32);
| ---------------- fn(u32) -> Foo {Foo} defined here
LL |
LL | fn test() -> Foo { Foo }
| --- ^^^
| | |
| | expected struct `Foo`, found fn item
| | help: use parentheses to instantiate this tuple struct: `Foo(_)`
| --- ^^^ expected struct `Foo`, found fn item
| |
| expected `Foo` because of return type
|
= note: expected struct `Foo`
found fn item `fn(u32) -> Foo {Foo}`
help: use parentheses to instantiate this tuple struct
|
LL | fn test() -> Foo { Foo(_) }
| ^^^
error: aborting due to previous error

View file

@ -2,13 +2,23 @@ error[E0615]: attempted to take value of method `get_x` on type `Point`
--> $DIR/method-missing-call.rs:22:26
|
LL | .get_x;
| ^^^^^ help: use parentheses to call the method: `get_x()`
| ^^^^^
|
help: use parentheses to call the method
|
LL | .get_x();
| ^^
error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter<std::iter::Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>`
--> $DIR/method-missing-call.rs:29:16
|
LL | .filter_map;
| ^^^^^^^^^^ help: use parentheses to call the method: `filter_map(...)`
| ^^^^^^^^^^
|
help: use parentheses to call the method
|
LL | .filter_map(_);
| ^^^
error: aborting due to 2 previous errors

View file

@ -2,12 +2,13 @@ error[E0284]: type annotations needed
--> $DIR/question-mark-type-infer.rs:12:21
|
LL | l.iter().map(f).collect()?
| ^^^^^^^
| |
| cannot infer type
| help: consider specifying the type argument in the method call: `collect::<B>`
| ^^^^^^^ cannot infer type
|
= note: cannot resolve `<_ as std::ops::Try>::Ok == _`
help: consider specifying the type argument in the method call
|
LL | l.iter().map(f).collect::<B>()?
| ^^^^^
error: aborting due to previous error

View file

@ -2,14 +2,16 @@ error[E0308]: cannot coerce intrinsics to function pointers
--> $DIR/reify-intrinsic.rs:6:64
|
LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute;
| ------------------------------------------------- ^^^^^^^^^^^^^^^^^^^
| | |
| | cannot coerce intrinsics to function pointers
| | help: use parentheses to call this function: `std::mem::transmute(...)`
| ------------------------------------------------- ^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
| |
| expected due to this
|
= note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize`
found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
help: use parentheses to call this function
|
LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute(...);
| ^^^^^
error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
--> $DIR/reify-intrinsic.rs:11:13

View file

@ -304,14 +304,16 @@ LL | Fn(u8),
| ------ fn(u8) -> m::n::Z {m::n::Z::Fn} defined here
...
LL | let _: Z = Z::Fn;
| - ^^^^^
| | |
| | expected enum `m::n::Z`, found fn item
| | help: use parentheses to instantiate this tuple variant: `Z::Fn(_)`
| - ^^^^^ expected enum `m::n::Z`, found fn item
| |
| expected due to this
|
= note: expected enum `m::n::Z`
found fn item `fn(u8) -> m::n::Z {m::n::Z::Fn}`
help: use parentheses to instantiate this tuple variant
|
LL | let _: Z = Z::Fn(_);
| ^^^
error[E0618]: expected function, found enum variant `Z::Unit`
--> $DIR/privacy-enum-ctor.rs:31:17
@ -336,14 +338,16 @@ LL | Fn(u8),
| ------ fn(u8) -> m::E {m::E::Fn} defined here
...
LL | let _: E = m::E::Fn;
| - ^^^^^^^^
| | |
| | expected enum `m::E`, found fn item
| | help: use parentheses to instantiate this tuple variant: `m::E::Fn(_)`
| - ^^^^^^^^ expected enum `m::E`, found fn item
| |
| expected due to this
|
= note: expected enum `m::E`
found fn item `fn(u8) -> m::E {m::E::Fn}`
help: use parentheses to instantiate this tuple variant
|
LL | let _: E = m::E::Fn(_);
| ^^^
error[E0618]: expected function, found enum variant `m::E::Unit`
--> $DIR/privacy-enum-ctor.rs:47:16
@ -368,14 +372,16 @@ LL | Fn(u8),
| ------ fn(u8) -> m::E {m::E::Fn} defined here
...
LL | let _: E = E::Fn;
| - ^^^^^
| | |
| | expected enum `m::E`, found fn item
| | help: use parentheses to instantiate this tuple variant: `E::Fn(_)`
| - ^^^^^ expected enum `m::E`, found fn item
| |
| expected due to this
|
= note: expected enum `m::E`
found fn item `fn(u8) -> m::E {m::E::Fn}`
help: use parentheses to instantiate this tuple variant
|
LL | let _: E = E::Fn(_);
| ^^^
error[E0618]: expected function, found enum variant `E::Unit`
--> $DIR/privacy-enum-ctor.rs:55:16

View file

@ -2,12 +2,13 @@ error[E0282]: type annotations needed
--> $DIR/type-annotations-needed-expr.rs:2:39
|
LL | let _ = (vec![1,2,3]).into_iter().sum() as f64;
| ^^^
| |
| cannot infer type for type parameter `S` declared on the associated function `sum`
| help: consider specifying the type argument in the method call: `sum::<S>`
| ^^^ cannot infer type for type parameter `S` declared on the associated function `sum`
|
= note: type must be known at this point
help: consider specifying the type argument in the method call
|
LL | let _ = (vec![1,2,3]).into_iter().sum::<S>() as f64;
| ^^^^^
error: aborting due to previous error

View file

@ -2,15 +2,17 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/str-mut-idx.rs:4:15
|
LL | fn bot<T>() -> T { loop {} }
| --- -- help: consider relaxing the implicit `Sized` restriction: `: ?Sized`
| |
| required by this bound in `bot`
| --- - required by this bound in `bot`
...
LL | s[1..2] = bot();
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn bot<T: ?Sized>() -> T { loop {} }
| ^^^^^^^^
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/str-mut-idx.rs:4:5

View file

@ -5,14 +5,16 @@ LL | fn bar<'a, T>() where T: 'a {}
| --------------------------- fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:25:17
@ -21,14 +23,16 @@ LL | fn bar<'a, T>() where T: 'a {}
| --------------------------- fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u32>>::bar::<'static, char>()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:33:17
@ -37,14 +41,16 @@ LL | fn baz() {}
| -------- fn() {<i8 as Foo<'static, 'static, u8>>::baz} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u8>>::baz()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:41:17
@ -53,14 +59,16 @@ LL | fn foo<'z>() where &'z (): Sized {
| -------------------------------- fn() {foo::<'static>} defined here
...
LL | let x: () = foo::<'static>;
| -- ^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `foo::<'static>()`
| -- ^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {foo::<'static>}`
help: use parentheses to call this function
|
LL | let x: () = foo::<'static>();
| ^^
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/substs-ppaux.rs:49:5

View file

@ -5,14 +5,16 @@ LL | fn bar<'a, T>() where T: 'a {}
| --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:25:17
@ -21,14 +23,16 @@ LL | fn bar<'a, T>() where T: 'a {}
| --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u32>>::bar::<'static, char>()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:33:17
@ -37,14 +41,16 @@ LL | fn baz() {}
| -------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz} defined here
...
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `<i8 as Foo<'static, 'static, u8>>::baz()`
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
help: use parentheses to call this function
|
LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz();
| ^^
error[E0308]: mismatched types
--> $DIR/substs-ppaux.rs:41:17
@ -53,14 +59,16 @@ LL | fn foo<'z>() where &'z (): Sized {
| -------------------------------- fn() {foo::<ReStatic>} defined here
...
LL | let x: () = foo::<'static>;
| -- ^^^^^^^^^^^^^^
| | |
| | expected `()`, found fn item
| | help: use parentheses to call this function: `foo::<'static>()`
| -- ^^^^^^^^^^^^^^ expected `()`, found fn item
| |
| expected due to this
|
= note: expected unit type `()`
found fn item `fn() {foo::<ReStatic>}`
help: use parentheses to call this function
|
LL | let x: () = foo::<'static>();
| ^^
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/substs-ppaux.rs:49:5

View file

@ -8,10 +8,12 @@ LL | fn bar(f: impl Future<Output=()>) {}
| --- ----------------- required by this bound in `bar`
...
LL | bar(foo);
| ^^^
| |
| the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
| help: use parentheses to call the function: `foo()`
| ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
|
help: use parentheses to call the function
|
LL | bar(foo());
| ^^
error[E0277]: the trait bound `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]: std::future::Future` is not satisfied
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
@ -22,10 +24,12 @@ LL | fn bar(f: impl Future<Output=()>) {}
LL | let async_closure = async || ();
| -------- consider calling this closure
LL | bar(async_closure);
| ^^^^^^^^^^^^^
| |
| the trait `std::future::Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]`
| help: use parentheses to call the closure: `async_closure()`
| ^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]`
|
help: use parentheses to call the closure
|
LL | bar(async_closure());
| ^^
error: aborting due to 2 previous errors

View file

@ -9,7 +9,11 @@ LL | let Thing { foo } = t;
| |
| expected struct `std::string::String`, found struct `foo`
| `foo` is interpreted as a unit struct, not a new binding
| help: bind the struct field to a different name instead: `foo: other_foo`
|
help: bind the struct field to a different name instead
|
LL | let Thing { foo: other_foo } = t;
| ^^^^^^^^^^^
error: aborting due to previous error

View file

@ -8,10 +8,12 @@ LL | fn bar(f: impl T<O=()>) {}
| --- ------- required by this bound in `bar`
...
LL | bar(foo);
| ^^^
| |
| the trait `T` is not implemented for `fn() -> impl T {foo}`
| help: use parentheses to call the function: `foo()`
| ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
|
help: use parentheses to call the function
|
LL | bar(foo());
| ^^
error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]: T` is not satisfied
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9
@ -22,10 +24,12 @@ LL | fn bar(f: impl T<O=()>) {}
LL | let closure = || S;
| -- consider calling this closure
LL | bar(closure);
| ^^^^^^^
| |
| the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]`
| help: use parentheses to call the closure: `closure()`
| ^^^^^^^ the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]`
|
help: use parentheses to call the closure
|
LL | bar(closure());
| ^^
error: aborting due to 2 previous errors

View file

@ -19,14 +19,16 @@ LL | fn foo(a: usize, b: usize) -> usize { a }
| ----------------------------------- fn(usize, usize) -> usize {foo} defined here
...
LL | let _: usize = foo;
| ----- ^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `foo(a, b)`
| ----- ^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize, usize) -> usize {foo}`
help: use parentheses to call this function
|
LL | let _: usize = foo(a, b);
| ^^^^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:30:16
@ -35,14 +37,16 @@ LL | struct S(usize, usize);
| ----------------------- fn(usize, usize) -> S {S} defined here
...
LL | let _: S = S;
| - ^
| | |
| | expected struct `S`, found fn item
| | help: use parentheses to instantiate this tuple struct: `S(_, _)`
| - ^ expected struct `S`, found fn item
| |
| expected due to this
|
= note: expected struct `S`
found fn item `fn(usize, usize) -> S {S}`
help: use parentheses to instantiate this tuple struct
|
LL | let _: S = S(_, _);
| ^^^^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:31:20
@ -51,14 +55,16 @@ LL | fn bar() -> usize { 42 }
| ----------------- fn() -> usize {bar} defined here
...
LL | let _: usize = bar;
| ----- ^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `bar()`
| ----- ^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn() -> usize {bar}`
help: use parentheses to call this function
|
LL | let _: usize = bar();
| ^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:32:16
@ -67,14 +73,16 @@ LL | struct V();
| ----------- fn() -> V {V} defined here
...
LL | let _: V = V;
| - ^
| | |
| | expected struct `V`, found fn item
| | help: use parentheses to instantiate this tuple struct: `V()`
| - ^ expected struct `V`, found fn item
| |
| expected due to this
|
= note: expected struct `V`
found fn item `fn() -> V {V}`
help: use parentheses to instantiate this tuple struct
|
LL | let _: V = V();
| ^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:33:20
@ -83,14 +91,16 @@ LL | fn baz(x: usize, y: usize) -> usize { x }
| ----------------------------------- fn(usize, usize) -> usize {<_ as T>::baz} defined here
...
LL | let _: usize = T::baz;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `T::baz(x, y)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize, usize) -> usize {<_ as T>::baz}`
help: use parentheses to call this function
|
LL | let _: usize = T::baz(x, y);
| ^^^^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:34:20
@ -99,14 +109,16 @@ LL | fn bat(x: usize) -> usize { 42 }
| ------------------------- fn(usize) -> usize {<_ as T>::bat} defined here
...
LL | let _: usize = T::bat;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `T::bat(x)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<_ as T>::bat}`
help: use parentheses to call this function
|
LL | let _: usize = T::bat(x);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:35:16
@ -115,14 +127,16 @@ LL | A(usize),
| -------- fn(usize) -> E {E::A} defined here
...
LL | let _: E = E::A;
| - ^^^^
| | |
| | expected enum `E`, found fn item
| | help: use parentheses to instantiate this tuple variant: `E::A(_)`
| - ^^^^ expected enum `E`, found fn item
| |
| expected due to this
|
= note: expected enum `E`
found fn item `fn(usize) -> E {E::A}`
help: use parentheses to instantiate this tuple variant
|
LL | let _: E = E::A(_);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:37:20
@ -131,14 +145,16 @@ LL | fn baz(x: usize, y: usize) -> usize { x }
| ----------------------------------- fn(usize, usize) -> usize {<X as T>::baz} defined here
...
LL | let _: usize = X::baz;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::baz(x, y)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize, usize) -> usize {<X as T>::baz}`
help: use parentheses to call this function
|
LL | let _: usize = X::baz(x, y);
| ^^^^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:38:20
@ -147,14 +163,16 @@ LL | fn bat(x: usize) -> usize { 42 }
| ------------------------- fn(usize) -> usize {<X as T>::bat} defined here
...
LL | let _: usize = X::bat;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::bat(x)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bat}`
help: use parentheses to call this function
|
LL | let _: usize = X::bat(x);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:39:20
@ -163,14 +181,16 @@ LL | fn bax(x: usize) -> usize { 42 }
| ------------------------- fn(usize) -> usize {<X as T>::bax} defined here
...
LL | let _: usize = X::bax;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::bax(x)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bax}`
help: use parentheses to call this function
|
LL | let _: usize = X::bax(x);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:40:20
@ -179,14 +199,16 @@ LL | fn bach(x: usize) -> usize;
| --------------------------- fn(usize) -> usize {<X as T>::bach} defined here
...
LL | let _: usize = X::bach;
| ----- ^^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::bach(x)`
| ----- ^^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bach}`
help: use parentheses to call this function
|
LL | let _: usize = X::bach(x);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:41:20
@ -195,14 +217,16 @@ LL | fn ban(&self) -> usize { 42 }
| ---------------------- for<'r> fn(&'r X) -> usize {<X as T>::ban} defined here
...
LL | let _: usize = X::ban;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::ban(_)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `for<'r> fn(&'r X) -> usize {<X as T>::ban}`
help: use parentheses to call this function
|
LL | let _: usize = X::ban(_);
| ^^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:42:20
@ -211,26 +235,38 @@ LL | fn bal(&self) -> usize;
| ----------------------- for<'r> fn(&'r X) -> usize {<X as T>::bal} defined here
...
LL | let _: usize = X::bal;
| ----- ^^^^^^
| | |
| | expected `usize`, found fn item
| | help: use parentheses to call this function: `X::bal(_)`
| ----- ^^^^^^ expected `usize`, found fn item
| |
| expected due to this
|
= note: expected type `usize`
found fn item `for<'r> fn(&'r X) -> usize {<X as T>::bal}`
help: use parentheses to call this function
|
LL | let _: usize = X::bal(_);
| ^^^
error[E0615]: attempted to take value of method `ban` on type `X`
--> $DIR/fn-or-tuple-struct-without-args.rs:43:22
|
LL | let _: usize = X.ban;
| ^^^ help: use parentheses to call the method: `ban()`
| ^^^
|
help: use parentheses to call the method
|
LL | let _: usize = X.ban();
| ^^
error[E0615]: attempted to take value of method `bal` on type `X`
--> $DIR/fn-or-tuple-struct-without-args.rs:44:22
|
LL | let _: usize = X.bal;
| ^^^ help: use parentheses to call the method: `bal()`
| ^^^
|
help: use parentheses to call the method
|
LL | let _: usize = X.bal();
| ^^
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:46:20
@ -238,14 +274,16 @@ error[E0308]: mismatched types
LL | let closure = || 42;
| ----- the found closure
LL | let _: usize = closure;
| ----- ^^^^^^^
| | |
| | expected `usize`, found closure
| | help: use parentheses to call this closure: `closure()`
| ----- ^^^^^^^ expected `usize`, found closure
| |
| expected due to this
|
= note: expected type `usize`
found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]`
help: use parentheses to call this closure
|
LL | let _: usize = closure();
| ^^
error: aborting due to 17 previous errors

View file

@ -5,13 +5,14 @@ LL | fn foo<X: Trait>(_: X) {}
| --- ----- required by this bound in `foo`
...
LL | foo(&s);
| -^
| |
| the trait `Trait` is not implemented for `&S`
| help: consider changing this borrow's mutability: `&mut`
| ^^ the trait `Trait` is not implemented for `&S`
|
= help: the following implementations were found:
<&'a mut S as Trait>
help: consider changing this borrow's mutability
|
LL | foo(&mut s);
| ^^^^
error[E0277]: the trait bound `S: Trait` is not satisfied
--> $DIR/imm-ref-trait-object-literal.rs:13:7

View file

@ -8,9 +8,12 @@ error[E0615]: attempted to take value of method `collect` on type `std::vec::Int
--> $DIR/method-missing-parentheses.rs:2:32
|
LL | let _ = vec![].into_iter().collect::<usize>;
| ^^^^^^^---------
| |
| help: use parentheses to call the method: `collect::<usize>()`
| ^^^^^^^
|
help: use parentheses to call the method
|
LL | let _ = vec![].into_iter().collect::<usize>();
| ^^
error: aborting due to 2 previous errors

View file

@ -2,10 +2,12 @@ error[E0282]: type annotations needed
--> $DIR/or_else-multiple-type-params.rs:7:10
|
LL | .or_else(|err| {
| ^^^^^^^
| |
| cannot infer type for type parameter `F` declared on the associated function `or_else`
| help: consider specifying the type arguments in the method call: `or_else::<F, O>`
| ^^^^^^^ cannot infer type for type parameter `F` declared on the associated function `or_else`
|
help: consider specifying the type arguments in the method call
|
LL | .or_else::<F, O>(|err| {
| ^^^^^^^^
error: aborting due to previous error

View file

@ -2,9 +2,12 @@ error[E0282]: type annotations needed
--> $DIR/sort_by_key.rs:3:9
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum());
| ^^^^^^^^^^^ --- help: consider specifying the type argument in the method call: `sum::<S>`
| |
| cannot infer type for type parameter `K` declared on the associated function `sort_by_key`
| ^^^^^^^^^^^ cannot infer type for type parameter `K` declared on the associated function `sort_by_key`
|
help: consider specifying the type argument in the method call
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
| ^^^^^
error: aborting due to previous error

View file

@ -5,12 +5,13 @@ LL | fn foo<T: Into<String>>(x: i32) {}
| --- ------------ required by this bound in `foo`
...
LL | foo(42);
| ^^^
| |
| cannot infer type for type parameter `T` declared on the function `foo`
| help: consider specifying the type argument in the function call: `foo::<T>`
| ^^^ cannot infer type for type parameter `T` declared on the function `foo`
|
= note: cannot resolve `_: std::convert::Into<std::string::String>`
help: consider specifying the type argument in the function call
|
LL | foo::<T>(42);
| ^^^^^
error: aborting due to previous error

View file

@ -17,5 +17,5 @@ fn main() {
let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U`
//~| HELP use parentheses to call the method
//~| SUGGESTION calculate()
//~| SUGGESTION ()
}

View file

@ -14,7 +14,12 @@ error[E0615]: attempted to take value of method `calculate` on type `U`
--> $DIR/union-suggest-field.rs:18:15
|
LL | let y = u.calculate;
| ^^^^^^^^^ help: use parentheses to call the method: `calculate()`
| ^^^^^^^^^
|
help: use parentheses to call the method
|
LL | let y = u.calculate();
| ^^
error: aborting due to 3 previous errors

View file

@ -7,12 +7,14 @@ LL | f2::<X>(x);
| ^ doesn't have a size known at compile-time
...
LL | fn f2<X>(x: &X) {
| -- -- help: consider relaxing the implicit `Sized` restriction: `: ?Sized`
| |
| required by this bound in `f2`
| -- - required by this bound in `f2`
|
= help: the trait `std::marker::Sized` is not implemented for `X`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn f2<X: ?Sized>(x: &X) {
| ^^^^^^^^
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized3.rs:18:13
@ -23,12 +25,14 @@ LL | f4::<X>(x);
| ^ doesn't have a size known at compile-time
...
LL | fn f4<X: T>(x: &X) {
| -- - - help: consider relaxing the implicit `Sized` restriction: `+ ?Sized`
| |
| required by this bound in `f4`
| -- - required by this bound in `f4`
|
= help: the trait `std::marker::Sized` is not implemented for `X`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn f4<X: T + ?Sized>(x: &X) {
| ^^^^^^^^^
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized3.rs:33:8