Skip to content

Commit 9c704cc

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35616 - clementmiao:E0067_new_error_format, r=jonathandturner
changed E0067 to new error format Updated E0067 to new error format. Part of rust-lang#35233 Fixes rust-lang#35502 Passes all the tests when running: `python src/bootstrap/bootstrap.py --step check-cfail --stage 1` **This seems strange, given that the format for E0067 has been changed.** It feels like it should fail some unit tests maybe? Let me know if I'm mistaken. Otherwise I can create a unit test for it. Thanks for letting me help! r? @jonathandturner
2 parents a2e88ad + bd90a16 commit 9c704cc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/librustc_typeck/check/op.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4141

4242
let tcx = self.tcx;
4343
if !tcx.expr_is_lval(lhs_expr) {
44-
span_err!(tcx.sess, lhs_expr.span, E0067, "invalid left-hand side expression");
44+
struct_span_err!(
45+
tcx.sess, lhs_expr.span,
46+
E0067, "invalid left-hand side expression")
47+
.span_label(
48+
lhs_expr.span,
49+
&format!("invalid expression for left-hand side"))
50+
.emit();
4551
}
4652
}
4753

src/test/compile-fail/E0067.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ use std::collections::LinkedList;
1313
fn main() {
1414
LinkedList::new() += 1; //~ ERROR E0368
1515
//~^ ERROR E0067
16+
//~^^ NOTE invalid expression for left-hand side
17+
//~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>`
1618
}

0 commit comments

Comments
 (0)