about summary refs log tree commit diff
path: root/src/librustc_lint
AgeCommit message (Collapse)AuthorLines
2019-04-28Implement internal lintsflip1995-1/+3
- USAGE_OF_QUALIFIED_TY - TY_PASS_BY_REFERENCE
2019-04-24Derive Default for EllipsisInclusiveRangePatternssd234678-9/+2
2019-04-24Derive Default instead of new in applicable lintsd234678-7/+2
2019-04-23Remove visit_subpats from check_pat in favor of state in ↵Tomas Koutsky-5/+32
EllipsisInclusiveRangePatterns
2019-04-21Change return type of `TyCtxt::is_static` to boolVadim Petrochenkov-2/+1
Add `TyCtxt::is_mutable_static`
2019-04-18Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkovbors-1/+1
Rename files about error codes fixes #60017 This PR will be failed in tidy. <details> <summary>The log is here:</summary> ``` tidy check tidy error: duplicate error code: 411 tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:83: __diagnostic_used!(E0411); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:84: err.code(DiagnosticId::Error("E0411".to_owned())); tidy error: duplicate error code: 424 tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:90: debug!("smart_resolve_path_fragment: E0424, source={:?}", source); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:92: __diagnostic_used!(E0424); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:93: err.code(DiagnosticId::Error("E0424".to_owned())); some tidy checks failed ``` </details> I'd like to fix this but I don't know what to do. I will work on later. Please let me know if you have any solutions. r? @petrochenkov
2019-04-17Rename modulesYuki OKUSHI-1/+1
2019-04-17Rename diagnostics to error_codesYuki OKUSHI-0/+0
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-15Preallocate BUILTIN_ATTRIBUTES symbols and use a hash map instead of loopingJohn Kåre Alsaker-16/+30
2019-04-15Make check_name genericJohn Kåre Alsaker-1/+1
2019-04-14Rollup merge of #59858 - mark-i-m:dup-matcher-bindings-3, r=CentrilMazdak Farrokhzad-5/+2
Make duplicate matcher bindings a hard error r? @Centril Closes #57742
2019-04-11Add discr_index to multi-variant layoutsTyler Mandry-0/+1
We relax the assumption that the discriminant is always field 0, in preparations for layouts like generators where this is not going to be the case.
2019-04-10make duplicate matcher bindings a hard errorMark Mansi-5/+2
2019-04-04add mutable_borrow_reservation_conflict future-incompatibility lint.Felix S. Klock II-0/+5
Convert the new 2-phase reservation errors into instances of the lint so that they will be controlled by that attribute.
2019-04-04Rollup merge of #59669 - Centril:lint-pass-macro, r=oli-obkMazdak Farrokhzad-458/+96
Reduce repetition in librustc(_lint) wrt. impl LintPass by using macros r? @oli-obk cc @Zoxc
2019-04-03reduce repetition in librustc(_lint) wrt. impl LintPassMazdak Farrokhzad-458/+96
2019-04-03Remove TyKind arg from report_bin_hex_error functionflip1995-11/+6
2019-04-03Deny internal lints on librustc_lintflip1995-8/+10
2019-04-03Add register_internals function to `rustc_lint`flip1995-0/+16
2019-03-31Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obkMazdak Farrokhzad-41/+46
rustc_target: factor out common fields of non-Single Variants. @tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant. This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums". r? @oli-obk
2019-03-30Rollup merge of #59463 - ↵Mazdak Farrokhzad-11/+36
pnkfelix:issue-56327-skip-dyn-keyword-lint-under-macros, r=matthewjasper skip dyn keyword lint under macros This PR is following my own intuition that `rustfix` should never inject bugs into working code (even if that comes at the expense of it failing to fix things that will become bugs). Fix #56327
2019-03-29rustc_target: factor out common fields of non-Single Variants.Eduard-Mihai Burtescu-41/+46
2019-03-29Rollup merge of #58019 - Zoxc:combine-late-lints, r=estebankMazdak Farrokhzad-71/+114
Combine all builtin late lints and make lint checking parallel Blocked on https://github.com/rust-lang/rust/pull/57293. Cuts runtime of late lint checking from 3.222s to 0.546s with 8 threads on `winapi` (@retep998 ;) ) r? @estebank
2019-03-28Combine all builtin late lintsJohn Kåre Alsaker-71/+114
2019-03-28Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obkMazdak Farrokhzad-1/+1
Type dependent defs wrappers First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR. Issue: https://github.com/rust-lang/rust/issues/59094 This PR adds 3 helper methods to `TypeckTables`: * `opt_type_dependent_def` * `opt_type_dependent_def_id` * `type_dependent_def_id` I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result. Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here? Sry it took me so long, as I said I'm new here and I had tough week :).
2019-03-27Do not lint `dyn` tokens under macros.Felix S. Klock II-11/+36
The existing `KeywordIdents` lint blindly scans the token stream for a macro or macro definition. It does not attempt to parse the input, which means it cannot distinguish between occurrences of `dyn` that are truly instances of it as an identifier (e.g. `let dyn = 3;`) versus occurrences that follow its usage as a contextual keyword (e.g. the type `Box<dyn Trait>`). In an ideal world the lint would parse the token stream in order to distinguish such occurrences; but in general we cannot do this, because a macro_rules definition does not specify what parsing contexts the macro being defined is allowed to be used within. So rather than put a lot of work into attempting to come up with a more precise but still incomplete solution, I am just taking the short cut of not linting any instance of `dyn` under a macro. This prevents `rustfix` from injecting bugs into legal 2015 edition code.
2019-03-26Exclude UnusedBrokenConst from module lintsJohn Kåre Alsaker-3/+5
2019-03-25Make more lints incrementalJohn Kåre Alsaker-20/+21
2019-03-25Make some lints incrementalJohn Kåre Alsaker-8/+45
2019-03-25Auto merge of #59256 - petrochenkov:derval2, r=Zoxcbors-4/+5
Make meta-item API compatible with `LocalInternedString::get` soundness fix r? @Zoxc
2019-03-24Separate variant id and variant constructor id.David Wood-1/+1
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-23Auto merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxcbors-8/+4
middle: replace NodeId with HirId in AccessLevels Pushing the limits of HirIdification (#57578). Replaces `NodeId` with `HirId` in `middle::privacy::AccessLevels`. Actually this time I was more successful and cracked it; I probably tried to HirIdify too much at once when I attempted it last time ^^. r? @Zoxc
2019-03-17Make meta-item API compatible with `LocalInternedString::get` soundness fixVadim Petrochenkov-4/+5
2019-03-16Fix rebaseVadim Petrochenkov-1/+1
2019-03-16syntax: Do not accidentally treat multi-segment meta-items as single-segmentVadim Petrochenkov-4/+6
2019-03-16Add def getting methods to librustc/ty/contextTomas Koutsky-1/+1
2019-03-15rustc: rename item_path to def_path (except the module in ty).Eduard-Mihai Burtescu-1/+1
2019-03-13middle: replace NodeId with HirId in AccessLevelsljedrz-8/+4
2019-03-12Auto merge of #58608 - ↵bors-0/+5
pnkfelix:warning-period-for-detecting-nested-impl-trait, r=zoxc Warning period for detecting nested impl trait Here is some proposed code for making a warning period for the new checking of nested impl trait. It undoes some of the corrective effects of PR #57730, by using boolean flags to track parts of the analysis that were previously skipped prior to PRs #57730 and #57981 landing. Cc #57979
2019-03-08expand unused doc comment diagnosticAndy Russell-12/+43
Report the diagnostic on macro expansions, and add a label indicating why the comment is unused.
2019-03-08improve unused doc comment diagnostic reportingAndy Russell-9/+32
Report all unused attributes on a given doc comment instead of just the first one, and extend the span of sugared doc comments to encompass the whole comment.
2019-03-08Temporarily emulate the (accidentally) omitted recursion during impl Trait ↵Felix S. Klock II-0/+5
check. Note that the two previous visitors were omitting slightly different recursive calls, so I need two flags to properly emulate them.
2019-03-07hir: remove NodeId from PatKindljedrz-2/+2
2019-03-07HirIdification: replace NodeId method callsljedrz-2/+2
2019-03-02hir: HirIdify Impl&TraitItemIdljedrz-5/+2
2019-03-02hir: remove NodeId from Itemljedrz-18/+18
2019-03-02hir: remove NodeId from ForeignItemljedrz-7/+7
2019-03-02hir: remove NodeId from StructFieldljedrz-4/+7
2019-03-01hir: remove NodeId from ImplItemljedrz-6/+7