blob: 597dc61c3f7e2e501dd977370bc3c421929cf5b0 [file] [log] [blame]
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(/* usize */, /* usize */);
| ++++++++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:30:16
|
LL | struct S(usize, usize);
| -------- 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 construct this tuple struct
|
LL | let _: S = S(/* usize */, /* usize */);
| ++++++++++++++++++++++++++
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();
| -------- 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 construct 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(/* usize */, /* usize */);
| ++++++++++++++++++++++++++
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(/* usize */);
| +++++++++++++
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 construct this tuple variant
|
LL | let _: E = E::A(/* usize */);
| +++++++++++++
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(/* usize */, /* usize */);
| ++++++++++++++++++++++++++
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(/* usize */);
| +++++++++++++
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(/* usize */);
| +++++++++++++
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(/* usize */);
| +++++++++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:41:20
|
LL | fn ban(&self) -> usize { 42 }
| ---------------------- for<'a> fn(&'a 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<'a> fn(&'a X) -> usize {<X as T>::ban}`
help: use parentheses to call this associated function
|
LL | let _: usize = X::ban(/* &X */);
| ++++++++++
error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:42:20
|
LL | fn bal(&self) -> usize;
| ----------------------- for<'a> fn(&'a 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<'a> fn(&'a X) -> usize {<X as T>::bal}`
help: use parentheses to call this associated function
|
LL | let _: usize = X::bal(/* &X */);
| ++++++++++
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;
| ^^^ 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;
| ^^^ 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;
| -- the found closure
LL | let _: usize = 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: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`.