Commit Graph

12 Commits

Author SHA1 Message Date
Nicholas Nethercote
1881bfaa2b Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
Rejyr
88e5dd2530 refactor: cleanup 2023-01-09 18:57:02 -05:00
Rejyr
c3a6801f8e migrate: redundant_semicolon.rs 2023-01-09 17:07:25 -05:00
Nilstrieb
c65ebae221
Migrate all diagnostics 2022-10-23 10:09:44 +02:00
Maybe Waffle
a8f7e244b7 Refactor rustc lint API 2022-10-01 10:03:06 +00:00
David Wood
8e836566f0 lint: port redundant semicolons diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
Takayuki Maeda
77d6176e69 remove unnecessary to_string and String::new 2022-06-13 15:48:40 +09:00
Aaron Hill
c857cbeb06
Lint on redundant trailing semicolon after item
We now lint on code like this:

```rust
fn main() {
    fn foo() {};
    struct Bar {};
}
```

Previously, this caused warnings in Cargo, so it was disabled.
2020-12-29 16:30:02 -05:00
Aaron Hill
772292fa51
Don't lint on redundant semicolons after item statements
This preserves the current lint behavior for now.

Linting after item statements currently prevents the compiler from bootstrapping.
Fixing this is blocked on fixing this upstream in Cargo, and bumping the Cargo
submodule.
2020-11-27 09:37:49 -05:00
Aaron Hill
e78e9d4a06
Treat trailing semicolon as a statement in macro call
See https://github.com/rust-lang/rust/issues/61733#issuecomment-716188981

We now preserve the trailing semicolon in a macro invocation, even if
the macro expands to nothing. As a result, the following code no longer
compiles:

```rust
macro_rules! empty {
    () => { }
}

fn foo() -> bool { //~ ERROR mismatched
    { true } //~ ERROR mismatched
    empty!();
}
```

Previously, `{ true }` would be considered the trailing expression, even
though there's a semicolon in `empty!();`

This makes macro expansion more token-based.
2020-11-02 13:03:13 -05:00
Eric Huss
45c1e0ae07 Auto-generate lint documentation. 2020-09-13 08:48:03 -07:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00