Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/binop/false-binop-caused-by-missing-semi.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
188 B
Rust
Raw Normal View History

Silence redundant error on typo resulting on binop
2023-10-27 17:27:21 +00:00
//@ run-rustfix
Detect misparsed binop caused by missing semi When encountering ```rust foo() *bar = baz; ``` We currently emit potentially two errors, one for the return type of `foo` not being multiplyiable by the type of `bar`, and another for `foo() * bar` not being assignable. We now check for this case and suggest adding a semicolon in the right place. Fix #80446.
2023-10-27 17:19:32 +00:00
fn foo() {}
fn main() {
let mut y = 42;
let x = &mut y;
foo()
*x = 0; //~ ERROR invalid left-hand side of assignment
Silence redundant error on typo resulting on binop
2023-10-27 17:27:21 +00:00
let _ = x;
Detect misparsed binop caused by missing semi When encountering ```rust foo() *bar = baz; ``` We currently emit potentially two errors, one for the return type of `foo` not being multiplyiable by the type of `bar`, and another for `foo() * bar` not being assignable. We now check for this case and suggest adding a semicolon in the right place. Fix #80446.
2023-10-27 17:19:32 +00:00
println!("{y}");
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 480ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API