gcc/rust/ChangeLog:
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit):
Added richlocation & error code.
gcc/testsuite/ChangeLog:
* rust/compile/let_alt.rs: Updated comment.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
= new HIR::AltPattern (mapping, std::move (alts), pattern.get_locus ());
if (is_let_top_level)
- rust_error_at (pattern.get_locus (),
- "top level alternate patterns are not allowed for %<let%> "
- "bindings - use an outer grouped pattern");
+ {
+ rich_location richloc (line_table, pattern.get_locus ());
+ richloc.add_fixit_replace ("use an outer grouped pattern");
+ rust_error_at (
+ richloc, "top level or-patterns are not allowed for %<let%> bindings");
+ }
}
} // namespace HIR
fn main() {
let _a | _a = 12;
- // { dg-error "top level alternate patterns are not allowed" "" { target *-*-* } .-1 }
+ // { dg-error "top level or-patterns are not allowed for .let. bindings" "" { target *-*-* } .-1 }
}