about summary refs log tree commit diff
path: root/src/librustc/lint
AgeCommit message (Collapse)AuthorLines
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-26/+58
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-04rename hir::map::local_def_id_from_hir_id to local_def_idljedrz-1/+1
2019-07-04rename hir::map::local_def_id to local_def_id_from_node_idljedrz-1/+1
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-26Remove outdated question_mark_macro_sep lintJulien Cretin-9/+1
2019-06-24Turn internal lints into tool lintsflip1995-13/+13
2019-06-24Allow default_hash_types in some cratesflip1995-1/+1
2019-06-24Only allow {declare,impl}_lint_pass macros for implementing LintPassflip1995-10/+24
2019-06-24Implement initernal lint LINT_PASS_IMPL_WITHOUT_MACROflip1995-17/+35
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-2/+2
2019-06-17remove _by_hir_id if there is no NodeId counterpartljedrz-2/+2
2019-06-14Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-4/+1
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-12/+12
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-8/+3
2019-06-12rustc: remove some unnecessary lifetimes in -> TyCtxt methods.Eduard-Mihai Burtescu-1/+1
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-11/+11
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-1/+1
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-15/+15
2019-06-11rustc: deny(unused_lifetimes).Eduard-Mihai Burtescu-3/+3
2019-06-03syntax: revert `ast::AsyncArgument` and associated changes.Eduard-Mihai Burtescu-24/+0
Here follows the main reverts applied in order to make this commit: Revert "Rollup merge of #60676 - davidtwco:issue-60674, r=cramertj" This reverts commit 45b09453dbf120cc23d889435aac3ed7d2ec8eb7, reversing changes made to f6df1f6c30b469cb9e65c5453a0efa03cbb6005e. Revert "Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakis" This reverts commit 16939a50ea440e72cb6ecefdaabb988addb1ec0e, reversing changes made to 12bf98155249783583a91863c5dccf9e346f1226. Revert "Rollup merge of #59823 - davidtwco:issue-54716, r=cramertj" This reverts commit 62d1574876f5531bce1b267e62dff520d7adcbbb, reversing changes made to 4eff8526a789e0dfa8b97f7dec91b7b5c18e8544.
2019-05-30Auto merge of #61253 - nnethercote:avoid-hygiene_data-lookups, r=petrochenkovbors-3/+3
Avoid `hygiene_data` lookups These commits mostly introduce compound operations that allow two close adjacent `hygiene_data` lookups to be combined. r? @petrochenkov
2019-05-29Auto merge of #61203 - memoryruins:bare_trait_objects, r=Centrilbors-1/+1
Warn on bare_trait_objects by default The `bare_trait_objects` lint is set to `warn` by default. Most ui tests have been updated to use `dyn` to avoid creating noise in stderr files. r? @Centril cc #54910
2019-05-29Introduce and use `SyntaxContext::outer_expn_info()`.Nicholas Nethercote-3/+3
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-28Set bare_trait_objects lint to warnmemoryruins-1/+1
2019-05-27Auto merge of #61140 - estebank:attr-diagnostics, r=michaelwoeristerbors-13/+20
Reword malformed attribute input diagnostics - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser Split up from https://github.com/rust-lang/rust/pull/61026, where there's prior conversation.
2019-05-27Use `Symbol` more in lint APIsOliver Scherer-27/+33
2019-05-25Reword malformed attribute input diagnosticsEsteban Küber-13/+20
- Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser
2019-05-25rustc: integrate ty::Const into ty::print as print_const.Eduard-Mihai Burtescu-1/+9
2019-05-24Rollup merge of #61098 - varkor:fix-overflowing-literal-in-loop, r=estebankMazdak Farrokhzad-15/+16
Fix overflowing literal lint in loops Fixes https://github.com/rust-lang/rust/issues/60459. r? @estebank
2019-05-23Fix missing overflowing literal lint in for loopvarkor-15/+16
2019-05-23Update lint_levelsJohn Kåre Alsaker-3/+3
2019-05-21Respect lint attributes on match armsMatthew Jasper-0/+6
2019-05-20Auto merge of #60815 - nnethercote:use-Symbol-more-2, r=petrochenkovbors-4/+5
Use `Symbol` even more These patches simplify the code a bit (fewer conversions) and also speed things up a bit (fewer `with_interner` calls). r? @petrochenkov
2019-05-20Introduce `LocalInternedString::intern`.Nicholas Nethercote-4/+5
`LocalInternedString::intern(x)` is preferable to `Symbol::intern(x).as_str()`, because the former involves one call to `with_interner` while the latter involves two.
2019-05-18Fix lints handling in rustdocGuillaume Gomez-0/+3
2019-05-17Auto merge of #49799 - hdhoang:46205_deny_incoherent_fundamental_impls, ↵bors-7/+0
r=nikomatsakis lint: convert incoherent_fundamental_impls into hard error *Summary for affected authors:* If your crate depends on one of the following crates, please upgrade to a newer version: - gtk-rs: upgrade to at least 0.4 - rusqlite: upgrade to at least 0.14 - nalgebra: upgrade to at least 0.15, or the last patch version of 0.14 - spade: upgrade or refresh the Cargo.lock file to use version 1.7 - imageproc: upgrade to at least 0.16 (newer versions no longer use nalgebra) implement #46205 r? @nikomatsakis
2019-05-13Return a `Symbol` from `name_or_empty` functions.Nicholas Nethercote-3/+14
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-2/+2
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-2/+2
2019-05-03rustc: rename hir::def::Def to Res (short for "resolution").Eduard-Mihai Burtescu-3/+3
2019-05-03Rollup merge of #60478 - euclio:doc-fixes, r=cramertjMazdak Farrokhzad-4/+4
minor compiler doc tweaks
2019-05-03Rollup merge of #60388 - cramertj:elided-lifetime-async, r=nikomatsakisMazdak Farrokhzad-30/+50
Disallow non-explicit elided lifetimes in async fn Fix https://github.com/rust-lang/rust/issues/60203 r? @nikomatsakis
2019-05-03Rollup merge of #59928 - petrochenkov:denyambass, r=varkorMazdak Farrokhzad-1/+1
Make deprecation lint `ambiguous_associated_items` deny-by-default As requested by r? @Centril cc https://github.com/rust-lang/rust/issues/57644
2019-05-02fix markdown syntax in `LateContext` examplesAndy Russell-4/+4
2019-05-01Disallow non-explicit elided lifetimes in async fnTaylor Cramer-30/+50
2019-05-01Ensure that drop order of `async fn` matches `fn`.David Wood-5/+10
This commit modifies the lowering of `async fn` arguments so that the drop order matches the equivalent `fn`. Previously, async function arguments were lowered as shown below: async fn foo(<pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } After this PR, async function arguments will be lowered as: async fn foo(<pattern>: <ty>, <pattern>: <ty>, <pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>, __arg1: <ty>, __arg2: <ty>) { async move { let __arg2 = __arg2; let <pattern> = __arg2; let __arg1 = __arg1; let <pattern> = __arg1; let __arg0 = __arg0; let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } If `<pattern>` is a simple ident, then it is lowered to a single `let <pattern> = <pattern>;` statement as an optimization.
2019-04-28Implement internal lintsflip1995-10/+122
- USAGE_OF_QUALIFIED_TY - TY_PASS_BY_REFERENCE
2019-04-23Rollup merge of #59823 - davidtwco:issue-54716, r=cramertjMazdak Farrokhzad-0/+19
[wg-async-await] Drop `async fn` arguments in async block Fixes #54716. This PR modifies the HIR lowering (and some other places to make this work) so that unused arguments to a async function are always dropped inside the async move block and not at the end of the function body. ``` async fn foo(<pattern>: <type>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern>: <ty> = __arg0; } // <-- dropped as you "exit" the async block } ``` However, the exact ordering of drops is not the same as a regular function, [as visible in this playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=be39af1a58e5d430be1eb3c722cb1ec3) - I believe this to be an unrelated issue. There is a [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-t-compiler.2Fwg-async-await/topic/.2354716.20drop.20order) for this. r? @cramertj cc @nikomatsakis
2019-04-23Remove visit_subpats from check_pat in favor of state in ↵Tomas Koutsky-6/+5
EllipsisInclusiveRangePatterns
2019-04-21Introduce `ArgSource` for diagnostics.David Wood-0/+3
This commit introduces an `ArgSource` enum that is lowered into the HIR so that diagnostics can correctly refer to the argument pattern's original name rather than the generated pattern.