Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #91602

Closed
wants to merge 251 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
1d26e41
Clarify platform availability of GetTempPath2
talagrand Oct 27, 2021
c3d4577
Fix `match_overlapping_arm` false negative
Nov 1, 2021
693df63
Ensure `match_overlapping_arms` warns on first
Nov 1, 2021
1011e08
Reference nightly-rustc docs in clippy's docs
xFrednet Nov 4, 2021
d134ddd
Improve `clippy_utils` function docs
xFrednet Nov 4, 2021
a276cd2
Add clippy docs to check for a specific type
xFrednet Nov 4, 2021
5405152
Added note about the usage of `clippy_utils::path`
xFrednet Nov 4, 2021
84a4ab7
Auto merge of #7928 - xFrednet:rust-90354-deploy-clippy-docs, r=flip1995
bors Nov 4, 2021
e674d0a
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
flip1995 Nov 4, 2021
93ffc9d
Remove rustfmt::skip attribute from register_plugins function
flip1995 Nov 5, 2021
14d54f0
Use Span::from_expansion instead of in_macro
camsteffen Oct 29, 2021
85e2592
Auto merge of #7909 - mikerite:fix-7816, r=camsteffen
bors Nov 5, 2021
5b1b6a2
Edit docs about macros
camsteffen Nov 5, 2021
9a60a93
Auto merge of #7897 - camsteffen:in-macro, r=flip1995
bors Nov 5, 2021
445c83f
Auto merge of #7937 - flip1995:rustfmt-skip-artefact, r=Manishearth
bors Nov 5, 2021
1c4dd8d
Remove trim_semicolon
camsteffen Nov 2, 2021
73501da
Add expr_visitor util
camsteffen Oct 20, 2021
5239a90
Factor in some expr_visitor usages
camsteffen Nov 5, 2021
2c7b7e8
Remove if let check for match_ref_pats
camsteffen Nov 5, 2021
c96cd35
Extend author lint
Serial-ATA Oct 29, 2021
b5bae09
Add `cargo dev lint` to manually run clippy on a file
Alexendoo Nov 2, 2021
e3d1e60
Auto merge of #7894 - Serial-ATA:extend-author-lint, r=camsteffen
bors Nov 6, 2021
9a8919d
Fix Clippy with changed format_args!
camsteffen Nov 6, 2021
0cb9ac2
Give inline const separate DefKind
nbdd0121 Oct 2, 2021
07f4f7c
Auto merge of #7917 - Alexendoo:cargo-dev-lint, r=giraffate
bors Nov 7, 2021
c063203
ast: Fix naming conventions in AST structures
petrochenkov Nov 7, 2021
2c6f03d
Fix ICE in undocumented_unsafe_blocks
Serial-ATA Nov 7, 2021
ac9dd36
Don't abort compilation after giving a lint error
jyn514 Jul 21, 2021
6fcdf81
Auto merge of #7945 - Serial-ATA:issue-7934, r=flip1995
bors Nov 8, 2021
94517d3
Auto merge of #7938 - camsteffen:visitors, r=xFrednet
bors Nov 8, 2021
6d23824
Make select_* methods return Vec for TraitEngine
fee1-dead Nov 8, 2021
413d255
Add MSRV to deprecated_cfg_attr
Serial-ATA Nov 7, 2021
830f220
Auto merge of #7944 - Serial-ATA:deprecated-cfg-attr-msrv, r=giraffate
bors Nov 9, 2021
6809234
Fix explicit_counter_loop suggestion for non-usize types
Serial-ATA Nov 9, 2021
98416d7
Remove `unimplemented!()` case in matches code
Nov 9, 2021
949b259
Change `Bound` to `EndBound`
Nov 9, 2021
f829523
Simplify range comparison code
Nov 9, 2021
c8f909e
Improve variable naming
Nov 9, 2021
81fa758
Improve variable naming 2
Nov 9, 2021
8b76915
matches: remove `pub` from some items
Nov 9, 2021
6536c58
Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-se
bors Nov 9, 2021
0332a7b
Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995
bors Nov 9, 2021
36d5475
Auto merge of #90700 - fee1-dead:select-returns-vec, r=davidtwco
bors Nov 9, 2021
e54c341
Fix suggestion for deref expressions in redundant_pattern_matching
Serial-ATA Nov 8, 2021
c94d62b
Auto merge of #7949 - Serial-ATA:issue-7921, r=flip1995
bors Nov 9, 2021
3382201
Lint for bool to integer casts in `cast_lossless`
5225225 Nov 8, 2021
96db1d6
fix dogfood lint on clippy_utils
5225225 Nov 8, 2021
6e84f00
Check MSRV for bool to int from impl
5225225 Nov 9, 2021
3b6b1ab
Rollup merge of #89561 - nbdd0121:const_typeck, r=nikomatsakis
matthiaskrgr Nov 9, 2021
f69721f
Auto merge of #7950 - Serial-ATA:issue-7920, r=llogiq
bors Nov 9, 2021
93f13d5
Auto merge of #7951 - mikerite:matches-20211109, r=llogiq
bors Nov 9, 2021
e8861c8
Add `semicolon_if_nothing_returned` test for `let-else` stmts
dswij Nov 10, 2021
a003ca6
`semicolon_if_nothing_returned` now checks if the stmt ends with semi…
dswij Nov 10, 2021
2e17035
Auto merge of #7955 - dswij:let-else-early-return, r=giraffate
bors Nov 10, 2021
7c1e62d
Added `clippy::version` attribute as lint metadata
xFrednet Oct 12, 2021
8565fc4
Add clippy version to Clippy's lint list
xFrednet Oct 12, 2021
23ed792
Document new `clippy::version` attribute and make it mandatory
xFrednet Oct 17, 2021
63cb410
Manually add `clippy::version` attribute to deprecated lints
xFrednet Oct 17, 2021
d647696
Added `clippy::version` attribute to all normal lints
xFrednet Oct 21, 2021
9d9d06d
Add lint to check for invalid `clippy:version` attributes
xFrednet Oct 21, 2021
d68408f
Updated version label and style on Clippy's lint list
xFrednet Nov 2, 2021
94bc0a1
Address review feedback
xFrednet Nov 10, 2021
ce01346
author: name qpath consistently
camsteffen Nov 8, 2021
d0cc201
author: fix some bugs
camsteffen Nov 10, 2021
a806ce7
author: reorder match arm
camsteffen Nov 8, 2021
72d7b9c
author: Remove needless `ref`s
camsteffen Nov 10, 2021
847a95b
Refactor utils on checking attribute
dswij Oct 25, 2021
2d037aa
Check for no_std and no_core attribute in `swap` lint
dswij Oct 25, 2021
dcd1a16
Add test for `swap` lint when `no_std` is present
dswij Oct 25, 2021
8389df9
Auto merge of #7877 - dswij:no-std-fp, r=camsteffen
bors Nov 11, 2021
8c45fd8
New internal lint to make `clippy::version` attribute mandatory
xFrednet Nov 11, 2021
3bfe98d
Auto merge of #7813 - xFrednet:6492-lint-version, r=flip1995
bors Nov 11, 2021
27a1763
Make author DRYer
camsteffen Nov 5, 2021
e444cbe
New `index_refutable_slice` lint
xFrednet Aug 31, 2021
3d4d0cf
Auto merge of #7643 - xFrednet:7569-splits-for-slices, r=camsteffen
bors Nov 11, 2021
8b84a76
Auto merge of #7956 - camsteffen:author, r=llogiq
bors Nov 11, 2021
24d561f
Use rustfmt version from `rust-toolchain`
Jarcho Nov 12, 2021
610b381
Auto merge of #7963 - Jarcho:dev_fmt, r=flip1995
bors Nov 12, 2021
d4c8cb6
Change cast_lossless message for bools only
5225225 Nov 12, 2021
4f82dd8
Auto merge of #7948 - 5225225:castlosslessbool, r=llogiq
bors Nov 12, 2021
91fe265
Add rustfmt component to rust-toolchain
Alexendoo Nov 12, 2021
608c9e8
Run clippy_dev workflow on current rust-toolchain
Alexendoo Nov 12, 2021
507030f
Run rustfmt on batches of multiple files
Alexendoo Nov 12, 2021
cc9d7ff
Auto merge of #7966 - Alexendoo:batch-rustfmt, r=camsteffen
bors Nov 12, 2021
80a263d
Fix `manual_map` suggestion when used with unsafe functions and unsaf…
Jarcho Nov 13, 2021
1df10f0
fix typo
togami2864 Nov 13, 2021
f51fb34
Auto merge of #7969 - togami2864:fix-typo, r=xFrednet
bors Nov 13, 2021
2ed4a8a
fix suggestion in option_map_or_none
togami2864 Nov 13, 2021
3fe11e7
option_if_let_else: don't expand macros in suggestion
matthiaskrgr Nov 13, 2021
3e20e30
Fix specific code outlined in issue #7975.
Blckbrry-Pi Nov 14, 2021
634e79c
Support suggestion for #7854
surechen Nov 11, 2021
f82bf47
Auto merge of #7957 - surechen:fix_for_7854, r=giraffate
bors Nov 15, 2021
4f71ff3
add test case for option_map_or_none
togami2864 Nov 15, 2021
0def42f
Auto merge of #7974 - matthiaskrgr:7973_opt_map_or_else_dont_expand_s…
bors Nov 15, 2021
bbffe82
add reduce_unit_expression
togami2864 Nov 15, 2021
02e0726
fix a bug that the closure arguments are not displayed
togami2864 Nov 15, 2021
cd57816
add comment
togami2864 Nov 15, 2021
300282c
fix fmt
togami2864 Nov 15, 2021
0a30fdc
move the let statement out of the macro
togami2864 Nov 15, 2021
8ded385
Improve `needless_borrow` lint.
Jarcho Nov 15, 2021
2938ffd
Improve heuristics for determining whether eager of lazy evaluation i…
Jarcho Aug 17, 2021
5b1b65b
Auto merge of #7639 - Jarcho:whitelist_cheap_functions, r=camsteffen
bors Nov 16, 2021
7605bac
resolve CI
togami2864 Nov 16, 2021
5b3c00f
Successfully generalize prevention of suggestions causing multiple mu…
Blckbrry-Pi Nov 16, 2021
c52b389
Fix readability suggestions.
Blckbrry-Pi Nov 16, 2021
83ad511
Auto merge of #7982 - Blckbrry-Pi:master, r=llogiq
bors Nov 16, 2021
e9bf5ec
Don't show no_effect warning on unit structs implementing fn* traits
F3real Nov 16, 2021
c051656
fixes: #7889
surechen Oct 29, 2021
46687f1
Auto merge of #7896 - surechen:fix_manual_split_once, r=camsteffen
bors Nov 17, 2021
3f3d7c2
Fix ICE on `undocumented_unsafe_blocks`
giraffate Nov 17, 2021
94ca94f
Auto merge of #7898 - F3real:unit_struct, r=camsteffen
bors Nov 17, 2021
e34927e
add multi-line test case
togami2864 Nov 17, 2021
d550e5f
Auto merge of #7988 - giraffate:fix_ice_on_undocumented_unsafe_blocks…
bors Nov 17, 2021
006c442
check whether stmts is empty or not in block
togami2864 Nov 17, 2021
8506f66
Minor simplification to `manual_map`
Jarcho Nov 17, 2021
5f861ee
Addition `manual_map` test for `unsafe` blocks
Jarcho Nov 17, 2021
8e317f5
fix suggestion message
togami2864 Nov 17, 2021
6ac42fe
Auto merge of #7971 - togami2864:fix/option-map-or-none, r=llogiq
bors Nov 17, 2021
bb58dc8
Auto merge of #7968 - Jarcho:manual_map_unsafe, r=xFrednet
bors Nov 17, 2021
cb62680
rustc: Remove `#[rustc_synthetic]`
petrochenkov Nov 18, 2021
b5a61aa
fix typo
togami2864 Nov 18, 2021
8536647
Auto merge of #7992 - togami2864:fix-typo, r=giraffate
bors Nov 18, 2021
731dfde
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 18, 2021
4bccd59
Bump nightly version -> 2021-11-18
flip1995 Nov 18, 2021
8dd1bce
Auto merge of #7994 - flip1995:rustup, r=flip1995
bors Nov 18, 2021
b7f1891
Pluralize disallowed_type lint
phansch Nov 17, 2021
a0d81d1
Pluralize disallowed_type lint filenames
phansch Nov 17, 2021
9b38fb7
Also pluralize disallowed_method(s) lint
flip1995 Nov 18, 2021
0375d20
Add missing components to rust-toolchain file
couchand Nov 17, 2021
2776076
Auto merge of #7977 - Jarcho:multi_needless_borrow, r=xFrednet
bors Nov 18, 2021
abb7155
add test case for result_map_or_into_option
togami2864 Nov 19, 2021
cd81bb9
fix stderr
togami2864 Nov 19, 2021
0d283cc
Auto merge of #7996 - togami2864:test-map-or-none, r=Manishearth
bors Nov 19, 2021
38bd251
Auto merge of #7984 - phansch:disallowed-type-rename, r=xFrednet
bors Nov 19, 2021
1429949
Don't check for a nightly toolchain in fmt test
Jarcho Nov 20, 2021
c443f8f
Fix `strlen_on_c_strings` when not used with a full path
Jarcho Nov 20, 2021
0d1f1ce
Remove surrounding unsafe block in `strlen_on_c_strings` when possible
Jarcho Nov 20, 2021
f4c75cd
Fix `any()` not taking reference in `search_is_some` lint
ThibsG Jul 13, 2021
5ed93af
Use `ExprUseVisitor` and multipart suggestion to avoid iffy `String` …
ThibsG Aug 9, 2021
b38f173
Build suggestion within visitor + add more tests
ThibsG Aug 18, 2021
ddcbac3
Split tests (too long for CI)
ThibsG Aug 19, 2021
6dca4f2
Add some doc for `search_is_some` lint
ThibsG Aug 19, 2021
e24aba2
Use applicability for snippets
ThibsG Sep 7, 2021
9ab4b67
Simplifying `next_pos` init
ThibsG Sep 7, 2021
d0dd797
Build end of suggestion only once at the end of the process
ThibsG Sep 7, 2021
97783a8
Return a struct and add applicability
ThibsG Sep 7, 2021
91dd9c4
Handle other projection kinds
ThibsG Sep 12, 2021
788c9cc
Applying refactoring for simplified code
ThibsG Sep 12, 2021
ac45a83
Handle multiple reference levels into binding type and add more tests
ThibsG Sep 14, 2021
6d1ccbf
Correct suggestion when dereferencing enough, calling a function
ThibsG Sep 19, 2021
7a55407
Fix suggestions when call functions involved taking by ref
ThibsG Sep 21, 2021
90a72f5
Handle args taken by ref also for `MethodCall`
ThibsG Oct 1, 2021
268ef40
Add test case for references bindings
ThibsG Oct 1, 2021
abaaf74
Add some notes about `MethodCall` cases
ThibsG Oct 1, 2021
7221999
Add tests with closure
ThibsG Oct 20, 2021
2ff702c
Rephrase the fn checking for a double ref, not only one
ThibsG Oct 20, 2021
1176b8e
Handle closures with type annotations on args
ThibsG Nov 1, 2021
5ebede0
Fix full projection identifier + move applicability to `MaybeIncorrect`
ThibsG Nov 20, 2021
ec7364f
add test suit
togami2864 Nov 20, 2021
982124a
Add new lint `octal_escapes`
birkenfeld Nov 20, 2021
827fd50
Auto merge of #8000 - Jarcho:nightly_fmt, r=llogiq
bors Nov 20, 2021
1c8085d
Allow `suboptimal_flops` in const functions
xFrednet Nov 20, 2021
092fe20
Move deref closure builder to `clippy_utils::sugg` module
ThibsG Nov 20, 2021
0c4055c
Avoid inline hints with double backticks for `doc-markdown`
birkenfeld Nov 20, 2021
32048eb
Auto merge of #8011 - birkenfeld:double_backticks, r=xFrednet
bors Nov 20, 2021
846c0be
Fixes #7915
surechen Nov 19, 2021
e58ffb8
Fix Clippy with changed for loop desugar
camsteffen Oct 27, 2021
8c1c763
clippy: Fix pattern_type_mismatch for loop
camsteffen Nov 19, 2021
de2208a
Auto merge of #7997 - surechen:Fixes_7915, r=giraffate
bors Nov 21, 2021
5fbfdfa
Auto merge of #8009 - xFrednet:8004-suboptimal-flops-in-const, r=gira…
bors Nov 22, 2021
4027594
Auto merge of #7989 - couchand:2021-11/toolchain-missing-components, …
bors Nov 22, 2021
850e7f5
`octal_escapes`: updates from review, fix byte string prefix
birkenfeld Nov 21, 2021
0bc25d0
octal_escapes: emit only one lint for all cases found each literal
birkenfeld Nov 22, 2021
1210bb4
octal_escapes: note on print!() format strings
birkenfeld Nov 22, 2021
57a8804
Auto merge of #8007 - birkenfeld:octal_escapes, r=xFrednet
bors Nov 22, 2021
ec3d1c8
Fix FP on `if_then_some_else_none` when there is early return
dswij Nov 16, 2021
d6c707d
Auto merge of #7980 - dswij:7870, r=xFrednet
bors Nov 23, 2021
5740230
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 23, 2021
c46c8c5
Bump nightly version -> 2021-11-23
flip1995 Nov 23, 2021
81f37a8
Auto merge of #8025 - flip1995:rustup, r=flip1995
bors Nov 23, 2021
3957244
Add `needless_late_init` lint
Alexendoo Nov 18, 2021
a135347
Run rustfix for `strlen_on_c_strings` tests
Jarcho Nov 24, 2021
c0bad8b
Add more descriptive help info for `needless_question_mark`
dswij Nov 25, 2021
35b0f24
Auto merge of #8028 - dswij:8016, r=flip1995
bors Nov 25, 2021
5fc61a2
Fix clippy test
estebank Nov 25, 2021
9274ec5
Visit `param_env` field in Obligation's `TypeFoldable` impl
Aaron1011 Nov 24, 2021
140ba61
add test suit
togami2864 Nov 26, 2021
a745cc5
make non_ascii_literal to catch char
togami2864 Nov 26, 2021
e8ef6ca
fix stderr
togami2864 Nov 26, 2021
e6a6ed4
fix doc
togami2864 Nov 26, 2021
6b997b6
Auto merge of #91205 - Aaron1011:visit_param_env, r=lcnr
bors Nov 26, 2021
cd8b724
fix small nit
togami2864 Nov 26, 2021
5a6169d
Auto merge of #8034 - togami2864:non-ascii-in-sigle-literal, r=llogiq
bors Nov 26, 2021
d346ec9
Add async/const fn tests for needless-late-init
Alexendoo Nov 26, 2021
b38a540
Print a suggestion when comparing references to primitive types in co…
FabianWolff Nov 26, 2021
3720735
Auto merge of #7995 - Alexendoo:needless_late_init, r=giraffate
bors Nov 27, 2021
3c8b644
Only check for errors in predicate when skipping impl assembly
Aaron1011 Nov 26, 2021
c5ce7ff
Add `Index` when checking projs in a call, rename some variables and …
ThibsG Nov 27, 2021
917fdb1
Rewrite comment when handling special case for `ProjectionKind::Deref`
ThibsG Nov 27, 2021
a8e7fed
Add a note about type annotation on closure param
ThibsG Nov 28, 2021
f51bbc7
apply iter_cloned_collect to copied()
togami2864 Nov 20, 2021
56533d9
Take a LocalDefId in expect_*item.
cjgillot Oct 20, 2021
4e84dd1
Auto merge of #8006 - togami2864:generalize-copied, r=camsteffen
bors Nov 28, 2021
908815c
Auto merge of #8001 - Jarcho:unprefixed_strlen, r=giraffate
bors Nov 29, 2021
11002c7
Use new template forms for issue templates
flip1995 Nov 25, 2021
abaffa7
Auto merge of #8032 - flip1995:new_templates, r=camsteffen
bors Nov 30, 2021
bd63686
Add test for pattern_type_mismatch.
surechen Nov 23, 2021
522f3f9
`no_std_swap`: Remove obsolete TODO from test
homersimpsons Nov 18, 2021
ecf931f
Auto merge of #7993 - homersimpsons:patch-1, r=flip1995
bors Dec 1, 2021
8ad56c8
Auto merge of #8049 - surechen:fixes_7946, r=flip1995
bors Dec 1, 2021
abddd6c
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 2, 2021
782b1a8
Bump nightly version -> 2021-12-02
flip1995 Dec 2, 2021
ec57cc1
Bump Clippy Version -> 0.1.59
flip1995 Dec 2, 2021
392b0c5
Auto merge of #8057 - flip1995:rustup, r=flip1995
bors Dec 2, 2021
f26821c
Fixed same_name_method description
vallentin Dec 2, 2021
d5d830a
Auto merge of #7463 - ThibsG:find_any_7392, r=xFrednet
bors Dec 2, 2021
5cc451b
Escape backslash for singe_char_pattern.rs
frobiac Dec 2, 2021
fddef24
Auto merge of #8067 - frobiac:8060-backslash_escaped_in_single_char_p…
bors Dec 3, 2021
be1a73b
Auto merge of #8061 - vallentin:fix-same-name-method-desc, r=flip1995
bors Dec 3, 2021
9e5939a
Remove a code path that is neither documented nor can I see the reaso…
oli-obk Aug 20, 2021
1c45d1e
Enable rustbot shortcuts for rust-clippy
xFrednet Dec 3, 2021
11ad5a2
Add note about crate lint level attributes to pre-expansion lints
xFrednet Dec 3, 2021
de9de4f
Upgrade map_flatten to complexity
camsteffen Dec 1, 2021
17b7478
Add margin after lists on Clippy's lint list
xFrednet Dec 3, 2021
3cd151d
Auto merge of #8040 - xFrednet:6610-known-problems-section-for-pre-ex…
bors Dec 3, 2021
93564c3
Tweak "call this function" suggestion to have smaller span
estebank Dec 3, 2021
844996b
Consider NonNull as a pointer type
Qwaz Dec 4, 2021
14c6193
Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE
wesleywiser Nov 19, 2021
98e9b32
Add test with `#[rustc_evaluate_where_clauses]`
wesleywiser Nov 22, 2021
6fe13f6
Add test case that evals to `EvaluatedToOkModuloRegions`
wesleywiser Dec 4, 2021
9eabec9
Auto merge of #8054 - camsteffen:map-flatten-style, r=giraffate
bors Dec 4, 2021
907f6d9
Auto merge of #8074 - Qwaz:send_nonnull, r=xFrednet
bors Dec 4, 2021
aa3370c
doc: suggest try_reserve in try_reserve_exact
TennyZhuang Dec 5, 2021
e3c6044
fix some false negatives for single_char_pattern
nixxquality Dec 5, 2021
476d609
Auto merge of #8072 - xFrednet:0000-teach-rustbot-acronyms, r=llogiq
bors Dec 5, 2021
01e302b
Fix dogfood
nixxquality Dec 5, 2021
a5d5976
Auto merge of #8077 - nixxquality:single_char_pattern-false-negatives…
bors Dec 6, 2021
f004a1b
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
flip1995 Dec 6, 2021
e36e5a5
Update Cargo.lock
flip1995 Dec 6, 2021
a0fb992
Fix AnonConst ICE
terrarier2111 Nov 28, 2021
a30d60c
update Miri
RalfJung Dec 6, 2021
923f8da
Rollup merge of #89999 - talagrand:GetTempPath2, r=m-ou-se
matthiaskrgr Dec 6, 2021
a699859
Rollup merge of #91065 - wesleywiser:add_incr_test, r=jackh726
matthiaskrgr Dec 6, 2021
62e568b
Rollup merge of #91272 - FabianWolff:issue-90870-const-fn-eq, r=wesle…
matthiaskrgr Dec 6, 2021
2309e7d
Rollup merge of #91312 - terrarier2111:anon-const-ice, r=jackh726
matthiaskrgr Dec 6, 2021
7e796ff
Rollup merge of #91493 - oli-obk:cleanup, r=michaelwoerister
matthiaskrgr Dec 6, 2021
7cd16cf
Rollup merge of #91503 - estebank:call-fn-span, r=michaelwoerister
matthiaskrgr Dec 6, 2021
1c19b91
Rollup merge of #91547 - TennyZhuang:suggest_try_reserve, r=scottmcm
matthiaskrgr Dec 6, 2021
85a1d67
Rollup merge of #91590 - flip1995:clippyup, r=Manishearth
matthiaskrgr Dec 6, 2021
9c57fd7
Rollup merge of #91599 - RalfJung:miri, r=RalfJung
matthiaskrgr Dec 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 16 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ dependencies = [

[[package]]
name = "clippy"
version = "0.1.58"
version = "0.1.59"
dependencies = [
"cargo_metadata 0.14.0",
"clippy_lints",
Expand All @@ -584,6 +584,7 @@ dependencies = [
"filetime",
"if_chain",
"itertools 0.10.1",
"parking_lot",
"quote",
"regex",
"rustc-workspace-hack",
Expand All @@ -600,6 +601,7 @@ name = "clippy_dev"
version = "0.0.1"
dependencies = [
"bytecount",
"cargo_metadata 0.14.0",
"clap",
"indoc",
"itertools 0.10.1",
Expand All @@ -611,7 +613,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.58"
version = "0.1.59"
dependencies = [
"cargo_metadata 0.14.0",
"clippy_utils",
Expand All @@ -632,7 +634,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.58"
version = "0.1.59"
dependencies = [
"if_chain",
"rustc-semver",
Expand Down Expand Up @@ -1713,9 +1715,12 @@ dependencies = [

[[package]]
name = "instant"
version = "0.1.6"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if 1.0.0",
]

[[package]]
name = "itertools"
Expand Down Expand Up @@ -1992,9 +1997,9 @@ version = "0.1.0"

[[package]]
name = "lock_api"
version = "0.4.1"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
dependencies = [
"scopeguard",
]
Expand Down Expand Up @@ -2511,9 +2516,9 @@ dependencies = [

[[package]]
name = "parking_lot"
version = "0.11.1"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
Expand All @@ -2522,9 +2527,9 @@ dependencies = [

[[package]]
name = "parking_lot_core"
version = "0.8.3"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if 1.0.0",
"instant",
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_const_eval/src/transform/check_consts/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
if let Some(trait_id) = tcx.trait_of_item(callee) {
trace!("attempting to call a trait method");
if !self.tcx.features().const_trait_impl {
self.check_op(ops::FnCallNonConst);
self.check_op(ops::FnCallNonConst(Some((callee, substs))));
return;
}

Expand Down Expand Up @@ -857,7 +857,7 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
}

if !nonconst_call_permission {
self.check_op(ops::FnCallNonConst);
self.check_op(ops::FnCallNonConst(None));
return;
}
}
Expand Down Expand Up @@ -926,7 +926,7 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
}

if !nonconst_call_permission {
self.check_op(ops::FnCallNonConst);
self.check_op(ops::FnCallNonConst(None));
return;
}
}
Expand Down
70 changes: 63 additions & 7 deletions compiler/rustc_const_eval/src/transform/check_consts/ops.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! Concrete error types for all operations which may be invalid in a certain const context.

use rustc_errors::{struct_span_err, DiagnosticBuilder};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_middle::mir;
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
use rustc_middle::{mir, ty::AssocKind};
use rustc_session::parse::feature_err;
use rustc_span::symbol::sym;
use rustc_span::{Span, Symbol};
use rustc_span::{symbol::Ident, Span, Symbol};
use rustc_span::{BytePos, Pos};

use super::ConstCx;

Expand Down Expand Up @@ -72,17 +74,71 @@ impl NonConstOp for FnCallIndirect {

/// A function call where the callee is not marked as `const`.
#[derive(Debug)]
pub struct FnCallNonConst;
impl NonConstOp for FnCallNonConst {
pub struct FnCallNonConst<'tcx>(pub Option<(DefId, SubstsRef<'tcx>)>);
impl<'a> NonConstOp for FnCallNonConst<'a> {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
struct_span_err!(
let mut err = struct_span_err!(
ccx.tcx.sess,
span,
E0015,
"calls in {}s are limited to constant functions, \
tuple structs and tuple variants",
ccx.const_kind(),
)
);

if let FnCallNonConst(Some((callee, substs))) = *self {
if let Some(trait_def_id) = ccx.tcx.lang_items().eq_trait() {
if let Some(eq_item) = ccx.tcx.associated_items(trait_def_id).find_by_name_and_kind(
ccx.tcx,
Ident::with_dummy_span(sym::eq),
AssocKind::Fn,
trait_def_id,
) {
if callee == eq_item.def_id && substs.len() == 2 {
match (substs[0].unpack(), substs[1].unpack()) {
(GenericArgKind::Type(self_ty), GenericArgKind::Type(rhs_ty))
if self_ty == rhs_ty
&& self_ty.is_ref()
&& self_ty.peel_refs().is_primitive() =>
{
let mut num_refs = 0;
let mut tmp_ty = self_ty;
while let rustc_middle::ty::Ref(_, inner_ty, _) = tmp_ty.kind() {
num_refs += 1;
tmp_ty = inner_ty;
}
let deref = "*".repeat(num_refs);

if let Ok(call_str) =
ccx.tcx.sess.source_map().span_to_snippet(span)
{
if let Some(eq_idx) = call_str.find("==") {
if let Some(rhs_idx) = call_str[(eq_idx + 2)..]
.find(|c: char| !c.is_whitespace())
{
let rhs_pos = span.lo()
+ BytePos::from_usize(eq_idx + 2 + rhs_idx);
let rhs_span = span.with_lo(rhs_pos).with_hi(rhs_pos);
err.multipart_suggestion(
"consider dereferencing here",
vec![
(span.shrink_to_lo(), deref.clone()),
(rhs_span, deref),
],
Applicability::MachineApplicable,
);
}
}
}
}
_ => {}
}
}
}
}
}

err
}
}

Expand Down
13 changes: 8 additions & 5 deletions compiler/rustc_infer/src/infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
if let Some(def_id) = def_id.as_local() {
let opaque_hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let parent_def_id = self.infcx.defining_use_anchor;
let def_scope_default = || {
let opaque_parent_hir_id = tcx.hir().get_parent_item(opaque_hir_id);
parent_def_id == tcx.hir().local_def_id(opaque_parent_hir_id)
};
let (in_definition_scope, origin) = match tcx.hir().expect_item(def_id).kind
{
// Anonymous `impl Trait`
Expand All @@ -481,7 +477,14 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
}) => {
(may_define_opaque_type(tcx, parent_def_id, opaque_hir_id), origin)
}
_ => (def_scope_default(), hir::OpaqueTyOrigin::TyAlias),
ref itemkind => {
span_bug!(
self.value_span,
"weird opaque type: {:#?}, {:#?}",
ty.kind(),
itemkind
)
}
};
if in_definition_scope {
let opaque_type_key =
Expand Down
25 changes: 11 additions & 14 deletions compiler/rustc_typeck/src/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) -> bool /* did we suggest to call a function because of missing parentheses? */ {
err.span_label(span, ty.to_string());
if let FnDef(def_id, _) = *ty.kind() {
let source_map = self.tcx.sess.source_map();
if !self.tcx.has_typeck_results(def_id) {
return false;
}
Expand All @@ -517,20 +516,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.lookup_op_method(fn_sig.output(), &[other_ty], Op::Binary(op, is_assign))
.is_ok()
{
if let Ok(snippet) = source_map.span_to_snippet(span) {
let (variable_snippet, applicability) = if !fn_sig.inputs().is_empty() {
(format!("{}( /* arguments */ )", snippet), Applicability::HasPlaceholders)
} else {
(format!("{}()", snippet), Applicability::MaybeIncorrect)
};
let (variable_snippet, applicability) = if !fn_sig.inputs().is_empty() {
("( /* arguments */ )".to_string(), Applicability::HasPlaceholders)
} else {
("()".to_string(), Applicability::MaybeIncorrect)
};

err.span_suggestion(
span,
"you might have forgotten to call this function",
variable_snippet,
applicability,
);
}
err.span_suggestion_verbose(
span.shrink_to_hi(),
"you might have forgotten to call this function",
variable_snippet,
applicability,
);
return true;
}
}
Expand Down
15 changes: 11 additions & 4 deletions compiler/rustc_typeck/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
// We've encountered an `AnonConst` in some path, so we need to
// figure out which generic parameter it corresponds to and return
// the relevant type.
let (arg_index, segment) = path
let filtered = path
.segments
.iter()
.filter_map(|seg| seg.args.map(|args| (args.args, seg)))
Expand All @@ -181,10 +181,17 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
.filter(|arg| arg.is_const())
.position(|arg| arg.id() == hir_id)
.map(|index| (index, seg))
})
.unwrap_or_else(|| {
bug!("no arg matching AnonConst in path");
});
let (arg_index, segment) = match filtered {
None => {
tcx.sess.delay_span_bug(
tcx.def_span(def_id),
"no arg matching AnonConst in path",
);
return None;
}
Some(inner) => inner,
};

// Try to use the segment resolution if it is valid, otherwise we
// default to the path resolution.
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: VecDeque::reserve
/// [`try_reserve`]: VecDeque::try_reserve
///
/// # Errors
///
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,9 @@ impl String {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: String::reserve
/// [`try_reserve`]: String::try_reserve
///
/// # Errors
///
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,9 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: Vec::reserve
/// [`try_reserve`]: Vec::try_reserve
///
/// # Errors
///
Expand Down
21 changes: 9 additions & 12 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,28 +583,25 @@ pub fn home_dir() -> Option<PathBuf> {
/// may result in "insecure temporary file" security vulnerabilities. Consider
/// using a crate that securely creates temporary files or directories.
///
/// # Unix
/// # Platform-specific behavior
///
/// Returns the value of the `TMPDIR` environment variable if it is
/// On Unix, returns the value of the `TMPDIR` environment variable if it is
/// set, otherwise for non-Android it returns `/tmp`. If Android, since there
/// is no global temporary folder (it is usually allocated per-app), it returns
/// `/data/local/tmp`.
/// On Windows, the behavior is equivalent to that of [`GetTempPath2`][GetTempPath2] /
/// [`GetTempPath`][GetTempPath], which this function uses internally.
/// Note that, this [may change in the future][changes].
///
/// # Windows
///
/// Returns the value of, in order, the `TMP`, `TEMP`,
/// `USERPROFILE` environment variable if any are set and not the empty
/// string. Otherwise, `temp_dir` returns the path of the Windows directory.
/// This behavior is identical to that of [`GetTempPath`][msdn], which this
/// function uses internally.
///
/// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
/// [changes]: io#platform-specific-behavior
/// [GetTempPath2]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a
/// [GetTempPath]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
///
/// ```no_run
/// use std::env;
///
/// fn main() {
/// let mut dir = env::temp_dir();
/// let dir = env::temp_dir();
/// println!("Temporary directory: {}", dir.display());
/// }
/// ```
Expand Down
6 changes: 6 additions & 0 deletions library/std/src/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,12 @@ compat_fn! {
-> () {
GetSystemTimeAsFileTime(lpSystemTimeAsFileTime)
}

// >= Win11 / Server 2022
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a
pub fn GetTempPath2W(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD {
GetTempPathW(nBufferLength, lpBuffer)
}
}

compat_fn! {
Expand Down
Loading