Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When presenting the proper type ascription syntax, mention the feature gate #61325

Closed
estebank opened this issue May 29, 2019 · 0 comments · Fixed by #61374
Closed

When presenting the proper type ascription syntax, mention the feature gate #61325

estebank opened this issue May 29, 2019 · 0 comments · Fixed by #61374
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority

Comments

@estebank
Copy link
Contributor

As per #59453 (comment), given the code

we emit

error: expected type, found `3`
--> $DIR/recover-from-bad-variant.rs:7:26
|
LL | let x = Enum::Foo(a: 3, b: 4);
| ^ expecting a type here because of type ascription
|
= note: type ascription is a nightly-only feature that lets you annotate an expression with a type: `<expr>: <type>`
note: this expression expects an ascribed type after the colon
--> $DIR/recover-from-bad-variant.rs:7:23
|
LL | let x = Enum::Foo(a: 3, b: 4);
| ^
= help: this might be indicative of a syntax error elsewhere

We should mention the feature gate:

= note: #![feature(type_ascription)] lets you annotate an expression with a type: `<expr>: <type>`
@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority labels May 29, 2019
Centril added a commit to Centril/rust that referenced this issue May 30, 2019
Explicitly suggest 'type_ascription' feature

Closes: rust-lang#61325

r? @estebank
pietroalbini added a commit to pietroalbini/rust that referenced this issue May 31, 2019
Explicitly suggest 'type_ascription' feature

Closes: rust-lang#61325

r? @estebank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant