about summary refs log tree commit diff
path: root/src/librustc_lint/lib.rs
AgeCommit message (Collapse)AuthorLines
2019-12-06Use `to_option` in various placesvarkor-0/+1
2019-12-03Move early lint declarations to librustc_sessionMark Rousskov-0/+2
2019-12-01rustc_lint: Remove lint `plugin_as_library`Vadim Petrochenkov-2/+1
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-1/+0
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-0/+12
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-07Rollup merge of #66017 - LukasKalbertodt:array-into-iter-lint, r=matthewjasperMazdak Farrokhzad-0/+4
Add future incompatibility lint for `array.into_iter()` This is for #65819. This lint warns when calling `into_iter` on an array directly. That's because today the method call resolves to `<&[T] as IntoIterator>::into_iter` but that would change when adding `IntoIterator` impls for arrays. This problem is discussed in detail in #65819. We still haven't decided how to proceed exactly, but it seems like adding a lint is a good idea regardless? Also: this is the first time I implement a lint, so there are probably a lot of things I can improve. I used a different strategy than @scottmcm describes [here](https://github.com/rust-lang/rust/pull/65819#issuecomment-548667847) since I already started implementing this before they commented. ### TODO - [x] Decide if we want this lint -> apparently [we want](https://github.com/rust-lang/rust/pull/65819#issuecomment-548964818) - [x] Open a lint-tracking-issue and add the correct issue number in the code -> https://github.com/rust-lang/rust/issues/66145
2019-11-06Add future incompatibility lint for `array.into_iter()`Lukas Kalbertodt-0/+4
As we might want to add `IntoIterator` impls for arrays in the future, and since that introduces a breaking change, this lint warns and suggests using `iter()` instead (which is shorter and more explicit).
2019-11-06nested_impl_trait -> errorMazdak Farrokhzad-0/+2
2019-11-06duplicate_macro_exports -> errorMazdak Farrokhzad-0/+2
2019-11-06parenthesized_params_in_types_and_modules -> errorMazdak Farrokhzad-0/+2
2019-11-06safe_extern_static -> errorMazdak Farrokhzad-0/+2
2019-11-06legacy_directory_ownership -> errorMazdak Farrokhzad-0/+2
2019-11-06legacy_ctor_visibility -> errorMazdak Farrokhzad-0/+2
2019-11-02uninit/zeroed lint: warn against NULL vtablesRalf Jung-0/+1
2019-10-23Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakisMazdak Farrokhzad-197/+39
Lockless LintStore This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence. The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes: * We no longer implicitly register lints when registering lint passes * For the most part this means that registration calls now likely want to call something like: `lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`. * In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints. * Lint passes still have a list of associated lints, but a followup PR could plausibly change that * This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before. * We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected). * Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.
2019-10-21Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJungMazdak Farrokhzad-3/+0
Change untagged_unions to not allow union fields with drop This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass. Change untagged_unions to not allow union fields with drop Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar). The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature. Tracking issue: https://github.com/rust-lang/rust/issues/55149
2019-10-17Create lint store during plugin registrationMark Rousskov-2/+13
Remove lint store from Session
2019-10-17Remove side table of future incompatibility infoMark Rousskov-157/+0
Moves this information to a direct field of Lint, which is where it belongs.
2019-10-17Take lint passes as constructor functionsMark Rousskov-5/+4
2019-10-17Make get_lints be a static functionMark Rousskov-10/+10
This moves from calling get_lints on instantiated pass objects to the raw object
2019-10-17No longer implicitly register lints when registering passesMark Rousskov-1/+6
This is in preparation for on-demand constructing passes
2019-10-17Split out just registration to separate functionMark Rousskov-15/+15
2019-10-17Split module and crate late pass registrationMark Rousskov-13/+6
2019-10-17Lints being from a plugin is dependent on the lint, not the registrationMark Rousskov-8/+7
2019-10-17De-propagate optional session from lint registrationMark Rousskov-25/+17
This is straight up removing dead code, but is a separate commit from the previous to avoid conflating clean up and important changes.
2019-10-16Move overlapping patterns to its own lintEsteban Küber-0/+1
2019-10-11Remove unions_with_drop_fields lintSimon Sapin-3/+0
Cases where it would trigger are now hard errors.
2019-09-08Rollup merge of #64066 - petrochenkov:softstab, r=matthewjasperMazdak Farrokhzad-1/+6
Support "soft" feature-gating using a lint Use it for feature-gating `#[bench]`. Closes https://github.com/rust-lang/rust/issues/63798.
2019-09-07Turn `soft_unstable` into a future-compatibility lintVadim Petrochenkov-1/+6
2019-09-05Remove rustc_diagnostic_macros featureMark Rousskov-1/+0
2019-08-20Deprecate using rustc_plugin without the rustc_driver dylib.Simon Sapin-1/+1
CC https://github.com/rust-lang/rust/pull/59800 https://github.com/rust-lang/rust/commit/7198687bb2df13a3298ef1e8f594753073d6b9e8 Fix https://github.com/rust-lang/rust/issues/62717
2019-08-12Add lint for excess trailing semicolonsNathan-0/+3
2019-08-11add basic lint testing for misuse of mem::zeroed and mem::uninitializedRalf Jung-0/+1
2019-07-30Turn INCOMPLETE_FEATURES into a lint.Mazdak Farrokhzad-0/+1
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-2/+0
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-1/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-21normalize use of backticks in compiler messages for librustc_lintSamy Kacimi-2/+2
2019-07-10Auto merge of #62339 - ↵bors-0/+5
pnkfelix:issue-61188-use-visitor-for-structural-match-check, r=nikomatsakis use visitor for #[structural_match] check This changes the code so that we recur down the structure of a type of a const (rather than just inspecting at a shallow one or two levels) when we are looking to see if it has an ADT that did not derive `PartialEq` and `Eq`. Fix #61188 Fix #62307 Cc #62336
2019-07-08future-compat lint for newly handled cases of `#[structural_match]`.Felix S. Klock II-0/+5
2019-07-06in which the `non_ascii_idents` lint appears (RFC 2457)Zack M. Davis-0/+3
RFC 2457 declares: "A `non_ascii_idents` lint is added to the compiler. This lint is allow by default."
2019-07-06Make WhileTrue into an EarlyLintPass lint.Mazdak Farrokhzad-1/+1
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-2/+3
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-26Remove outdated question_mark_macro_sep lintJulien Cretin-6/+0
2019-06-24Rename internal -> rustc::internalflip1995-1/+1
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-24Implement initernal lint LINT_PASS_IMPL_WITHOUT_MACROflip1995-0/+2
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-1/+1
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-1/+1
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-1/+1