Commit graph

7633 commits

Author SHA1 Message Date
bors
e32b66c871 Auto merge of #8906 - rust-lang:copy-large-enum-variants, r=Jarcho
remove `large_enum_variant` suggestion for `Copy` types

Replaces the (erroneous) suggestion on `large_enum_variant` for `Copy` types by a note. This fixes #8894.

---

changelog: none
2022-06-02 16:37:09 +00:00
dswij
678dcdd2be Apply needless_return suggestions 2022-06-02 20:22:15 +08:00
dswij
b885035ef7 needless_return checks for macro expr in return stmts 2022-06-02 20:22:15 +08:00
bors
9428e2e25e Auto merge of #8905 - c410-f3r:arith, r=llogiq
[1/N] Implement Arithmetic lint

Assuming that https://github.com/rust-lang/rust-clippy/issues/8903 is OK, this PR starts the creation of the `Arithmetic` lint with configurable types.

My current struggle to get a rustc review inspired me to create smaller PRs in order to easy review and make merges as fast as possible. So the first step here only moves the `arithmetic.rs` file to `numeric_arithmetic.rs` to make room for the new lint.

--
changelog: none
2022-06-02 12:05:27 +00:00
Andre Bogus
756caf79e6 account for generics 2022-06-02 12:45:15 +02:00
Preston From
bc5a8e9537 Lint message correctly identifies match vs for loop 2022-06-02 02:38:57 -06:00
bors
0d5ace3ed2 Auto merge of #8908 - Serial-ATA:doc-comment-issues, r=xFrednet
Make docs more consistent

changelog: none

This just fixes some docs to make them more consistent. I mostly just changed `// Good`, `// Bad`, etc to `Use instead:`.
2022-06-02 07:38:01 +00:00
kyoto7250
007fae10ed fix(manual_find_map and manual_filter_map): check clone method 2022-06-02 09:54:14 +09:00
Serial
b20f95c1a1 Combine doc examples 2022-06-01 18:53:15 -04:00
bors
7572b6b757 Auto merge of #8869 - Jarcho:derive_partial_eq_without_eq, r=flip1995
Set correct `ParamEnv` for `derive_partial_eq_without_eq`

fixes #8867

changelog: Handle differing predicates applied by `#[derive(PartialEq)]` and `#[derive(Eq)]` in `derive_partial_eq_without_eq`
2022-06-01 19:27:54 +00:00
bors
c4c413b6fc Auto merge of #7930 - lengyijun:needless_deref_new, r=Jarcho
new lint: `borrow_deref_ref`

changelog: ``[`borrow_deref_ref`]``

Related pr: #6837 #7577
`@Jarcho` Could you please give a review?

`cargo lintcheck` gives no false negative (but tested crates are out-of-date).

TODO:
1. Not sure the name. `deref_on_immutable_ref` or some others?
2022-06-01 16:43:14 +00:00
Nicholas Nethercote
11d22ae7c5 Lazify SourceFile::lines.
`SourceFile::lines` is a big part of metadata. It's stored in a compressed form
(a difference list) to save disk space. Decoding it is a big fraction of
compile time for very small crates/programs.

This commit introduces a new type `SourceFileLines` which has a `Lines`
form and a `Diffs` form. The latter is used when the metadata is first
read, and it is only decoded into the `Lines` form when line data is
actually needed. This avoids the decoding cost for many files,
especially in `std`. It's a performance win of up to 15% for tiny
crates/programs where metadata decoding is a high part of compilation
costs.

A `Lock` is needed because the methods that access lines data (which can
trigger decoding) take `&self` rather than `&mut self`. To allow for this,
`SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather
than returning the lines slice.
2022-06-01 10:36:39 +10:00
Jason Newcomb
ca78e2428e Add lint swap_ptr_to_ref 2022-05-31 13:08:05 -04:00
bors
5b1a4c0d76 Auto merge of #8884 - evantypanski:manual_range_contains_multiple, r=Manishearth
Fix `manual_range_contains` false negative with chains of `&&` and `||`

Fixes #8745

Since the precedence for `&&` is the same as itself the HIR for a chain of `&&` ends up with a right skewed tree like:

```
     &&
    /  \
  &&   c2
 /  \
