Skip to content

Rollup of 16 pull requests #76045

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 224 commits into from
Closed
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
2d1515a
Miri: Renamed "undef" to "uninit"
pnadon Aug 8, 2020
a77e881
should_impl_trait - ignore methods with lifetime params
tnielens Jun 16, 2020
2bc0ecd
should_implement_trait - add test cases for every checked trait method
tnielens Jun 19, 2020
e6b2254
should_implement_trait - pr remarks
tnielens Jun 20, 2020
7cc1a2e
should_implement_trait - filter on explicit lifetime param only
tnielens Jun 23, 2020
166c520
should_impl_trait - pr comments
tnielens Jul 29, 2020
f9ba829
should_impl_trait - self linting
tnielens Aug 9, 2020
3e3e50b
Add example of false positive to PTR_ARG docs.
Ryan1729 Aug 10, 2020
fbf637d
formatting
Ryan1729 Aug 10, 2020
91aa55d
Rollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung
JohnTitor Aug 11, 2020
b8713e3
unnecessary-mut-passed: make lint message say if fn is a function or …
matthiaskrgr Aug 11, 2020
3337f79
Auto merge of #5892 - matthiaskrgr:redundant_mut, r=flip1995
bors Aug 11, 2020
c0a9d64
stable-sort-primitive: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
ac194ca
map_clone: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
04867e0
mutex-atomic: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
6af297f
iter-next-slice: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
f171f89
int_plus_one: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
bdf4dc3
implicit-saturating-sub: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
1f17c3b
multiple_inherent_impl: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
4236156
pub-enum-variant-names: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
2de290d
duration-subsec: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
db390f5
enum-clike-unportable-variant: tweak message a bit (Clike -> C-like)
matthiaskrgr Aug 11, 2020
89591a7
enum-variant-names: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
605e027
if_let_some_result: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
be3e695
if_not_else: make lint adhere to lint message convention
matthiaskrgr Aug 11, 2020
027780c
Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup
flip1995 Aug 11, 2020
fdc2f87
Auto merge of #75405 - flip1995:clippyup, r=Manishearth
bors Aug 12, 2020
8a96b9c
write.rs: don't clone TokenStream
matthiaskrgr Aug 12, 2020
7d2e42d
fix typo pointed out in review comment
Ryan1729 Aug 12, 2020
318c74a
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Aug 12, 2020
3ed0a4c
Auto merge of #5898 - flip1995:rustup, r=flip1995
bors Aug 12, 2020
2f4de2f
Auto merge of #5885 - Ryan1729:patch-2, r=flip1995
bors Aug 12, 2020
0fc61be
Add the other overloadable operations to suspicious_arithmetic_impl
Ryan1729 Aug 10, 2020
616682d
formatting
Ryan1729 Aug 10, 2020
c705817
trailing comma
Ryan1729 Aug 10, 2020
f4eeff9
add tests for Rem, BitAnd, BitOr, BitXor, Shl, and Shr
Ryan1729 Aug 12, 2020
c73cf9f
Auto merge of #5893 - matthiaskrgr:lint_msg, r=yaahc
bors Aug 12, 2020
7bd7a46
run tests/ui/update-references.sh to update 'suspicious_arithmetic_im…
Ryan1729 Aug 12, 2020
439bae6
Auto merge of #5884 - Ryan1729:patch-1, r=flip1995
bors Aug 12, 2020
480ccc3
Change Rc<Box<T>> recommendation to be Rc<T> instead of Box<T>
JarredAllen Aug 12, 2020
dc1e09b
Auto merge of #5897 - matthiaskrgr:no_clone_tts, r=flip1995
bors Aug 12, 2020
5634c8d
Fix: keep parenthesis for suggestion in `useless_conversion` lint
ThibsG Aug 12, 2020
4e28d99
Replace panics with early returns
JarredAllen Aug 12, 2020
9f827ab
Add reference to rustc-dev-guide about lint message
giraffate Aug 13, 2020
fc4fd91
Auto merge of #5900 - ThibsG:ParensUselessConversion4750, r=phansch
bors Aug 13, 2020
d5f5487
Auto merge of #5899 - JarredAllen:rc-box-suggestion, r=yaahc
bors Aug 13, 2020
ba363bd
Auto merge of #5901 - giraffate:add_reference_to_rustc_dev_guide, r=m…
bors Aug 13, 2020
429a1ce
merge `as_local_hir_id` with `local_def_id_to_hir_id`
lcnr Aug 12, 2020
48a1425
docs: typo in `temporary_cstring_as_ptr`: s/point/&s
ErichDonGubler Aug 13, 2020
8ecc0fc
Auto merge of #5905 - ErichDonGubler:patch-1, r=flip1995
bors Aug 13, 2020
8514b84
appreciative too_large_for_stack in useless `vec!`
wiomoc Aug 14, 2020
8e54997
Don't use `to_string` in impl Display
Jul 22, 2020
f98ffa2
Fix FP for `same_item_push`
giraffate Aug 14, 2020
72d2c2e
Lint `push_str` with a single-character string literal
wiomoc Aug 9, 2020
ae56e98
Merge lint with `single_char_pattern`
wiomoc Aug 14, 2020
b381ade
elide lifetimes
wiomoc Aug 14, 2020
f0cc006
Auto merge of #5910 - flip1995:rustup, r=flip1995
bors Aug 15, 2020
6d18fe7
Make needless_return a late lint pass
jrqc Aug 12, 2020
85f4ef0
Visitor added
jrqc Aug 12, 2020
65d10c7
Borrow checker added
jrqc Aug 13, 2020
cd6ca72
Known problems changed
jrqc Aug 13, 2020
a7d5c2f
Modifications according to the code review
jrqc Aug 13, 2020
96efaee
cargo dev update_lints
jrqc Aug 13, 2020
baa4cb1
early return removed
jrqc Aug 14, 2020
1a140dc
Improve needless_doctest_main by using the parser
ebroto Aug 15, 2020
f8db258
Auto merge of #5912 - ebroto:needless_doctest_main_improvements, r=Ma…
bors Aug 16, 2020
e522ca3
Auto merge of #5831 - chansuke:to_string_in_display, r=flip1995
bors Aug 16, 2020
c8e05fc
Auto merge of #5881 - wiomoc:feature/single-char-push_str, r=ebroto,f…
bors Aug 16, 2020
dff7e74
Auto merge of #5903 - jrqc:needless_return, r=ebroto,flip1995
bors Aug 16, 2020
78857cc
Auto merge of #5907 - wiomoc:feature/useless-vec-max-size, r=flip1995
bors Aug 16, 2020
3bd9889
Auto merge of #5725 - montrivo:should-impl-trait, r=flip1995
bors Aug 16, 2020
a3ea65c
Implement new lint
bugadani Jun 15, 2020
923d612
Rename the changelog footnote as well
bugadani Jun 15, 2020
848af39
Add note to `or_fun_call`, list checked methods
bugadani Jun 15, 2020
a7cc5d4
Also simplify if the closure body is an index expression
bugadani Jun 15, 2020
d7220db
Run cargo dev update_lints
bugadani Jun 15, 2020
75637c1
Catch function calls in argument lists, add tests that tuples don't g…
bugadani Jun 15, 2020
a7083ee
Removed the extra lifetime parameter
bugadani Jul 26, 2020
94cf90e
Apply suggested change
bugadani Jul 26, 2020
9c41822
Apply suggested change
bugadani Jul 26, 2020
d8f0a14
Fix typo in description of unnecessary_mut_passed
HactarCE Aug 16, 2020
d71b418
Moved to submodule, don't trigger if map_unwrap_or does
bugadani Aug 16, 2020
8a14c11
Cleanup, explain return value
bugadani Aug 16, 2020
3b52d7f
run cargo dev fmt
bugadani Aug 16, 2020
b7ee868
Fix dogfooding test errors
bugadani Aug 16, 2020
5d723d0
Auto merge of #5913 - HactarCE:patch-1, r=flip1995
bors Aug 16, 2020
b175642
Fix missed rename
bugadani Aug 16, 2020
fc1e07e
Rename lint to use plural form
bugadani Aug 16, 2020
8d0d89a
Auto merge of #5720 - bugadani:new-lint, r=flip1995,yaahc
bors Aug 16, 2020
6afa4ef
Introduce function for comparing expression values
tmiasko Aug 16, 2020
9b800b1
Rename SpanlessEq::ignore_fn to deny_side_effects
tmiasko Aug 16, 2020
d1dbf79
Expresions with Assign / AssignOp have side effects
tmiasko Aug 16, 2020
4f4abf4
Warn about explicit self-assignment
tmiasko Aug 16, 2020
8332fe8
Auto merge of #5894 - tmiasko:self-assignment, r=Manishearth
bors Aug 16, 2020
99ba290
Improve code style
giraffate Aug 16, 2020
262db3b
deps: bump cargo_metadata and semver
matthiaskrgr Aug 17, 2020
838c201
Auto merge of #5915 - matthiaskrgr:deps_, r=Manishearth
bors Aug 17, 2020
f13d2bf
clippy: support `QPath::LangItem`
davidtwco Aug 4, 2020
9360ca6
Auto merge of #5908 - giraffate:fix_fp_for_same_item_push, r=flip1995
bors Aug 17, 2020
ae0eb39
rust_ast::ast => rustc_ast
ryzokuken Apr 27, 2020
4b0e6d5
Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
bors Aug 17, 2020
c680602
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Aug 18, 2020
6220dff
Auto merge of #5922 - flip1995:rustup, r=flip1995
bors Aug 18, 2020
df4d42f
transmute: avoid suggesting from/to bits in const
ebroto Aug 17, 2020
6a12bae
no from/to bits in const: add tests cases for f64
ebroto Aug 18, 2020
902b282
Improve lint message in `to_string_in_display`
giraffate Aug 19, 2020
c236c0f
Fix false positive in `PRECEDENCE` lint
Aug 20, 2020
191b080
Capture tokens for Pat used in macro_rules! argument
Aaron1011 Jul 27, 2020
d891954
Auto merge of #5919 - ebroto:5747_from_bits_in_const, r=matthiaskrgr
bors Aug 20, 2020
4104611
Auto merge of #5928 - mikerite:fix-5924, r=ebroto
bors Aug 20, 2020
11efd75
Fix false negative in `option_as_ref_deref`
Aug 21, 2020
c2799c8
Merge remote-tracking branch 'upstream/master' into sync-from-rust
ebroto Aug 21, 2020
146e352
run cargo dev fmt
ebroto Aug 21, 2020
1a26dbf
Auto merge of #5938 - ebroto:sync-from-rust, r=ebroto
bors Aug 21, 2020
aa3b04f
Auto merge of #5933 - mikerite:fix-5927, r=matthiaskrgr
bors Aug 21, 2020
b57ef14
Auto merge of #5926 - giraffate:improve_lint_message_in_to_string_in_…
bors Aug 22, 2020
03bc7ae
Add async test case for `wrong_self_convention` lint
ThibsG Aug 21, 2020
a8520b0
Auto merge of #5934 - ThibsG:WrongSelfTestCase4037, r=ebroto
bors Aug 22, 2020
191b6c7
Don't lint if it has always inline attribute
ThibsG Aug 22, 2020
5b07b9e
Widen understanding of prelude import
stchris Aug 20, 2020
53508ae
Run sh tests/ui/update-all-references.sh
stchris Aug 20, 2020
e615a26
Use more elegant way to check for prelude string
stchris Aug 21, 2020
f21d10b
Auto merge of #5929 - stchris:issues/5917, r=ebroto
bors Aug 22, 2020
dd07860
Auto merge of #5941 - ThibsG:InlineInCopyPassByRef, r=yaahc
bors Aug 22, 2020
e8d33d7
Fix `let_and_return` bad suggestion
Aug 23, 2020
6dd65b8
Fix cargo dev new_lint for late lint passes
ebroto Aug 20, 2020
eb8ede7
Improve documentation related to the sync process
ebroto Aug 23, 2020
8776db9
Fix ICE in `repeat_once` lint
ebroto Aug 23, 2020
91b200c
Fix fp in `borrow_interior_mutable_const`
rail-rain Aug 23, 2020
2d86cc5
Auto merge of #5930 - ebroto:dev_newlint_fix_lt, r=matthiaskrgr
bors Aug 23, 2020
27ae4d3
Auto merge of #5948 - ebroto:5944_repeat_ice, r=Manishearth
bors Aug 23, 2020
b05077e
Apply suggestions from PR review
ebroto Aug 23, 2020
b2c2266
Fix FP for `redundant_closure_call`
giraffate Aug 18, 2020
9fe0ac3
Avoid period in lint message according to convention
giraffate Aug 24, 2020
ce8915c
typo
rail-rain Aug 24, 2020
bc7ea6f
Shorten liballoc doc intra link while readable
pickfire Aug 24, 2020
3d820f7
Fix incorrect suggestion when `clone_on_ref_ptr` is triggered in macros
ThibsG Aug 24, 2020
680c681
Added a lint which corrects expressions like (a - b) < f32::EPSILON
1c3t3a Aug 24, 2020
8e0e179
Expand rustdoc theme chooser x padding
pickfire Aug 24, 2020
f38eb93
Fix clashing_extern_declarations false positive.
jumbatm Aug 24, 2020
e9964f2
stable_sort_primitive: print the type that is being sorted in the lin…
matthiaskrgr Aug 21, 2020
8d9a485
Auto merge of #5935 - matthiaskrgr:unstable_sort_ty_name, r=flip1995
bors Aug 24, 2020
1831f65
Fix typo in TLS Model in Unstable Book
ArekPiekarz Aug 24, 2020
48b4aea
Unbreak the clippy test
scottmcm Aug 24, 2020
64b53f3
Auto merge of #5920 - giraffate:fix_fp_for_redundant_closure_call, r=…
bors Aug 25, 2020
9102832
Fix incorrect comment
Aug 25, 2020
48d4736
Simplify fmt test by using the clippy dev alias
Aug 25, 2020
c7dc9c3
Fix intermittent build error
Aug 25, 2020
179df0b
Added F32::EPSILON and F64::EPSILON to paths.rs
1c3t3a Aug 25, 2020
f20f7f2
Improve theme button hover background color
GuillaumeGomez Aug 25, 2020
671770e
Also handle transparent single-variant enums
jumbatm Aug 25, 2020
2ea86af
Use same name as attr.
jumbatm Aug 25, 2020
352df40
Remove unnecessary assert.
jumbatm Aug 25, 2020
acc6b6c
Fix typo
flip1995 Aug 25, 2020
a4090d2
Add test for issue #27130
bugadani Aug 25, 2020
5ef345a
Auto merge of #5960 - flip1995:rustup, r=flip1995
bors Aug 25, 2020
ba43a43
Auto merge of #5947 - ebroto:rustup_doc_improvements, r=flip1995
bors Aug 25, 2020
f901559
Auto merge of #5952 - 1c3t3a:1c3t3a-dev-5819, r=Manishearth
bors Aug 25, 2020
f326668
Auto merge of #5958 - mikerite:fix-fmt-20200825, r=flip1995
bors Aug 25, 2020
18e7a1b
Add `Res::ns()` instead of `matches_ns()`
jyn514 Aug 25, 2020
3b1e5d6
Re-enable len_zero for ranges now that `is_empty` is stable on them
scottmcm Aug 25, 2020
e191151
Auto merge of #5961 - scottmcm:master, r=Manishearth
bors Aug 25, 2020
370fc45
Update clippy_lints/src/methods/mod.rs
ThibsG Aug 25, 2020
56d3f39
Unify error reporting for intra-doc links
jyn514 Aug 25, 2020
05a040f
Remove unused `ns` parameter
jyn514 Aug 25, 2020
5ce4ee9
Add back `Res::matches_ns`, implemented in terms of `ns`
jyn514 Aug 25, 2020
e233d80
Remove outdated FIXME
jyn514 Aug 25, 2020
ad7a03c
Auto merge of #5951 - ThibsG:FixMacroCloneOnRefPtr2076, r=ebroto
bors Aug 25, 2020
bb351de
Use map_or(true) instead of unwrap_or(true)
jyn514 Aug 26, 2020
d3c5817
Note that `from_res` panics on errors
jyn514 Aug 26, 2020
9d18c24
Fix typo
hkmatsumoto Aug 26, 2020
23db542
Auto merge of #5964 - matsujika:matsujika-patch-1, r=ebroto
bors Aug 26, 2020
178c1bb
Fix a typo in #75781
Amanieu Aug 26, 2020
9ef4479
Auto merge of #5949 - rail-rain:fix_fp_borrow_interior_mutable_const,…
bors Aug 26, 2020
894581b
Auto merge of #5946 - mikerite:fix-5729, r=flip1995
bors Aug 26, 2020
2d85314
Changed the location of the suggestion as well as the way the suggest…
1c3t3a Aug 26, 2020
64c4bb0
Auto merge of #5966 - 1c3t3a:1c3t3a-dev-5819-fix, r=Manishearth
bors Aug 26, 2020
30b7dac
Set ninja=true by default
joshtriplett Jul 29, 2020
181ce0e
Disable ninja on macOS CI
joshtriplett Jul 29, 2020
6149dff
Install ninja on CI builders
joshtriplett Jul 29, 2020
bb39f35
Provide a better diagnostic if ninja isn't installed
joshtriplett Jul 29, 2020
edc05da
Fix the wrong use of `snippet_with_applicability`
rail-rain Aug 26, 2020
e45c59e
Auto merge of #5968 - rail-rain:fix_use_snippet_with_applicability, r…
bors Aug 26, 2020
91024f1
Add new lint to prevent usage of unwrap in fns that return result
yaahc Aug 26, 2020
dead45f
Auto merge of #5957 - xvschneider:AddUnwrapInsideResultLint, r=yaahc
bors Aug 26, 2020
f758c7b
Debian 6 doesn't have ninja, so use make for the dist builds
joshtriplett Aug 26, 2020
b71c8b6
should not try to apply field accessing on enum
csmoe Aug 27, 2020
04bff17
Fix FP in `to_string_in_display`
giraffate Aug 27, 2020
2a3ee5f
Fix FP in `new_ret_no_self`: trigger in trait def instead of impl block
ThibsG Jul 7, 2020
3cb75c2
Remove expansion restriction + fix doc and tests naming
ThibsG Aug 25, 2020
5046126
Merge logic of looking for `Self` type
ThibsG Aug 27, 2020
970e779
Add __fastfail for Windows on arm/aarch64
rylev Aug 27, 2020
f0722c0
Switch to intra-doc links in `core::hash`
camelid Aug 23, 2020
046556e
Make sure the functions don't get merged
bugadani Aug 27, 2020
07c5e9e
Auto merge of #5971 - giraffate:fix_fp_in_to_string_in_display, r=ebroto
bors Aug 27, 2020
9cdcfe2
Fix loading pretty-printers in rust-lldb script
artemmukhin Aug 28, 2020
392478c
Update compiler-builtins
vigoux Aug 24, 2020
e8be047
Update clippy_lints/src/utils/mod.rs
ThibsG Aug 28, 2020
ffaadae
Update clippy_lints/src/utils/mod.rs
ThibsG Aug 28, 2020
73b1ee1
Update clippy_lints/src/methods/mod.rs
ThibsG Aug 28, 2020
2037ba4
bump Miri
RalfJung Aug 28, 2020
8bcc4d6
Switch to asm! macro and use brk instruction on ARM
rylev Aug 28, 2020
3d0b0e6
Auto merge of #5774 - ThibsG:FixNewRetNoSelf, r=ebroto
bors Aug 28, 2020
8b501e3
Disable ninja on the dry-run builder
joshtriplett Aug 28, 2020
9e2228d
Back to opcode for 32 bit ARM __fastfail
rylev Aug 28, 2020
adc7351
Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup
flip1995 Aug 28, 2020
575e27d
Update Cargo.lock
flip1995 Aug 28, 2020
9ae5e95
Fix test
Amanieu Aug 28, 2020
062f744
Rollup merge of #74922 - joshtriplett:ninja-by-default, r=Mark-Simula…
Dylan-DPC Aug 29, 2020
520dbb9
Rollup merge of #75852 - camelid:patch-3, r=jyn514
Dylan-DPC Aug 29, 2020
b8023cc
Rollup merge of #75874 - pickfire:patch-3, r=jyn514
Dylan-DPC Aug 29, 2020
2cb4c22
Rollup merge of #75877 - vigoux:master, r=Amanieu
Dylan-DPC Aug 29, 2020
1b3cb99
Rollup merge of #75881 - pickfire:patch-5, r=GuillaumeGomez
Dylan-DPC Aug 29, 2020
9687dad
Rollup merge of #75885 - jumbatm:issue75739-clashing-extern-declarati…
Dylan-DPC Aug 29, 2020
3e5669a
Rollup merge of #75892 - ArekPiekarz:unstable_book_tls_model_typo, r=…
Dylan-DPC Aug 29, 2020
2c06347
Rollup merge of #75901 - GuillaumeGomez:ayu-theme-button-hover-backgr…
Dylan-DPC Aug 29, 2020
1f1dbdc
Rollup merge of #75910 - bugadani:testcase, r=oli-obk
Dylan-DPC Aug 29, 2020
9cd0768
Rollup merge of #75916 - jyn514:unify-error-reporting, r=euclio
Dylan-DPC Aug 29, 2020
5ee0755
Rollup merge of #75939 - Amanieu:fix_asm2, r=nagisa
Dylan-DPC Aug 29, 2020
d62a324
Rollup merge of #75985 - csmoe:issue-61076-1, r=estebank
Dylan-DPC Aug 29, 2020
993adf3
Rollup merge of #75990 - rylev:arm-fastfail, r=alexcrichton
Dylan-DPC Aug 29, 2020
53f2dc8
Rollup merge of #76015 - ortem:fix-lldb-script, r=Mark-Simulacrum
Dylan-DPC Aug 29, 2020
75f5474
Rollup merge of #76016 - RalfJung:miri, r=RalfJung
Dylan-DPC Aug 29, 2020
305c4b7
Rollup merge of #76034 - flip1995:clippyup, r=Manishearth
Dylan-DPC Aug 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -583,7 +583,7 @@ jobs:
- name: dist-x86_64-apple
env:
SCRIPT: "./x.py dist"
RUST_CONFIGURE_ARGS: "--target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc"
RUST_CONFIGURE_ARGS: "--target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
@@ -594,7 +594,7 @@ jobs:
- name: dist-x86_64-apple-alt
env:
SCRIPT: "./x.py dist"
RUST_CONFIGURE_ARGS: "--enable-extended --enable-profiler --set rust.jemalloc"
RUST_CONFIGURE_ARGS: "--enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
@@ -604,7 +604,7 @@ jobs:
- name: x86_64-apple
env:
SCRIPT: "./x.py --stage 2 test"
RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc"
RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.8
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
15 changes: 7 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -342,7 +342,7 @@ dependencies = [
name = "cargo-miri"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.9.1",
"cargo_metadata 0.11.1",
"directories",
"rustc-workspace-hack",
"rustc_version",
@@ -518,15 +518,15 @@ dependencies = [
name = "clippy"
version = "0.0.212"
dependencies = [
"cargo_metadata 0.9.1",
"cargo_metadata 0.11.1",
"clippy-mini-macro-test",
"clippy_lints",
"compiletest_rs",
"derive-new",
"lazy_static",
"rustc-workspace-hack",
"rustc_tools_util 0.2.0",
"semver 0.9.0",
"semver 0.10.0",
"serde",
"tempfile",
"tester",
@@ -540,15 +540,15 @@ version = "0.2.0"
name = "clippy_lints"
version = "0.0.212"
dependencies = [
"cargo_metadata 0.9.1",
"cargo_metadata 0.11.1",
"if_chain",
"itertools 0.9.0",
"lazy_static",
"pulldown-cmark",
"quine-mc_cluskey",
"quote",
"regex-syntax",
"semver 0.9.0",
"semver 0.10.0",
"serde",
"smallvec 1.4.2",
"syn",
@@ -615,9 +615,9 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.32"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc4ac2c824d2bfc612cba57708198547e9a26943af0632aff033e0693074d5c"
checksum = "e3fcd8aba10d17504c87ef12d4f62ef404c6a4703d16682a9eb5543e6cf24455"
dependencies = [
"cc",
"rustc-std-workspace-core",
@@ -1991,7 +1991,6 @@ dependencies = [
name = "miri"
version = "0.1.0"
dependencies = [
"byteorder",
"colored",
"compiletest_rs",
"env_logger 0.7.1",
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ by running `./x.py --help` or reading the [rustc dev guide][rustcguidebuild].
* `python` 3 or 2.7
* GNU `make` 3.81 or later
* `cmake` 3.4.3 or later
* `ninja`
* `curl`
* `git`
* `ssl` which comes in `libssl-dev` or `openssl-devel`
6 changes: 2 additions & 4 deletions config.toml.example
Original file line number Diff line number Diff line change
@@ -49,10 +49,8 @@
# dynamic version to be available.
#static-libstdcpp = false

# Tell the LLVM build system to use Ninja instead of the platform default for
# the generated build system. This can sometimes be faster than make, for
# example.
#ninja = false
# Whether to use Ninja to build LLVM. This runs much faster than make.
#ninja = true

# LLVM targets to build support for.
# Note: this is NOT related to Rust compilation targets. However, as Rust is
4 changes: 1 addition & 3 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
//!
//! # Examples
//!
//! You can explicitly create a [`Vec<T>`] with [`new`]:
//! You can explicitly create a [`Vec`] with [`Vec::new`]:
//!
//! ```
//! let v: Vec<i32> = Vec::new();
@@ -50,8 +50,6 @@
//! v[1] = v[1] + 5;
//! ```
//!
//! [`Vec<T>`]: Vec
//! [`new`]: Vec::new
//! [`push`]: Vec::push
#![stable(feature = "rust1", since = "1.0.0")]
31 changes: 8 additions & 23 deletions library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
@@ -39,8 +39,6 @@
//! If you need more control over how a value is hashed, you need to implement
//! the [`Hash`] trait:
//!
//! [`Hash`]: trait.Hash.html
//!
//! ```rust
//! use std::collections::hash_map::DefaultHasher;
//! use std::hash::{Hash, Hasher};
@@ -149,11 +147,9 @@ mod sip;
/// Thankfully, you won't need to worry about upholding this property when
/// deriving both [`Eq`] and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
///
/// [`Eq`]: ../../std/cmp/trait.Eq.html
/// [`Hasher`]: trait.Hasher.html
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
/// [`hash`]: #tymethod.hash
/// [`hash`]: Hash::hash
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Hash {
/// Feeds this value into the given [`Hasher`].
@@ -168,8 +164,6 @@ pub trait Hash {
/// 7920.hash(&mut hasher);
/// println!("Hash is {:x}!", hasher.finish());
/// ```
///
/// [`Hasher`]: trait.Hasher.html
#[stable(feature = "rust1", since = "1.0.0")]
fn hash<H: Hasher>(&self, state: &mut H);

@@ -186,8 +180,6 @@ pub trait Hash {
/// Hash::hash_slice(&numbers, &mut hasher);
/// println!("Hash is {:x}!", hasher.finish());
/// ```
///
/// [`Hasher`]: trait.Hasher.html
#[stable(feature = "hash_slice", since = "1.3.0")]
fn hash_slice<H: Hasher>(data: &[Self], state: &mut H)
where
@@ -239,10 +231,9 @@ pub use macros::Hash;
/// println!("Hash is {:x}!", hasher.finish());
/// ```
///
/// [`Hash`]: trait.Hash.html
/// [`finish`]: #tymethod.finish
/// [`write`]: #tymethod.write
/// [`write_u8`]: #method.write_u8
/// [`finish`]: Hasher::finish
/// [`write`]: Hasher::write
/// [`write_u8`]: Hasher::write_u8
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Hasher {
/// Returns the hash value for the values written so far.
@@ -264,7 +255,7 @@ pub trait Hasher {
/// println!("Hash is {:x}!", hasher.finish());
/// ```
///
/// [`write`]: #tymethod.write
/// [`write`]: Hasher::write
#[stable(feature = "rust1", since = "1.0.0")]
fn finish(&self) -> u64;

@@ -433,8 +424,7 @@ impl<H: Hasher + ?Sized> Hasher for &mut H {
/// assert_eq!(hasher_1.finish(), hasher_2.finish());
/// ```
///
/// [`build_hasher`]: #tymethod.build_hasher
/// [`Hasher`]: trait.Hasher.html
/// [`build_hasher`]: BuildHasher::build_hasher
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
#[stable(since = "1.7.0", feature = "build_hasher")]
pub trait BuildHasher {
@@ -456,8 +446,6 @@ pub trait BuildHasher {
/// let s = RandomState::new();
/// let new_s = s.build_hasher();
/// ```
///
/// [`Hasher`]: trait.Hasher.html
#[stable(since = "1.7.0", feature = "build_hasher")]
fn build_hasher(&self) -> Self::Hasher;
}
@@ -470,7 +458,7 @@ pub trait BuildHasher {
/// defined.
///
/// Any `BuildHasherDefault` is [zero-sized]. It can be created with
/// [`default`][method.Default]. When using `BuildHasherDefault` with [`HashMap`] or
/// [`default`][method.default]. When using `BuildHasherDefault` with [`HashMap`] or
/// [`HashSet`], this doesn't need to be done, since they implement appropriate
/// [`Default`] instances themselves.
///
@@ -503,10 +491,7 @@ pub trait BuildHasher {
/// let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
/// ```
///
/// [`BuildHasher`]: trait.BuildHasher.html
/// [`Default`]: ../default/trait.Default.html
/// [method.default]: #method.default
/// [`Hasher`]: trait.Hasher.html
/// [method.default]: BuildHasherDefault::default
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
/// [zero-sized]: https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts
17 changes: 14 additions & 3 deletions library/panic_abort/src/lib.rs
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
#![feature(panic_runtime)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![feature(llvm_asm)]
#![feature(asm)]

use core::any::Any;

@@ -47,7 +47,7 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
}
__rust_abort();
}
} else if #[cfg(all(windows, any(target_arch = "x86", target_arch = "x86_64")))] {
} else if #[cfg(windows)] {
// On Windows, use the processor-specific __fastfail mechanism. In Windows 8
// and later, this will terminate the process immediately without running any
// in-process exception handlers. In earlier versions of Windows, this
@@ -59,7 +59,18 @@ pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
//
// Note: this is the same implementation as in libstd's `abort_internal`
unsafe fn abort() -> ! {
llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
} else if #[cfg(target_arch = "arm")] {
asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
} else if #[cfg(target_arch = "aarch64")] {
asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
} else {
core::intrinsics::abort();
}
}
core::intrinsics::unreachable();
}
} else {
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
libc = { version = "0.2.74", default-features = false, features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.32" }
compiler_builtins = { version = "0.1.35" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.8.1", default-features = false, features = ['rustc-dep-of-std'] }
16 changes: 13 additions & 3 deletions library/std/src/sys/windows/mod.rs
Original file line number Diff line number Diff line change
@@ -306,10 +306,20 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
/// that function for more information on `__fastfail`
#[allow(unreachable_code)]
pub fn abort_internal() -> ! {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
unsafe {
llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
crate::intrinsics::unreachable();
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
crate::intrinsics::unreachable();
} else if #[cfg(target_arch = "arm")] {
asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
crate::intrinsics::unreachable();
} else if #[cfg(target_arch = "aarch64")] {
asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
crate::intrinsics::unreachable();
}
}
}
crate::intrinsics::abort();
}
1 change: 1 addition & 0 deletions src/bootstrap/builder/tests.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ fn configure(host: &[&str], target: &[&str]) -> Config {
config.save_toolstates = None;
config.skip_only_host_steps = false;
config.dry_run = true;
config.ninja = false;
// try to avoid spurious failures in dist where we create/delete each others file
let dir = config
.out
1 change: 1 addition & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -450,6 +450,7 @@ impl Config {
pub fn default_opts() -> Config {
let mut config = Config::default();
config.llvm_optimize = true;
config.ninja = true;
config.llvm_version_check = true;
config.backtrace = true;
config.rust_optimize = true;
1 change: 1 addition & 0 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
@@ -647,6 +647,7 @@ impl Step for DebuggerScripts {

cp_debugger_script("lldb_lookup.py");
cp_debugger_script("lldb_providers.py");
cp_debugger_script("lldb_commands")
}
}
}
12 changes: 10 additions & 2 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
@@ -100,8 +100,16 @@ pub fn check(build: &mut Build) {
if build.config.ninja {
// Some Linux distros rename `ninja` to `ninja-build`.
// CMake can work with either binary name.
if cmd_finder.maybe_have("ninja-build").is_none() {
cmd_finder.must_have("ninja");
if cmd_finder.maybe_have("ninja-build").is_none()
&& cmd_finder.maybe_have("ninja").is_none()
{
eprintln!(
"
Couldn't find required command: ninja
You should install ninja, or set ninja=false in config.toml
"
);
std::process::exit(1);
}
}

6 changes: 3 additions & 3 deletions src/ci/azure-pipelines/auto.yml
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ jobs:
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
x86_64-apple:
SCRIPT: ./x.py --stage 2 test
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.8
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
@@ -46,7 +46,7 @@ jobs:

dist-x86_64-apple:
SCRIPT: ./x.py dist
INITIAL_RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
INITIAL_RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
@@ -55,7 +55,7 @@ jobs:

dist-x86_64-apple-alt:
SCRIPT: ./x.py dist
INITIAL_RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
INITIAL_RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
1 change: 1 addition & 0 deletions src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:20.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/armhf-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
libc6-dev \
libc6-dev-armhf-cross \
make \
ninja-build \
python3 \
qemu-system-arm \
xz-utils
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/disabled/asmjs/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libssl-dev \
make \
ninja-build \
nasm \
pkg-config \
python3 \
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
libc6-dev \
libc6-dev-riscv64-cross \
make \
ninja-build \
patch \
python3 \
qemu-system-misc \
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++-multilib \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-i686-freebsd/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@ ENV RUST_CONFIGURE_ARGS \
--enable-profiler \
--set target.i686-unknown-linux-gnu.linker=clang \
--build=i686-unknown-linux-gnu \
--set llvm.ninja=false \
--set rust.jemalloc
ENV SCRIPT python2.7 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS
ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libncurses-dev \
gawk \
make \
ninja-build \
file \
curl \
ca-certificates \
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ apt-get install -y --no-install-recommends \
git \
lld-5.0 \
make \
ninja-build \
python \
sudo \
xz-utils
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -96,6 +96,7 @@ ENV RUST_CONFIGURE_ARGS \
--set target.x86_64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
--set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
--set llvm.thin-lto=true \
--set llvm.ninja=false \
--set rust.jemalloc
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
wget \
curl \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++-multilib \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/i686-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++-multilib \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/mingw-check/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/test-various/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/wasm32/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:19.10
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-llvm-8/Dockerfile
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
g++-arm-linux-gnueabi \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ FROM ubuntu:19.10
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
1 change: 1 addition & 0 deletions src/ci/docker/scripts/android-base-apt-get.sh
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ apt-get install -y --no-install-recommends \
git \
libssl-dev \
make \
ninja-build \
pkg-config \
python3 \
sudo \
1 change: 1 addition & 0 deletions src/ci/docker/scripts/cross-apt-packages.sh
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
libtool-bin \
make \
ninja-build \
patch \
pkg-config \
python3 \
6 changes: 3 additions & 3 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
@@ -605,7 +605,7 @@ jobs:
- name: dist-x86_64-apple
env:
SCRIPT: ./x.py dist
RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
@@ -620,7 +620,7 @@ jobs:
- name: dist-x86_64-apple-alt
env:
SCRIPT: ./x.py dist
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
@@ -634,7 +634,7 @@ jobs:
- name: x86_64-apple
env:
SCRIPT: ./x.py --stage 2 test
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.8
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
2 changes: 1 addition & 1 deletion src/doc/unstable-book/src/compiler-flags/tls-model.md
Original file line number Diff line number Diff line change
@@ -22,4 +22,4 @@ The TLS data must not be in a library loaded after startup (via `dlopen`).
but not in a shared library, and is accessed only from that executable.

`rustc` and LLVM may use a more optimized model than specified if they know that we are producing
and executable rather than a library, or that the `static` item is private enough.
an executable rather than a library, or that the `static` item is private enough.
1 change: 0 additions & 1 deletion src/etc/lldb_commands
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\"
type synthetic add -l lldb_lookup.synthetic_lookup -x \".*\" --category Rust
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::([a-z_]+::)+)String$\" --category Rust
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^&str$\" --category Rust
5 changes: 4 additions & 1 deletion src/etc/rust-lldb
Original file line number Diff line number Diff line change
@@ -30,5 +30,8 @@ EOF
fi
fi

script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands"

# Call LLDB with the commands added to the argument list
exec "$lldb" --source-before-file ./lldb_commands "$@"
exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@"
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/asm.rs
Original file line number Diff line number Diff line change
@@ -485,7 +485,7 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'tcx>>)
format!("{{{}{}}}", class, idx)
} else if reg == InlineAsmReg::AArch64(AArch64InlineAsmReg::x30) {
// LLVM doesn't recognize x30
"lr".to_string()
"{lr}".to_string()
} else {
format!("{{{}}}", reg.name())
}
18 changes: 12 additions & 6 deletions src/librustc_hir/def.rs
Original file line number Diff line number Diff line change
@@ -451,13 +451,19 @@ impl<Id> Res<Id> {
}
}

pub fn matches_ns(&self, ns: Namespace) -> bool {
/// Returns `None` if this is `Res::Err`
pub fn ns(&self) -> Option<Namespace> {
match self {
Res::Def(kind, ..) => kind.ns() == Some(ns),
Res::PrimTy(..) | Res::SelfTy(..) | Res::ToolMod => ns == Namespace::TypeNS,
Res::SelfCtor(..) | Res::Local(..) => ns == Namespace::ValueNS,
Res::NonMacroAttr(..) => ns == Namespace::MacroNS,
Res::Err => true,
Res::Def(kind, ..) => kind.ns(),
Res::PrimTy(..) | Res::SelfTy(..) | Res::ToolMod => Some(Namespace::TypeNS),
Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS),
Res::NonMacroAttr(..) => Some(Namespace::MacroNS),
Res::Err => None,
}
}

/// Always returns `true` if `self` is `Res::Err`
pub fn matches_ns(&self, ns: Namespace) -> bool {
self.ns().map_or(true, |actual_ns| actual_ns == ns)
}
}
35 changes: 35 additions & 0 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{ForeignItemKind, GenericParamKind, PatKind};
use rustc_hir::{HirId, HirIdSet, Node};
use rustc_index::vec::Idx;
use rustc_middle::lint::LintDiagnosticBuilder;
use rustc_middle::ty::subst::{GenericArgKind, Subst};
use rustc_middle::ty::{self, layout::LayoutError, Ty, TyCtxt};
@@ -2162,6 +2163,40 @@ impl ClashingExternDeclarations {
ckind: CItemKind,
) -> bool {
debug!("structurally_same_type_impl(cx, a = {:?}, b = {:?})", a, b);
let tcx = cx.tcx;

// Given a transparent newtype, reach through and grab the inner
// type unless the newtype makes the type non-null.
let non_transparent_ty = |ty: Ty<'tcx>| -> Ty<'tcx> {
let mut ty = ty;
loop {
if let ty::Adt(def, substs) = ty.kind {
let is_transparent = def.subst(tcx, substs).repr.transparent();
let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, &def);
debug!(
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
ty, is_transparent, is_non_null
);
if is_transparent && !is_non_null {
debug_assert!(def.variants.len() == 1);
let v = &def.variants[VariantIdx::new(0)];
ty = v
.transparent_newtype_field(tcx)
.expect(
"single-variant transparent structure with zero-sized field",
)
.ty(tcx, substs);
continue;
}
}
debug!("non_transparent_ty -> {:?}", ty);
return ty;
}
};

let a = non_transparent_ty(a);
let b = non_transparent_ty(b);

if !seen_types.insert((a, b)) {
// We've encountered a cycle. There's no point going any further -- the types are
// structurally the same.
18 changes: 11 additions & 7 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ use rustc_index::vec::Idx;
use rustc_middle::mir::interpret::{sign_extend, truncate};
use rustc_middle::ty::layout::{IntegerExt, SizeSkeleton};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
use rustc_middle::ty::{self, AdtKind, Ty, TyCtxt, TypeFoldable};
use rustc_span::source_map;
use rustc_span::symbol::sym;
use rustc_span::{Span, DUMMY_SP};
@@ -527,22 +527,26 @@ enum FfiResult<'tcx> {
FfiUnsafe { ty: Ty<'tcx>, reason: String, help: Option<String> },
}

crate fn nonnull_optimization_guaranteed<'tcx>(tcx: TyCtxt<'tcx>, def: &ty::AdtDef) -> bool {
tcx.get_attrs(def.did)
.iter()
.any(|a| tcx.sess.check_name(a, sym::rustc_nonnull_optimization_guaranteed))
}

/// Is type known to be non-null?
fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKind) -> bool {
crate fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKind) -> bool {
let tcx = cx.tcx;
match ty.kind {
ty::FnPtr(_) => true,
ty::Ref(..) => true,
ty::Adt(def, _) if def.is_box() && matches!(mode, CItemKind::Definition) => true,
ty::Adt(def, substs) if def.repr.transparent() && !def.is_union() => {
let guaranteed_nonnull_optimization = tcx
.get_attrs(def.did)
.iter()
.any(|a| tcx.sess.check_name(a, sym::rustc_nonnull_optimization_guaranteed));
let marked_non_null = nonnull_optimization_guaranteed(tcx, &def);

if guaranteed_nonnull_optimization {
if marked_non_null {
return true;
}

for variant in &def.variants {
if let Some(field) = variant.transparent_newtype_field(tcx) {
if ty_is_known_nonnull(cx, field.ty(tcx, substs), mode) {
18 changes: 11 additions & 7 deletions src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
@@ -1545,13 +1545,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
normalized_ty.kind,
);
if let ty::Adt(def, _) = normalized_ty.kind {
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident) {
err.span_suggestion_verbose(
base.span.shrink_to_hi(),
"consider awaiting before field access",
".await".to_string(),
Applicability::MaybeIncorrect,
);
// no field access on enum type
if !def.is_enum() {
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident)
{
err.span_suggestion_verbose(
base.span.shrink_to_hi(),
"consider awaiting before field access",
".await".to_string(),
Applicability::MaybeIncorrect,
);
}
}
}
}
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
@@ -1290,7 +1290,7 @@ h4 > .notable-traits {
#theme-choices > button {
border: none;
width: 100%;
padding: 4px;
padding: 4px 8px;
text-align: center;
background: rgba(0,0,0,0);
}
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
@@ -518,7 +518,7 @@ kbd {
}

#theme-choices > button:hover, #theme-choices > button:focus {
background-color: rgba(70, 70, 70, 0.33);
background-color: rgba(110, 110, 110, 0.33);
}

@media (max-width: 700px) {
124 changes: 56 additions & 68 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
@@ -829,16 +829,13 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
}
let candidates =
candidates.map(|candidate| candidate.map(|(res, _)| res));
let candidates = [TypeNS, ValueNS, MacroNS]
.iter()
.filter_map(|&ns| candidates[ns].map(|res| (res, ns)));
ambiguity_error(
cx,
&item,
path_str,
&dox,
link_range,
candidates.collect(),
candidates.present_items().collect(),
);
continue;
}
@@ -880,7 +877,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
fragment = Some(path.to_owned());
} else {
// `[char]` when a `char` module is in scope
let candidates = vec![(res, TypeNS), (prim, TypeNS)];
let candidates = vec![res, prim];
ambiguity_error(cx, &item, path_str, &dox, link_range, candidates);
continue;
}
@@ -898,20 +895,8 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
specified.article(),
specified.descr()
);
let suggestion = resolved.display_for(path_str);
let help_msg =
format!("to link to the {}, use its disambiguator", resolved.descr());
diag.note(&note);
if let Some(sp) = sp {
diag.span_suggestion(
sp,
&help_msg,
suggestion,
Applicability::MaybeIncorrect,
);
} else {
diag.help(&format!("{}: {}", help_msg, suggestion));
}
suggest_disambiguator(resolved, diag, path_str, &dox, sp, &link_range);
});
};
if let Res::PrimTy(_) = res {
@@ -1047,17 +1032,32 @@ impl Disambiguator {
}
}

fn display_for(self, path_str: &str) -> String {
/// WARNING: panics on `Res::Err`
fn from_res(res: Res) -> Self {
match res {
Res::Def(kind, _) => Disambiguator::Kind(kind),
Res::PrimTy(_) => Disambiguator::Primitive,
_ => Disambiguator::Namespace(res.ns().expect("can't call `from_res` on Res::err")),
}
}

/// Return (description of the change, suggestion)
fn display_for(self, path_str: &str) -> (&'static str, String) {
const PREFIX: &str = "prefix with the item kind";
const FUNCTION: &str = "add parentheses";
const MACRO: &str = "add an exclamation mark";

let kind = match self {
Disambiguator::Primitive => return format!("prim@{}", path_str),
Disambiguator::Primitive => return (PREFIX, format!("prim@{}", path_str)),
Disambiguator::Kind(kind) => kind,
Disambiguator::Namespace(_) => panic!("display_for cannot be used on namespaces"),
};
if kind == DefKind::Macro(MacroKind::Bang) {
return format!("{}!", path_str);
return (MACRO, format!("{}!", path_str));
} else if kind == DefKind::Fn || kind == DefKind::AssocFn {
return format!("{}()", path_str);
return (FUNCTION, format!("{}()", path_str));
}

let prefix = match kind {
DefKind::Struct => "struct",
DefKind::Enum => "enum",
@@ -1079,7 +1079,9 @@ impl Disambiguator {
Namespace::MacroNS => "macro",
},
};
format!("{}@{}", prefix, path_str)

// FIXME: if this is an implied shortcut link, it's bad style to suggest `@`
(PREFIX, format!("{}@{}", prefix, path_str))
}

fn ns(self) -> Namespace {
@@ -1247,12 +1249,12 @@ fn ambiguity_error(
path_str: &str,
dox: &str,
link_range: Option<Range<usize>>,
candidates: Vec<(Res, Namespace)>,
candidates: Vec<Res>,
) {
let mut msg = format!("`{}` is ", path_str);

match candidates.as_slice() {
[(first_def, _), (second_def, _)] => {
[first_def, second_def] => {
msg += &format!(
"both {} {} and {} {}",
first_def.article(),
@@ -1263,7 +1265,7 @@ fn ambiguity_error(
}
_ => {
let mut candidates = candidates.iter().peekable();
while let Some((res, _)) = candidates.next() {
while let Some(res) = candidates.next() {
if candidates.peek().is_some() {
msg += &format!("{} {}, ", res.article(), res.descr());
} else {
@@ -1276,52 +1278,38 @@ fn ambiguity_error(
report_diagnostic(cx, &msg, item, dox, link_range.clone(), |diag, sp| {
if let Some(sp) = sp {
diag.span_label(sp, "ambiguous link");
} else {
diag.note("ambiguous link");
}

let link_range = link_range.expect("must have a link range if we have a span");

for (res, ns) in candidates {
let (action, mut suggestion) = match res {
Res::Def(DefKind::AssocFn | DefKind::Fn, _) => {
("add parentheses", format!("{}()", path_str))
}
Res::Def(DefKind::Macro(MacroKind::Bang), _) => {
("add an exclamation mark", format!("{}!", path_str))
}
_ => {
let type_ = match (res, ns) {
(Res::PrimTy(_), _) => "prim",
(Res::Def(DefKind::Const, _), _) => "const",
(Res::Def(DefKind::Static, _), _) => "static",
(Res::Def(DefKind::Struct, _), _) => "struct",
(Res::Def(DefKind::Enum, _), _) => "enum",
(Res::Def(DefKind::Union, _), _) => "union",
(Res::Def(DefKind::Trait, _), _) => "trait",
(Res::Def(DefKind::Mod, _), _) => "module",
(_, TypeNS) => "type",
(_, ValueNS) => "value",
(Res::Def(DefKind::Macro(MacroKind::Derive), _), MacroNS) => "derive",
(_, MacroNS) => "macro",
};

// FIXME: if this is an implied shortcut link, it's bad style to suggest `@`
("prefix with the item type", format!("{}@{}", type_, path_str))
}
};
for res in candidates {
let disambiguator = Disambiguator::from_res(res);
suggest_disambiguator(disambiguator, diag, path_str, dox, sp, &link_range);
}
});
}

if dox.bytes().nth(link_range.start) == Some(b'`') {
suggestion = format!("`{}`", suggestion);
}
fn suggest_disambiguator(
disambiguator: Disambiguator,
diag: &mut DiagnosticBuilder<'_>,
path_str: &str,
dox: &str,
sp: Option<rustc_span::Span>,
link_range: &Option<Range<usize>>,
) {
let (action, mut suggestion) = disambiguator.display_for(path_str);
let help = format!("to link to the {}, {}", disambiguator.descr(), action);

// FIXME: Create a version of this suggestion for when we don't have the span.
diag.span_suggestion(
sp,
&format!("to link to the {}, {}", res.descr(), action),
suggestion,
Applicability::MaybeIncorrect,
);
}
if let Some(sp) = sp {
let link_range = link_range.as_ref().expect("must have a link range if we have a span");
if dox.bytes().nth(link_range.start) == Some(b'`') {
suggestion = format!("`{}`", suggestion);
}
});

diag.span_suggestion(sp, &help, suggestion, Applicability::MaybeIncorrect);
} else {
diag.help(&format!("{}: {}", help, suggestion));
}
}

fn privacy_error(
16 changes: 11 additions & 5 deletions src/test/assembly/asm/aarch64-types.rs
Original file line number Diff line number Diff line change
@@ -96,6 +96,17 @@ pub unsafe fn sym_static() {
asm!("adr x0, {}", sym extern_static);
}

// Regression test for #75761
// CHECK-LABEL: issue_75761:
// CHECK: str {{.*}}x30
// CHECK: //APP
// CHECK: //NO_APP
// CHECK: ldr {{.*}}x30
#[no_mangle]
pub unsafe fn issue_75761() {
asm!("", out("v0") _, out("x30") _);
}

macro_rules! check {
($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => {
#[no_mangle]
@@ -553,8 +564,3 @@ check_reg!(v0_f32x4 f32x4 "s0" "fmov");
// CHECK: fmov s0, s0
// CHECK: //NO_APP
check_reg!(v0_f64x2 f64x2 "s0" "fmov");

// Regression test for #75761
pub unsafe fn issue_75761() {
asm!("", out("v0") _, out("x30") _);
}
22 changes: 22 additions & 0 deletions src/test/codegen/issue-27130.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// compile-flags: -O
// min-llvm-version: 11.0

#![crate_type = "lib"]

// CHECK-LABEL: @trim_in_place
#[no_mangle]
pub fn trim_in_place(a: &mut &[u8]) {
while a.first() == Some(&42) {
// CHECK-NOT: slice_index_order_fail
*a = &a[1..];
}
}

// CHECK-LABEL: @trim_in_place2
#[no_mangle]
pub fn trim_in_place2(a: &mut &[u8]) {
while let Some(&42) = a.first() {
// CHECK-NOT: slice_index_order_fail
*a = &a[2..];
}
}
4 changes: 2 additions & 2 deletions src/test/rustdoc-ui/intra-link-prim-conflict.rs
Original file line number Diff line number Diff line change
@@ -18,13 +18,13 @@
/// [struct@char]
//~^ ERROR incompatible link
//~| HELP use its disambiguator
//~| HELP prefix with the item kind
//~| NOTE resolved to a module
pub mod char {}

pub mod inner {
//! [struct@char]
//~^ ERROR incompatible link
//~| HELP use its disambiguator
//~| HELP prefix with the item kind
//~| NOTE resolved to a builtin type
}
28 changes: 18 additions & 10 deletions src/test/rustdoc-ui/intra-link-prim-conflict.stderr
Original file line number Diff line number Diff line change
@@ -9,11 +9,11 @@ note: the lint level is defined here
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^
help: to link to the module, prefix with the item type
help: to link to the module, prefix with the item kind
|
LL | /// [module@char]
| ^^^^^^^^^^^
help: to link to the builtin type, prefix with the item type
LL | /// [mod@char]
| ^^^^^^^^
help: to link to the builtin type, prefix with the item kind
|
LL | /// [prim@char]
| ^^^^^^^^^
@@ -24,11 +24,11 @@ error: `char` is both a module and a builtin type
LL | /// [type@char]
| ^^^^^^^^^ ambiguous link
|
help: to link to the module, prefix with the item type
help: to link to the module, prefix with the item kind
|
LL | /// [module@char]
| ^^^^^^^^^^^
help: to link to the builtin type, prefix with the item type
LL | /// [mod@char]
| ^^^^^^^^
help: to link to the builtin type, prefix with the item kind
|
LL | /// [prim@char]
| ^^^^^^^^^
@@ -37,17 +37,25 @@ error: incompatible link kind for `char`
--> $DIR/intra-link-prim-conflict.rs:19:6
|
LL | /// [struct@char]
| ^^^^^^^^^^^ help: to link to the module, use its disambiguator: `mod@char`
| ^^^^^^^^^^^
|
= note: this link resolved to a module, which is not a struct
help: to link to the module, prefix with the item kind
|
LL | /// [mod@char]
| ^^^^^^^^

error: incompatible link kind for `char`
--> $DIR/intra-link-prim-conflict.rs:26:10
|
LL | //! [struct@char]
| ^^^^^^^^^^^ help: to link to the builtin type, use its disambiguator: `prim@char`
| ^^^^^^^^^^^
|
= note: this link resolved to a builtin type, which is not a struct
help: to link to the builtin type, prefix with the item kind
|
LL | //! [prim@char]
| ^^^^^^^^^

error: aborting due to 4 previous errors

16 changes: 8 additions & 8 deletions src/test/rustdoc-ui/intra-links-ambiguity.stderr
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ note: the lint level is defined here
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^
help: to link to the struct, prefix with the item type
help: to link to the struct, prefix with the item kind
|
LL | /// [`struct@ambiguous`] is ambiguous.
| ^^^^^^^^^^^^^^^^^^
@@ -24,7 +24,7 @@ error: `ambiguous` is both a struct and a function
LL | /// [ambiguous] is ambiguous.
| ^^^^^^^^^ ambiguous link
|
help: to link to the struct, prefix with the item type
help: to link to the struct, prefix with the item kind
|
LL | /// [struct@ambiguous] is ambiguous.
| ^^^^^^^^^^^^^^^^
@@ -39,7 +39,7 @@ error: `multi_conflict` is a struct, a function, and a macro
LL | /// [`multi_conflict`] is a three-way conflict.
| ^^^^^^^^^^^^^^^^ ambiguous link
|
help: to link to the struct, prefix with the item type
help: to link to the struct, prefix with the item kind
|
LL | /// [`struct@multi_conflict`] is a three-way conflict.
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -58,11 +58,11 @@ error: `type_and_value` is both a module and a constant
LL | /// Ambiguous [type_and_value].
| ^^^^^^^^^^^^^^ ambiguous link
|
help: to link to the module, prefix with the item type
help: to link to the module, prefix with the item kind
|
LL | /// Ambiguous [module@type_and_value].
| ^^^^^^^^^^^^^^^^^^^^^
help: to link to the constant, prefix with the item type
LL | /// Ambiguous [mod@type_and_value].
| ^^^^^^^^^^^^^^^^^^
help: to link to the constant, prefix with the item kind
|
LL | /// Ambiguous [const@type_and_value].
| ^^^^^^^^^^^^^^^^^^^^
@@ -73,7 +73,7 @@ error: `foo::bar` is both an enum and a function
LL | /// Ambiguous non-implied shortcut link [`foo::bar`].
| ^^^^^^^^^^ ambiguous link
|
help: to link to the enum, prefix with the item type
help: to link to the enum, prefix with the item kind
|
LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`].
| ^^^^^^^^^^^^^^^
22 changes: 11 additions & 11 deletions src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs
Original file line number Diff line number Diff line change
@@ -14,55 +14,55 @@ trait T {}
/// Link to [struct@S]
//~^ ERROR incompatible link kind for `S`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [mod@S]
//~^ ERROR incompatible link kind for `S`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [union@S]
//~^ ERROR incompatible link kind for `S`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [trait@S]
//~^ ERROR incompatible link kind for `S`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [struct@T]
//~^ ERROR incompatible link kind for `T`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [derive@m]
//~^ ERROR incompatible link kind for `m`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP add an exclamation mark

/// Link to [const@s]
//~^ ERROR incompatible link kind for `s`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [static@c]
//~^ ERROR incompatible link kind for `c`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [fn@c]
//~^ ERROR incompatible link kind for `c`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [c()]
//~^ ERROR incompatible link kind for `c`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP prefix with the item kind

/// Link to [const@f]
//~^ ERROR incompatible link kind for `f`
//~| NOTE this link resolved
//~| HELP use its disambiguator
//~| HELP add parentheses
pub fn f() {}
58 changes: 47 additions & 11 deletions src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -2,92 +2,128 @@ error: incompatible link kind for `S`
--> $DIR/intra-links-disambiguator-mismatch.rs:14:14
|
LL | /// Link to [struct@S]
| ^^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S`
| ^^^^^^^^
|
note: the lint level is defined here
--> $DIR/intra-links-disambiguator-mismatch.rs:1:9
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^
= note: this link resolved to an enum, which is not a struct
help: to link to the enum, prefix with the item kind
|
LL | /// Link to [enum@S]
| ^^^^^^

error: incompatible link kind for `S`
--> $DIR/intra-links-disambiguator-mismatch.rs:19:14
|
LL | /// Link to [mod@S]
| ^^^^^ help: to link to the enum, use its disambiguator: `enum@S`
| ^^^^^
|
= note: this link resolved to an enum, which is not a module
help: to link to the enum, prefix with the item kind
|
LL | /// Link to [enum@S]
| ^^^^^^

error: incompatible link kind for `S`
--> $DIR/intra-links-disambiguator-mismatch.rs:24:14
|
LL | /// Link to [union@S]
| ^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S`
| ^^^^^^^
|
= note: this link resolved to an enum, which is not a union
help: to link to the enum, prefix with the item kind
|
LL | /// Link to [enum@S]
| ^^^^^^

error: incompatible link kind for `S`
--> $DIR/intra-links-disambiguator-mismatch.rs:29:14
|
LL | /// Link to [trait@S]
| ^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S`
| ^^^^^^^
|
= note: this link resolved to an enum, which is not a trait
help: to link to the enum, prefix with the item kind
|
LL | /// Link to [enum@S]
| ^^^^^^

error: incompatible link kind for `T`
--> $DIR/intra-links-disambiguator-mismatch.rs:34:14
|
LL | /// Link to [struct@T]
| ^^^^^^^^ help: to link to the trait, use its disambiguator: `trait@T`
| ^^^^^^^^
|
= note: this link resolved to a trait, which is not a struct
help: to link to the trait, prefix with the item kind
|
LL | /// Link to [trait@T]
| ^^^^^^^

error: incompatible link kind for `m`
--> $DIR/intra-links-disambiguator-mismatch.rs:39:14
|
LL | /// Link to [derive@m]
| ^^^^^^^^ help: to link to the macro, use its disambiguator: `m!`
| ^^^^^^^^ help: to link to the macro, add an exclamation mark: `m!`
|
= note: this link resolved to a macro, which is not a derive macro

error: incompatible link kind for `s`
--> $DIR/intra-links-disambiguator-mismatch.rs:44:14
|
LL | /// Link to [const@s]
| ^^^^^^^ help: to link to the static, use its disambiguator: `static@s`
| ^^^^^^^
|
= note: this link resolved to a static, which is not a constant
help: to link to the static, prefix with the item kind
|
LL | /// Link to [static@s]
| ^^^^^^^^

error: incompatible link kind for `c`
--> $DIR/intra-links-disambiguator-mismatch.rs:49:14
|
LL | /// Link to [static@c]
| ^^^^^^^^ help: to link to the constant, use its disambiguator: `const@c`
| ^^^^^^^^
|
= note: this link resolved to a constant, which is not a static
help: to link to the constant, prefix with the item kind
|
LL | /// Link to [const@c]
| ^^^^^^^

error: incompatible link kind for `c`
--> $DIR/intra-links-disambiguator-mismatch.rs:54:14
|
LL | /// Link to [fn@c]
| ^^^^ help: to link to the constant, use its disambiguator: `const@c`
| ^^^^
|
= note: this link resolved to a constant, which is not a function
help: to link to the constant, prefix with the item kind
|
LL | /// Link to [const@c]
| ^^^^^^^

error: incompatible link kind for `c`
--> $DIR/intra-links-disambiguator-mismatch.rs:59:14
|
LL | /// Link to [c()]
| ^^^ help: to link to the constant, use its disambiguator: `const@c`
| ^^^
|
= note: this link resolved to a constant, which is not a function
help: to link to the constant, prefix with the item kind
|
LL | /// Link to [const@c]
| ^^^^^^^

error: incompatible link kind for `f`
--> $DIR/intra-links-disambiguator-mismatch.rs:64:14
|
LL | /// Link to [const@f]
| ^^^^^^^ help: to link to the function, use its disambiguator: `f()`
| ^^^^^^^ help: to link to the function, add parentheses: `f()`
|
= note: this link resolved to a function, which is not a constant

81 changes: 78 additions & 3 deletions src/test/ui/lint/clashing-extern-fn.rs
Original file line number Diff line number Diff line change
@@ -182,7 +182,9 @@ mod same_sized_members_clash {
y: f32,
z: f32,
}
extern "C" { fn origin() -> Point3; }
extern "C" {
fn origin() -> Point3;
}
}
mod b {
#[repr(C)]
@@ -191,8 +193,9 @@ mod same_sized_members_clash {
y: i32,
z: i32, // NOTE: Incorrectly redeclared as i32
}
extern "C" { fn origin() -> Point3; }
//~^ WARN `origin` redeclared with a different signature
extern "C" {
fn origin() -> Point3; //~ WARN `origin` redeclared with a different signature
}
}
}

@@ -258,6 +261,78 @@ mod non_zero_and_non_null {
}
}

// See #75739
mod non_zero_transparent {
mod a1 {
use std::num::NonZeroUsize;
extern "C" {
fn f1() -> NonZeroUsize;
}
}

mod b1 {
#[repr(transparent)]
struct X(NonZeroUsize);
use std::num::NonZeroUsize;
extern "C" {
fn f1() -> X;
}
}

mod a2 {
use std::num::NonZeroUsize;
extern "C" {
fn f2() -> NonZeroUsize;
}
}

mod b2 {
#[repr(transparent)]
struct X1(NonZeroUsize);

#[repr(transparent)]
struct X(X1);

use std::num::NonZeroUsize;
extern "C" {
// Same case as above, but with two layers of newtyping.
fn f2() -> X;
}
}

mod a3 {
#[repr(transparent)]
struct X(core::ptr::NonNull<i32>);

use std::num::NonZeroUsize;
extern "C" {
fn f3() -> X;
}
}

mod b3 {
extern "C" {
fn f3() -> core::ptr::NonNull<i32>;
}
}

mod a4 {
#[repr(transparent)]
enum E {
X(std::num::NonZeroUsize),
}
extern "C" {
fn f4() -> E;
}
}

mod b4 {
extern "C" {
fn f4() -> std::num::NonZeroUsize;
}
}
}

mod null_optimised_enums {
mod a {
extern "C" {
22 changes: 11 additions & 11 deletions src/test/ui/lint/clashing-extern-fn.stderr
Original file line number Diff line number Diff line change
@@ -106,19 +106,19 @@ LL | fn draw_point(p: Point);
found `unsafe extern "C" fn(sameish_members::b::Point)`

warning: `origin` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:194:22
--> $DIR/clashing-extern-fn.rs:197:13
|
LL | extern "C" { fn origin() -> Point3; }
| ---------------------- `origin` previously declared here
LL | fn origin() -> Point3;
| ---------------------- `origin` previously declared here
...
LL | extern "C" { fn origin() -> Point3; }
| ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
LL | fn origin() -> Point3;
| ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> same_sized_members_clash::a::Point3`
found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3`

warning: `transparent_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:217:13
--> $DIR/clashing-extern-fn.rs:220:13
|
LL | fn transparent_incorrect() -> T;
| -------------------------------- `transparent_incorrect` previously declared here
@@ -130,7 +130,7 @@ LL | fn transparent_incorrect() -> isize;
found `unsafe extern "C" fn() -> isize`

warning: `missing_return_type` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:235:13
--> $DIR/clashing-extern-fn.rs:238:13
|
LL | fn missing_return_type() -> usize;
| ---------------------------------- `missing_return_type` previously declared here
@@ -142,7 +142,7 @@ LL | fn missing_return_type();
found `unsafe extern "C" fn()`

warning: `non_zero_usize` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:253:13
--> $DIR/clashing-extern-fn.rs:256:13
|
LL | fn non_zero_usize() -> core::num::NonZeroUsize;
| ----------------------------------------------- `non_zero_usize` previously declared here
@@ -154,7 +154,7 @@ LL | fn non_zero_usize() -> usize;
found `unsafe extern "C" fn() -> usize`

warning: `non_null_ptr` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:255:13
--> $DIR/clashing-extern-fn.rs:258:13
|
LL | fn non_null_ptr() -> core::ptr::NonNull<usize>;
| ----------------------------------------------- `non_null_ptr` previously declared here
@@ -166,7 +166,7 @@ LL | fn non_null_ptr() -> *const usize;
found `unsafe extern "C" fn() -> *const usize`

warning: `option_non_zero_usize_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:281:13
--> $DIR/clashing-extern-fn.rs:356:13
|
LL | fn option_non_zero_usize_incorrect() -> usize;
| ---------------------------------------------- `option_non_zero_usize_incorrect` previously declared here
@@ -178,7 +178,7 @@ LL | fn option_non_zero_usize_incorrect() -> isize;
found `unsafe extern "C" fn() -> isize`

warning: `option_non_null_ptr_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:283:13
--> $DIR/clashing-extern-fn.rs:358:13
|
LL | fn option_non_null_ptr_incorrect() -> *const usize;
| --------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here
2 changes: 1 addition & 1 deletion src/tools/clippy/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[alias]
uitest = "test --test compile-test"
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
dev = "run --target-dir clippy_dev/target --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"

[build]
rustflags = ["-Zunstable-options"]
7 changes: 7 additions & 0 deletions src/tools/clippy/.github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -92,6 +92,13 @@ jobs:
env:
OS: ${{ runner.os }}

- name: Test cargo dev new lint
run: |
cargo dev new_lint --name new_early_pass --pass early
cargo dev new_lint --name new_late_pass --pass late
cargo check
git reset --hard HEAD
# Cleanup
- name: Run cargo-cache --autoclean
run: |
6 changes: 6 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1498,6 +1498,7 @@ Released 2018-09-13
[`float_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_arithmetic
[`float_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
[`float_cmp_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp_const
[`float_equality_without_abs`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_equality_without_abs
[`fn_address_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_address_comparisons
[`fn_params_excessive_bools`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_params_excessive_bools
[`fn_to_numeric_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast
@@ -1690,6 +1691,7 @@ Released 2018-09-13
[`same_functions_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
[`search_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
[`self_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_assignment
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse
[`shadow_same`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_same
@@ -1699,6 +1701,7 @@ Released 2018-09-13
[`should_implement_trait`]: https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
[`similar_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#similar_names
[`single_char_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
[`single_char_push_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_char_push_str
[`single_component_path_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
[`single_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match
[`single_match_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
@@ -1723,6 +1726,7 @@ Released 2018-09-13
[`temporary_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_assignment
[`temporary_cstring_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_cstring_as_ptr
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
[`todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
[`too_many_lines`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
@@ -1752,6 +1756,7 @@ Released 2018-09-13
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
[`unnecessary_fold`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold
[`unnecessary_lazy_evaluations`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
[`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
[`unnecessary_sort_by`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
@@ -1773,6 +1778,7 @@ Released 2018-09-13
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
[`unwrap_in_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_in_result
[`unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
[`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug
[`use_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_self
58 changes: 49 additions & 9 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -189,6 +189,35 @@ Clippy in the `rust-lang/rust` repository.
For general information about `subtree`s in the Rust repository see [Rust's
`CONTRIBUTING.md`][subtree].

### Patching git-subtree to work with big repos

Currently there's a bug in `git-subtree` that prevents it from working properly
with the [`rust-lang/rust`] repo. There's an open PR to fix that, but it's stale.
Before continuing with the following steps, we need to manually apply that fix to
our local copy of `git-subtree`.

You can get the patched version of `git-subtree` from [here][gitgitgadget-pr].
Put this file under `/usr/lib/git-core` (taking a backup of the previous file)
and make sure it has the proper permissions:

```bash
sudo cp --backup /path/to/patched/git-subtree.sh /usr/lib/git-core/git-subtree
sudo chmod --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
```

_Note:_ The first time running `git subtree push` a cache has to be built. This
involves going through the complete Clippy history once. For this you have to
increase the stack limit though, which you can do with `ulimit -s 60000`.
Make sure to run the `ulimit` command from the same session you call git subtree.

_Note:_ If you are a Debian user, `dash` is the shell used by default for scripts instead of `sh`.
This shell has a hardcoded recursion limit set to 1000. In order to make this process work,
you need to force the script to run `bash` instead. You can do this by editing the first
line of the `git-subtree` script and changing `sh` to `bash`.

### Performing the sync

Here is a TL;DR version of the sync process (all of the following commands have
to be run inside the `rust` directory):

@@ -198,6 +227,7 @@ to be run inside the `rust` directory):
# Make sure to change `your-github-name` to your github name in the following command
git subtree push -P src/tools/clippy git@github.com:your-github-name/rust-clippy sync-from-rust
```

_Note:_ This will directly push to the remote repository. You can also push
to your local copy by replacing the remote address with `/path/to/rust-clippy`
directory.
@@ -213,14 +243,30 @@ to be run inside the `rust` directory):
3. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
~~annoy~~ ask them in the [Discord] channel.)
4. Sync the `rust-lang/rust-clippy` master to the rust-copy of Clippy:

### Syncing back changes in Clippy to [`rust-lang/rust`]

To avoid flooding the [`rust-lang/rust`] PR queue, changes in Clippy's repo are synced back
in a bi-weekly basis if there's no urgent changes. This is done starting on the day of
the Rust stable release and then every other week. That way we guarantee that
every feature in Clippy is available for 2 weeks in nightly, before it can get to beta.
For reference, the first sync following this cadence was performed the 2020-08-27.

All of the following commands have to be run inside the `rust` directory.

1. Make sure Clippy itself is up-to-date by following the steps outlined in the previous
section if necessary.

2. Sync the `rust-lang/rust-clippy` master to the rust-copy of Clippy:
```bash
git checkout -b sync-from-clippy
git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
```
5. Open a PR to [`rust-lang/rust`]
3. Open a PR to [`rust-lang/rust`]

### Defining remotes

Also, you may want to define remotes, so you don't have to type out the remote
You may want to define remotes, so you don't have to type out the remote
addresses on every sync. You can do this with the following commands (these
commands still have to be run inside the `rust` directory):

@@ -241,12 +287,6 @@ You can then sync with the remote names from above, e.g.:
$ git subtree push -P src/tools/clippy clippy-local sync-from-rust
```

_Note:_ The first time running `git subtree push` a cache has to be built. This
involves going through the complete Clippy history once. For this you have to
increase the stack limit though, which you can do with `ulimit -s 60000`. For
this to work, you will need the fix of `git subtree` available
[here][gitgitgadget-pr].

[gitgitgadget-pr]: https://github.com/gitgitgadget/git/pull/493
[subtree]: https://rustc-dev-guide.rust-lang.org/contributing.html#external-dependencies-subtree
[`rust-lang/rust`]: https://github.com/rust-lang/rust
4 changes: 2 additions & 2 deletions src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -31,13 +31,13 @@ path = "src/driver.rs"
# begin automatic update
clippy_lints = { version = "0.0.212", path = "clippy_lints" }
# end automatic update
semver = "0.9"
semver = "0.10"
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"}
tempfile = { version = "3.1.0", optional = true }
lazy_static = "1.0"

[dev-dependencies]
cargo_metadata = "0.9.1"
cargo_metadata = "0.11.1"
compiletest_rs = { version = "0.5.0", features = ["tmp"] }
tester = "0.7"
lazy_static = "1.0"
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str
fn create_lint(lint: &LintData) -> io::Result<()> {
let (pass_type, pass_lifetimes, pass_import, context_import) = match lint.pass {
"early" => ("EarlyLintPass", "", "use rustc_ast::ast::*;", "EarlyContext"),
"late" => ("LateLintPass", "<'_, '_>", "use rustc_hir::*;", "LateContext"),
"late" => ("LateLintPass", "<'_>", "use rustc_hir::*;", "LateContext"),
_ => {
unreachable!("`pass_type` should only ever be `early` or `late`!");
},
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ keywords = ["clippy", "lint", "plugin"]
edition = "2018"

[dependencies]
cargo_metadata = "0.9.1"
cargo_metadata = "0.11.1"
if_chain = "1.0.0"
itertools = "0.9"
lazy_static = "1.0.2"
@@ -28,7 +28,7 @@ serde = { version = "1.0", features = ["derive"] }
smallvec = { version = "1", features = ["union"] }
toml = "0.5.3"
unicode-normalization = "0.1"
semver = "0.9.0"
semver = "0.10.0"
# NOTE: cargo requires serde feat in its url dep
# see <https://github.com/rust-lang/rust/pull/63587#issuecomment-522343864>
url = { version = "2.1.0", features = ["serde"] }
14 changes: 6 additions & 8 deletions src/tools/clippy/clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{
get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, trait_ref_of_method, SpanlessEq,
eq_expr_value, get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, trait_ref_of_method,
};
use crate::utils::{higher, sugg};
use if_chain::if_chain;
@@ -70,11 +70,11 @@ impl<'tcx> LateLintPass<'tcx> for AssignOps {
return;
}
// lhs op= l op r
if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, l) {
if eq_expr_value(cx, lhs, l) {
lint_misrefactored_assign_op(cx, expr, *op, rhs, lhs, r);
}
// lhs op= l commutative_op r
if is_commutative(op.node) && SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, r) {
if is_commutative(op.node) && eq_expr_value(cx, lhs, r) {
lint_misrefactored_assign_op(cx, expr, *op, rhs, lhs, l);
}
}
@@ -161,14 +161,12 @@ impl<'tcx> LateLintPass<'tcx> for AssignOps {

if visitor.counter == 1 {
// a = a op b
if SpanlessEq::new(cx).ignore_fn().eq_expr(assignee, l) {
if eq_expr_value(cx, assignee, l) {
lint(assignee, r);
}
// a = b commutative_op a
// Limited to primitive type as these ops are know to be commutative
if SpanlessEq::new(cx).ignore_fn().eq_expr(assignee, r)
&& cx.typeck_results().expr_ty(assignee).is_primitive_ty()
{
if eq_expr_value(cx, assignee, r) && cx.typeck_results().expr_ty(assignee).is_primitive_ty() {
match op.node {
hir::BinOpKind::Add
| hir::BinOpKind::Mul
@@ -253,7 +251,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
type Map = Map<'tcx>;

fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(self.assignee, expr) {
if eq_expr_value(self.cx, self.assignee, expr) {
self.counter += 1;
}

2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ use crate::utils::{
span_lint_and_sugg, span_lint_and_then, without_block_comments,
};
use if_chain::if_chain;
use rustc_ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
use rustc_ast::util::lev_distance::find_best_match_for_name;
use rustc_ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
use rustc_errors::Applicability;
use rustc_hir::{
Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitFn, TraitItem, TraitItemKind,
10 changes: 5 additions & 5 deletions src/tools/clippy/clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{
get_trait_def_id, implements_trait, in_macro, is_type_diagnostic_item, paths, snippet_opt, span_lint_and_sugg,
span_lint_and_then, SpanlessEq,
eq_expr_value, get_trait_def_id, implements_trait, in_macro, is_type_diagnostic_item, paths, snippet_opt,
span_lint_and_sugg, span_lint_and_then,
};
use if_chain::if_chain;
use rustc_ast::ast::LitKind;
@@ -128,7 +128,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
}
}
for (n, expr) in self.terminals.iter().enumerate() {
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e, expr) {
if eq_expr_value(self.cx, e, expr) {
#[allow(clippy::cast_possible_truncation)]
return Ok(Bool::Term(n as u8));
}
@@ -138,8 +138,8 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
if implements_ord(self.cx, e_lhs);
if let ExprKind::Binary(expr_binop, expr_lhs, expr_rhs) = &expr.kind;
if negate(e_binop.node) == Some(expr_binop.node);
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e_lhs, expr_lhs);
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e_rhs, expr_rhs);
if eq_expr_value(self.cx, e_lhs, expr_lhs);
if eq_expr_value(self.cx, e_rhs, expr_rhs);
then {
#[allow(clippy::cast_possible_truncation)]
return Ok(Bool::Not(Box::new(Bool::Term(n as u8))));
7 changes: 3 additions & 4 deletions src/tools/clippy/clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{eq_expr_value, SpanlessEq, SpanlessHash};
use crate::utils::{get_parent_expr, higher, if_sequence, snippet, span_lint_and_note, span_lint_and_then};
use crate::utils::{SpanlessEq, SpanlessHash};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::{Arm, Block, Expr, ExprKind, MatchSource, Pat, PatKind};
use rustc_lint::{LateContext, LateLintPass};
@@ -197,8 +197,7 @@ fn lint_same_cond(cx: &LateContext<'_>, conds: &[&Expr<'_>]) {
h.finish()
};

let eq: &dyn Fn(&&Expr<'_>, &&Expr<'_>) -> bool =
&|&lhs, &rhs| -> bool { SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, rhs) };
let eq: &dyn Fn(&&Expr<'_>, &&Expr<'_>) -> bool = &|&lhs, &rhs| -> bool { eq_expr_value(cx, lhs, rhs) };

for (i, j) in search_same(conds, hash, eq) {
span_lint_and_note(
@@ -222,7 +221,7 @@ fn lint_same_fns_in_if_cond(cx: &LateContext<'_>, conds: &[&Expr<'_>]) {

let eq: &dyn Fn(&&Expr<'_>, &&Expr<'_>) -> bool = &|&lhs, &rhs| -> bool {
// Do not spawn warning if `IFS_SAME_COND` already produced it.
if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, rhs) {
if eq_expr_value(cx, lhs, rhs) {
return false;
}
SpanlessEq::new(cx).eq_expr(lhs, rhs)
75 changes: 69 additions & 6 deletions src/tools/clippy/clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
use crate::utils::{implements_trait, is_entrypoint_fn, is_type_diagnostic_item, return_ty, span_lint};
use if_chain::if_chain;
use itertools::Itertools;
use rustc_ast::ast::{AttrKind, Attribute};
use rustc_ast::ast::{Async, AttrKind, Attribute, FnRetTy, ItemKind};
use rustc_ast::token::CommentKind;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lrc;
use rustc_errors::emitter::EmitterWriter;
use rustc_errors::Handler;
use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty;
use rustc_parse::maybe_new_parser_from_source_str;
use rustc_session::parse::ParseSess;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::{BytePos, MultiSpan, Span};
use rustc_span::Pos;
use rustc_span::source_map::{BytePos, FilePathMapping, MultiSpan, SourceMap, Span};
use rustc_span::{FileName, Pos};
use std::io;
use std::ops::Range;
use url::Url;

@@ -431,10 +437,67 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
headers
}

static LEAVE_MAIN_PATTERNS: &[&str] = &["static", "fn main() {}", "extern crate", "async fn main() {"];

fn check_code(cx: &LateContext<'_>, text: &str, span: Span) {
if text.contains("fn main() {") && !LEAVE_MAIN_PATTERNS.iter().any(|p| text.contains(p)) {
fn has_needless_main(code: &str) -> bool {
let filename = FileName::anon_source_code(code);

let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
let handler = Handler::with_emitter(false, None, box emitter);
let sess = ParseSess::with_span_handler(handler, sm);

let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code.into()) {
Ok(p) => p,
Err(errs) => {
for mut err in errs {
err.cancel();
}
return false;
},
};

let mut relevant_main_found = false;
loop {
match parser.parse_item() {
Ok(Some(item)) => match &item.kind {
// Tests with one of these items are ignored
ItemKind::Static(..)
| ItemKind::Const(..)
| ItemKind::ExternCrate(..)
| ItemKind::ForeignMod(..) => return false,
// We found a main function ...
ItemKind::Fn(_, sig, _, Some(block)) if item.ident.name == sym!(main) => {
let is_async = matches!(sig.header.asyncness, Async::Yes{..});
let returns_nothing = match &sig.decl.output {
FnRetTy::Default(..) => true,
FnRetTy::Ty(ty) if ty.kind.is_unit() => true,
_ => false,
};

if returns_nothing && !is_async && !block.stmts.is_empty() {
// This main function should be linted, but only if there are no other functions
relevant_main_found = true;
} else {
// This main function should not be linted, we're done
return false;
}
},
// Another function was found; this case is ignored too
ItemKind::Fn(..) => return false,
_ => {},
},
Ok(None) => break,
Err(mut e) => {
e.cancel();
return false;
},
}
}

relevant_main_found
}

if has_needless_main(text) {
span_lint(cx, NEEDLESS_DOCTEST_MAIN, span, "needless `fn main` in doctest");
}
}
5 changes: 2 additions & 3 deletions src/tools/clippy/clippy_lints/src/double_comparison.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;

use crate::utils::{snippet_with_applicability, span_lint_and_sugg, SpanlessEq};
use crate::utils::{eq_expr_value, snippet_with_applicability, span_lint_and_sugg};

declare_clippy_lint! {
/// **What it does:** Checks for double comparisons that could be simplified to a single expression.
@@ -46,8 +46,7 @@ impl<'tcx> DoubleComparisons {
},
_ => return,
};
let mut spanless_eq = SpanlessEq::new(cx).ignore_fn();
if !(spanless_eq.eq_expr(&llhs, &rlhs) && spanless_eq.eq_expr(&lrhs, &rrhs)) {
if !(eq_expr_value(cx, &llhs, &rlhs) && eq_expr_value(cx, &lrhs, &rrhs)) {
return;
}
macro_rules! lint_double_comparison {
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/duration_subsec.rs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for DurationSubsec {
cx,
DURATION_SUBSEC,
expr.span,
&format!("Calling `{}()` is more concise than this calculation", suggested_fn),
&format!("calling `{}()` is more concise than this calculation", suggested_fn),
"try",
format!(
"{}.{}()",
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/enum_clike.rs
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
cx,
ENUM_CLIKE_UNPORTABLE_VARIANT,
var.span,
"Clike enum variant discriminant is not portable to 32-bit targets",
"C-like enum variant discriminant is not portable to 32-bit targets",
);
};
}
6 changes: 3 additions & 3 deletions src/tools/clippy/clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
@@ -183,10 +183,10 @@ fn check_variant(
&& name.chars().nth(item_name_chars).map_or(false, |c| !c.is_lowercase())
&& name.chars().nth(item_name_chars + 1).map_or(false, |c| !c.is_numeric())
{
span_lint(cx, lint, var.span, "Variant name starts with the enum's name");
span_lint(cx, lint, var.span, "variant name starts with the enum's name");
}
if partial_rmatch(item_name, &name) == item_name_chars {
span_lint(cx, lint, var.span, "Variant name ends with the enum's name");
span_lint(cx, lint, var.span, "variant name ends with the enum's name");
}
}
let first = &def.variants[0].ident.name.as_str();
@@ -227,7 +227,7 @@ fn check_variant(
cx,
lint,
span,
&format!("All variants have the same {}fix: `{}`", what, value),
&format!("all variants have the same {}fix: `{}`", what, value),
None,
&format!(
"remove the {}fixes and use full paths to \
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/eq_op.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{
implements_trait, in_macro, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq,
eq_expr_value, implements_trait, in_macro, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then,
};
use rustc_errors::Applicability;
use rustc_hir::{BinOp, BinOpKind, BorrowKind, Expr, ExprKind};
@@ -69,7 +69,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
if macro_with_not_op(&left.kind) || macro_with_not_op(&right.kind) {
return;
}
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) {
if is_valid_operator(op) && eq_expr_value(cx, left, right) {
span_lint(
cx,
EQ_OP,
110 changes: 110 additions & 0 deletions src/tools/clippy/clippy_lints/src/float_equality_without_abs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
use crate::utils::{match_qpath, paths, span_lint_and_then, sugg};
use if_chain::if_chain;
use rustc_ast::util::parser::AssocOp;
use rustc_errors::Applicability;
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Spanned;

declare_clippy_lint! {
/// **What it does:** Checks for statements of the form `(a - b) < f32::EPSILON` or
/// `(a - b) < f64::EPSILON`. Notes the missing `.abs()`.
///
/// **Why is this bad?** The code without `.abs()` is more likely to have a bug.
///
/// **Known problems:** If the user can ensure that b is larger than a, the `.abs()` is
/// technically unneccessary. However, it will make the code more robust and doesn't have any
/// large performance implications. If the abs call was deliberately left out for performance
/// reasons, it is probably better to state this explicitly in the code, which then can be done
/// with an allow.
///
/// **Example:**
///
/// ```rust
/// pub fn is_roughly_equal(a: f32, b: f32) -> bool {
/// (a - b) < f32::EPSILON
/// }
/// ```
/// Use instead:
/// ```rust
/// pub fn is_roughly_equal(a: f32, b: f32) -> bool {
/// (a - b).abs() < f32::EPSILON
/// }
/// ```
pub FLOAT_EQUALITY_WITHOUT_ABS,
correctness,
"float equality check without `.abs()`"
}

declare_lint_pass!(FloatEqualityWithoutAbs => [FLOAT_EQUALITY_WITHOUT_ABS]);

impl<'tcx> LateLintPass<'tcx> for FloatEqualityWithoutAbs {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
let lhs;
let rhs;

// check if expr is a binary expression with a lt or gt operator
if let ExprKind::Binary(op, ref left, ref right) = expr.kind {
match op.node {
BinOpKind::Lt => {
lhs = left;
rhs = right;
},
BinOpKind::Gt => {
lhs = right;
rhs = left;
},
_ => return,
};
} else {
return;
}

if_chain! {

// left hand side is a substraction
if let ExprKind::Binary(
Spanned {
node: BinOpKind::Sub,
..
},
val_l,
val_r,
) = lhs.kind;

// right hand side matches either f32::EPSILON or f64::EPSILON
if let ExprKind::Path(ref epsilon_path) = rhs.kind;
if match_qpath(epsilon_path, &paths::F32_EPSILON) || match_qpath(epsilon_path, &paths::F64_EPSILON);

// values of the substractions on the left hand side are of the type float
let t_val_l = cx.typeck_results().expr_ty(val_l);
let t_val_r = cx.typeck_results().expr_ty(val_r);
if let ty::Float(_) = t_val_l.kind;
if let ty::Float(_) = t_val_r.kind;

then {
let sug_l = sugg::Sugg::hir(cx, &val_l, "..");
let sug_r = sugg::Sugg::hir(cx, &val_r, "..");
// format the suggestion
let suggestion = format!("{}.abs()", sugg::make_assoc(AssocOp::Subtract, &sug_l, &sug_r).maybe_par());
// spans the lint
span_lint_and_then(
cx,
FLOAT_EQUALITY_WITHOUT_ABS,
expr.span,
"float equality check without `.abs()`",
| diag | {
diag.span_suggestion(
lhs.span,
"add `.abs()`",
suggestion,
Applicability::MaybeIncorrect,
);
}
);
}
}
}
}
24 changes: 10 additions & 14 deletions src/tools/clippy/clippy_lints/src/floating_point_arithmetic.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use crate::consts::{
constant, constant_simple, Constant,
Constant::{Int, F32, F64},
};
use crate::utils::{get_parent_expr, higher, numeric_literal, span_lint_and_sugg, sugg, SpanlessEq};
use crate::utils::{eq_expr_value, get_parent_expr, higher, numeric_literal, span_lint_and_sugg, sugg};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment, UnOp};
@@ -363,8 +363,8 @@ fn detect_hypot(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<String> {
if_chain! {
if let ExprKind::Binary(Spanned { node: BinOpKind::Mul, .. }, ref lmul_lhs, ref lmul_rhs) = add_lhs.kind;
if let ExprKind::Binary(Spanned { node: BinOpKind::Mul, .. }, ref rmul_lhs, ref rmul_rhs) = add_rhs.kind;
if are_exprs_equal(cx, lmul_lhs, lmul_rhs);
if are_exprs_equal(cx, rmul_lhs, rmul_rhs);
if eq_expr_value(cx, lmul_lhs, lmul_rhs);
if eq_expr_value(cx, rmul_lhs, rmul_rhs);
then {
return Some(format!("{}.hypot({})", Sugg::hir(cx, &lmul_lhs, ".."), Sugg::hir(cx, &rmul_lhs, "..")));
}
@@ -502,8 +502,8 @@ fn check_mul_add(cx: &LateContext<'_>, expr: &Expr<'_>) {
fn is_testing_positive(cx: &LateContext<'_>, expr: &Expr<'_>, test: &Expr<'_>) -> bool {
if let ExprKind::Binary(Spanned { node: op, .. }, left, right) = expr.kind {
match op {
BinOpKind::Gt | BinOpKind::Ge => is_zero(cx, right) && are_exprs_equal(cx, left, test),
BinOpKind::Lt | BinOpKind::Le => is_zero(cx, left) && are_exprs_equal(cx, right, test),
BinOpKind::Gt | BinOpKind::Ge => is_zero(cx, right) && eq_expr_value(cx, left, test),
BinOpKind::Lt | BinOpKind::Le => is_zero(cx, left) && eq_expr_value(cx, right, test),
_ => false,
}
} else {
@@ -515,19 +515,15 @@ fn is_testing_positive(cx: &LateContext<'_>, expr: &Expr<'_>, test: &Expr<'_>) -
fn is_testing_negative(cx: &LateContext<'_>, expr: &Expr<'_>, test: &Expr<'_>) -> bool {
if let ExprKind::Binary(Spanned { node: op, .. }, left, right) = expr.kind {
match op {
BinOpKind::Gt | BinOpKind::Ge => is_zero(cx, left) && are_exprs_equal(cx, right, test),
BinOpKind::Lt | BinOpKind::Le => is_zero(cx, right) && are_exprs_equal(cx, left, test),
BinOpKind::Gt | BinOpKind::Ge => is_zero(cx, left) && eq_expr_value(cx, right, test),
BinOpKind::Lt | BinOpKind::Le => is_zero(cx, right) && eq_expr_value(cx, left, test),
_ => false,
}
} else {
false
}
}

fn are_exprs_equal(cx: &LateContext<'_>, expr1: &Expr<'_>, expr2: &Expr<'_>) -> bool {
SpanlessEq::new(cx).ignore_fn().eq_expr(expr1, expr2)
}

/// Returns true iff expr is some zero literal
fn is_zero(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
match constant_simple(cx, cx.typeck_results(), expr) {
@@ -546,12 +542,12 @@ fn is_zero(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
/// returns None.
fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a>) -> Option<(bool, &'a Expr<'a>)> {
if let ExprKind::Unary(UnOp::UnNeg, expr1_negated) = &expr1.kind {
if are_exprs_equal(cx, expr1_negated, expr2) {
if eq_expr_value(cx, expr1_negated, expr2) {
return Some((false, expr2));
}
}
if let ExprKind::Unary(UnOp::UnNeg, expr2_negated) = &expr2.kind {
if are_exprs_equal(cx, expr1, expr2_negated) {
if eq_expr_value(cx, expr1, expr2_negated) {
return Some((true, expr1));
}
}
@@ -614,7 +610,7 @@ fn are_same_base_logs(cx: &LateContext<'_>, expr_a: &Expr<'_>, expr_b: &Expr<'_>
args_a.len() == args_b.len() &&
(
["ln", "log2", "log10"].contains(&&*method_name_a.as_str()) ||
method_name_a.as_str() == "log" && args_a.len() == 2 && are_exprs_equal(cx, &args_a[1], &args_b[1])
method_name_a.as_str() == "log" && args_a.len() == 2 && eq_expr_value(cx, &args_a[1], &args_b[1])
);
}
}
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/if_let_some_result.rs
Original file line number Diff line number Diff line change
@@ -61,8 +61,8 @@ impl<'tcx> LateLintPass<'tcx> for OkIfLet {
cx,
IF_LET_SOME_RESULT,
expr.span.with_hi(op.span.hi()),
"Matching on `Some` with `ok()` is redundant",
&format!("Consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
"matching on `Some` with `ok()` is redundant",
&format!("consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
sugg,
applicability,
);
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/if_not_else.rs
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ impl EarlyLintPass for IfNotElse {
cx,
IF_NOT_ELSE,
item.span,
"Unnecessary boolean `not` operation",
"unnecessary boolean `not` operation",
None,
"remove the `!` and swap the blocks of the `if`/`else`",
);
@@ -70,7 +70,7 @@ impl EarlyLintPass for IfNotElse {
cx,
IF_NOT_ELSE,
item.span,
"Unnecessary `!=` operation",
"unnecessary `!=` operation",
None,
"change to `==` and swap the blocks of the `if`/`else`",
);
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/implicit_saturating_sub.rs
Original file line number Diff line number Diff line change
@@ -158,9 +158,9 @@ fn print_lint_and_sugg(cx: &LateContext<'_>, var_name: &str, expr: &Expr<'_>) {
cx,
IMPLICIT_SATURATING_SUB,
expr.span,
"Implicitly performing saturating subtraction",
"implicitly performing saturating subtraction",
"try",
format!("{} = {}.saturating_sub({});", var_name, var_name, 1.to_string()),
format!("{} = {}.saturating_sub({});", var_name, var_name, '1'),
Applicability::MachineApplicable,
);
}
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/inherent_impl.rs
Original file line number Diff line number Diff line change
@@ -81,9 +81,9 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
cx,
MULTIPLE_INHERENT_IMPL,
*additional_span,
"Multiple implementations of this structure",
"multiple implementations of this structure",
|diag| {
diag.span_note(*initial_span, "First implementation here");
diag.span_note(*initial_span, "first implementation here");
},
)
})
6 changes: 3 additions & 3 deletions src/tools/clippy/clippy_lints/src/int_plus_one.rs
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ impl IntPlusOne {
cx,
INT_PLUS_ONE,
block.span,
"Unnecessary `>= y + 1` or `x - 1 >=`",
"unnecessary `>= y + 1` or `x - 1 >=`",
"change it to",
recommendation,
Applicability::MachineApplicable, // snippet
@@ -163,8 +163,8 @@ impl IntPlusOne {
impl EarlyLintPass for IntPlusOne {
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = item.kind {
if let Some(ref rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
Self::emit_warning(cx, item, rec.clone());
if let Some(rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
Self::emit_warning(cx, item, rec);
}
}
}
17 changes: 1 addition & 16 deletions src/tools/clippy/clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{get_item_name, higher, snippet_with_applicability, span_lint, span_lint_and_sugg, walk_ptrs_ty};
use crate::utils::{get_item_name, snippet_with_applicability, span_lint, span_lint_and_sugg, walk_ptrs_ty};
use rustc_ast::ast::LitKind;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
@@ -260,17 +260,6 @@ fn check_len(

/// Checks if this type has an `is_empty` method.
fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
/// Special case ranges until `range_is_empty` is stabilized. See issue 3807.
fn should_skip_range(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
higher::range(expr).map_or(false, |_| {
!cx.tcx
.features()
.declared_lib_features
.iter()
.any(|(name, _)| name.as_str() == "range_is_empty")
})
}

/// Gets an `AssocItem` and return true if it matches `is_empty(self)`.
fn is_is_empty(cx: &LateContext<'_>, item: &ty::AssocItem) -> bool {
if let ty::AssocKind::Fn = item.kind {
@@ -296,10 +285,6 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
})
}

if should_skip_range(cx, expr) {
return false;
}

let ty = &walk_ptrs_ty(cx.typeck_results().expr_ty(expr));
match ty.kind {
ty::Dynamic(ref tt, ..) => tt.principal().map_or(false, |principal| {
124 changes: 0 additions & 124 deletions src/tools/clippy/clippy_lints/src/let_and_return.rs

This file was deleted.

45 changes: 35 additions & 10 deletions src/tools/clippy/clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
@@ -193,6 +193,7 @@ mod excessive_bools;
mod exit;
mod explicit_write;
mod fallible_impl_from;
mod float_equality_without_abs;
mod float_literal;
mod floating_point_arithmetic;
mod format;
@@ -218,7 +219,6 @@ mod large_const_arrays;
mod large_enum_variant;
mod large_stack_arrays;
mod len_zero;
mod let_and_return;
mod let_if_seq;
mod let_underscore;
mod lifetimes;
@@ -285,6 +285,7 @@ mod reference;
mod regex;
mod repeat_once;
mod returns;
mod self_assignment;
mod serde_api;
mod shadow;
mod single_component_path_imports;
@@ -296,6 +297,7 @@ mod swap;
mod tabs_in_doc_comments;
mod temporary_assignment;
mod to_digit_is_some;
mod to_string_in_display;
mod trait_bounds;
mod transmute;
mod transmuting_null;
@@ -310,7 +312,9 @@ mod unnested_or_patterns;
mod unsafe_removed_from_name;
mod unused_io_amount;
mod unused_self;
mod unused_unit;
mod unwrap;
mod unwrap_in_result;
mod use_self;
mod useless_conversion;
mod vec;
@@ -547,6 +551,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&exit::EXIT,
&explicit_write::EXPLICIT_WRITE,
&fallible_impl_from::FALLIBLE_IMPL_FROM,
&float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS,
&float_literal::EXCESSIVE_PRECISION,
&float_literal::LOSSY_FLOAT_LITERAL,
&floating_point_arithmetic::IMPRECISE_FLOPS,
@@ -586,7 +591,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&large_stack_arrays::LARGE_STACK_ARRAYS,
&len_zero::LEN_WITHOUT_IS_EMPTY,
&len_zero::LEN_ZERO,
&let_and_return::LET_AND_RETURN,
&let_if_seq::USELESS_LET_IF_SEQ,
&let_underscore::LET_UNDERSCORE_LOCK,
&let_underscore::LET_UNDERSCORE_MUST_USE,
@@ -677,13 +681,15 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&methods::SEARCH_IS_SOME,
&methods::SHOULD_IMPLEMENT_TRAIT,
&methods::SINGLE_CHAR_PATTERN,
&methods::SINGLE_CHAR_PUSH_STR,
&methods::SKIP_WHILE_NEXT,
&methods::STRING_EXTEND_CHARS,
&methods::SUSPICIOUS_MAP,
&methods::TEMPORARY_CSTRING_AS_PTR,
&methods::UNINIT_ASSUMED_INIT,
&methods::UNNECESSARY_FILTER_MAP,
&methods::UNNECESSARY_FOLD,
&methods::UNNECESSARY_LAZY_EVALUATIONS,
&methods::UNWRAP_USED,
&methods::USELESS_ASREF,
&methods::WRONG_PUB_SELF_CONVENTION,
@@ -769,8 +775,9 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&regex::INVALID_REGEX,
&regex::TRIVIAL_REGEX,
&repeat_once::REPEAT_ONCE,
&returns::LET_AND_RETURN,
&returns::NEEDLESS_RETURN,
&returns::UNUSED_UNIT,
&self_assignment::SELF_ASSIGNMENT,
&serde_api::SERDE_API_MISUSE,
&shadow::SHADOW_REUSE,
&shadow::SHADOW_SAME,
@@ -788,6 +795,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS,
&temporary_assignment::TEMPORARY_ASSIGNMENT,
&to_digit_is_some::TO_DIGIT_IS_SOME,
&to_string_in_display::TO_STRING_IN_DISPLAY,
&trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS,
&trait_bounds::TYPE_REPETITION_IN_BOUNDS,
&transmute::CROSSPOINTER_TRANSMUTE,
@@ -840,8 +848,10 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
&unused_io_amount::UNUSED_IO_AMOUNT,
&unused_self::UNUSED_SELF,
&unused_unit::UNUSED_UNIT,
&unwrap::PANICKING_UNWRAP,
&unwrap::UNNECESSARY_UNWRAP,
&unwrap_in_result::UNWRAP_IN_RESULT,
&use_self::USE_SELF,
&useless_conversion::USELESS_CONVERSION,
&utils::internal_lints::CLIPPY_LINTS_INTERNAL,
@@ -930,11 +940,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold));
let too_large_for_stack = conf.too_large_for_stack;
store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack});
store.register_late_pass(move || box vec::UselessVec{too_large_for_stack});
store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented);
store.register_late_pass(|| box strings::StringLitAsBytes);
store.register_late_pass(|| box derive::Derive);
store.register_late_pass(|| box types::CharLitAsU8);
store.register_late_pass(|| box vec::UselessVec);
store.register_late_pass(|| box drop_bounds::DropBounds);
store.register_late_pass(|| box get_last_with_len::GetLastWithLen);
store.register_late_pass(|| box drop_forget_ref::DropForgetRef);
@@ -1017,6 +1027,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_early_pass(|| box reference::DerefAddrOf);
store.register_early_pass(|| box reference::RefInDeref);
store.register_early_pass(|| box double_parens::DoubleParens);
store.register_late_pass(|| box to_string_in_display::ToStringInDisplay::new());
store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval);
store.register_early_pass(|| box if_not_else::IfNotElse);
store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse);
@@ -1025,8 +1036,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_early_pass(|| box misc_early::MiscEarlyLints);
store.register_early_pass(|| box redundant_closure_call::RedundantClosureCall);
store.register_late_pass(|| box redundant_closure_call::RedundantClosureCall);
store.register_early_pass(|| box returns::Return);
store.register_late_pass(|| box let_and_return::LetReturn);
store.register_early_pass(|| box unused_unit::UnusedUnit);
store.register_late_pass(|| box returns::Return);
store.register_early_pass(|| box collapsible_if::CollapsibleIf);
store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
store.register_early_pass(|| box precedence::Precedence);
@@ -1085,6 +1096,9 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(|| box pattern_type_mismatch::PatternTypeMismatch);
store.register_late_pass(|| box stable_sort_primitive::StableSortPrimitive);
store.register_late_pass(|| box repeat_once::RepeatOnce);
store.register_late_pass(|| box unwrap_in_result::UnwrapInResult);
store.register_late_pass(|| box self_assignment::SelfAssignment);
store.register_late_pass(|| box float_equality_without_abs::FloatEqualityWithoutAbs);

store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
@@ -1122,6 +1136,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&shadow::SHADOW_REUSE),
LintId::of(&shadow::SHADOW_SAME),
LintId::of(&strings::STRING_ADD),
LintId::of(&unwrap_in_result::UNWRAP_IN_RESULT),
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
LintId::of(&write::PRINT_STDOUT),
LintId::of(&write::USE_DEBUG),
@@ -1260,6 +1275,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
LintId::of(&explicit_write::EXPLICIT_WRITE),
LintId::of(&float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
LintId::of(&float_literal::EXCESSIVE_PRECISION),
LintId::of(&format::USELESS_FORMAT),
LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
@@ -1284,7 +1300,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
LintId::of(&len_zero::LEN_ZERO),
LintId::of(&let_and_return::LET_AND_RETURN),
LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
@@ -1349,13 +1364,15 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::SEARCH_IS_SOME),
LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
LintId::of(&methods::SINGLE_CHAR_PATTERN),
LintId::of(&methods::SINGLE_CHAR_PUSH_STR),
LintId::of(&methods::SKIP_WHILE_NEXT),
LintId::of(&methods::STRING_EXTEND_CHARS),
LintId::of(&methods::SUSPICIOUS_MAP),
LintId::of(&methods::TEMPORARY_CSTRING_AS_PTR),
LintId::of(&methods::UNINIT_ASSUMED_INIT),
LintId::of(&methods::UNNECESSARY_FILTER_MAP),
LintId::of(&methods::UNNECESSARY_FOLD),
LintId::of(&methods::UNNECESSARY_LAZY_EVALUATIONS),
LintId::of(&methods::USELESS_ASREF),
LintId::of(&methods::WRONG_SELF_CONVENTION),
LintId::of(&methods::ZST_OFFSET),
@@ -1413,8 +1430,9 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&regex::INVALID_REGEX),
LintId::of(&regex::TRIVIAL_REGEX),
LintId::of(&repeat_once::REPEAT_ONCE),
LintId::of(&returns::LET_AND_RETURN),
LintId::of(&returns::NEEDLESS_RETURN),
LintId::of(&returns::UNUSED_UNIT),
LintId::of(&self_assignment::SELF_ASSIGNMENT),
LintId::of(&serde_api::SERDE_API_MISUSE),
LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
@@ -1427,6 +1445,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
LintId::of(&temporary_assignment::TEMPORARY_ASSIGNMENT),
LintId::of(&to_digit_is_some::TO_DIGIT_IS_SOME),
LintId::of(&to_string_in_display::TO_STRING_IN_DISPLAY),
LintId::of(&transmute::CROSSPOINTER_TRANSMUTE),
LintId::of(&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
LintId::of(&transmute::TRANSMUTE_BYTES_TO_STR),
@@ -1460,6 +1479,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
LintId::of(&unused_unit::UNUSED_UNIT),
LintId::of(&unwrap::PANICKING_UNWRAP),
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
LintId::of(&useless_conversion::USELESS_CONVERSION),
@@ -1500,7 +1520,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&inherent_to_string::INHERENT_TO_STRING),
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
LintId::of(&len_zero::LEN_ZERO),
LintId::of(&let_and_return::LET_AND_RETURN),
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
LintId::of(&loops::EMPTY_LOOP),
LintId::of(&loops::FOR_KV_MAP),
@@ -1532,8 +1551,10 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::OPTION_MAP_OR_NONE),
LintId::of(&methods::RESULT_MAP_OR_INTO_OPTION),
LintId::of(&methods::SHOULD_IMPLEMENT_TRAIT),
LintId::of(&methods::SINGLE_CHAR_PUSH_STR),
LintId::of(&methods::STRING_EXTEND_CHARS),
LintId::of(&methods::UNNECESSARY_FOLD),
LintId::of(&methods::UNNECESSARY_LAZY_EVALUATIONS),
LintId::of(&methods::WRONG_SELF_CONVENTION),
LintId::of(&misc::TOPLEVEL_REF_ARG),
LintId::of(&misc::ZERO_PTR),
@@ -1554,8 +1575,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
LintId::of(&regex::TRIVIAL_REGEX),
LintId::of(&returns::LET_AND_RETURN),
LintId::of(&returns::NEEDLESS_RETURN),
LintId::of(&returns::UNUSED_UNIT),
LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
LintId::of(&strings::STRING_LIT_AS_BYTES),
LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
@@ -1564,6 +1585,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&types::FN_TO_NUMERIC_CAST),
LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
LintId::of(&unused_unit::UNUSED_UNIT),
LintId::of(&write::PRINTLN_EMPTY_STRING),
LintId::of(&write::PRINT_LITERAL),
LintId::of(&write::PRINT_WITH_NEWLINE),
@@ -1672,6 +1694,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
LintId::of(&eq_op::EQ_OP),
LintId::of(&erasing_op::ERASING_OP),
LintId::of(&float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
LintId::of(&formatting::POSSIBLE_MISSING_COMMA),
LintId::of(&functions::NOT_UNSAFE_PTR_ARG_DEREF),
LintId::of(&if_let_mutex::IF_LET_MUTEX),
@@ -1704,10 +1727,12 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&ptr::MUT_FROM_REF),
LintId::of(&ranges::REVERSED_EMPTY_RANGES),
LintId::of(&regex::INVALID_REGEX),
LintId::of(&self_assignment::SELF_ASSIGNMENT),
LintId::of(&serde_api::SERDE_API_MISUSE),
LintId::of(&suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
LintId::of(&suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
LintId::of(&swap::ALMOST_SWAPPED),
LintId::of(&to_string_in_display::TO_STRING_IN_DISPLAY),
LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
LintId::of(&transmute::WRONG_TRANSMUTE),
LintId::of(&transmuting_null::TRANSMUTING_NULL),
Loading