Skip to content

Rollup of 8 pull requests #83063

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

Closed
wants to merge 289 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
289 commits
Select commit Hold shift + click to select a range
b119b65
tests: add test that roughly ensures that our lint messages conform w…
matthiaskrgr Feb 24, 2021
5370576
fix clippy lint warnings
matthiaskrgr Feb 24, 2021
8eb2bd1
update the lint messages and tests
matthiaskrgr Feb 24, 2021
e107b65
disable lint_message_convention test inside the rustc test suite
matthiaskrgr Feb 25, 2021
e00b1cc
change some lint messages and remove old entries from the ignorelist
matthiaskrgr Feb 26, 2021
24460f7
lintcheck: update logs
matthiaskrgr Feb 26, 2021
ebc5c8f
use different example (C-like) for valid capitalized start of lint me…
matthiaskrgr Feb 28, 2021
da3a573
Fix false positives on procedural macros of `missing_inline_in_public…
Feb 28, 2021
a3278a1
Fix `manual_map`: do not expand macros in suggestions
Jarcho Feb 28, 2021
ac2f041
Auto merge of #6787 - matthiaskrgr:lint_msgs, r=llogiq
bors Feb 28, 2021
d931d1b
lintcheck: refactor: introduce a basic LintcheckConfig struct which h…
matthiaskrgr Feb 26, 2021
2d9932d
lintcheck: don't run clippy in parallel by default
matthiaskrgr Feb 27, 2021
e338604
lintcheck: uses consts for clippy driver and cargo clippy paths
matthiaskrgr Feb 27, 2021
1b1ed93
lintcheck: put the full paths (target/lintcheck/sources/<crate>...) t…
matthiaskrgr Feb 27, 2021
b9a7a2a
lintcheck: add a couple of dtolnays crates to the source list
matthiaskrgr Feb 27, 2021
70d952e
lintcheck: more fixes
matthiaskrgr Feb 28, 2021
1ebaae8
lintcheck: make download path and source path consts, move source dir…
matthiaskrgr Feb 28, 2021
45d6a77
lintcheck: add more embark crate sources to the sources toml
matthiaskrgr Feb 28, 2021
25f9098
update lintcheck_crates logs and fix typos
matthiaskrgr Feb 28, 2021
5ae1e17
Auto merge of #6813 - matthiaskrgr:lintcheck_refactor, r=flip1995
bors Mar 1, 2021
7984e60
Use diagnostic items in into_iter_collections
camsteffen Feb 27, 2021
ada8c72
Add version = "Two" to rustfmt.toml
camsteffen Mar 1, 2021
2c485e3
Don't move `yield` or inline assembly into closure
Jarcho Mar 1, 2021
f21320f
Use diagnostic or language items instead of paths
Jarcho Mar 2, 2021
e50afa4
Auto merge of #6822 - camsteffen:rustfmt, r=llogiq
bors Mar 2, 2021
62ac4bd
create loops dir; arrange manual_flatten lint and utils
nahuakang Feb 7, 2021
408368a
Refactor check_for_loop_arg; rename manual_flatten's lint back to che…
nahuakang Feb 8, 2021
7b0f588
Refactor check_for_loop_over_map_kv to its own module
nahuakang Feb 8, 2021
6e4663d
Refactor check_for_mut_range_bound to its own module
nahuakang Feb 8, 2021
71c9fdf
Refactor check_for_loop_range into its module
nahuakang Feb 8, 2021
71026ca
Refactor check_for_loop_explicit_counter to its own module
nahuakang Feb 8, 2021
1e5e541
Refactor check_for_single_element_loop to its own module
nahuakang Feb 8, 2021
9520cba
Add check_infinite_loop to its own module
nahuakang Feb 9, 2021
453e6b9
Add check_needless_collect to its own module
nahuakang Feb 9, 2021
2c1f676
Add detect_same_item_push to its own module
nahuakang Feb 9, 2021
5b870e1
Move detect_manual_memcpy to its module; split up utils structs
nahuakang Feb 9, 2021
455d047
Refactor never loop to its own module
nahuakang Feb 21, 2021
d0b657c
Refactor while let on iterator lint to its module; rename for loop ex…
nahuakang Feb 21, 2021
287a4f8
Refactor empty loop to its own module
nahuakang Feb 21, 2021
7158c94
Refactor while let loop to its own module
nahuakang Feb 21, 2021
7cfdef6
Move MinifyingSugg into manual_memcpy
nahuakang Feb 21, 2021
ecebfe0
Move check_for_loop_arg back to mod; split into 4 lint files
nahuakang Feb 21, 2021
2229a08
Clean up: Rename some files to be consistent with lint names; import …
nahuakang Feb 21, 2021
845a3a0
Include loops.rs changes from PR#6698
nahuakang Feb 22, 2021
eaf63d6
Unify names of lint entry functions in loops to 'check'
Y-Nak Mar 2, 2021
74bd806
Simplify check_for_loop_arg
Y-Nak Mar 2, 2021
306545f
Create transmute directory
magurotuna Feb 10, 2021
4ac438b
Add transmute/utils.rs
magurotuna Feb 10, 2021
0d7dd00
Move useless_transmute to its own module
magurotuna Feb 10, 2021
ef97764
Move wrong_transmute to its own module
magurotuna Feb 10, 2021
afc9275
Move crosspointer_transmute to its own module
magurotuna Feb 10, 2021
6442d45
Move transmute_ptr_to_ref to its own module
magurotuna Feb 10, 2021
4c65221
Move transmute_int_to_char to its own module
magurotuna Feb 10, 2021
7af3458
Move transmute_bytes_to_str and transmute_ptr_to_ptr to transmute_ref…
magurotuna Feb 10, 2021
f8bc0e2
Move transmute_ptr_to_ptr to its own module
magurotuna Feb 10, 2021
d04ea41
Move transmute_int_to_bool to its own module
magurotuna Feb 10, 2021
acedc7b
Move transmute_int_to_float to its own module
magurotuna Feb 10, 2021
e7d2393
Move transmute_float_to_int to its own module
magurotuna Feb 10, 2021
c57a826
Move unsound_collection_transmute to its own module
magurotuna Feb 10, 2021
25c221e
Move transmutes_expressible_as_ptr_casts to its own module
magurotuna Feb 10, 2021
89ef26a
Cleanup imports
magurotuna Feb 10, 2021
8a8f7b4
Refactor calls to lint check functions
magurotuna Feb 10, 2021
bf00098
Make check_cast private
magurotuna Feb 10, 2021
3cd6ca0
Auto merge of #6716 - magurotuna:refactor-transmute-mod, r=flip1995
bors Mar 2, 2021
eb04beb
Auto merge of #6791 - TaKO8Ki:iter-count, r=matthiaskrgr
bors Mar 2, 2021
19c886b
Remove "for_loop_arg.rs"
Y-Nak Mar 2, 2021
9e4a064
Move naive_bytecount to pedantic
djc Mar 2, 2021
ece3543
Auto merge of #6801 - Jarcho:manual_match_fix, r=phansch
bors Mar 2, 2021
e3f4855
Allow noop_method_call in clippy ui test
rylev Jan 18, 2021
09c4503
Fix borrow and deref
rylev Feb 16, 2021
43d19f6
Auto merge of #6824 - Y-Nak:refactor_loops_module, r=flip1995
bors Mar 3, 2021
5656510
Fix false-positive in `use_self`
daxpedda Mar 3, 2021
03e72d5
Let Cargo track `CLIPPY_ARGS`
Mar 3, 2021
ff51964
Auto merge of #6825 - djc:naive-bytecount-pedantic, r=Manishearth
bors Mar 3, 2021
bbe6416
lintcheck: fix clippy warnings
matthiaskrgr Mar 2, 2021
d783e3d
Auto merge of #6839 - matthiaskrgr:lintcheck_clippy_warnings, r=flip1995
bors Mar 4, 2021
39c5e86
When checking if two empty hir blocks are equal also check to see if …
Jarcho Mar 4, 2021
6680710
Auto merge of #6833 - daxpedda:use-self, r=Manishearth
bors Mar 4, 2021
7be3a32
Auto merge of #6843 - Jarcho:match_on_same_arms_macro, r=Manishearth
bors Mar 4, 2021
37c4b11
lintcheck: add test
matthiaskrgr Mar 4, 2021
3f7ad32
update lintcheck logs
matthiaskrgr Mar 4, 2021
f0e6ce8
Auto merge of #6846 - matthiaskrgr:lintcheck_test, r=Manishearth
bors Mar 4, 2021
26265bb
ci: Sync clippy and clippy_bors workflows
flip1995 Mar 5, 2021
5b2e7e9
Shrink the size of Rvalue by 16 bytes
oli-obk Mar 5, 2021
5ebe6d3
Fix dogfood test
flip1995 Mar 5, 2021
3c502ec
Remove hack that forces dogfood to run on nightly
flip1995 Mar 5, 2021
1d71d9a
Fix dogfood errors in clippy_lints
flip1995 Mar 5, 2021
4aaad08
Fix dogfood errors in clippy_dev
flip1995 Mar 5, 2021
74eb448
Extract directory creation into its own function
flip1995 Mar 5, 2021
9e54538
Auto merge of #6849 - flip1995:dogfood-fix, r=matthiaskrgr
bors Mar 5, 2021
45424c7
lintcheck: add --fix mode which tries to apply lint suggestions to th…
matthiaskrgr Mar 5, 2021
45454f0
Avoid mir in implicit_return
camsteffen Mar 5, 2021
ae8ec07
Avoid mir in missing_errors_doc
camsteffen Mar 5, 2021
5abd8c5
Use typeck_body
camsteffen Mar 5, 2021
54def1e
Auto merge of #6852 - camsteffen:avoid-mir, r=Manishearth
bors Mar 5, 2021
a0b7f9b
useless_format: fix examples in the description
mgacek8 Mar 5, 2021
0941fc0
Make clippy set mir_opt_level using Option
spastorino Mar 4, 2021
6b40d12
Rollup merge of #82736 - spastorino:mir-opt-level-perf-changes, r=oli…
GuillaumeGomez Mar 5, 2021
0153679
Auto merge of #6848 - matthiaskrgr:lintcheck_clippyfix, r=llogiq
bors Mar 5, 2021
13271d3
Auto merge of #6854 - mgacek8:6844_fix_doc_for_useless_format_lint, r…
bors Mar 6, 2021
e4ffff9
Use `LanguageItems::require`
Jarcho Mar 2, 2021
5945e85
Auto merge of #6823 - Jarcho:diagnostic_items, r=phansch
bors Mar 7, 2021
47145de
`len_without_is_empty` will now consider multiple impl blocks
Jarcho Mar 5, 2021
e451d6e
Auto merge of #6853 - Jarcho:len_without_is_empty_fp, r=Manishearth
bors Mar 7, 2021
3877a41
migrate paths to newly-added diagnostic items
anall Feb 27, 2021
9bdc273
relocate functions from `clippy_lints::types`
anall Mar 7, 2021
d02ca3b
Auto merge of #6807 - anall:feature/use_new_diagnostics, r=Manishearth
bors Mar 8, 2021
06fe44e
Add msrv to contents in adding lints md
giraffate Mar 8, 2021
b27cbda
make is_normalizable more strict
anall Mar 8, 2021
e6c643f
Auto merge of #6864 - giraffate:fix_doc_adding_a_new_lint, r=Manishearth
bors Mar 8, 2021
f3b68d3
Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
bors Mar 8, 2021
2d07c33
Rename `ClippyArgsCallbacks` to `RustcCallbacks`
Mar 8, 2021
2d53b6b
Move `test_no_deps_ignores_path_deps_in_workspaces()` out of `dogfood…
Mar 8, 2021
3cd5f44
Don't panic if `CLIPPY_ARGS` is not Unicode
Mar 8, 2021
d0d5232
Auto merge of #6834 - hyd-dev:clippy-args, r=phansch,flip1995,oli-obk
bors Mar 8, 2021
714a826
Create types dir and move old module under it
Y-Nak Feb 11, 2021
df307c0
Move box_vec to its own module
Y-Nak Feb 11, 2021
128f1f5
Move redundant_allocation to its own module
Y-Nak Feb 11, 2021
f110c5e
Move rc_buffer to its own module
Y-Nak Feb 12, 2021
2c2fb39
Move vec_box to its own module
Y-Nak Feb 12, 2021
fbd25e9
Add flags to detect lints are triggered
Y-Nak Feb 12, 2021
b59c879
Move option_option to its own module
Y-Nak Feb 12, 2021
cc3ab1c
Move linked_list to its own module
Y-Nak Feb 12, 2021
53d3ffe
Move borrowed_box to its own module
Y-Nak Feb 12, 2021
2afa7df
Remove unused is_local from borrowed_box
Y-Nak Feb 12, 2021
bb8208d
Import declared lints at the top of the file
Y-Nak Feb 16, 2021
db59c35
Fix some lints in types that fail dogfood
Y-Nak Feb 25, 2021
b207f23
Auto merge of #6725 - Y-Nak:refactor-types-lints, r=flip1995
bors Mar 8, 2021
f2d917e
Don't assume lang items will exist.
Jarcho Mar 8, 2021
c4e2cf9
Opt-in to rustc_private for `rust-analyzer`
DJMcNab Mar 8, 2021
bf98aa6
Fix redundant closure with macros
camsteffen Mar 8, 2021
7e4f5ca
clippy: fix or-pattern in let binding
mark-i-m Mar 8, 2021
8c540dc
Improve the redundant_closure message
camsteffen Mar 8, 2021
2cb5bbf
Auto merge of #6871 - camsteffen:redundant-closure-macro, r=Manishearth
bors Mar 8, 2021
f098007
Separate lints of casts group from types group
Y-Nak Mar 9, 2021
360f065
Move 'is_isize_or_usize' to clippy_utils
Y-Nak Mar 9, 2021
c2cbcd3
Move cast_precision_loss to its own module
Y-Nak Mar 9, 2021
b12d751
Move cast_lossless to its own module
Y-Nak Mar 9, 2021
e322c77
use TyS::walk
anall Mar 9, 2021
e812a8a
use `.all` instead of negative use of `.any`
anall Mar 9, 2021
727e5f1
Auto merge of #6869 - DJMcNab:rust-analyzer-private, r=phansch
bors Mar 9, 2021
0534bf4
Move cast_possible_truncation to its own module
Y-Nak Mar 9, 2021
0975031
Move cast_sign_loss to its own module
Y-Nak Mar 9, 2021
a383e03
Move cast_possible_wrap to its own module
Y-Nak Mar 9, 2021
9709993
Move unnecessary_cast to its own module
Y-Nak Mar 9, 2021
0dce992
Remove 'lint_numeric_casts'
Y-Nak Mar 9, 2021
458f6d1
Move fn_to_numeric_cast to its own module
Y-Nak Mar 9, 2021
9a24877
Move fn_to_numeric_cast_with_truncation to its own module
Y-Nak Mar 9, 2021
ebd1ec0
Move cast_ptr_alignment to its own module
Y-Nak Mar 9, 2021
f33bb3d
Move cast_ref_to_mut to its own module
Y-Nak Mar 9, 2021
43c88c6
Move char_lit_as_u8 to its own module
Y-Nak Mar 9, 2021
824662d
Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov
m-ou-se Mar 9, 2021
98fbc09
Allow calling *const methods on *mut values
osa1 Mar 9, 2021
9e631da
Move ptr_as_ptr to its own module
Y-Nak Mar 9, 2021
3ed0bcc
Auto merge of #6873 - Y-Nak:refactor-casts-lint, r=flip1995
bors Mar 9, 2021
627e910
Auto merge of #6868 - Jarcho:lang_item, r=flip1995
bors Mar 9, 2021
9707599
add comment for when can be removed
anall Mar 9, 2021
8a5f98a
Auto merge of #6866 - anall:ice6840, r=flip1995
bors Mar 9, 2021
e0f982b
Improve doc on `map_flatten`
giraffate Mar 9, 2021
2b781c9
Auto merge of #6876 - giraffate:improve_doc_on_map_flatten, r=flip1995
bors Mar 9, 2021
8e1ce48
Set Clippy authors to "The Rust Clippy Developers"
flip1995 Mar 9, 2021
6f60dd8
Update match branches
JulianKnodt Oct 5, 2020
fb4dc58
Update cranelift
JulianKnodt Dec 29, 2020
cb8bc0b
Switch to changing cp_non_overlap in tform
JulianKnodt Jan 23, 2021
8d5e0f5
Simplify clippy author.
cjgillot Dec 6, 2020
476c528
Do not store attrs in FnKind.
cjgillot Nov 27, 2020
3e721b1
Remove hir::StmtKind::attrs.
cjgillot Nov 25, 2020
acd6014
Remove hir::Local::attrs.
cjgillot Nov 25, 2020
b32cffe
Remove hir::Crate::attrs.
cjgillot Nov 26, 2020
0449607
Remove hir::Arm::attrs.
cjgillot Nov 26, 2020
55f68ea
Remove hir::Variant::attrs.
cjgillot Nov 26, 2020
c3a17db
Remove hir::StructField::attrs.
cjgillot Nov 26, 2020
dd2af14
Remove hir::TraitItem::attrs.
cjgillot Nov 27, 2020
49835d8
Remove hir::ImplItem::attrs.
cjgillot Nov 27, 2020
dc9560c
Remove hir::Item::attrs.
cjgillot Jan 24, 2021
6c66826
Remove hir::Expr::attrs.
cjgillot Nov 27, 2020
fb27517
Auto merge of #6878 - flip1995:authors, r=Manishearth
bors Mar 9, 2021
612a9b2
2229: Handle capturing a reference into a repr packed struct
arora-aman Mar 7, 2021
36a27ec
Auto merge of #79519 - cjgillot:noattr, r=wesleywiser
bors Mar 10, 2021
a1e25a9
Auto merge of #6794 - camsteffen:needless-borrowed-ref, r=flip1995
bors Mar 10, 2021
8222d48
Auto merge of #6814 - hyd-dev:issue-6486, r=flip1995
bors Mar 10, 2021
a808822
Simplify lower ast block
camsteffen Mar 10, 2021
78c740e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Mar 11, 2021
ae6be4f
Bump nightly version => 2021-03-11
flip1995 Mar 11, 2021
9c1dd0c
Fix remaining dogfood errors (internal lints)
flip1995 Mar 11, 2021
99afc6e
Auto merge of #6881 - flip1995:rustup, r=flip1995
bors Mar 11, 2021
f0f07ac
move expect_used, filter_next, get_unwrap, ok_expect and unwrap_used …
TaKO8Ki Mar 2, 2021
483bac2
move skip_while_next to its own module
TaKO8Ki Mar 2, 2021
110dac7
move option_as_ref_deref to its own module
TaKO8Ki Mar 2, 2021
60a0537
move suspicious_map to its own module
TaKO8Ki Mar 2, 2021
8623b33
move filetype_is_file to its own module
TaKO8Ki Mar 2, 2021
35147d4
move uninit_assumed_init to its own module
TaKO8Ki Mar 2, 2021
45ee914
move iter_cloned_collect to its own module
TaKO8Ki Mar 2, 2021
6376da7
replace `lints` and `lint` with `check`
TaKO8Ki Mar 2, 2021
9b0a42b
move zst_offset to its own module
TaKO8Ki Mar 4, 2021
db91d9c
move map_collect_result_unit to its own module
TaKO8Ki Mar 4, 2021
3fe099b
move iter_next_slice to its own module
TaKO8Ki Mar 4, 2021
5912ca9
move iter_nth, iter_nth_zero and iterator_step_by_zero to their own m…
TaKO8Ki Mar 4, 2021
b5d809a
move wrong_self_convention to its own module
TaKO8Ki Mar 4, 2021
2ade32d
move string_extend_chars and clone_on_ref_ptr to their own module
TaKO8Ki Mar 4, 2021
8006dab
move single_char_insert_string to its own module
TaKO8Ki Mar 6, 2021
805aa47
move single_char_push_string to its own module
TaKO8Ki Mar 6, 2021
0c8d143
move into_iter_on_ref and single_char_pattern to their own modules
TaKO8Ki Mar 6, 2021
2561b7e
move from_iter_insteam_of_collect to its own module
TaKO8Ki Mar 6, 2021
183daeb
move filter_map to its own module
TaKO8Ki Mar 6, 2021
805dcd1
move filter_map_map to its own module
TaKO8Ki Mar 6, 2021
2baf043
move filter_map_next to its own module
TaKO8Ki Mar 6, 2021
6d94161
move filter_flat_map to its own module
TaKO8Ki Mar 6, 2021
f430384
move filter_map_flat_map to its own module
TaKO8Ki Mar 6, 2021
37ba779
move flat_map_identity to its own module
TaKO8Ki Mar 6, 2021
24909fa
move map_flatten and search_is_some to their own modules
TaKO8Ki Mar 6, 2021
171c4c1
move iter_skip_next to its own module
TaKO8Ki Mar 6, 2021
caaba82
move clone_on_copy to its own module
TaKO8Ki Mar 6, 2021
78e572c
move useless_asref to its own module
TaKO8Ki Mar 6, 2021
bbed852
unnecessary_fold to its own module
TaKO8Ki Mar 6, 2021
5557596
move option_map_or_none to its own module
TaKO8Ki Mar 6, 2021
b0824bf
move map_unwrap_or to its own module
TaKO8Ki Mar 6, 2021
f49349b
move or_fun_call to its own module
TaKO8Ki Mar 6, 2021
c711de2
move expect_fun_call to its own module
TaKO8Ki Mar 6, 2021
99f8607
remove unused imports
TaKO8Ki Mar 11, 2021
83a9553
fix interning-defined-symbol error
TaKO8Ki Mar 11, 2021
2546e6f
lintcheck: move out of clippy-dev into own crate
matthiaskrgr Mar 6, 2021
a846945
lintcheck: make sure we lauch from the repo root
matthiaskrgr Mar 9, 2021
c760150
gitignore: add lintchecks target dir
matthiaskrgr Mar 9, 2021
fac6da1
move testfiles to "lintcheck" and fix more paths
matthiaskrgr Mar 9, 2021
d859a17
lintcheck: update readme and remove the now redundant readme from cli…
matthiaskrgr Mar 9, 2021
3e60ba0
lintcheck: fix bug where lint messages about macros coming from crate…
matthiaskrgr Mar 11, 2021
b29ef18
lintcheck: update logs
matthiaskrgr Mar 11, 2021
b068b74
lintcheck: fix --fix and document it in the readme.
matthiaskrgr Mar 11, 2021
528e464
lintcheck: fix clippy warnings
matthiaskrgr Mar 11, 2021
ac93578
docs: basics.md: mention lintcheck
matthiaskrgr Mar 11, 2021
0af90fd
doc line length fixes
matthiaskrgr Mar 11, 2021
534a13d
Auto merge of #6884 - matthiaskrgr:lintcheck_crate, r=Manishearth
bors Mar 11, 2021
6ed6f1e
Auto merge of #6826 - TaKO8Ki:refactor-methods-mod, r=phansch
bors Mar 11, 2021
65ed23c
Support merge_functions option in NewPM since LLVM >= 12
kubo39 Mar 11, 2021
8357e57
Add support for storing code model to LLVM module IR
kubo39 Mar 11, 2021
d180f91
Emit the enum range assumption if the range only contains one element
Rustin170506 Mar 11, 2021
2feccf0
just drop kernel code model test case
kubo39 Mar 12, 2021
d480a3e
updated vulnerable deps
klensy Mar 12, 2021
fb311e1
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
flip1995 Mar 12, 2021
412ebc3
Update Cargo.lock
flip1995 Mar 12, 2021
99d0519
Clippy: HACK! Fix bootstrap error
flip1995 Mar 12, 2021
b43c02e
Rollup merge of #82436 - osa1:issue80258, r=nikomatsakis
Dylan-DPC Mar 12, 2021
55120b7
Rollup merge of #82878 - sexxi-goose:repr_packed, r=nikomatsakis
Dylan-DPC Mar 12, 2021
7878ef0
Rollup merge of #82984 - camsteffen:lower-block, r=cjgillot
Dylan-DPC Mar 12, 2021
f55a5a3
Rollup merge of #83012 - flip1995:clippyup, r=Manishearth
Dylan-DPC Mar 12, 2021
c0033e5
Rollup merge of #83020 - hi-rustin:rustin-patch-enum, r=lcnr
Dylan-DPC Mar 12, 2021
1b97480
Rollup merge of #83037 - kubo39:merge-functions-in-llvm-new-pass-mana…
Dylan-DPC Mar 12, 2021
d10e41f
Rollup merge of #83044 - kubo39:set-llvm-code-model, r=nikic
Dylan-DPC Mar 12, 2021
51a94c4
Rollup merge of #83052 - klensy:dep-update, r=Mark-Simulacrum
Dylan-DPC Mar 12, 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
  •  
  •  
  •  