... c1
```

So only the leftmost `&&` was actually "fully" checked, the top level was just `c2` and `&&` so the `manual_range_contains` lint won't apply. This change makes it also check `c2` with `c1`.

There's a bit of a hacky solution in the [second commit](257f09776a) to check if the number of open/closing parens in the snippet match. This is to prevent a case like `((x % 2 == 0) || (x < 0)) || (x >= 10)` from offering a suggestion like `((x % 2 == 0) || !(0..10).contains(&x)` which now won't compile.

Any suggestions for that paren hack welcome, kinda new to working on this so not too sure about possible solutions :) it's weird because I don't know how else to check for parens in HIR considering they're removed when lowering AST.

changelog: Fix [`manual_range_contains`] false negative with chains of `&&` and `||`
2022-05-31 16:17:12 +00:00
bors
7000e758c1 Auto merge of #8564 - Jarcho:transmute_erase_regions, r=Alexendoo
Don't lint `useless_transmute` on types with erased regions

fixes #6356
fixes #3340
fixes #2906

This should get a proper fix at some point, but this at least gets the lint running on some types.

cc #5343

changelog: Don't lint `useless_transmute` on types with erased regions
2022-05-31 15:57:27 +00:00
bors
9add456618 Auto merge of #8876 - Alexendoo:cast-abs-to-different-uint, r=dswij,xFrednet
`cast_abs_to_unsigned`: do not remove cast if it's required

Fixes #8873

If `iX` is not cast to `uX` then keep the cast rather than removing it

changelog: [`cast_abs_to_unsigned`]: do not remove cast if it's required
2022-05-31 15:40:03 +00:00
Jason Newcomb
0c6ebf1c6a Move useless_transmute back to complexity 2022-05-31 10:40:40 -04:00
Jason Newcomb
9c9cca3e66 Don't lint useless_transmute on types with erased regions 2022-05-31 10:39:53 -04:00
bors
2466a0507c Auto merge of #8918 - Jarcho:almost_complete_letter_range, r=llogiq
Add lint `almost_complete_letter_range`

fixes #7269

changelog: Add lint `almost_complete_letter_range`
2022-05-31 05:10:42 +00:00
Jason Newcomb
eb2908b4ea Add lint almost_complete_letter_range 2022-05-30 23:20:04 -04:00
bors
e1607e9d31 Auto merge of #8912 - Alexendoo:needless-late-init-ice, r=giraffate
needless_late_init: fix ICE when all branches return the never type

Fixes #8911

When the assignment is done in a match guard or the if condition and all of the branches return the never type `assignment_suggestions` would return an empty `Vec` which caused the ICE. It now returns `None` in that scenario

Also moves some tests to the top of the file

changelog: ICE Fixes: [`needless_late_init`] #8911
2022-05-31 00:46:52 +00:00
bors
588e1982d3 Auto merge of #8913 - InfRandomness:ICE-#8748, r=giraffate
Fix #8748

Thank you for making Clippy better!

changelog: Fix ICE #8748 in shadow.rs
2022-05-31 00:17:52 +00:00
bors
d9f497830c Auto merge of #8899 - botahamec:use-self-tuple-struct-variants, r=Alexendoo
Fix `[use_self]` false negative with on struct and tuple struct patterns

fixes #8845

changelog: Triggered the warning for ``[`use_self`]`` on `TupleStruct` and `Struct` patterns, whereas currently it's only triggered for `Path` patterns
2022-05-30 22:05:13 +00:00
InfRandomness
0a7f19b547 Fix #8748 2022-05-30 22:46:31 +02:00
Micha White
2aa4569303
Triggered the lint on tuple struct and struct patterns 2022-05-30 13:39:18 -04:00
lyj
c5410150eb needless_deref 2022-05-30 01:46:15 +00:00
Alex Macleod
722f7d28c3 needless_late_init: fix ICE when all branches return the never type 2022-05-29 18:39:27 +00:00
Serial
cfd0f5592b Make docs more consistent 2022-05-28 09:48:26 -04:00
llogiq
c9be57dbf3
Merge branch 'master' into doc_link_with_quotes 2022-05-28 10:55:25 +02:00
kyoto7250
6fd2c6de90 fix(lint): check const context
https://github.com/rust-lang/rust-clippy/issues/8898
2022-05-28 14:45:25 +09:00
Andre Bogus
19f94d52b3 remove large_enum_variant suggestion for Copy types 2022-05-28 01:36:05 +02:00
Caio
4fc0ee6260 [1/N] Implement Arithmetic lint 2022-05-27 18:53:02 -03:00
bors
1dd55471b4 Auto merge of #8892 - smoelius:fix-empty-line-false-positive, r=Manishearth
Fix `empty_line_after_outer_attribute` false positive

This PR fixes a false positive in `empty_line_after_outer_attribute`.

Here is a minimal example that trigger the FP:
```rust
#[derive(clap::Parser)]
#[clap(after_help = "This ia a help message.

You're welcome.
")]
pub struct Args;
```

changelog: PF: [`empty_line_after_outer_attribute`]: No longer lints empty lines in inner string values.
2022-05-27 20:34:06 +00:00
bors
461a6613cf Auto merge of #8897 - tamaroning:improve_dbg, r=Alexendoo
Introduce `allow-dbg-in-tests` config value

related to: Issue #8758,  PR https://github.com/rust-lang/rust-clippy/pull/8838

changelog: Introduced `allow-dbg-in-tests` config value. [dbg_macro] does not allow `dbg!` in test code by default.
2022-05-27 19:41:39 +00:00
Preston From
e33d87d4a0 When setting suggestion, add suggestion for MoveAndClone for non-ref
When trying to set the current suggestion, if the type of the expression
is not a reference and it is not trivially pure clone copy, we should still
trigger and emit a lint message. Since this fix may require cloning an
expensive-to-clone type, do not attempt to offer a suggested fix.

This change means that matches generated from TryDesugar and AwaitDesugar
would normally trigger a lint, but they are out of scope for this lint,
so we will explicitly ignore matches with sources of TryDesugar or
AwaitDesugar.

changelog: Update for [`significant_drop_in_scrutinee`] to correctly
emit lint messages for cases where the type is not a reference and
not trivially pure clone copy.
2022-05-27 00:08:49 -06:00
bors
a5ece8132f Auto merge of #8885 - Serial-ATA:rc-clone-in-vec-init-weak, r=llogiq
Support `Weak` in [`rc_clone_in_vec_init`]

changelog: Support `Weak` in [`rc_clone_in_vec_init`]
2022-05-27 04:02:53 +00:00
Serial
fc28f6acc8 Support Weak in [rc_clone_in_vec_init] 2022-05-26 21:52:25 -04:00
tamaron
ea06a414f1 fix 2022-05-27 01:30:44 +09:00
bors
bc4d39e5fe Auto merge of #8866 - botahamec:unused-rounding, r=llogiq
Add new lint `[unused_rounding]`

fixes #39

changelog: added a ``[`unused_rounding`]`` lint to check for the rounding of whole-number literals
2022-05-26 05:16:37 +00:00
Samuel E. Moelius III
9ee211af9f Fix empty_line_after_outer_attribute false positive 2022-05-25 19:35:26 -04:00
bors
45785fe1ee Auto merge of #8889 - Serial-ATA:remove-newlines, r=xFrednet
Remove newlines in [`match_str_case_mismatch`] example

changelog: none
2022-05-25 21:59:28 +00:00
Serial
1c573c7f18 Remove newlines in [match_str_case_mismatch] example 2022-05-25 17:37:57 -04:00
Serial
45be175eeb Collect renamed lints 2022-05-25 17:31:21 -04:00
Ding Xiang Fei
2f250783b1 try to cache region_scope_tree as a query 2022-05-25 13:52:32 +08:00
Micha White
f489954e3e
Changed the lint description 2022-05-24 22:53:35 -04:00
Micha White
4de301e394
Fixed the test to not use an epsilon 2022-05-24 22:53:35 -04:00
Micha White
d8a281ef73
Added an unused_rounding lint 2022-05-24 22:53:29 -04:00
kyoto7250
d0f93c12a2 refactor: get the required variables with MethodCall 2022-05-25 09:11:29 +09:00
kyoto7250
b531eb1a7a suggest first() instead of get(0) 2022-05-25 09:08:25 +09:00
kyoto7250
1dd026698d feat(lint): impl lint about use first() instead of get(0) 2022-05-25 09:08:23 +09:00
bors
b97784fd07 Auto merge of #8862 - Alexendoo:get-last-with-len, r=Jarcho,xFrednet
`get_last_with_len`: lint `VecDeque` and any deref to slice

changelog: [`get_last_with_len`]: lint `VecDeque` and any deref to slice

Previously only `Vec`s were linted, this will now catch any usages on slices, arrays, etc. It also suggests `.back()` for `VecDeque`s

Also moves the lint into `methods/`
2022-05-24 21:40:15 +00:00
bors
c41c410a90 Auto merge of #8786 - Alexendoo:identity-op-suggestions, r=dswij,xFrednet
`identity_op`: add parenthesis to suggestions where required

changelog: [`identity_op`]: add parenthesis to suggestions where required

Follow up to #8730, wraps the cases we can't lint as-is in parenthesis rather than ignoring them

Catches a couple new FPs with mixed operator precedences and `as` casts

```rust
// such as
0 + { a } * 2;
0 + a as usize;
```

The suggestions are now applied using `span_lint_and_sugg` rather than appearing in just the message and have a `run-rustfix` test
2022-05-24 20:47:34 +00:00
Evan Typanski
257f09776a Fix issue with mismatched parens in suggestion 2022-05-24 14:57:49 -04:00
bors
fbb9e565e3 Auto merge of #8754 - guerinoni:no_effect_replace, r=llogiq
New lint `no_effect_replace`

Closes #1595

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>

changelog: Add [`no_effect_replace`] lint.
2022-05-24 16:55:06 +00:00
Evan Typanski
78f7e3745f Fix manual_range_contains with equal precedence 2022-05-24 11:50:12 -04:00
Federico Guerinoni
ea62347a5a New lint no_effect_replace
Closes #1595

changelog: Add no_effect_replace lint.
2022-05-24 11:08:41 +02:00
bors
286b717808 Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk
Refactor call terminator to always include destination place

In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things.

cc `@RalfJung` `@eddyb` who were involved in the original conversation

r? rust-lang/mir-opt
2022-05-24 07:13:26 +00:00
Yuki Okushi
1f3116f806 Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum
Lifetime variance fixes for clippy

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the clippy team can review independently.
2022-05-24 12:18:31 +09:00
Jakob Degen
0684d62b56 Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
Michael Goulet
0ad3a0ac07 Lifetime variance fixes for clippy 2022-05-23 09:34:49 -07:00
Alex Macleod
a342f52f91 cast_abs_to_unsigned: do not remove cast if it's required 2022-05-23 12:23:48 +00:00
David Tolnay
8ec9e5e161 Fix clippy explicit_write lint for new writeln implementation 2022-05-22 17:39:56 -07:00
Jason Newcomb
5cf07c6d29 Set correct ParamEnv for derive_partial_eq_without_eq 2022-05-22 12:19:10 -04:00
Ding Xiang Fei
e885157f03 factor out the rvalue lifetime rule
remove region_scope_tree from RegionCtxt

Apply suggestions from code review

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-05-22 16:46:50 +08:00
Alex Macleod
855849034c get_last_with_len: lint VecDeque and any deref to slice
previously only vecs were supported
2022-05-21 19:52:43 +00:00
xFrednet
fc965c7300 Fix lint registration 2022-05-21 13:50:11 +02:00
xFrednet
4587b6628d Merge 'rust-clippy/master' into clippyup 2022-05-21 13:24:00 +02:00
bors
8d04a32ab4 Auto merge of #96923 - eholk:fix-fake-read, r=nikomatsakis
Drop Tracking: Implement `fake_read` callback

This PR updates drop tracking's use of `ExprUseVisitor` so that we treat `fake_read` events as borrows. Without doing this, we were not handling match expressions correctly, which showed up as a breakage in the `addassign-yield.rs` test. We did not previously notice this because we still had rather large temporary scopes that we held borrows for, which changed in #94309.

This PR also includes a variant of the `addassign-yield.rs` test case to make sure we continue to have correct behavior here with drop tracking.

r? `@nikomatsakis`
2022-05-21 04:21:38 +00:00
bors
b312ad7d0c Auto merge of #8856 - xFrednet:rustup, r=Manishearth,Alexendoo
Rustup

`@rust-lang/clippy,` `@Jarcho,` `@dswij,` `@Alexendoo.` Could someone review this? It should be pretty straight forward since it's just a sync. I think it's also fine if either one of `@Jarcho,` `@dswij,` `@Alexendoo` approves this, as these are usually not reviewed. I just want to make sure that I didn't break something obvious 🙃

It should be enough to look at the merge commit 🙃

changelog: none
changelog: move [`significant_drop_in_scrutinee`] to `suspicious`
2022-05-20 21:35:14 +00:00
xFrednet
7842dbc4f5
Remove duplicated code and ignore deadlock test 2022-05-20 23:32:58 +02:00
xFrednet
8283238973
Update clippy version 0.1.62 -> 0.1.63 2022-05-20 21:12:41 +02:00
xFrednet
5b72632c98
move to sus and fix dogfood 2022-05-20 21:03:24 +02:00
xFrednet
4e6cf0036e
Merge remote-tracking branch 'upstream/master' into rustup 2022-05-20 20:47:31 +02:00
Alex Macleod
5730fd49fa Lint indirect usages in disallowed_methods 2022-05-20 12:39:15 +00:00
bors
6f26383f8e Auto merge of #8841 - Serial-ATA:remove-code-block, r=xFrednet
Remove code block from `pub_enum_variant_names`

changelog: none

Just noticed this empty code block that no other lint has 😄.
![old](https://user-images.githubusercontent.com/69764315/169314573-098ce938-8a4c-4451-afd7-7b082823a0de.png)

r? `@xFrednet`
2022-05-19 21:46:18 +00:00
bors
ea96091331 Auto merge of #8838 - tamaroning:fix_dbg, r=Jarcho,xFrednet
[dbg_macro] tolerates use of `dbg!` in items which have `#[cfg(test)]` attribute

fix: #8758
changelog: [dbg_macro] tolerates use of `dbg!` in items with `#[cfg(test)]` attribute
2022-05-19 15:46:35 +00:00
Serial
944e1bbca3 Remove code block from pub_enum_variant_names 2022-05-19 10:10:55 -04:00
bors
01421e0cbd Auto merge of #96863 - SparrowLii:let, r=michaelwoerister
use `hir::Let` in `hir::Guard::IfLet`

This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`
2022-05-18 17:48:46 +00:00
bors
b6ad6fc5aa Auto merge of #8823 - smoelius:unknown-field, r=xFrednet
Improve "unknown field" error messages

Fixes #8806

Sample output:
```
error: error reading Clippy's configuration file `/home/smoelius/github/smoelius/rust-clippy/clippy.toml`: unknown field `foobar`, expected one of
           allow-expect-in-tests              enable-raw-pointer-heuristic-for-send    standard-macro-braces
           allow-unwrap-in-tests              enforced-import-renames                  third-party
           allowed-scripts                    enum-variant-name-threshold              too-large-for-stack
           array-size-threshold               enum-variant-size-threshold              too-many-arguments-threshold
           avoid-breaking-exported-api        literal-representation-threshold         too-many-lines-threshold
           await-holding-invalid-types        max-fn-params-bools                      trivial-copy-size-limit
           blacklisted-names                  max-include-file-size                    type-complexity-threshold
           cargo-ignore-publish               max-struct-bools                         unreadable-literal-lint-fractions
           cognitive-complexity-threshold     max-suggested-slice-pattern-length       upper-case-acronyms-aggressive
           cyclomatic-complexity-threshold    max-trait-bounds                         vec-box-size-threshold
           disallowed-methods                 msrv                                     verbose-bit-mask-threshold
           disallowed-types                   pass-by-value-size-limit                 warn-on-all-wildcard-imports
           doc-valid-idents                   single-char-binding-names-threshold
       at line 1 column 1
```

You can test this by (say) adding `foobar = 42` to Clippy's root `clippy.toml` file, and running `cargo run --bin cargo-clippy`.

Note that, to get the terminal width, this PR adds `termize` as a dependency to `cargo-clippy`. However, `termize` is also [how `rustc_errors` gets the terminal width](481db40311/compiler/rustc_errors/src/emitter.rs (L1607)). So, hopefully, this is not a dealbreaker.

r? `@xFrednet`

changelog: Enhancements: the "unknown field" error messages for config files now wraps the field names.
2022-05-18 17:15:38 +00:00
Samuel E. Moelius III
564725775b Improve "unknown field" error messages 2022-05-18 05:21:10 -04:00
bors
bf2e63104d Auto merge of #8807 - Jarcho:cmp_owned, r=giraffate
Fix `cmp_owned` on copy types

fixes #8803
fixes #7365

changelog: Don't lint `cmp_owned` on `From::from` for copy types
2022-05-18 00:19:36 +00:00
tamaron
b4c3f0f79b fix 2022-05-18 00:37:12 +09:00
bors
d901079ca1 Auto merge of #8814 - yonip23:add-suggestion-to-rc-clone-in-vec-init, r=xFrednet
add suggestions to rc_clone_in_vec_init

A followup to https://github.com/rust-lang/rust-clippy/pull/8769
I also switch the order of the 2 suggestions, since the loop initialization one is probably the common case.

`@xFrednet` I'm not letting you guys rest for a minute 😅
changelog: add suggestions to [`rc_clone_in_vec_init`]
2022-05-17 05:46:00 +00:00
SparrowLii
d7a6654580 Change Successors to impl Iterator<Item = BasicBlock> 2022-05-17 08:41:01 +08:00
Jason Newcomb
c649d4e8a7 Fix ICE in let_unit_value when calling a static or const callable type 2022-05-16 10:00:32 -04:00
bors
a1632fffc1 Auto merge of #8761 - tamaroning:fix_8505, r=Jarcho
`undocumented_unsafe_blocks` does not trigger on unsafe trait impls

Closes #8505

changelog: This lint checks unsafe impls NOT from macro expansions and checks ones in macro declarations.
~~`unsafe impl`s from macro invocations don't trigger the lint for now.~~
~~This lint checks unsafe impls from/not from macro expansions~~
2022-05-16 00:47:10 +00:00
bors
6ec735962f Auto merge of #8699 - Jarcho:vec_init_then_push_7071, r=dswij,xFrednet
Don't lint `vec_init_then_push` when further extended

fixes #7071

This will still lint when a larger number of pushes are done (four currently). The exact number could be debated, but this is more readable then a sequence of pushes so it shouldn't be too large.

changelog: Don't lint `vec_init_then_push` when further extended.
changelog: Remove `mut` binding from `vec_init_then_push` when possible.
2022-05-15 21:51:24 +00:00
Jason Newcomb
f1574cc131 Update vec_init_then_push docs 2022-05-15 17:39:39 -04:00
Jason Newcomb
4fd2968242 Move mixed_read_write_in_expression into restriction 2022-05-15 17:08:48 -04:00
Jason Newcomb
50eada16f7 Rename eval_order_dependence to mixed_read_write_in_expression 2022-05-15 17:08:45 -04:00
bors
198c70daab Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk
Add EarlyBinder

Chalk has no concept of `Param` (e0ade19d13/chalk-ir/src/lib.rs (L579)) or `ReEarlyBound` (e0ade19d13/chalk-ir/src/lib.rs (L1308)). Everything  is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk.

Either way, tracking when we have or haven't already substituted out these in rustc can be helpful.

As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted.

r? `@nikomatsakis`
2022-05-14 23:53:11 +00:00
Alex Macleod
1f79a442e5 Add duplicate_mod lint 2022-05-14 22:31:13 +01:00
Jack Huey
cc0607a5b1 Add bound_type_of 2022-05-13 18:27:18 -04:00
bors
2038084cf2 Auto merge of #8813 - evantypanski:redundant_alloc_fat_ptr, r=Alexendoo
Fix redundant_allocation warning for Rc<Box<str>>

changelog: [`redundant_allocation`] Fixes #8604

Fixes false positives where a fat pointer with `str` type was made thin by another allocation, but that thinning allocation was marked as redundant
2022-05-13 15:02:58 +00:00
Evan Typanski
ad7338e565 Comment why hir_ty_to_ty is safe in check_ty 2022-05-13 05:55:50 -04:00
ydah
4e5f69cc86 Tweak some words improved representation
This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"
2022-05-13 14:20:25 +09:00
yonip23
ed3744b957 inline construct_lint_suggestions 2022-05-13 02:20:28 +03:00
Evan Typanski
0def44a1c1 Catch other thinning allocations using Ty 2022-05-12 19:15:08 -04:00
yonip23
dc23b5d661 fix indentation + test 2022-05-12 10:06:15 +03:00
tamaron
9e66f2d058 fix 2022-05-12 12:33:05 +09:00