Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #91157

Closed
wants to merge 171 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
c3d4577
Fix `match_overlapping_arm` false negative
Nov 1, 2021
693df63
Ensure `match_overlapping_arms` warns on first
Nov 1, 2021
1011e08
Reference nightly-rustc docs in clippy's docs
xFrednet Nov 4, 2021
d134ddd
Improve `clippy_utils` function docs
xFrednet Nov 4, 2021
a276cd2
Add clippy docs to check for a specific type
xFrednet Nov 4, 2021
5405152
Added note about the usage of `clippy_utils::path`
xFrednet Nov 4, 2021
84a4ab7
Auto merge of #7928 - xFrednet:rust-90354-deploy-clippy-docs, r=flip1995
bors Nov 4, 2021
e674d0a
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
flip1995 Nov 4, 2021
93ffc9d
Remove rustfmt::skip attribute from register_plugins function
flip1995 Nov 5, 2021
14d54f0
Use Span::from_expansion instead of in_macro
camsteffen Oct 29, 2021
85e2592
Auto merge of #7909 - mikerite:fix-7816, r=camsteffen
bors Nov 5, 2021
5b1b6a2
Edit docs about macros
camsteffen Nov 5, 2021
9a60a93
Auto merge of #7897 - camsteffen:in-macro, r=flip1995
bors Nov 5, 2021
445c83f
Auto merge of #7937 - flip1995:rustfmt-skip-artefact, r=Manishearth
bors Nov 5, 2021
1c4dd8d
Remove trim_semicolon
camsteffen Nov 2, 2021
73501da
Add expr_visitor util
camsteffen Oct 20, 2021
5239a90
Factor in some expr_visitor usages
camsteffen Nov 5, 2021
2c7b7e8
Remove if let check for match_ref_pats
camsteffen Nov 5, 2021
c96cd35
Extend author lint
Serial-ATA Oct 29, 2021
b5bae09
Add `cargo dev lint` to manually run clippy on a file
Alexendoo Nov 2, 2021
e3d1e60
Auto merge of #7894 - Serial-ATA:extend-author-lint, r=camsteffen
bors Nov 6, 2021
9a8919d
Fix Clippy with changed format_args!
camsteffen Nov 6, 2021
0cb9ac2
Give inline const separate DefKind
nbdd0121 Oct 2, 2021
07f4f7c
Auto merge of #7917 - Alexendoo:cargo-dev-lint, r=giraffate
bors Nov 7, 2021
c063203
ast: Fix naming conventions in AST structures
petrochenkov Nov 7, 2021
2c6f03d
Fix ICE in undocumented_unsafe_blocks
Serial-ATA Nov 7, 2021
ac9dd36
Don't abort compilation after giving a lint error
jyn514 Jul 21, 2021
6fcdf81
Auto merge of #7945 - Serial-ATA:issue-7934, r=flip1995
bors Nov 8, 2021
94517d3
Auto merge of #7938 - camsteffen:visitors, r=xFrednet
bors Nov 8, 2021
6d23824
Make select_* methods return Vec for TraitEngine
fee1-dead Nov 8, 2021
413d255
Add MSRV to deprecated_cfg_attr
Serial-ATA Nov 7, 2021
830f220
Auto merge of #7944 - Serial-ATA:deprecated-cfg-attr-msrv, r=giraffate
bors Nov 9, 2021
6809234
Fix explicit_counter_loop suggestion for non-usize types
Serial-ATA Nov 9, 2021
98416d7
Remove `unimplemented!()` case in matches code
Nov 9, 2021
949b259
Change `Bound` to `EndBound`
Nov 9, 2021
f829523
Simplify range comparison code
Nov 9, 2021
c8f909e
Improve variable naming
Nov 9, 2021
81fa758
Improve variable naming 2
Nov 9, 2021
8b76915
matches: remove `pub` from some items
Nov 9, 2021
6536c58
Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-se
bors Nov 9, 2021
0332a7b
Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995
bors Nov 9, 2021
36d5475
Auto merge of #90700 - fee1-dead:select-returns-vec, r=davidtwco
bors Nov 9, 2021
e54c341
Fix suggestion for deref expressions in redundant_pattern_matching
Serial-ATA Nov 8, 2021
c94d62b
Auto merge of #7949 - Serial-ATA:issue-7921, r=flip1995
bors Nov 9, 2021
3382201
Lint for bool to integer casts in `cast_lossless`
5225225 Nov 8, 2021
96db1d6
fix dogfood lint on clippy_utils
5225225 Nov 8, 2021
6e84f00
Check MSRV for bool to int from impl
5225225 Nov 9, 2021
3b6b1ab
Rollup merge of #89561 - nbdd0121:const_typeck, r=nikomatsakis
matthiaskrgr Nov 9, 2021
f69721f
Auto merge of #7950 - Serial-ATA:issue-7920, r=llogiq
bors Nov 9, 2021
93f13d5
Auto merge of #7951 - mikerite:matches-20211109, r=llogiq
bors Nov 9, 2021
e8861c8
Add `semicolon_if_nothing_returned` test for `let-else` stmts
dswij Nov 10, 2021
a003ca6
`semicolon_if_nothing_returned` now checks if the stmt ends with semi…
dswij Nov 10, 2021
2e17035
Auto merge of #7955 - dswij:let-else-early-return, r=giraffate
bors Nov 10, 2021
7c1e62d
Added `clippy::version` attribute as lint metadata
xFrednet Oct 12, 2021
8565fc4
Add clippy version to Clippy's lint list
xFrednet Oct 12, 2021
23ed792
Document new `clippy::version` attribute and make it mandatory
xFrednet Oct 17, 2021
63cb410
Manually add `clippy::version` attribute to deprecated lints
xFrednet Oct 17, 2021
d647696
Added `clippy::version` attribute to all normal lints
xFrednet Oct 21, 2021
9d9d06d
Add lint to check for invalid `clippy:version` attributes
xFrednet Oct 21, 2021
d68408f
Updated version label and style on Clippy's lint list
xFrednet Nov 2, 2021
94bc0a1
Address review feedback
xFrednet Nov 10, 2021
ce01346
author: name qpath consistently
camsteffen Nov 8, 2021
d0cc201
author: fix some bugs
camsteffen Nov 10, 2021
a806ce7
author: reorder match arm
camsteffen Nov 8, 2021
72d7b9c
author: Remove needless `ref`s
camsteffen Nov 10, 2021
847a95b
Refactor utils on checking attribute
dswij Oct 25, 2021
2d037aa
Check for no_std and no_core attribute in `swap` lint
dswij Oct 25, 2021
dcd1a16
Add test for `swap` lint when `no_std` is present
dswij Oct 25, 2021
8389df9
Auto merge of #7877 - dswij:no-std-fp, r=camsteffen
bors Nov 11, 2021
8c45fd8
New internal lint to make `clippy::version` attribute mandatory
xFrednet Nov 11, 2021
3bfe98d
Auto merge of #7813 - xFrednet:6492-lint-version, r=flip1995
bors Nov 11, 2021
27a1763
Make author DRYer
camsteffen Nov 5, 2021
e444cbe
New `index_refutable_slice` lint
xFrednet Aug 31, 2021
3d4d0cf
Auto merge of #7643 - xFrednet:7569-splits-for-slices, r=camsteffen
bors Nov 11, 2021
8b84a76
Auto merge of #7956 - camsteffen:author, r=llogiq
bors Nov 11, 2021
24d561f
Use rustfmt version from `rust-toolchain`
Jarcho Nov 12, 2021
610b381
Auto merge of #7963 - Jarcho:dev_fmt, r=flip1995
bors Nov 12, 2021
d4c8cb6
Change cast_lossless message for bools only
5225225 Nov 12, 2021
4f82dd8
Auto merge of #7948 - 5225225:castlosslessbool, r=llogiq
bors Nov 12, 2021
91fe265
Add rustfmt component to rust-toolchain
Alexendoo Nov 12, 2021
608c9e8
Run clippy_dev workflow on current rust-toolchain
Alexendoo Nov 12, 2021
507030f
Run rustfmt on batches of multiple files
Alexendoo Nov 12, 2021
cc9d7ff
Auto merge of #7966 - Alexendoo:batch-rustfmt, r=camsteffen
bors Nov 12, 2021
80a263d
Fix `manual_map` suggestion when used with unsafe functions and unsaf…
Jarcho Nov 13, 2021
1df10f0
fix typo
togami2864 Nov 13, 2021
f51fb34
Auto merge of #7969 - togami2864:fix-typo, r=xFrednet
bors Nov 13, 2021
2ed4a8a
fix suggestion in option_map_or_none
togami2864 Nov 13, 2021
3fe11e7
option_if_let_else: don't expand macros in suggestion
matthiaskrgr Nov 13, 2021
3e20e30
Fix specific code outlined in issue #7975.
Blckbrry-Pi Nov 14, 2021
634e79c
Support suggestion for #7854
surechen Nov 11, 2021
f82bf47
Auto merge of #7957 - surechen:fix_for_7854, r=giraffate
bors Nov 15, 2021
4f71ff3
add test case for option_map_or_none
togami2864 Nov 15, 2021
0def42f
Auto merge of #7974 - matthiaskrgr:7973_opt_map_or_else_dont_expand_s…
bors Nov 15, 2021
bbffe82
add reduce_unit_expression
togami2864 Nov 15, 2021
02e0726
fix a bug that the closure arguments are not displayed
togami2864 Nov 15, 2021
cd57816
add comment
togami2864 Nov 15, 2021
300282c
fix fmt
togami2864 Nov 15, 2021
0a30fdc
move the let statement out of the macro
togami2864 Nov 15, 2021
8ded385
Improve `needless_borrow` lint.
Jarcho Nov 15, 2021
2938ffd
Improve heuristics for determining whether eager of lazy evaluation i…
Jarcho Aug 17, 2021
5b1b65b
Auto merge of #7639 - Jarcho:whitelist_cheap_functions, r=camsteffen
bors Nov 16, 2021
7605bac
resolve CI
togami2864 Nov 16, 2021
5b3c00f
Successfully generalize prevention of suggestions causing multiple mu…
Blckbrry-Pi Nov 16, 2021
c52b389
Fix readability suggestions.
Blckbrry-Pi Nov 16, 2021
83ad511
Auto merge of #7982 - Blckbrry-Pi:master, r=llogiq
bors Nov 16, 2021
e9bf5ec
Don't show no_effect warning on unit structs implementing fn* traits
F3real Nov 16, 2021
c051656
fixes: #7889
surechen Oct 29, 2021
46687f1
Auto merge of #7896 - surechen:fix_manual_split_once, r=camsteffen
bors Nov 17, 2021
3f3d7c2
Fix ICE on `undocumented_unsafe_blocks`
giraffate Nov 17, 2021
94ca94f
Auto merge of #7898 - F3real:unit_struct, r=camsteffen
bors Nov 17, 2021
e34927e
add multi-line test case
togami2864 Nov 17, 2021
d550e5f
Auto merge of #7988 - giraffate:fix_ice_on_undocumented_unsafe_blocks…
bors Nov 17, 2021
006c442
check whether stmts is empty or not in block
togami2864 Nov 17, 2021
8506f66
Minor simplification to `manual_map`
Jarcho Nov 17, 2021
5f861ee
Addition `manual_map` test for `unsafe` blocks
Jarcho Nov 17, 2021
8e317f5
fix suggestion message
togami2864 Nov 17, 2021
6ac42fe
Auto merge of #7971 - togami2864:fix/option-map-or-none, r=llogiq
bors Nov 17, 2021
bb58dc8
Auto merge of #7968 - Jarcho:manual_map_unsafe, r=xFrednet
bors Nov 17, 2021
cb62680
rustc: Remove `#[rustc_synthetic]`
petrochenkov Nov 18, 2021
b5a61aa
fix typo
togami2864 Nov 18, 2021
8536647
Auto merge of #7992 - togami2864:fix-typo, r=giraffate
bors Nov 18, 2021
731dfde
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 18, 2021
4bccd59
Bump nightly version -> 2021-11-18
flip1995 Nov 18, 2021
8dd1bce
Auto merge of #7994 - flip1995:rustup, r=flip1995
bors Nov 18, 2021
b7f1891
Pluralize disallowed_type lint
phansch Nov 17, 2021
a0d81d1
Pluralize disallowed_type lint filenames
phansch Nov 17, 2021
9b38fb7
Also pluralize disallowed_method(s) lint
flip1995 Nov 18, 2021
0375d20
Add missing components to rust-toolchain file
couchand Nov 17, 2021
2776076
Auto merge of #7977 - Jarcho:multi_needless_borrow, r=xFrednet
bors Nov 18, 2021
abb7155
add test case for result_map_or_into_option
togami2864 Nov 19, 2021
cd81bb9
fix stderr
togami2864 Nov 19, 2021
0d283cc
Auto merge of #7996 - togami2864:test-map-or-none, r=Manishearth
bors Nov 19, 2021
38bd251
Auto merge of #7984 - phansch:disallowed-type-rename, r=xFrednet
bors Nov 19, 2021
1429949
Don't check for a nightly toolchain in fmt test
Jarcho Nov 20, 2021
982124a
Add new lint `octal_escapes`
birkenfeld Nov 20, 2021
827fd50
Auto merge of #8000 - Jarcho:nightly_fmt, r=llogiq
bors Nov 20, 2021
1c8085d
Allow `suboptimal_flops` in const functions
xFrednet Nov 20, 2021
0c4055c
Avoid inline hints with double backticks for `doc-markdown`
birkenfeld Nov 20, 2021
32048eb
Auto merge of #8011 - birkenfeld:double_backticks, r=xFrednet
bors Nov 20, 2021
846c0be
Fixes #7915
surechen Nov 19, 2021
9aef9a2
Inhibit clicks on summary's children
jsha Nov 21, 2021
e58ffb8
Fix Clippy with changed for loop desugar
camsteffen Oct 27, 2021
8c1c763
clippy: Fix pattern_type_mismatch for loop
camsteffen Nov 19, 2021
de2208a
Auto merge of #7997 - surechen:Fixes_7915, r=giraffate
bors Nov 21, 2021
5fbfdfa
Auto merge of #8009 - xFrednet:8004-suboptimal-flops-in-const, r=gira…
bors Nov 22, 2021
7f35556
Add GUI test for clicking on non-toggle summary
jsha Nov 22, 2021
4027594
Auto merge of #7989 - couchand:2021-11/toolchain-missing-components, …
bors Nov 22, 2021
850e7f5
`octal_escapes`: updates from review, fix byte string prefix
birkenfeld Nov 21, 2021
bb7ec7b
Give people a single link they can click in the contributing guide
jyn514 Nov 22, 2021
0bc25d0
octal_escapes: emit only one lint for all cases found each literal
birkenfeld Nov 22, 2021
1210bb4
octal_escapes: note on print!() format strings
birkenfeld Nov 22, 2021
57a8804
Auto merge of #8007 - birkenfeld:octal_escapes, r=xFrednet
bors Nov 22, 2021
6d61d87
Split inline const to two feature gates
nbdd0121 Nov 22, 2021
6f38568
`#![feature(inline_const)]` is no longer incomplete
nbdd0121 Nov 22, 2021
7b103e7
Use `derive_default_enum` in the compiler
jhpratt Nov 23, 2021
ec3d1c8
Fix FP on `if_then_some_else_none` when there is early return
dswij Nov 16, 2021
08a500f
fix test in std::process on android
name1e5s Nov 23, 2021
e8e02d9
Make `intrinsics::write_bytes` const
lilasta Nov 23, 2021
d6c707d
Auto merge of #7980 - dswij:7870, r=xFrednet
bors Nov 23, 2021
5740230
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 23, 2021
c46c8c5
Bump nightly version -> 2021-11-23
flip1995 Nov 23, 2021
81f37a8
Auto merge of #8025 - flip1995:rustup, r=flip1995
bors Nov 23, 2021
1ee5aa4
Merge commit '81f37a8150fc86f8de00e6947e86d2b69291906a' into clippyup
flip1995 Nov 23, 2021
b95545b
Update Cargo.lock
flip1995 Nov 23, 2021
aa73065
Rollup merge of #90081 - woppopo:const_write_bytes, r=oli-obk
matthiaskrgr Nov 23, 2021
58269a6
Rollup merge of #91103 - jsha:non-toggle-click-doesnt-toggle, r=Manis…
matthiaskrgr Nov 23, 2021
39542a0
Rollup merge of #91137 - jyn514:contributing, r=spastorino
matthiaskrgr Nov 23, 2021
ccc53bb
Rollup merge of #91140 - nbdd0121:const_typeck, r=oli-obk
matthiaskrgr Nov 23, 2021
80bb3c0
Rollup merge of #91148 - jhpratt:use-default-enum, r=petrochenkov
matthiaskrgr Nov 23, 2021
5c8ed8f
Rollup merge of #91151 - name1e5s:chore/process_test, r=m-ou-se
matthiaskrgr Nov 23, 2021
c9ce710
Rollup merge of #91154 - flip1995:clippyup, r=Manishearth
matthiaskrgr Nov 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
Thank you for your interest in contributing to Rust! There are many ways to contribute
and we appreciate all of them.

