Mazdak Farrokhzad
0d01fbaeb8
Rollup merge of #58919 - estebank:impl-trait-return-lifetime, r=pnkfelix
...
Suggest using anonymous lifetime in `impl Trait` return
Fix #48467 .
r? @nikomatsakis
2019-04-01 17:29:51 +02:00
Mazdak Farrokhzad
dffdd8f728
Rollup merge of #58805 - fabric-and-ink:redundant_import, r=petrochenkov
...
Lint for redundant imports
Add lint for redundant imports. The changes are suggested by @petrochenkov.
Closes #10178 .
2019-03-31 19:19:47 +02:00
Esteban Küber
30c247f881
Suggest using anonymous lifetime in impl Trait return without hacks
...
Fallback to `static_impl_trait` for nice error message by peeking at the
return type and the lifetime type. Point at the return type instead of
the return expr/stmt in NLL mode.
2019-03-31 09:11:47 -07:00
Mazdak Farrokhzad
fb8396da84
Rollup merge of #59574 - JohnTitor:distinguish-error-vs-warning, r=Centril
...
Distinguish message for external macros depending on error level
fixes #57716
(I picked you because assigned to this issue.)
r? @estebank
2019-03-31 16:10:38 +02:00
Mazdak Farrokhzad
61222b5731
Rollup merge of #59572 - davidtwco:issue-59508, r=varkor
...
Include bounds in generic re-ordering diagnostic
Fixes #59508 .
r? @estebank
cc @varkor
2019-03-31 16:10:37 +02:00
David Wood
0270d565d9
Only mention const generics if enabled.
...
This commit updates the generic parameter re-ordering diagnostic to only
mention const generics if the feature is enabled.
2019-03-31 00:14:21 +01:00
David Wood
3829746ef9
Include bounds in generic reordering diagnostic.
...
This commit extends the existing generic re-ordering diagnostic to
include any bounds on the generic parameter, thus producing correct
suggestions.
2019-03-31 00:14:21 +01:00
Yuki OKUSHI
45c82abf13
Distinguish depending on error level
...
Remove unnecessary comment
2019-03-31 07:51:31 +09:00
Fabian Drinck
c244c411e4
Handle glob import in redundancy check
2019-03-30 22:37:02 +01:00
Fabian Drinck
df80eae985
Change message to present tense
2019-03-30 22:37:02 +01:00
Fabian Drinck
4a619aa126
Add glob import to redundancy test
2019-03-30 22:37:02 +01:00
Fabian Drinck
0f3b1c0358
Fix tests
2019-03-30 22:37:02 +01:00
Fabian Drinck
6e7b45e12b
Replace REDUNDANT_IMPORT with UNUSED_IMPORTS
2019-03-30 22:37:02 +01:00
Fabian Drinck
f9272364bf
Edit ui tests
2019-03-30 22:37:02 +01:00
Fabian Drinck
8919894c51
Distinguish between imported and defined items
2019-03-30 22:37:02 +01:00
Fabian Drinck
d04e83fe2c
Bless tests
2019-03-30 22:37:02 +01:00
Fabian Drinck
2245d10fac
Improve warning
2019-03-30 22:37:02 +01:00
Fabian Drinck
29d68edc6e
Add lint for redundant imports
...
Co-authored-by: Stephan Schauerte <stephan.schauerte@gmail.com>
2019-03-30 22:37:02 +01:00
Mazdak Farrokhzad
c9dca36a36
Rollup merge of #59463 - 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-30 14:14:55 +01:00
Mazdak Farrokhzad
41e64b6c5c
Rollup merge of #59455 - estebank:borrow-sugg-shorthand-field, r=davidtwco
...
Account for short-hand field syntax when suggesting borrow
Fix #52965 .
2019-03-30 07:51:37 +01:00
Mazdak Farrokhzad
c28704c2a8
Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkov
...
Recover from parse error in tuple syntax
2019-03-30 07:51:36 +01:00
Mazdak Farrokhzad
d050a157a8
Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, r=petrochenkov,QuietMisdreavus
...
RFC 2008: Enum Variants
Part of #44109 . See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140 ) for previous discussion.
r? @petrochenkov
cc @nikomatsakis
2019-03-30 07:51:34 +01:00
Esteban Küber
ee2a9d93e9
Suggest using anonymous lifetime in impl Trait return
2019-03-29 13:24:29 -07:00
Esteban Küber
3592079765
revert change to test file as per review request
2019-03-29 06:41:15 -07:00
Mazdak Farrokhzad
4aacc49ece
Rollup merge of #59486 - varkor:dead-code-impl, r=sanxiyn
...
Visit `ImplItem` in `dead_code` lint
Fixes https://github.com/rust-lang/rust/issues/47131 .
2019-03-29 12:32:30 +01:00
Mazdak Farrokhzad
c105f34fcb
Rollup merge of #59473 - estebank:borrow-sugg-inside-macro, r=davidtwco
...
Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans
Fix #58298 .
2019-03-29 12:32:28 +01:00
Mazdak Farrokhzad
fda206633d
Rollup merge of #59467 - hgallagher1993:local_branch, r=estebank
...
Better diagnostic for binary operation on BoxedValues
Fixes #59458
2019-03-29 12:32:26 +01:00
Esteban Küber
b7dc8e71cc
fix text after rebase
2019-03-28 19:58:00 -07:00
Mazdak Farrokhzad
f9262afa4d
Rollup merge of #59394 - mark-i-m:dup-matcher-bindings-2, r=Centril
...
warn -> deny duplicate match bindings
This is the next step of https://github.com/rust-lang/rust/issues/57742
r? @Centril
- [x] Decide whether to go to deny-by-default or hard error.
- My preference is to make this deny-by-default, rather than going straight to a hard error. The CI should fail because I haven't updated the ui test yet. I'll update it when we decide which to do.
- [x] Update [test](c25d6b8344/src/test/ui/macros/macro-multiple-matcher-bindings.rs )
- [ ] ~Crater run~ see https://github.com/rust-lang/rust/pull/59394#issuecomment-477817351
2019-03-29 02:40:48 +01:00
David Wood
3a88cd7778
Implement #[non_exhaustive] on variants.
...
This commit removes the check that disallows the `#[non_exhaustive]`
attribute from being placed on enum variants and removes the associated
tests.
Further, this commit lowers the visibility of enum variant constructors
when the variant is marked as non-exhaustive.
2019-03-28 22:29:02 +01:00
mark
9f14e146ed
deny duplicate matcher bindings by default
2019-03-28 14:27:16 -05:00
hgallagher1993
4644c3a6aa
Add check for when left and right overlap and change span for explanation to point at operator
2019-03-28 13:54:29 -04:00
Mazdak Farrokhzad
0f26958cea
Rollup merge of #59429 - estebank:for-loop-move-nll, r=petrochenkov
...
When moving out of a for loop head, suggest borrowing it in nll mode
Follow up to #59195 for NLL.
2019-03-28 13:35:44 +01:00
Mazdak Farrokhzad
06a9196055
Rollup merge of #59408 - euclio:compiletest-normalization, r=oli-obk
...
compiletest: make path normalization smarter
Fixes #59109 .
2019-03-28 13:35:43 +01:00
Mazdak Farrokhzad
a92d689b12
Rollup merge of #59371 - dlrobertson:rename_va_list_copy, r=joshtriplett
...
ffi: rename VaList::copy to VaList::with_copy
Rename `VaList::copy` to `VaList::with_copy`
r? @joshtriplett
2019-03-28 13:35:40 +01:00
Felix S. Klock II
528366d3ff
Revise and generalize the macros-unlinted tests.
...
Review feedback asked for the test to be generalized to include macros
2.0; that generalization is dyn-2015-idents-in-decl-macros-unlinted.rs
As a drive-by, I also decided to revise the test to make it clear
*why* we cannot generally lint these cases. (I already had similar
demonstrations in dyn-2015-edition-keyword-ident-lint.rs, but it does
not hurt to try to emphasize matters.)
I also added some commentary on the cases where we could choose to
make the lint smarter, namely the situations where a macro is
*definitely* using `dyn` as an identifier (because it is using it as a
path component).
2019-03-28 13:08:56 +01:00
Felix S. Klock II
f043d2da65
Revise test slightly so that dyn in macro invocation *must* be parsed as keyword in test.
...
Back-story: After reflection this morning, I realized that the
previous form of this test would allow the macro invocation to treat
the `dyn` input as a raw-identifier rather than a keyword, and since
the input was discarded by that version of the macro, the test would
pass despite the detail that the input `dyn` should not have been
parsed as a raw-identifier.
This revision fixes that oversight, by actually *using* the macro
input to construct a `Box<dyn Trait>` type.
2019-03-28 12:49:50 +01:00
Esteban Küber
e3918cf621
Recover from parse error in tuple syntax
2019-03-28 04:47:37 -07:00
Mazdak Farrokhzad
dcd531ea15
Rollup merge of #59198 - estebank:recovered-pattern, r=zackmdavis
...
Do not complain about unmentioned fields in recovered patterns
When the parser has to recover from malformed code in a pattern, do not
complain about missing fields.
Fix #59145 .
2019-03-28 08:43:32 +01:00
Esteban Küber
a51ca0268d
Expand test
2019-03-27 19:44:08 -07:00
Esteban Küber
4e7ec07bb9
Account for short-hand field syntax when suggesting borrow
2019-03-27 19:44:08 -07:00
Esteban Küber
326ec800b9
Account for fully overlapping multiline annotations
...
When two multiline span labels point at the same span, we special
case the output to avoid weird behavior:
```
foo(
_____^
|_____|
|| bar,
|| );
|| ^
||______|
|______foo
baz
```
instead showing
```
foo(
_____^
| bar,
| );
| ^
| |
|______foo
baz
```
2019-03-27 19:35:30 -07:00
Esteban Küber
925ca49cf1
Add test
2019-03-27 19:35:30 -07:00
Esteban Küber
0acb7867c2
Do not suggest borrowing when the span comes from a macro
2019-03-27 19:35:30 -07:00
varkor
40db5756b4
Add a regression test for #47131
2019-03-28 01:47:39 +00:00
Josh Stone
4a322f5fdd
Rollup merge of #59459 - JohnTitor:add-tests, r=Centril
...
Add some tests
close #52977
It seems that there are no tests for this issue, so I opened this PR.
off-topic: I noticed [this test](https://github.com/rust-lang/rust/blob/master/src/test/ui/existential_types/nested_existential_types.rs )'s indents are bad, could I include commit to fix this, or should I separate?
r? @oli-obk
2019-03-27 18:15:42 -07:00
Josh Stone
1e9e80fd91
Rollup merge of #59439 - Centril:generalize-assign-to-bool-diagnostic, r=oli-obk
...
Generalize diagnostic for `x = y` where `bool` is the expected type
Extracted out of https://github.com/rust-lang/rust/pull/59288 .
Currently we special case a diagnostic for `if x = y { ...` since the expected type is `bool` in this case and we instead suggest `if x == y`. This PR generalizes this such that given an expression of form `x = y` (`ExprKind::Assign(..)`) where the expected type is `bool`, we emit a suggestion `x == y`.
r? @oli-obk
Let's do a perf run to make sure this was not the source of regressions in #59288 .
2019-03-27 18:15:38 -07:00
Josh Stone
be34621ffc
Rollup merge of #59421 - estebank:tuple-index-suffix, r=petrochenkov
...
Reject integer suffix when tuple indexing
Fix #59418 .
r? @varkor
2019-03-27 18:15:35 -07:00
Josh Stone
e5fa59735b
Rollup merge of #59268 - estebank:from-string, r=QuietMisdreavus
...
Add suggestion to use `&*var` when `&str: From<String>` is expected
Fix #53879 .
2019-03-27 18:15:24 -07:00
Josh Stone
c818c1a1d6
Rollup merge of #57565 - petrochenkov:turbowarn, r=Centril
...
syntax: Remove warning for unnecessary path disambiguators
`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced).
One hardcoded warning less.
Closes https://github.com/rust-lang/rust/issues/58055
r? @nikomatsakis
2019-03-27 18:15:19 -07:00