about summary refs log tree commit diff
path: root/src/librustc_lint
AgeCommit message (Collapse)AuthorLines
2020-08-02Auto merge of #74785 - euclio:deprecation-kinds, r=petrochenkovbors-1/+1
report kind of deprecated item in message This is important for fields, which are incorrectly referred to as "items".
2020-08-01Auto merge of #74726 - oli-obk:tracing, r=Mark-Simulacrumbors-1/+1
Move from `log` to `tracing` The only visible change is that we now get timestamps in our logs: ``` Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: skipping replace of Rvalue::Use(const () because it is already a const Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: propagated into _2 Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: visit_constant: const () ``` This PR was explicitly designed to be as low-impact as possible. We can now move to using the name `tracing` insteads of `log` on a crate-by-crate basis and use any of the other tracing features where desirable. As far as I can tell this will allow tools to seamlessly keep working (since they are using `rustc_driver::init_log...`). This is the first half of step 1 of the accepted `tracing` MCP (https://github.com/rust-lang/compiler-team/issues/331)
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-31fix part of comparison that would always evaluate to "true", probably an ↵Matthias Krüger-1/+1
oversight
2020-07-31Auto merge of #74926 - Manishearth:rename-lint, r=jyn514bors-3/+4
Rename intra_doc_link_resolution_failure It should be plural to follow the conventions in https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
2020-07-30Rename the lint againManish Goregaokar-3/+3
2020-07-30intra_doc_resolution_failures -> broken_intra_doc_linksManish Goregaokar-1/+1
2020-07-30Rename to intra_doc_resolution_failuresManish Goregaokar-3/+3
2020-07-30Fix missed same-sized member clash in ClashingExternDeclarations.jumbatm-5/+32
2020-07-30Handle structs with zst members.jumbatm-23/+28
2020-07-30Address code review comments.jumbatm-137/+168
- Make `is_repr_nullable_ptr` freestanding again to avoid usage of ImproperCTypesVisitor in ClashingExternDeclarations (and don't accidentally revert the ParamEnv::reveal_all() fix from a week earlier) - Revise match condition for 1 Adt, 1 primitive - Generalise check for non-null type so that it would also work for ranges which exclude any single value (all bits set, for example) - Make is_repr_nullable_ptr return the representable type instead of just a boolean, to avoid adding an additional, independent "source of truth" about the FFI-compatibility of Option-like enums. Also, rename to `repr_nullable_ptr`.
2020-07-30Apply suggested wording changes from code review.jumbatm-2/+2
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-30Don't emit clashing decl lint for FFI-safe enums.jumbatm-24/+76
An example of an FFI-safe enum conversion is when converting Option<NonZeroUsize> to usize. Because the Some value must be non-zero, rustc can use 0 to represent the None variant, making this conversion is safe. Furthermore, it can be relied on (and removing this optimisation already would be a breaking change).
2020-07-29Register renamed lintManish Goregaokar-0/+1
2020-07-29Rename intra_doc_link_resolution_failure -> intra_doc_link_resolution_failuresManish Goregaokar-2/+2
2020-07-28Make closures and generators a must use typesTomasz Miąsko-0/+22
Warn about unused expressions with closure or generator type. This follows existing precedence of must use annotations present on `FnOnce`, `FnMut`, `Fn` traits, which already indirectly apply to closures in some cases, e.g.,: ```rust fn f() -> impl FnOnce() { || {} } fn main() { // an existing warning: unused implementer of `std::ops::FnOnce` that must be used: f(); // a new warning: unused closure that must be used: || {}; } ```
2020-07-27fix rebaseBastian Kauschke-2/+0
2020-07-27introduce PredicateAtomBastian Kauschke-9/+8
2020-07-27this might be unqualified, but at least it's now quantifiedBastian Kauschke-4/+4
2020-07-27split ignore_qualifiersBastian Kauschke-18/+8
2020-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-20/+26
2020-07-27progressBastian Kauschke-6/+9
2020-07-26report kind of deprecated item in messageAndy Russell-1/+1
This is important for fields, which are incorrectly referred to as "items".
2020-07-17Rollup merge of #74448 - davidtwco:improper-ctypes-definitions-boxes, ↵Manish Goregaokar-1/+12
r=davidtwco improper_ctypes_definitions: allow `Box` Addresses https://github.com/rust-lang/rust/pull/72700#issuecomment-659449386. This PR stops linting against `Box` in `extern "C" fn`s for the `improper_ctypes_definitions` lint - boxes are documented to be FFI-safe. cc @alexcrichton @CryZe
2020-07-17Rollup merge of #74438 - RalfJung:uninit-lint, r=davidtwcoManish Goregaokar-5/+23
warn about uninitialized multi-variant enums Fixes https://github.com/rust-lang/rust/issues/73608
2020-07-17Auto merge of #72983 - Lezzz:rename-typeck, r=nikomatsakisbors-41/+41
Rename TypeckTables to TypeckResults. Originally suggested by @eddyb.
2020-07-17improper_ctypes_definitions: allow `Box`David Wood-1/+12
This commit stops linting against `Box` in `extern "C" fn`s for the `improper_ctypes_definitions` lint - boxes are documented to be FFI-safe. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17warn about uninit multi-variant enumsRalf Jung-5/+23
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-41/+41
2020-07-16apply bootstrap cfgsMark Rousskov-1/+0
2020-07-15Auto merge of #74175 - nnethercote:more-static-symbols, r=oli-obkbors-2/+5
More static symbols These commits add some more static symbols and convert lots of places to use them. r? @oli-obk
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-2/+5
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-14lint: use `transparent_newtype_field` to avoid ICEDavid Wood-16/+16
This commit re-uses the `transparent_newtype_field` function instead of manually calling `is_zst` on normalized fields to determine which field in a transparent type is the non-zero-sized field, thus avoiding an ICE. Signed-off-by: David Wood <david@davidtw.co>
2020-07-10Avoid "whitelist"Tamir Duberstein-2/+2
Other terms are more inclusive and precise.
2020-07-09Rollup merge of #74070 - eddyb:forall-tcx-providers, r=nikomatsakisManish Goregaokar-2/+2
Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>. In order to work around normalization-under-HRTB (for `provide!` in `rustc_metadata`), we ended up with this: ```rust struct Providers<'tcx> { type_of: fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>, // ... } ``` But what I initially wanted to do, IIRC, was this: ```rust struct Providers { type_of: for<'tcx> fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>, // ... } ``` This PR moves to the latter, for the simple reason that only the latter allows keeping a `Providers` value, or a subset of its `fn` pointer fields, around in a `static` or `thread_local!`, which can be really useful for custom drivers that override queries. (@jyn514 and I came across a concrete usecase of that in `rustdoc`) The `provide!` macro in `rustc_metadata` is fixed by making the query key/value types available as type aliases under `ty::query::query_{keys,values}`, not just associated types (this is the first commit). r? @nikomatsakis
2020-07-09Auto merge of #74131 - ollie27:rustdoc_invalid_codeblock_attributes_name, ↵bors-2/+2
r=GuillaumeGomez rustdoc: Rename invalid_codeblock_attribute lint to be plural Lint names should be plural as per the lint naming conventions: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints r? @GuillaumeGomez
2020-07-07rustdoc: Rename invalid_codeblock_attribute lint to be pluralOliver Middleton-2/+2
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-2/+2
2020-07-03Use 'tcx for references to AccessLevels wherever possible.Eduard-Mihai Burtescu-144/+134
2020-07-02rustc_lint: avoid using TypeckTables::empty for LateContext.Eduard-Mihai Burtescu-21/+34
2020-06-30change `skip_binder` to use T by valueBastian Kauschke-1/+1
2020-06-28Rollup merge of #73817 - jumbatm:rename-to-clashing-extern-declarations, ↵Manish Goregaokar-10/+10
r=petrochenkov Rename clashing_extern_decl to clashing_extern_declarations. Rename clashing_extern_decl to clashing_extern_declarations to bring in-line with lint naming conventions. Fixes #73802. r? @petrochenkov
2020-06-27Rollup merge of #73758 - davidtwco:issue-60855-remaining-reveal-all, ↵Manish Goregaokar-62/+66
r=matthewjasper improper_ctypes: fix remaining `Reveal:All` Fixes #60855. This PR replaces the remaining uses of `ParamEnv::reveal_all` with `LateContext`'s `param_env` (normally `Reveal::UserFacing`) in the improper ctypes lint.
2020-06-28Rename the lint to clashing_extern_declarations.jumbatm-10/+10
Also, run RustFmt on the clashing_extern_fn test case and update stderrs.
2020-06-26improper_ctypes: fix remaining `Reveal:All`David Wood-62/+66
This commit replaces the remaining uses of `ParamEnv::reveal_all` with `LateContext`'s `param_env` (normally `Reveal::UserFacing`). Signed-off-by: David Wood <david@davidtw.co>
2020-06-26Auto merge of #73743 - eddyb:lint-on-demand-typeck-tables, r=Manishearthbors-35/+80
rustc_lint: only query `typeck_tables_of` when a lint needs it. This was prompted by @jyn514 running into a situation where `rustdoc` wants to run the `unused_doc` lint without triggering type-checking (as an alternative to the "everybody loops" approach - type-checking may error/ICE because of the `rustdoc` feature of allowing multi-platform docs where the actual bodies of functions may refer to APIs for different platforms). There was also this comment in the source: ```rust // FIXME: Make this lazy to avoid running the TypeckTables query? ``` The main effect of this is for lint authors, who now need to use `cx.tables()` to get `&TypeckTables`, as opposed to having them always available in `cx.tables`. r? @oli-obk or @Manishearth
2020-06-25Rollup merge of #72770 - crlf0710:mixed_script_confusable, r=ManishearthManish Goregaokar-130/+226
Implement mixed script confusable lint. This implements the mixed script confusable lint defined in RFC 2457. This is blocked on #72069 and https://github.com/unicode-rs/unicode-security/pull/13, and will need a Cargo.toml version bump after those are resolved. The lint message warning is sub-optimal for now. We'll need a mechanism to properly output `AugmentScriptSet` to screen, this is to be added in `unicode-security` crate. r? @Manishearth
2020-06-26rustc_lint: only query `typeck_tables_of` when a lint needs it.Eduard-Mihai Burtescu-35/+80
2020-06-26Implement mixed script confusable lint.Charles Lew-3/+126
2020-06-24improper_ctypes: only allow params in defns modeDavid Wood-2/+8
This commit adjusts the behaviour introduced in a previous commit so that generic parameters and projections are only allowed in the definitions mode - and are otherwise a bug. Generic parameters in declarations are prohibited earlier in the compiler, so if that branch were reached, it would be a bug. Signed-off-by: David Wood <david@davidtw.co>