1
Fork 0

Add a note about 2018e if someone uses try { in 2015e

This commit is contained in:
Scott McMurray 2019-02-17 23:55:45 -08:00
parent 16ca0b9f63
commit 9312ca10b6
2 changed files with 6 additions and 0 deletions

View file

@ -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");

View file

@ -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