about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2018-02-26Update UI testsVadim Petrochenkov-7/+7
2018-02-26Update UI testsVadim Petrochenkov-80/+80
2018-02-25Update ui testsGuillaume Gomez-0/+2
2018-02-20Fix internal references to bad_style in test code.boats-3/+3
2018-02-20Fix filepath in lint test.boats-10/+10
2018-02-20Fix carets.boats-5/+5
2018-02-20Add nonstandard_style alias for bad_style.boats-0/+103
2018-02-07Rollup merge of #47922 - ↵Manish Goregaokar-0/+74
zackmdavis:and_the_case_of_the_unused_field_pattern, r=estebank correct unused field pattern suggestions ![unused_field_pattern_local](https://user-images.githubusercontent.com/1076988/35662336-7a69488a-06cc-11e8-9901-8d22b5cf924f.png) r? @estebank
2018-02-04Rollup merge of #47896 - ↵kennytm-0/+55
zackmdavis:and_the_case_of_the_necessary_unnecessary_parens, r=nikomatsakis decline to lint technically-unnecessary parens in function or method arguments inside of nested macros In #46980 ("in which the unused-parens lint..." (14982db2d6)), the unused-parens lint was made to check function and method arguments, which it previously did not (seemingly due to oversight rather than willful design). However, in #47775 and discussion thereon, user–developers of Geal/nom and graphql-rust/juniper reported that the lint was seemingly erroneously triggering on certain complex macros in those projects. While this doesn't seem like a bug in the lint in the particular strict sense that the expanded code would, in fact, contain unncecessary parentheses, it also doesn't seem like the sort of thing macro authors should have to think about: the spirit of the unused-parens lint is to prevent needless clutter in code, not to give macro authors extra heartache in the handling of token trees. We propose the expediency of declining to lint unused parentheses in function or method args inside of nested expansions: we believe that this should eliminate the petty, troublesome lint warnings reported in the issue, without forgoing the benefits of the lint in simpler macros. It seemed like too much duplicated code for the `Call` and `MethodCall` match arms to duplicate the nested-macro check in addition to each having their own `for` loop, so this occasioned a slight refactor so that the function and method cases could share code—hopefully the overall intent is at least no less clear to the gentle reader. This is concerning #47775.
2018-01-31concerning well-formed suggestions for unused shorthand field patternsZack M. Davis-0/+74
Previously, unused variables would get a note that the warning could be silenced by prefixing the variable with an underscore, but that doesn't work for field shorthand patterns, which the liveness analysis didn't know about. The "to avoid this warning" verbiage seemed unnecessary. Resolves #47390.
2018-01-30wherein the parens lint keeps its own counsel re args in nested macrosZack M. Davis-0/+55
In #46980 ("in which the unused-parens lint..." (14982db2d6)), the unused-parens lint was made to check function and method arguments, which it previously did not (seemingly due to oversight rather than willful design). However, in #47775 and discussion thereon, user–developers of Geal/nom and graphql-rust/juniper reported that the lint was seemingly erroneously triggering on certain complex macros in those projects. While this doesn't seem like a bug in the lint in the particular strict sense that the expanded code would, in fact, contain unncecessary parentheses, it also doesn't seem like the sort of thing macro authors should have to think about: the spirit of the unused-parens lint is to prevent needless clutter in code, not to give macro authors extra heartache in the handling of token trees. We propose the expediency of declining to lint unused parentheses in function or method args inside of nested expansions: we believe that this should eliminate the petty, troublesome lint warnings reported in the issue, without forgoing the benefits of the lint in simpler macros. It seemed like too much duplicated code for the `Call` and `MethodCall` match arms to duplicate the nested-macro check in addition to each having their own `for` loop, so this occasioned a slight refactor so that the function and method cases could share code—hopefully the overall intent is at least no less clear to the gentle reader. This is concerning #47775.
2018-01-26Consider all whitespace when preparing spanEsteban Küber-28/+46
2018-01-26Include space in suggestion `mut` in bindingsEsteban Küber-1/+1
2018-01-16in which the private no-mangle lints receive a valued lesson in humilityZack M. Davis-10/+32
The incompetent fool who added these suggestions in 38e5a964f2 apparently thought it was safe to assume that, because the offending function or static was unreachable, it would therefore have not have any existing visibility modifiers, making it safe for us to unconditionally suggest inserting `pub`. This isn't true. This resolves #47383.
2018-01-02Correct for changes in line numbers in expected stderr output.Ed Schouten-58/+58
Due to the disable-cloudabi tags being added to the source files, the expected output of the compiler is altered slightly.
2018-01-02Add 'ignore-cloudabi' to tests that don't and won't build on CloudABI.Ed Schouten-0/+1
It looks like many of these tests are already disabled on emscripten, which also doesn't seem to support environment variables and subprocess spawning. Just add a similar tag for CloudABI. While there, sort some of the lists of operating systems alphabetically.
2017-12-19Point at `while true` span instead of entire blockEsteban Küber-12/+2
2017-12-11Auto merge of #46608 - estebank:resolve-return, r=nikomatsakisbors-2/+2
Resolve type on return type suggestion Partially address #45871.
2017-12-10Update ui tests' line numbers.Tommy Ip-84/+84
2017-12-10Add must-compile-successfully comment to appropriate ui tests.Tommy Ip-0/+9
2017-12-09Resolve type on return type suggestionEsteban Küber-2/+2
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-42/+51
2017-11-20Update ui test to rustc masterOliver Schneider-1/+0
2017-11-20Include rendered diagnostic in jsonOliver Schneider-16/+137
2017-11-06Auto merge of #45737 - oli-obk:json, r=petrochenkovbors-5/+383
Pretty print json in ui tests I found the json output in one line to not be useful for reviewing r? @petrochenkov
2017-11-06Adjust json errors to byte changesOliver Schneider-32/+32
2017-11-03Auto merge of #45569 - zackmdavis:unexported_pub_lint, r=petrochenkovbors-0/+411
`unreachable-pub` lint (as authorized by RFC 2126) To whom it may concern: RFC 2126 commissions the creation of a lint for `pub` items that are not visible from crate root (#45521). We understand (but seek confirmation from more knowledgable compiler elders) that this can be implemented by linting HIR items that are _not_ ~~`cx.access_levels.is_exported`~~ `cx.access_levels.is_reachable` but have a `vis` (-ibility) field of `hir::Visibility::Public`. The lint, tentatively called ~~`unexported-pub`~~ `unreachable-pub` (with the understanding that much could be written on the merits of various names, as it is said of the colors of bicycle-sheds), suggests `crate` as a replacement for `pub` if the `crate_visibility_modifier` feature is enabled (see #45388), and `pub(crate)` otherwise. We also use help messaging to suggest the other potential fix of exporting the item; feedback is desired as to whether this may be confusing or could be worded better. As a preview of what respecting the proposed lint would look like (and to generate confirmatory evidence that this implementation doesn't issue false positives), ~~we take its suggestions for `libcore`~~ (save one, which is deferred to another pull request because it brings up an unrelated technical matter). I remain your obedient servant. ![unexported_pub](https://user-images.githubusercontent.com/1076988/32089794-fbd02420-baa0-11e7-87e5-3ec01f18924a.png) r? @petrochenkov
2017-11-03Don't add a new -Z flag, reuse -Zunstable-optionsOliver Schneider-2/+2
2017-11-03Pretty print json in ui testsOliver Schneider-5/+383
2017-11-02unreachable-pub lint for `pub` items not reachable from crate rootZack M. Davis-0/+411
This is with deepest thanks to Vadim Petrochenkov for thorough review, and resolves #45521.
2017-11-02Report lint names in json diagnosticsOliver Schneider-1/+1
2017-10-29Add several lints into `unused` lint groupVadim Petrochenkov-4/+10
Remove a couple of obsolete lints
2017-10-24Reduce the repetition in json error outputOliver Schneider-2/+2
2017-10-24Add a test reproducing the quadratic json explosionOliver Schneider-0/+23
2017-10-19Auto merge of #45080 - clippered:issue-44986/fix-windows-ui-path, r=estebankbors-3/+1
Issue 44986/fix windows ui path #44968
2017-10-16bolster UI test converage for lint suggestionsZack M. Davis-11/+83
2017-10-14rustc: Remove `used_mut_nodes` from `TyCtxt`Alex Crichton-14/+14
This updates the borrowck query to return a result, and this result is then used to incrementally check for unused mutable nodes given sets of all the used mutable nodes. Closes #42384
2017-10-11Fix #44968 Windows path in UI testsclippered-3/+1
2017-10-01correct unused-parens lint suggestion to strip exact pairZack M. Davis-0/+26
2017-09-30code suggestions for unused-mut, while-true lints; UI testZack M. Davis-0/+65
2017-09-15RFC 1940 UI test in own directory, exercise must_use trait methodsZack M. Davis-53/+0
(It was put forward that all tests related to a feature being in their own directory makes stabilization decisionmaking more convenient.)
2017-08-31add a lowercase suggestion to unknown_lintsAndre Bogus-0/+41
2017-08-22hard feature-gate for #[must_use] on functionsZack M. Davis-6/+7
We'll actually want a new "soft" warning-only gate to maintain backwards-compatibility, but it's cleaner to start out with the established, well-understood gate before implementing the alternative warn-only behavior in a later commit. This is in the matter of #43302.
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-18/+29
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-08#[must_use] for functions (RFC 1940)Zack M. Davis-0/+47
The return value of a function annotated with `must_use`, must be used. This is in the matter of #43302.
2017-07-02report the total number of errors on compilation failureAriel Ben-Yehuda-1/+1
Prior to this PR, when we aborted because a "critical pass" failed, we displayed the number of errors from that critical pass. While that's the number of errors that caused compilation to abort in *that place*, that's not what people really want to know. Instead, always report the total number of errors, and don't bother to track the number of errors from the last pass that failed. This changes the compiler driver API to handle errors more smoothly, and therefore is a compiler-api-[breaking-change]. Fixes #42793.
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-3/+3
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-06-29Rollup merge of #42919 - zackmdavis:once_again_we_heard_you_the_first_time, ↵Ariel Ben-Yehuda-5/+5
r=eddyb make lint on-by-default/implied-by messages appear only once From review discussion on #38103 (https://github.com/rust-lang/rust/pull/38103#discussion_r94845060). ![we_heard](https://user-images.githubusercontent.com/1076988/27564103-6284b78e-5a8a-11e7-9d35-f7f297ca9573.png) r? @nikomatsakis
2017-06-26make lint on-by-default/implied-by messages appear only onceZack M. Davis-5/+5
From review discussion on #38103 (https://github.com/rust-lang/rust/pull/38103#discussion_r94845060).
2017-06-23only set "overruled by outer forbid" once for lint groups, by group nameZack M. Davis-0/+51
Previously, conflicting forbid/allow attributes for a lint group would result in a separate "allow(L) overruled by outer forbid(L)" error for every lint L in the group. This was needlessly and annoyingly verbose; we prefer to just have one error pointing out the conflicting attributes. Resolves #42873.