From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../fn-or-tuple-struct-without-args.stderr | 283 +++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr (limited to 'tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr') diff --git a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr new file mode 100644 index 000000000..4cbcd31fa --- /dev/null +++ b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -0,0 +1,283 @@ +error[E0308]: mismatched types + --> $DIR/fn-or-tuple-struct-without-args.rs:29:20 + | +LL | fn foo(a: usize, b: usize) -> usize { a } + | ----------------------------------- function `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); + | -------- `S` defines a struct constructor here, which should be called +... +LL | let _: S = S; + | - ^ expected struct `S`, found struct constructor + | | + | expected due to this + | + = note: expected struct `S` + found struct constructor `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 } + | ----------------- function `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(); + | -------- `V` defines a struct constructor here, which should be called +... +LL | let _: V = V; + | - ^ expected struct `V`, found struct constructor + | | + | expected due to this + | + = note: expected struct `V` + found struct constructor `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 } + | ----------------------------------- associated function `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 } + | ------------------------- associated function `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), + | - `A` defines an enum variant constructor here, which should be called +... +LL | let _: E = E::A; + | - ^^^^ expected enum `E`, found enum constructor + | | + | expected due to this + | + = note: expected enum `E` + found enum constructor `fn(usize) -> E {E::A}` +help: use parentheses to construct this tuple variant + | +LL | let _: E = E::A(/* usize */); + | +++++++++++++ + +error[E0533]: expected value, found struct variant `E::B` + --> $DIR/fn-or-tuple-struct-without-args.rs:36:16 + | +LL | let _: E = E::B; + | ^^^^ not a value + +error[E0308]: mismatched types + --> $DIR/fn-or-tuple-struct-without-args.rs:37:20 + | +LL | fn baz(x: usize, y: usize) -> usize { x } + | ----------------------------------- associated function `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 {::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 } + | ------------------------- associated function `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 {::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 } + | ------------------------- associated function `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 {::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; + | --------------------------- associated function `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 {::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 } + | ---------------------- associated function `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 {::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; + | ----------------------- associated function `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 {::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, E0533, E0615. +For more information about an error, try `rustc --explain E0308`. -- cgit v1.2.3