mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Emit fewer errors for incorrect rtn and = -> : typos in bindings
Stash parse errors when pasing rtn that doesn't use `(..)`. Emit single error on `Foo::bar(qux)` that looks like rtn in incorrect position and suggest `Foo::bar(..)`. ``` error: return type notation not allowed in this position yet --> $DIR/let-binding-init-expr-as-ty.rs:18:10 | LL | struct K(S::new(())); | ^^^^^^^^^^ | help: furthermore, argument types not allowed with return type notation | LL - struct K(S::new(())); LL + struct K(S::new(..)); | ``` On incorrect rtn in let binding type for an existing inherent associated function, suggest `:` -> `=` to turn the "type" into a call expression. ``` error: expected type, found associated function call --> $DIR/let-binding-init-expr-as-ty.rs:29:12 | LL | let x: S::new(()); | ^^^^^^^^^^ | help: use `=` if you meant to assign | LL - let x: S::new(()); LL + let x = S::new(()); | ```
This commit is contained in:
@@ -386,6 +386,7 @@ pub enum StashKey {
|
||||
/// it's a method call without parens. If later on in `hir_typeck` we find out that this is
|
||||
/// the case we suppress this message and we give a better suggestion.
|
||||
GenericInFieldExpr,
|
||||
ReturnTypeNotation,
|
||||
}
|
||||
|
||||
fn default_track_diagnostic<R>(diag: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) -> R {
|
||||
|
||||
Reference in New Issue
Block a user