The best way to get started is by asking for help in the [#new
members](https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members)
Zulip stream. We have lots of docs below of how to get started on your own, but
the Zulip stream is the best place to *ask* for help.

Documentation for contributing to Rust is located in the [Guide to Rustc Development](https://rustc-dev-guide.rust-lang.org/),
commonly known as the [rustc-dev-guide]. Despite the name, this guide documents
not just how to develop rustc (the Rust compiler), but also how to contribute to any part
of the Rust project.

To get started with contributing, please read the [Contributing to Rust] chapter of the guide.
That chapter explains how to get your development environment set up and how to get help.
not just how to develop rustc (the Rust compiler), but also how to contribute to the standard library and rustdoc.

## About the [rustc-dev-guide]

Expand Down
21 changes: 13 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ dependencies = [
"filetime",
"if_chain",
"itertools 0.10.1",
"parking_lot",
"quote",
"regex",
"rustc-workspace-hack",
Expand All @@ -600,6 +601,7 @@ name = "clippy_dev"
version = "0.0.1"
dependencies = [
"bytecount",
"cargo_metadata 0.14.0",
"clap",
"indoc",
"itertools 0.10.1",
Expand Down Expand Up @@ -1713,9 +1715,12 @@ dependencies = [

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

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

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

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

[[package]]
name = "parking_lot_core"
version = "0.8.3"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if 1.0.0",
"instant",
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ standard library, and documentation.

**Note: this README is for _users_ rather than _contributors_.
If you wish to _contribute_ to the compiler, you should read the
[Getting Started][gettingstarted] section of the rustc-dev-guide instead.**
[Getting Started][gettingstarted] section of the rustc-dev-guide instead.
You can ask for help in the [#new members Zulip stream][new-members].**

[new-members]: https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members

## Quick Start

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
gate_all!(const_trait_impl, "const trait impls are experimental");
gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
gate_all!(inline_const, "inline-const is experimental");
gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
gate_all!(
const_generics_defaults,
"default values for const generic parameters are experimental"
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::copy => {
self.copy_intrinsic(&args[0], &args[1], &args[2], /*nonoverlapping*/ false)?;
}
sym::write_bytes => {
self.write_bytes_intrinsic(&args[0], &args[1], &args[2])?;
}
sym::offset => {
let ptr = self.read_pointer(&args[0])?;
let offset_count = self.read_scalar(&args[1])?.to_machine_isize(self)?;
Expand Down Expand Up @@ -543,6 +546,23 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.memory.copy(src, align, dst, align, size, nonoverlapping)
}

pub(crate) fn write_bytes_intrinsic(
&mut self,
dst: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::PointerTag>,
byte: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::PointerTag>,
count: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::PointerTag>,
) -> InterpResult<'tcx> {
let layout = self.layout_of(dst.layout.ty.builtin_deref(true).unwrap().ty)?;

let dst = self.read_pointer(&dst)?;
let byte = self.read_scalar(&byte)?.to_u8()?;
let count = self.read_scalar(&count)?.to_machine_usize(self)?;

let len = layout.size * count;
let bytes = std::iter::repeat(byte).take(len.bytes_usize());
self.memory.write_bytes(dst, bytes)
}

pub(crate) fn raw_eq_intrinsic(
&mut self,
lhs: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::PointerTag>,
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ declare_features! (
/// Allows associated types in inherent impls.
(incomplete, inherent_associated_types, "1.52.0", Some(8995), None),
/// Allow anonymous constants from an inline `const` block
(incomplete, inline_const, "1.49.0", Some(76001), None),
(active, inline_const, "1.49.0", Some(76001), None),
/// Allow anonymous constants from an inline `const` block in pattern position
(incomplete, inline_const_pat, "1.58.0", Some(76001), None),
/// Allows using `pointer` and `reference` in intra-doc links
(active, intra_doc_pointers, "1.51.0", Some(80896), None),
/// Allows `#[instruction_set(_)]` attribute
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ pub(crate) type UnificationTable<'a, 'tcx, T> = ut::UnificationTable<
/// This is used so that the region values inferred by HIR region solving are
/// not exposed, and so that we can avoid doing work in HIR typeck that MIR
/// typeck will also do.
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default)]
pub enum RegionckMode {
/// The default mode: report region errors, don't erase regions.
#[default]
Solve,
/// Erase the results of region after solving.
Erase {
Expand All @@ -108,12 +109,6 @@ pub enum RegionckMode {
},
}

impl Default for RegionckMode {
fn default() -> Self {
RegionckMode::Solve
}
}

impl RegionckMode {
/// Indicates that the MIR borrowck will repeat these region
/// checks, so we should ignore errors if NLL is (unconditionally)
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(derive_default_enum)]
#![feature(extend_one)]
#![feature(iter_zip)]
#![feature(let_else)]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(core_intrinsics)]
#![feature(derive_default_enum)]
#![feature(discriminant_kind)]
#![feature(exhaustive_patterns)]
#![feature(if_let_guard)]
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2263,10 +2263,11 @@ impl<'tcx> TyS<'tcx> {
/// a miscompilation or unsoundness.
///
/// When in doubt, use `VarianceDiagInfo::default()`
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub enum VarianceDiagInfo<'tcx> {
/// No additional information - this is the default.
/// We will not add any additional information to error messages.
#[default]
None,
/// We switched our variance because a type occurs inside
/// the generic argument of a mutable reference or pointer
Expand Down Expand Up @@ -2301,9 +2302,3 @@ impl<'tcx> VarianceDiagInfo<'tcx> {
}
}
}

impl<'tcx> Default for VarianceDiagInfo<'tcx> {
fn default() -> Self {
Self::None
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ impl<'a> Parser<'a> {
} else if self.eat_keyword(kw::Unsafe) {
self.parse_block_expr(None, lo, BlockCheckMode::Unsafe(ast::UserProvided), attrs)
} else if self.check_inline_const(0) {
self.parse_const_block(lo.to(self.token.span))
self.parse_const_block(lo.to(self.token.span), false)
} else if self.is_do_catch_block() {
self.recover_do_catch(attrs)
} else if self.is_try_block() {
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,12 @@ impl<'a> Parser<'a> {
}

/// Parses inline const expressions.
fn parse_const_block(&mut self, span: Span) -> PResult<'a, P<Expr>> {
self.sess.gated_spans.gate(sym::inline_const, span);
fn parse_const_block(&mut self, span: Span, pat: bool) -> PResult<'a, P<Expr>> {
if pat {
self.sess.gated_spans.gate(sym::inline_const_pat, span);
} else {
self.sess.gated_spans.gate(sym::inline_const, span);
}
self.eat_keyword(kw::Const);
let blk = self.parse_block()?;
let anon_const = AnonConst {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl<'a> Parser<'a> {
PatKind::Box(pat)
} else if self.check_inline_const(0) {
// Parse `const pat`
let const_expr = self.parse_const_block(lo.to(self.token.span))?;
let const_expr = self.parse_const_block(lo.to(self.token.span), true)?;

if let Some(re) = self.parse_range_end() {
self.parse_pat_range_begin_with(const_expr, re)?
Expand Down Expand Up @@ -884,7 +884,7 @@ impl<'a> Parser<'a> {

fn parse_pat_range_end(&mut self) -> PResult<'a, P<Expr>> {
if self.check_inline_const(0) {
self.parse_const_block(self.token.span)
self.parse_const_block(self.token.span, true)
} else if self.check_path() {
let lo = self.token.span;
let (qself, path) = if self.eat_lt() {
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,22 +335,17 @@ impl Default for ErrorOutputType {
}

/// Parameter to control path trimming.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum TrimmedDefPaths {
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
#[default]
Never,
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
Always,
/// `try_print_trimmed_def_path` calls the expensive query, the query calls `delay_good_path_bug`
GoodPath,
}

impl Default for TrimmedDefPaths {
fn default() -> Self {
Self::Never
}
}

/// Use tree-based collections to cheaply get a deterministic `Hash` implementation.
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(crate_visibility_modifier)]
#![feature(derive_default_enum)]
#![feature(min_specialization)]
#![feature(once_cell)]
#![recursion_limit = "256"]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ symbols! {
inlateout,
inline,
inline_const,
inline_const_pat,
inout,
instruction_set,
intel,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(drain_filter)]
#![feature(derive_default_enum)]
#![feature(hash_drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(iter_zip)]
Expand Down
16 changes: 6 additions & 10 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ pub use self::chalk_fulfill::FulfillmentContext as ChalkFulfillmentContext;
pub use rustc_infer::traits::*;

/// Whether to skip the leak check, as part of a future compatibility warning step.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
///
/// The "default" for skip-leak-check corresponds to the current
/// behavior (do not skip the leak check) -- not the behavior we are
/// transitioning into.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
pub enum SkipLeakCheck {
Yes,
#[default]
No,
}

Expand All @@ -94,15 +99,6 @@ impl SkipLeakCheck {
}
}

/// The "default" for skip-leak-check corresponds to the current
/// behavior (do not skip the leak check) -- not the behavior we are
/// transitioning into.
impl Default for SkipLeakCheck {
fn default() -> Self {
SkipLeakCheck::No
}
}

/// The mode that trait queries run in.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum TraitQueryMode {
Expand Down
20 changes: 18 additions & 2 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2242,13 +2242,29 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
/// assert_eq!(*v, 42);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
#[inline]
pub unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
}

debug_assert!(is_aligned_and_not_null(dst), "attempt to write to unaligned or null pointer");
#[cfg(debug_assertions)]
fn runtime_check<T>(ptr: *mut T) {
debug_assert!(
is_aligned_and_not_null(ptr),
"attempt to write to unaligned or null pointer"
);
}
#[cfg(debug_assertions)]
const fn compiletime_check<T>(_ptr: *mut T) {}
#[cfg(debug_assertions)]
// SAFETY: runtime debug-assertions are a best-effort basis; it's fine to
// not do them during compile time
unsafe {
const_eval_select((dst,), compiletime_check, runtime_check);
}

// SAFETY: the safety contract for `write_bytes` must be upheld by the caller.
unsafe { write_bytes(dst, val, count) }
Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))]
#![feature(const_refs_to_cell)]
#![feature(decl_macro)]
#![feature(derive_default_enum)]
#![feature(doc_cfg)]
#![feature(doc_notable_trait)]
#![feature(doc_primitive)]
Expand Down
Loading