summary refs log tree commit diff
path: root/src/librustc_session/lint
AgeCommit message (Collapse)AuthorLines
2020-07-10rustdoc: Rename invalid_codeblock_attribute lint to be pluralOliver Middleton-2/+2
2020-05-27Implement RFC 2585LeSeulArtichaut-0/+7
2020-05-26Rollup merge of #72342 - jsgf:warn-unused-deps, r=petrochenkovDylan DPC-0/+7
Warn about unused crate deps Implements #57274 by adding -Wunused-crate-dependencies. This will warn about any `--extern` option on the command line which isn't referenced by the crate source either via `use` or `extern crate`. Crates which are added for some side effect but are otherwise unreferenced - such as for symbols they define - the warning can be suppressed with `use somecrate as _;`. If a crate has multiple aliases (eg using `foo = { package = "bar" }` in `Cargo.toml`), then it will warn about each unused alias. This does not consider crate added by some other means than `--extern`, including the standard library. It also doesn't consider any crate without `add_prelude` set (though I'm not sure about this). Unfortunately this probably [does not yet work well with Cargo](https://github.com/rust-lang/rust/issues/57274#issuecomment-624839355) as it will over-specify crates, causing spurious warnings. As a result, this lint is "allow" by default and must be explicitly enabled either via `#![warn(unused_crate_deps)]` or with `-Wunused-crate-deps`.
2020-05-25Implement warning for unused dependencies.Jeremy Fitzhardinge-0/+7
This will print a diagnostic for crates which are mentioned as `--extern` arguments on the command line, but are never referenced from the source. This diagnostic is controlled by `-Wunused-crate-dependencies` or `#![warn(unused_crate_dependencies)]` and is "allow" by default. There are cases where certain crates need to be linked in but are not directly referenced - for example if they are providing symbols for C linkage. In this case the warning can be suppressed with `use needed_crate as _;`. Thanks to @petrochenkov for simplified core. Resolves issue #57274
2020-05-25rename lintRalf Jung-2/+2
2020-05-25add a lint against references to packed fieldsRalf Jung-1/+8
2020-05-18HIR passes for asm!Amanieu d'Antras-0/+7
2020-04-23Create new rustdoc lint to check for code blocks tagsGuillaume Gomez-0/+7
2020-03-29Auto merge of #70370 - petrochenkov:nosmatch, r=Centrilbors-1/+1
Remove attribute `#[structural_match]` and any references to it A small remaining part of https://github.com/rust-lang/rust/issues/63438.
2020-03-24Remove attribute `#[structural_match]` and any references to itVadim Petrochenkov-1/+1
2020-03-22Update lint name to follow conventionGuillaume Gomez-2/+2
2020-03-22rename NO_CRATE_LEVEL_DOC lint into MISSING_CRATE_LEVEL_DOCGuillaume Gomez-2/+2
2020-03-22Add lint when no doc is present at the crate-levelGuillaume Gomez-0/+7
2020-02-23Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkovbors-0/+8
Split non macro portion of unused_doc_comment from macro part into two passes/lints ## Motivation This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally. ## Approach This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs. The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable. fixes https://github.com/rust-lang/rust/issues/67838
2020-02-18better lint namesRalf Jung-11/+4
2020-02-15Emit some additional `unused_doc_comments` lints outside of the main passVadim Petrochenkov-0/+8
2020-02-14const-prop: use one helper method for all lints; consistently lint overflow ↵Ralf Jung-0/+14
on BinOps and not on Assert
2020-02-07Auto merge of #65232 - nikomatsakis:lazy-norm-anon-const-push-2, r=matthewjasperbors-0/+11
replace the leak check with universes, take 2 This PR is an attempt to revive the "universe-based region check", which is an important step towards lazy normalization. Unlike before, we also modify the definition of `'empty` so that it is indexed by a universe. This sidesteps some of the surprising effects we saw before -- at the core, we no longer think that `exists<'a> { forall<'b> { 'b: 'a } }` is solveable. The new region lattice looks like this: ``` static ----------+-----...------+ (greatest) | | | early-bound and | | free regions | | | | | scope regions | | | | | empty(root) placeholder(U1) | | / | | / placeholder(Un) empty(U1) -- / | / ... / | / empty(Un) -------- (smallest) ``` This PR has three effects: * It changes a fair number of error messages, I think for the better. * It fixes a number of bugs. The old algorithm was too conservative and caused us to reject legal subtypings. * It also causes two regressions (things that used to compile, but now do not). * `coherence-subtyping.rs` gets an additional error. This is expected. * `issue-57639.rs` regresses as before, for the reasons covered in #57639. Both of the regressions stem from the same underlying property: without the leak check, the instantaneous "subtype" check is not able to tell whether higher-ranked subtyping will succeed or not. In both cases, we might be able to fix the problem by doing a 'leak-check like change' at some later point (e.g., as part of coherence). This is a draft PR because: * I didn't finish ripping out the leak-check completely. * We might want to consider a crater run before landing this. * We might want some kind of design meeting to cover the overall strategy. * I just remembered I never finished 100% integrating this into the canonicalization code. * I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set). r? @matthewjasper
2020-02-06make lint warn by defaultNiko Matsakis-1/+1
2020-02-06lint impls that will become incoherent when leak-check is removedNiko Matsakis-0/+11
2020-02-05Selectively disable sanitizer instrumentationTomasz Miąsko-0/+7
Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.
2020-01-28lintify conflicting_repr_hintsMazdak Farrokhzad-0/+11
2020-01-11move {rustc -> rustc_session}::lint::builtinMazdak Farrokhzad-0/+530