24 changes: 9 additions & 15 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7"

[[package]]
name = "arc-swap"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"

[[package]]
name = "array_tool"
version = "1.0.3"
Expand Down Expand Up @@ -177,7 +171,7 @@ dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array 0.12.3",
"generic-array 0.12.4",
]

[[package]]
Expand Down Expand Up @@ -570,6 +564,7 @@ dependencies = [
"clippy_lints",
"compiletest_rs 0.6.0",
"derive-new",
"regex",
"rustc-workspace-hack",
"rustc_tools_util 0.2.0",
"semver 0.11.0",
Expand Down Expand Up @@ -1006,7 +1001,7 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array 0.12.3",
"generic-array 0.12.4",
]

[[package]]
Expand Down Expand Up @@ -1399,9 +1394,9 @@ dependencies = [

[[package]]
name = "generic-array"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
Expand Down Expand Up @@ -4917,11 +4912,10 @@ checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"

[[package]]
name = "signal-hook-registry"
version = "1.2.1"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035"
checksum = "ce32ea0c6c56d5eacaeb814fbed9960547021d3edd010ded1425f180536b20ab"
dependencies = [
"arc-swap",
"libc",
]

Expand All @@ -4933,9 +4927,9 @@ checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"

[[package]]
name = "sized-chunks"
version = "0.6.2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f"
checksum = "65e65d6a9f13cd78f361ea5a2cf53a45d67cdda421ba0316b9be101560f3d207"
dependencies = [
"bitmaps",
"typenum",
Expand Down
26 changes: 6 additions & 20 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2409,26 +2409,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}

fn lower_block_noalloc(&mut self, b: &Block, targeted_by_break: bool) -> hir::Block<'hir> {
let mut expr: Option<&'hir _> = None;

let stmts = self.arena.alloc_from_iter(
b.stmts
.iter()
.enumerate()
.filter_map(|(index, stmt)| {
if index == b.stmts.len() - 1 {
if let StmtKind::Expr(ref e) = stmt.kind {
expr = Some(self.lower_expr(e));
None
} else {
Some(self.lower_stmt(stmt))
}
} else {
Some(self.lower_stmt(stmt))
}
})
.flatten(),
);
let (stmts, expr) = match &*b.stmts {
[stmts @ .., Stmt { kind: StmtKind::Expr(e), .. }] => (stmts, Some(&*e)),
stmts => (stmts, None),
};
let stmts = self.arena.alloc_from_iter(stmts.iter().flat_map(|stmt| self.lower_stmt(stmt)));
let expr = expr.map(|e| self.lower_expr(e));
let rules = self.lower_block_check_mode(&b.rules);
let hir_id = self.lower_node_id(b.id);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn to_llvm_relocation_model(relocation_model: RelocModel) -> llvm::RelocModel {
}
}

fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeModel {
pub(crate) fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeModel {
match code_model {
Some(CodeModel::Tiny) => llvm::CodeModel::Tiny,
Some(CodeModel::Small) => llvm::CodeModel::Small,
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::attributes;
use crate::back::write::to_llvm_code_model;
use crate::callee::get_fn;
use crate::coverageinfo;
use crate::debuginfo;
Expand Down Expand Up @@ -181,6 +182,13 @@ pub unsafe fn create_module(
}
}

// Linking object files with different code models is undefined behavior
// because the compiler would have to generate additional code (to span
// longer jumps) if a larger code model is used with a smaller one.
//
// See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
llvm::LLVMRustSetModuleCodeModel(llmod, to_llvm_code_model(sess.code_model()));

// If skipping the PLT is enabled, we need to add some module metadata
// to ensure intrinsic calls don't use it.
if !sess.needs_plt() {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,7 @@ extern "C" {
pub fn LLVMRustUnsetComdat(V: &Value);
pub fn LLVMRustSetModulePICLevel(M: &Module);
pub fn LLVMRustSetModulePIELevel(M: &Module);
pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {

let er = scalar.valid_range_exclusive(bx.cx());
if er.end != er.start
&& scalar.valid_range.end() > scalar.valid_range.start()
&& scalar.valid_range.end() >= scalar.valid_range.start()
{
// We want `table[e as usize ± k]` to not
// have bound checks, and this is the most
Expand Down
16 changes: 14 additions & 2 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,18 @@ LLVMRustOptimizeWithNewPassManager(
TargetMachine *TM = unwrap(TMRef);
PassBuilder::OptimizationLevel OptLevel = fromRust(OptLevelRust);

// FIXME: MergeFunctions is not supported by NewPM yet.
(void) MergeFunctions;

PipelineTuningOptions PTO;
PTO.LoopUnrolling = UnrollLoops;
PTO.LoopInterleaving = UnrollLoops;
PTO.LoopVectorization = LoopVectorize;
PTO.SLPVectorization = SLPVectorize;
#if LLVM_VERSION_GE(12, 0)
PTO.MergeFunctions = MergeFunctions;
#else
// MergeFunctions is not supported by NewPM in older LLVM versions.
(void) MergeFunctions;
#endif

// FIXME: We may want to expose this as an option.
bool DebugPassManager = false;
Expand Down Expand Up @@ -1260,6 +1264,14 @@ extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
unwrap(M)->setPIELevel(PIELevel::Level::Large);
}

extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
LLVMRustCodeModel Model) {
auto CM = fromRust(Model);
if (!CM.hasValue())
return;
unwrap(M)->setCodeModel(*CM);
}

// Here you'll find an implementation of ThinLTO as used by the Rust compiler
// right now. This ThinLTO support is only enabled on "recent ish" versions of
// LLVM, and otherwise it's just blanket rejected from other compilers.
Expand Down
64 changes: 39 additions & 25 deletions compiler/rustc_typeck/src/check/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,46 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
let mut target =
self.structurally_resolved_type(autoderef.span(), autoderef.final_ty(false));

if let Some(mutbl) = pick.autoref {
let region = self.next_region_var(infer::Autoref(self.span, pick.item));
target = self.tcx.mk_ref(region, ty::TypeAndMut { mutbl, ty: target });
let mutbl = match mutbl {
hir::Mutability::Not => AutoBorrowMutability::Not,
hir::Mutability::Mut => AutoBorrowMutability::Mut {
// Method call receivers are the primary use case
// for two-phase borrows.
allow_two_phase_borrow: AllowTwoPhase::Yes,
},
};
adjustments
.push(Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(region, mutbl)), target });

if let Some(unsize_target) = pick.unsize {
target = self
.tcx
.mk_ref(region, ty::TypeAndMut { mutbl: mutbl.into(), ty: unsize_target });
adjustments.push(Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), target });
match &pick.autoref_or_ptr_adjustment {
Some(probe::AutorefOrPtrAdjustment::Autoref { mutbl, unsize }) => {
let region = self.next_region_var(infer::Autoref(self.span, pick.item));
target = self.tcx.mk_ref(region, ty::TypeAndMut { mutbl: *mutbl, ty: target });
let mutbl = match mutbl {
hir::Mutability::Not => AutoBorrowMutability::Not,
hir::Mutability::Mut => AutoBorrowMutability::Mut {
// Method call receivers are the primary use case
// for two-phase borrows.
allow_two_phase_borrow: AllowTwoPhase::Yes,
},
};
adjustments.push(Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(region, mutbl)),
target,
});

if let Some(unsize_target) = unsize {
target = self
.tcx
.mk_ref(region, ty::TypeAndMut { mutbl: mutbl.into(), ty: unsize_target });
adjustments
.push(Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), target });
}
}
Some(probe::AutorefOrPtrAdjustment::ToConstPtr) => {
target = match target.kind() {
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => {
assert_eq!(*mutbl, hir::Mutability::Mut);
self.tcx.mk_ptr(ty::TypeAndMut { mutbl: hir::Mutability::Not, ty })
}
other => panic!("Cannot adjust receiver type {:?} to const ptr", other),
};

adjustments.push(Adjustment {
kind: Adjust::Pointer(PointerCast::MutToConstPointer),
target,
});
}
} else {
// No unsizing should be performed without autoref (at
// least during method dispach). This is because we
// currently only unsize `[T;N]` to `[T]`, and naturally
// that must occur being a reference.
assert!(pick.unsize.is_none());
None => {}
}

self.register_predicates(autoderef.into_obligations());
Expand Down
Loading