Commit Graph

524 Commits

Author SHA1 Message Date
Aaron Hill
f9025512e7
Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint
cc #79813

This PR adds an allow-by-default future-compatibility lint
`SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a
macro body is ignored due to the macro being used in expression
position:

```rust
macro_rules! foo {
    () => {
        true; // WARN
    }
}

fn main() {
    let val = match true {
        true => false,
        _ => foo!()
    };
}
```

The lint takes its level from the macro call site, and
can be allowed for a particular macro by adding
`#[allow(semicolon_in_expressions_from_macros)]`.

The lint is set to warn for all internal rustc crates (when being built
by a stage1 compiler). After the next beta bump, we can enable
the lint for the bootstrap compiler as well.
2021-01-28 08:51:43 -05:00
Ralf Jung
69a997bef2 update const_err description 2021-01-22 10:21:52 +01:00
Joshua Nelson
c819a4c025 Don't mark ineffective_unstable_trait_impl as an internal lint
It's not an internal lint:
- It's not in the rustc::internal lint group
- It's on unconditionally, because it actually lints `staged_api`, not
  the compiler

This fixes a bug where `#[deny(rustc::internal)]` would warn that
`rustc::internal` was an unknown lint.
2021-01-15 17:31:10 -05:00
Mark Rousskov
c4a8d7f86a Introduce missing ABI lint on extern blocks 2021-01-13 07:49:16 -05:00
bors
c97f11af7b Auto merge of #79414 - sasurau4:feature/add-suggestion-for-pattern-in-fns-without-body, r=matthewjasper
Add suggestion for PATTERNS_IN_FNS_WITHOUT_BODY

## Overview

Fix #78927
2021-01-10 20:48:27 +00:00
Ralf Jung
b31400a226 improve unconditional_panic description 2021-01-01 15:00:27 +01:00
Wesley Wiser
56154a1147 Add example to lint docs 2020-12-22 09:33:16 -05:00
Wesley Wiser
9414f0b833 Revert "Remove missing_fragment_specifier lint"
This reverts commit 5ba961018c.
2020-12-22 08:35:52 -05:00
bors
75e1acb63a Auto merge of #78242 - Nadrieril:rename-overlapping_endpoints-lint, r=varkor
Rename `overlapping_patterns` lint

As discussed in https://github.com/rust-lang/rust/issues/65477. I also tweaked a few things along the way.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-12-22 10:32:03 +00:00
Daiki Ihara
acbebd81d4 add suggest for PatternsInWithoutBody 2020-12-21 21:40:47 +09:00
Tomasz Miąsko
8065dabd17 Validate naked functions definitions 2020-12-07 00:00:00 +00:00
Nadrieril
d1a50ffb7c Rename the overlapping_patterns lint to overlapping_range_endpoints 2020-11-29 21:29:19 +00:00
Eric Huss
d2d91b42a5 lint-docs: Add --validate flag to validate lint docs separately. 2020-11-28 13:39:02 -08:00
Carol (Nichols || Goulding)
ae17d7d455
More consistently use spaces after commas in lists in docs 2020-11-21 14:43:34 -05:00
Dylan DPC
b9671ae5f8
Rollup merge of #78114 - jyn514:private, r=oli-obk
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in https://github.com/rust-lang/rust/pull/77249#issuecomment-712339227.

r? ````````@Manishearth````````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
2020-11-09 01:13:31 +01:00
Joshua Nelson
eed0cebea3 Recognize private_intra_doc_links as a lint
Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```
2020-11-05 12:55:10 -05:00
Guillaume Gomez
16ed8501ef Fix more URLs 2020-11-05 10:23:39 +01:00
Guillaume Gomez
9d114506c6 Rename lint to non_autolinks 2020-11-05 10:22:08 +01:00
Guillaume Gomez
60caf51b0d Rename automatic_links to url_improvements 2020-11-05 10:22:08 +01:00
Guillaume Gomez
7f839b2ece Improve automatic_links globally 2020-11-05 10:22:08 +01:00
Guillaume Gomez
a54f043733 Add documentation for automatic_links lint 2020-11-05 10:22:08 +01:00
Guillaume Gomez
2980367030 Add new lint for automatic_links improvements 2020-11-05 10:22:08 +01:00
Mara Bos
6f1992a7d6 Turn 'useless #[deprecated]' error into a lint. 2020-11-01 20:48:58 +01:00
Aaron Hill
23018a55d9
Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00