Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustc_resolve/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ impl<'a> Resolver<'a> {
format!("{}!", path_str),
Applicability::MaybeIncorrect,
);
if path_str == "try" && span.rust_2015() {
err.note("if you want the `try` keyword, \
you need to be in the 2018 edition");
}
}
(Def::TyAlias(..), PathSource::Trait(_)) => {
err.span_label(span, "type aliases cannot be used as traits");
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/try-block/try-block-in-edition2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ error[E0574]: expected struct, variant or union type, found macro `try`
|
LL | let try_result: Option<_> = try {
| ^^^ help: use `!` to invoke the macro: `try!`
|
= note: if you want the `try` keyword, you need to be in the 2018 edition

error: aborting due to 2 previous errors

Expand Down