Matthias Krüger
a108d55ce6
don't restuct references just to reborrow
2022-12-18 17:04:32 +01:00
Oli Scherer
a5cd3bde95
Ensure no one constructs AliasTys themselves
2022-12-14 15:36:39 +00:00
Michael Goulet
61adaf8187
Combine projection and opaque into alias
2022-12-13 17:48:55 +00:00
Michael Goulet
c13bd83528
squash OpaqueTy and ProjectionTy into AliasTy
2022-12-13 17:40:27 +00:00
Michael Goulet
7f3af72606
Use ty::OpaqueTy everywhere
2022-12-13 17:29:26 +00:00
bors
c6fcdb6906
Auto merge of #105416 - nnethercote:more-linting-tweaks, r=cjgillot
...
More linting tweaks
Squeeze a little more blood from this stone.
r? `@cjgillot`
2022-12-10 19:49:51 +00:00
Matthias Krüger
9e87dd907e
Rollup merge of #105505 - WaffleLapkin:yeet_unused_parens_lint, r=fee1-dead
...
Don't warn about unused parens when they are used by yeet expr
Don't even get me started on how I've found this.
2022-12-10 09:24:44 +01:00
Esteban Küber
fb3e4b349a
Account for macros in const generics
2022-12-09 15:21:12 -08:00
Maybe Waffle
84a46352ac
Don't warn about unused parens when they are used by yeet expr
2022-12-09 18:32:06 +00:00
Nicholas Nethercote
b08fd6e8ef
Inline some hot lint pass functions.
...
These each have a single call site, due to being called from a
"combined" lint pass.
2022-12-07 19:29:31 +11:00
Matthias Krüger
b29a4f9bac
Rollup merge of #105004 - TaKO8Ki:fix-104897, r=wesleywiser
...
Fix `emit_unused_delims_expr` ICE
Fixes #104897
This is also related to #104433 .
2022-12-06 16:54:53 +01:00
Takayuki Maeda
5c7278a364
return when expr has error
...
fmt
add a comment
2022-12-02 17:01:21 +09:00
Vadim Petrochenkov
b32a4edb20
rustc_ast_lowering: Stop lowering imports into multiple items
...
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01 18:51:20 +03:00
Arpad Borsos
2db0dc3297
Simplify checking for GeneratorKind::Async
...
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28 23:12:01 +01:00
Santiago Pastorino
974e2837bb
Introduce PredicateKind::Clause
2022-11-25 00:04:54 -03:00
Matthias Krüger
83d1aab9ff
Rollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obk
...
lint: do not warn unused parens around higher-ranked function pointers
Fixes #104397
2022-11-24 21:34:56 +01:00
Arpad Borsos
9f36f988ad
Avoid GenFuture shim when compiling async constructs
...
Previously, async constructs would be lowered to "normal" generators,
with an additional `from_generator` / `GenFuture` shim in between to
convert from `Generator` to `Future`.
The compiler will now special-case these generators internally so that
async constructs will *directly* implement `Future` without the need
to go through the `from_generator` / `GenFuture` shim.
The primary motivation for this change was hiding this implementation
detail in stack traces and debuginfo, but it can in theory also help
the optimizer as there is less abstractions to see through.
2022-11-24 10:04:27 +01:00
Michael Howell
97d95d48e2
lint: do not warn unused parens around higher-ranked function pointers
...
Fixes #104397
2022-11-23 17:57:11 -07:00
Manish Goregaokar
a673364c54
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
...
Refactor must_use lint into two parts
Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.
Also fixes an integer overflow in the array length pluralization
calculation.
fixes #104352
2022-11-22 22:54:39 -05:00
Cameron Steffen
34cbe72780
Change to Ty::is_inhabited_from
2022-11-20 19:04:11 -06:00
Nilstrieb
4e9ceef76d
Refactor must_use lint into two parts
...
Before, the lint did the checking for `must_use` and pretty printing the
types in a special format in one pass, causing quite complex and
untranslatable code.
Now the collection and printing is split in two. That should also make
it easier to translate or extract the type pretty printing in the
future.
Also fixes an integer overflow in the array length pluralization
calculation.
2022-11-19 20:07:18 +01:00
Dylan DPC
3c6fc06906
Rollup merge of #104566 - matthiaskrgr:clippy_perf_nov18, r=oli-obk
...
couple of clippy::perf fixes
2022-11-19 11:54:46 +05:30
bors
70fe5f08ff
Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov
...
Shrink `ast::Expr` harder
r? `@ghost`
2022-11-18 16:56:12 +00:00
Matthias Krüger
e3036df003
couple of clippy::perf fixes
2022-11-18 10:30:47 +01:00
Matthias Krüger
c9ccb0ba28
Rollup merge of #104433 - TaKO8Ki:fix-104392, r=estebank
...
Fix `emit_unused_delims_expr` ICE
Fixes #104392
2022-11-17 22:33:18 +01:00
Nicholas Nethercote
6b7ca2fcf2
Box ExprKind::{Closure,MethodCall}, and QSelf in expressions, types, and patterns.
2022-11-17 13:45:59 +11:00
Takayuki Maeda
1cf4132a16
return when expr has errors
...
add ui tests
2022-11-15 17:22:40 +09:00
Takayuki Maeda
061610640c
simplify emit_unused_delims_expr
2022-11-15 16:43:50 +09:00
bors
42325c525b
Auto merge of #104293 - Manishearth:rollup-xj92d0k, r=Manishearth
...
Rollup of 8 pull requests
Successful merges:
- #95292 (Allow specialized const trait impls.)
- #100386 (Make `Sized` coinductive, again)
- #102215 (Implement the `+whole-archive` modifier for `wasm-ld`)
- #103468 (Fix unused lint and parser caring about spaces to won't produce invalid code)
- #103531 (Suggest calling the instance method of the same name when method not found)
- #103960 (piece of diagnostic migrate)
- #104051 (update Miri)
- #104129 (rustdoc: use javascript to layout notable traits popups)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-11 20:11:07 +00:00
Esteban Küber
8bd8484972
review comments
2022-11-10 18:06:59 -08:00
Esteban Küber
243496e129
Consider #[must_use] annotation on async fn as also affecting the Future::Output
...
No longer lint against `#[must_use] async fn foo()`.
When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.
Fix #78149 .
2022-11-10 18:01:03 -08:00
Esteban Küber
50bb7a40e1
Tweak span for #[must_use]
...
Do not point at whole statement, only at the expression (skip pointing at `;`)
2022-11-10 18:01:02 -08:00
yukang
a46af18cb1
fix parentheses surrounding spacing issue in parser
2022-10-24 18:24:10 +08:00
yukang
c0447b489b
fix #103435 , unused lint won't produce invalid code
2022-10-24 16:51:31 +08:00
Nilstrieb
c65ebae221
Migrate all diagnostics
2022-10-23 10:09:44 +02:00
Michael Goulet
8509819aef
Elaborate supertrait bounds when triggering unused_must_use on impl Trait
2022-10-20 17:31:01 +00:00
Maybe Waffle
a8f7e244b7
Refactor rustc lint API
2022-10-01 10:03:06 +00:00
Eric Holk
6c01273a15
Plumb dyn trait representation through ty::Dynamic
2022-09-12 16:55:55 -07:00
Cameron Steffen
02ba216e3c
Refactor and re-use BindingAnnotation
2022-09-02 12:55:05 -05:00
Dezhi Wu
b1430fb7ca
Fix a bunch of typo
...
This PR will fix some typos detected by [typos].
I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.
[typos]: https://github.com/crate-ci/typos
2022-08-31 18:24:55 +08:00
Camille GILLOT
9701845287
Do not consider method call receiver as an argument in AST.
2022-08-10 18:34:54 +02:00
Camille GILLOT
db7ddc50b6
Do not manually craft a span pointing inside a multibyte character.
2022-08-07 13:12:54 +02:00
wcampbell
8dd44f1af4
Enable unused_parens for match arms
2022-08-04 07:16:39 -04:00
David Wood
4f7b10f484
lint: port unused allocation diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com >
2022-06-30 08:59:22 +01:00
David Wood
e24833869f
lint: port unused import braces diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com >
2022-06-30 08:59:22 +01:00
David Wood
fc4f8d9bc2
lint: port unused delimiter diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com >
2022-06-30 08:59:22 +01:00
David Wood
2829f519a0
lint: port path statement diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com >
2022-06-30 08:59:22 +01:00
David Wood
1999a4c421
lint: port unused diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com >
2022-06-30 08:59:21 +01:00
Takayuki Maeda
77d6176e69
remove unnecessary to_string and String::new
2022-06-13 15:48:40 +09:00
lcnr
6c8265dc56
only_local: always check for misuse
2022-05-10 12:07:35 +02:00