instantiate -> construct
This commit is contained in:
parent
7eb2d4e7d0
commit
35f1570732
10 changed files with 16 additions and 18 deletions
|
@ -102,10 +102,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let msg = match def_id_or_name {
|
let msg = match def_id_or_name {
|
||||||
DefIdOrName::DefId(def_id) => match self.tcx.def_kind(def_id) {
|
DefIdOrName::DefId(def_id) => match self.tcx.def_kind(def_id) {
|
||||||
DefKind::Ctor(CtorOf::Struct, _) => "instantiate this tuple struct".to_string(),
|
DefKind::Ctor(CtorOf::Struct, _) => "construct this tuple struct".to_string(),
|
||||||
DefKind::Ctor(CtorOf::Variant, _) => {
|
DefKind::Ctor(CtorOf::Variant, _) => "construct this tuple variant".to_string(),
|
||||||
"instantiate this tuple variant".to_string()
|
|
||||||
}
|
|
||||||
kind => format!("call this {}", kind.descr(def_id)),
|
kind => format!("call this {}", kind.descr(def_id)),
|
||||||
},
|
},
|
||||||
DefIdOrName::Name(name) => format!("call this {name}"),
|
DefIdOrName::Name(name) => format!("call this {name}"),
|
||||||
|
|
|
@ -923,10 +923,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
let msg = match def_id_or_name {
|
let msg = match def_id_or_name {
|
||||||
DefIdOrName::DefId(def_id) => match self.tcx.def_kind(def_id) {
|
DefIdOrName::DefId(def_id) => match self.tcx.def_kind(def_id) {
|
||||||
DefKind::Ctor(CtorOf::Struct, _) => {
|
DefKind::Ctor(CtorOf::Struct, _) => {
|
||||||
"use parentheses to instantiate this tuple struct".to_string()
|
"use parentheses to construct this tuple struct".to_string()
|
||||||
}
|
}
|
||||||
DefKind::Ctor(CtorOf::Variant, _) => {
|
DefKind::Ctor(CtorOf::Variant, _) => {
|
||||||
"use parentheses to instantiate this tuple variant".to_string()
|
"use parentheses to construct this tuple variant".to_string()
|
||||||
}
|
}
|
||||||
kind => format!("use parentheses to call this {}", kind.descr(def_id)),
|
kind => format!("use parentheses to call this {}", kind.descr(def_id)),
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ LL | fn test() -> Foo { Foo }
|
||||||
|
|
|
|
||||||
= note: expected struct `Foo`
|
= note: expected struct `Foo`
|
||||||
found fn item `fn(u32) -> Foo {Foo}`
|
found fn item `fn(u32) -> Foo {Foo}`
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | fn test() -> Foo { Foo(/* u32 */) }
|
LL | fn test() -> Foo { Foo(/* u32 */) }
|
||||||
| +++++++++++
|
| +++++++++++
|
||||||
|
|
|
@ -327,7 +327,7 @@ LL | let _: Z = Z::Fn;
|
||||||
|
|
|
|
||||||
= note: expected enum `Z`
|
= note: expected enum `Z`
|
||||||
found fn item `fn(u8) -> Z {Z::Fn}`
|
found fn item `fn(u8) -> Z {Z::Fn}`
|
||||||
help: use parentheses to instantiate this tuple variant
|
help: use parentheses to construct this tuple variant
|
||||||
|
|
|
|
||||||
LL | let _: Z = Z::Fn(/* u8 */);
|
LL | let _: Z = Z::Fn(/* u8 */);
|
||||||
| ++++++++++
|
| ++++++++++
|
||||||
|
@ -362,7 +362,7 @@ LL | let _: E = m::E::Fn;
|
||||||
|
|
|
|
||||||
= note: expected enum `E`
|
= note: expected enum `E`
|
||||||
found fn item `fn(u8) -> E {E::Fn}`
|
found fn item `fn(u8) -> E {E::Fn}`
|
||||||
help: use parentheses to instantiate this tuple variant
|
help: use parentheses to construct this tuple variant
|
||||||
|
|
|
|
||||||
LL | let _: E = m::E::Fn(/* u8 */);
|
LL | let _: E = m::E::Fn(/* u8 */);
|
||||||
| ++++++++++
|
| ++++++++++
|
||||||
|
@ -397,7 +397,7 @@ LL | let _: E = E::Fn;
|
||||||
|
|
|
|
||||||
= note: expected enum `E`
|
= note: expected enum `E`
|
||||||
found fn item `fn(u8) -> E {E::Fn}`
|
found fn item `fn(u8) -> E {E::Fn}`
|
||||||
help: use parentheses to instantiate this tuple variant
|
help: use parentheses to construct this tuple variant
|
||||||
|
|
|
|
||||||
LL | let _: E = E::Fn(/* u8 */);
|
LL | let _: E = E::Fn(/* u8 */);
|
||||||
| ++++++++++
|
| ++++++++++
|
||||||
|
|
|
@ -2,7 +2,7 @@ fn main() {
|
||||||
insert_resource(Marker);
|
insert_resource(Marker);
|
||||||
insert_resource(Time);
|
insert_resource(Time);
|
||||||
//~^ ERROR the trait bound `fn(u32) -> Time {Time}: Resource` is not satisfied
|
//~^ ERROR the trait bound `fn(u32) -> Time {Time}: Resource` is not satisfied
|
||||||
//~| HELP use parentheses to instantiate this tuple struct
|
//~| HELP use parentheses to construct this tuple struct
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Resource {}
|
trait Resource {}
|
||||||
|
|
|
@ -11,7 +11,7 @@ note: required by a bound in `insert_resource`
|
||||||
|
|
|
|
||||||
LL | fn insert_resource<R: Resource>(resource: R) {}
|
LL | fn insert_resource<R: Resource>(resource: R) {}
|
||||||
| ^^^^^^^^ required by this bound in `insert_resource`
|
| ^^^^^^^^ required by this bound in `insert_resource`
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | insert_resource(Time(/* u32 */));
|
LL | insert_resource(Time(/* u32 */));
|
||||||
| +++++++++++
|
| +++++++++++
|
||||||
|
|
|
@ -49,7 +49,7 @@ LL | let _: S = S;
|
||||||
|
|
|
|
||||||
= note: expected struct `S`
|
= note: expected struct `S`
|
||||||
found fn item `fn(usize, usize) -> S {S}`
|
found fn item `fn(usize, usize) -> S {S}`
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | let _: S = S(/* usize */, /* usize */);
|
LL | let _: S = S(/* usize */, /* usize */);
|
||||||
| ++++++++++++++++++++++++++
|
| ++++++++++++++++++++++++++
|
||||||
|
@ -85,7 +85,7 @@ LL | let _: V = V;
|
||||||
|
|
|
|
||||||
= note: expected struct `V`
|
= note: expected struct `V`
|
||||||
found fn item `fn() -> V {V}`
|
found fn item `fn() -> V {V}`
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | let _: V = V();
|
LL | let _: V = V();
|
||||||
| ++
|
| ++
|
||||||
|
@ -139,7 +139,7 @@ LL | let _: E = E::A;
|
||||||
|
|
|
|
||||||
= note: expected enum `E`
|
= note: expected enum `E`
|
||||||
found fn item `fn(usize) -> E {E::A}`
|
found fn item `fn(usize) -> E {E::A}`
|
||||||
help: use parentheses to instantiate this tuple variant
|
help: use parentheses to construct this tuple variant
|
||||||
|
|
|
|
||||||
LL | let _: E = E::A(/* usize */);
|
LL | let _: E = E::A(/* usize */);
|
||||||
| +++++++++++++
|
| +++++++++++++
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo}` in the
|
||||||
LL | thing.bar.foo();
|
LL | thing.bar.foo();
|
||||||
| ^^^ method not found in `fn() -> Foo {Foo}`
|
| ^^^ method not found in `fn() -> Foo {Foo}`
|
||||||
|
|
|
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | (thing.bar)().foo();
|
LL | (thing.bar)().foo();
|
||||||
| + +++
|
| + +++
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` i
|
||||||
LL | thing.bar.foo();
|
LL | thing.bar.foo();
|
||||||
| ^^^ method not found in `fn() -> Foo {Foo::Tup}`
|
| ^^^ method not found in `fn() -> Foo {Foo::Tup}`
|
||||||
|
|
|
|
||||||
help: use parentheses to instantiate this tuple variant
|
help: use parentheses to construct this tuple variant
|
||||||
|
|
|
|
||||||
LL | (thing.bar)().foo();
|
LL | (thing.bar)().foo();
|
||||||
| + +++
|
| + +++
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0609]: no field `0` on type `fn(char, u16) -> Foo {Foo}`
|
||||||
LL | thing.bar.0;
|
LL | thing.bar.0;
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: use parentheses to instantiate this tuple struct
|
help: use parentheses to construct this tuple struct
|
||||||
|
|
|
|
||||||
LL | (thing.bar)(/* char */, /* u16 */).0;
|
LL | (thing.bar)(/* char */, /* u16 */).0;
|
||||||
| + ++++++++++++++++++++++++
|
| + ++++++++++++++++++++++++
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue