rust/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

298 lines
9.2 KiB
Plaintext
Raw Normal View History

error[E0423]: expected value, found struct variant `E::B`
--> $DIR/fn-or-tuple-struct-without-args.rs:36:16
|
LL | A(usize),
| -------- similarly named tuple variant `A` defined here
LL | B { a: usize },
| -------------- `E::B` defined here
...
LL | let _: E = E::B;
| ^^^^
|
help: use struct literal syntax instead
|
LL | let _: E = E::B { a: val };
| ~~~~~~~~~~~~~~~
help: a tuple variant with a similar name exists
|
LL | let _: E = E::A;
| ~
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:29:20
|
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
| |
| 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(_, _);
| ++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:30:16
|
LL | struct S(usize, usize);
2022-02-13 15:27:59 +00:00
| -------- fn(usize, usize) -> S {S} defined here
...
LL | let _: S = 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
|
LL | fn bar() -> usize { 42 }
| ----------------- fn() -> usize {bar} defined here
...
LL | let _: usize = 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
|
LL | struct V();
2022-02-13 15:27:59 +00:00
| -------- fn() -> V {V} defined here
...
LL | let _: V = 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
|
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
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize, usize) -> usize {<_ as T>::baz}`
help: use parentheses to call this associated function
|
LL | let _: usize = T::baz(_, _);
| ++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:34:20
|
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
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<_ as T>::bat}`
help: use parentheses to call this associated function
|
LL | let _: usize = T::bat(_);
| +++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:35:16
|
LL | A(usize),
| - fn(usize) -> E {E::A} defined here
...
LL | let _: E = 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
|
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
| |
| 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 associated function
|
LL | let _: usize = X::baz(_, _);
| ++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:38:20
|
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
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bat}`
help: use parentheses to call this associated function
|
LL | let _: usize = X::bat(_);
| +++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:39:20
|
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
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bax}`
help: use parentheses to call this associated function
|
LL | let _: usize = X::bax(_);
| +++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:40:20
|
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
| |
| expected due to this
|
= note: expected type `usize`
found fn item `fn(usize) -> usize {<X as T>::bach}`
help: use parentheses to call this associated function
|
LL | let _: usize = X::bach(_);
| +++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:41:20
|
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
| |
| 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 associated function
|
LL | let _: usize = X::ban(_);
| +++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:42:20
|
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
| |
| 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 associated 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;
2020-03-22 18:18:06 +00:00
| ^^^ method, not a field
|
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;
2020-03-22 18:18:06 +00:00
| ^^^ method, not a field
|
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
|
LL | let closure = || 42;
2022-06-27 05:45:35 +00:00
| -- the found closure
LL | let _: usize = closure;
| ----- ^^^^^^^ expected `usize`, found closure
| |
| expected due to this
|
= note: expected type `usize`
2022-06-27 05:45:35 +00:00
found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21]`
help: use parentheses to call this closure
|
LL | let _: usize = closure();
| ++
error: aborting due to 17 previous errors
Some errors have detailed explanations: E0308, E0423, E0615.
For more information about an error, try `rustc --explain E0308`.