about summary refs log tree commit diff
path: root/src/librustc_lint
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-8868/+0
2020-08-30Rollup merge of #75885 - ↵Dylan DPC-7/+46
jumbatm:issue75739-clashing-extern-declarations-transparent-nonzero, r=lcnr Fix another clashing_extern_declarations false positive. Fixes #75739. Fix another clashing_extern_declarations false positive, this time for transparent newtype with a non-zero member. r? @lcnr
2020-08-27Fix ICE on unwrap of unknown layout.jumbatm-10/+24
2020-08-26Remove unnecessary assert.jumbatm-5/+6
2020-08-26Use same name as attr.jumbatm-3/+3
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-25Also handle transparent single-variant enumsjumbatm-9/+11
2020-08-25Fix clashing_extern_declarations false positive.jumbatm-7/+43
Fixes a false positive for transparent newtype with a non-zero member.
2020-08-19Rollup merge of #75554 - jumbatm:fix-clashing-extern-decl-overflow, r=lcnrYuki Okushi-102/+132
Fix clashing_extern_declarations stack overflow for recursive types. Fixes #75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-19/+19
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-19/+19
2020-08-18Wrap recursion in `ensure_sufficient_stack`.jumbatm-88/+91
2020-08-18Also accept Refs for is_primitive_or_pointerjumbatm-4/+5
2020-08-18Avoid double hashset lookup.jumbatm-2/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-18Don't memoize seen types.jumbatm-51/+9
That cache is unlikely to be particularly useful within a single invocation of structurally_same_type, especially compared to memoizing results across _all_ invocations of that function.
2020-08-18Reduce indentation by replacing match arm w/ early return.jumbatm-125/+118
2020-08-18Remove structural equiv check for Array const.jumbatm-3/+0
2020-08-18Remove unnecessary rebinding of def ids.jumbatm-11/+5
2020-08-18Fix stack overflow for recursive types.jumbatm-102/+187
Adds a seen set to structurally_same_type to avoid recursing indefinitely when a reference or pointer member introduces a cycle in the visited types.
2020-08-16hir: simplify `is_range_literal`David Wood-2/+2
This commit simplifies `is_range_literal` by checking for `QPath::LangItem` containing range-related lang items, rather than using a heuristic. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-16hir: introduce `QPath::LangItem`David Wood-2/+2
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-6/+6
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-3/+3
2020-08-11Rollup merge of #75403 - giraffate:update_comment_in_fn, r=ecstatic-morseTyler Mandry-1/+1
Update comment for function `rustc::lint::builtin` -> `rustc_session::lint::builtin`
2020-08-11Update comment for functionTakayuki Nakata-1/+1
`rustc::lint::builtin` -> `rustc_session::lint::builtin`
2020-08-11Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obkYuki Okushi-17/+19
unused_delims: trim expr improves rustfix output.
2020-08-10unused_delims: trim exprBastian Kauschke-17/+19
2020-08-10Remove `CowBoxSymStr`.Nicholas Nethercote-61/+23
`CowBoxSymStr` is a type that either holds a `SymbolStr` (which is much the same as a `Symbol`), or an owned string. When computing skeletons, a `SymbolStr` is stored if the skeleton is the same as the original string, otherwise an owned string is stored. So, basically, `CowBoxSymStr` is a type for string interning. But we already have one of those: `Symbol` itself. This PR removes `CowBoxSymStr`, using `Symbol` instead. A good thing about this is that it avoids storing `SymbolStr` values in `skeleton_map`, something that is discouraged. The PR also inlines and removes the `calc_skeleton()` function because that simplifies the code.
2020-08-10Fix symbol ordering for confusable idents detection.Nicholas Nethercote-0/+6
Confusable idents detection uses a type `BTreeMap<Symbol, Span>`. This is highly dubious given that `Symbol` doesn't guarantee a meaningful order. (In practice, it currently gives an order that mostly matches source code order.) As a result, changes in `Symbol` representation make the `lint-confusable-idents.rs` test fail, because this error message: > identifier pair considered confusable between `s` and `s` is changed to this: > identifier pair considered confusable between `s` and `s` and the corresponding span pointers get swapped erroneously, leading to an incorrect "previous identifier" label. This commit sorts the relevant symbols by span before doing the checking, which ensures that the ident that appears first in the code will be mentioned first in the message. The commit also extends the test slightly to be more thorough.
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-25/+27
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-25/+27
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-08fix clippy::needless_return: remove unneeded return statementsMatthias Krüger-1/+1
2020-08-04Rollup merge of #75083 - JohnTitor:follow-up-unused-braces, r=lcnrYuki Okushi-1/+4
Do not trigger `unused_braces` for `while let` Follow-up for #75031 r? @lcnr
2020-08-04Rollup merge of #75056 - Veykril:path_statements_lint, r=oli-obkYuki Okushi-2/+18
Lint path statements to suggest using drop when the type needs drop Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-1/+1
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-03Do not trigger `unused_braces` for `while let`Yuki Okushi-1/+4
2020-08-02Rollup merge of #75031 - JohnTitor:unused-parens-braces-yield, r=lcnrManish Goregaokar-1/+1
Do not trigger `unused_{braces,parens}` lints with `yield` Fixes #74883 r? @lcnr
2020-08-02Lint path statements to use drop for drop typesLukas Wirth-2/+18
2020-08-03Recover strictness for `yield`Yuki Okushi-2/+1
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-02Do not trigger `unused_{braces,parens}` lints with `yield`Yuki Okushi-0/+1
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`.