]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #87580 - ChrisDenton:win-arg-parse-2008, r=m-ou-se
bors [Thu, 2 Sep 2021 16:16:13 +0000 (16:16 +0000)]
Auto merge of #87580 - ChrisDenton:win-arg-parse-2008, r=m-ou-se

Update Windows Argument Parsing

Fixes #44650

The Windows command line is passed to applications [as a single string](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string) which the application then parses to get a list of arguments. The standard rules (as used by C/C++) for parsing the command line have slightly changed over the years, most recently in 2008 which added new escaping rules.

This PR implements the new rules as [described on MSDN](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments) and [further detailed here](https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN). It has been tested against the behaviour of C++ by calling a C++ program that outputs its raw command line and the contents of `argv`. See [my repo](https://github.com/ChrisDenton/winarg/tree/std) if anyone wants to reproduce my work.

For an overview of how this PR changes argument parsing behavior and why we feel it is warranted see https://github.com/rust-lang/rust/pull/87580#issuecomment-893833893.

For some examples see: https://github.com/rust-lang/rust/pull/87580#issuecomment-894299249

2 years agoAuto merge of #88530 - bjorn3:shrink_session, r=cjgillot
bors [Thu, 2 Sep 2021 13:12:59 +0000 (13:12 +0000)]
Auto merge of #88530 - bjorn3:shrink_session, r=cjgillot

Shrink Session a bit

Remove a couple of unnecessary fields from `Session` and remove a `Lock<T>` for a field that is never mutated anyway.

2 years agoAdd explanation for ctfe_backtrace lock
bjorn3 [Tue, 31 Aug 2021 13:06:59 +0000 (15:06 +0200)]
Add explanation for ctfe_backtrace lock

2 years agoUse in_incr_comp_dir_sess in cg_clif
bjorn3 [Mon, 30 Aug 2021 13:06:56 +0000 (15:06 +0200)]
Use in_incr_comp_dir_sess in cg_clif

2 years agoRemove print_fuel_crate field of Session
bjorn3 [Mon, 30 Aug 2021 12:41:09 +0000 (14:41 +0200)]
Remove print_fuel_crate field of Session

2 years agoRemove optimization_fuel_crate from Session
bjorn3 [Mon, 30 Aug 2021 12:36:24 +0000 (14:36 +0200)]
Remove optimization_fuel_crate from Session

2 years agoAuto merge of #88516 - matthiaskrgr:clippy_perf_end_august, r=jyn514,GuillaumeGomez
bors [Thu, 2 Sep 2021 10:27:44 +0000 (10:27 +0000)]
Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, r=jyn514,GuillaumeGomez

some low hanging clippy::perf fixes

2 years agoAuto merge of #87114 - cjgillot:abilint, r=estebank
bors [Thu, 2 Sep 2021 06:06:24 +0000 (06:06 +0000)]
Auto merge of #87114 - cjgillot:abilint, r=estebank

Lint missing Abi in ast validation instead of lowering.

2 years agoAuto merge of #83342 - Count-Count:win-console-incomplete-utf8, r=m-ou-se
bors [Thu, 2 Sep 2021 03:31:17 +0000 (03:31 +0000)]
Auto merge of #83342 - Count-Count:win-console-incomplete-utf8, r=m-ou-se

Allow writing of incomplete UTF-8 sequences to the Windows console via stdout/stderr

# Problem
Writes of just an incomplete UTF-8 byte sequence (e.g. `b"\xC3"` or `b"\xF0\x9F"`)  to stdout/stderr with a Windows console attached error with `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` even though further writes could complete the codepoint. This is currently a rare occurence since the [linewritershim](https://github.com/rust-lang/rust/blob/2c56ea38b045624dc8b42ec948fc169eaff1206a/library/std/src/io/buffered/linewritershim.rs) implementation flushes complete lines immediately and buffers up to 1024 bytes for incomplete lines. It can still happen as described in #83258.

The problem will become more pronounced once the developer can switch stdout/stderr from line-buffered to block-buffered or immediate when the changes in the "Switchable buffering for Stdout" pull request (#78515) get merged.

# Patch description
If there is at least one valid UTF-8 codepoint all valid UTF-8 is passed through to the extracted `write_valid_utf8_to_console()` fn. The new code only comes into play if `write()` is being passed a short byte slice comprising an incomplete UTF-8 codepoint. In this case up to three bytes are buffered in the `IncompleteUtf8` struct associated with `Stdout` / `Stderr`. The bytes are accepted one at a time. As soon as an error can be detected `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` is returned. Once a complete UTF-8 codepoint is received it is passed to the `write_valid_utf8_to_console()` and the buffer length is set to zero.

Calling `flush()` will neither error nor write anything if an incomplete codepoint is present in the buffer.

# Tests
Currently there are no Windows-specific tests for console writing code at all. Writing (regression) tests for this problem is a bit challenging since unit tests and UI tests don't run in a console and suddenly popping up another console window might be surprising to developers running the testsuite and it might not work at all in CI builds. To just test the new functionality in unit tests the code would need to be refactored. Some guidance on how to proceed would be appreciated.

# Public API changes
* `std::str::verifications::utf8_char_width()` would be exposed as `std::str::utf8_char_width()` behind the "str_internals" feature gate.

# Related issues
* Fixes #83258.
* PR #78515 will exacerbate the problem.

# Open questions
* Add tests?
* Squash into one commit with better commit message?

2 years agoAuto merge of #88522 - camelid:box-paren-output, r=jyn514
bors [Thu, 2 Sep 2021 00:12:21 +0000 (00:12 +0000)]
Auto merge of #88522 - camelid:box-paren-output, r=jyn514

rustdoc: Box `GenericArgs::Parenthesized.output`

Split out from #88379.

This reduces the size of `GenericArgs` from 104 bytes to 56 bytes,
essentially reducing it by half.

`GenericArgs` is one of the fields of `PathSegment`, so this should
reduce the amount of memory allocated for `PathSegment`s in the cases
where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait.

r? `@jyn514`

2 years agoAuto merge of #88490 - GuillaumeGomez:associated-types-implementors-display, r=cameli...
bors [Wed, 1 Sep 2021 21:31:16 +0000 (21:31 +0000)]
Auto merge of #88490 - GuillaumeGomez:associated-types-implementors-display, r=camelid,Manishearth

Display associated types of implementors

Fixes #86631.

Contrary to before, it doesn't display methods. I also had to "resurrect" the `auto-hide-trait-implementations` setting. :3

Only question at this point: should I move the `render_impl` boolean arguments into one struct? We're starting to have quite a lot of them...

cc `@cynecx`
r? `@camelid`

2 years agoRemove implementors setting
Guillaume Gomez [Wed, 1 Sep 2021 18:34:51 +0000 (20:34 +0200)]
Remove implementors setting

2 years agoAuto merge of #88563 - ehuss:update-cargo-books, r=ehuss
bors [Wed, 1 Sep 2021 17:26:49 +0000 (17:26 +0000)]
Auto merge of #88563 - ehuss:update-cargo-books, r=ehuss

Update cargo, books

## nomicon

2 commits in 0c7e5bd1428e7838252bb57b7f0fbfda4ec82f02..fe6227eb3c8533200c52dffa42ef1b6f2f02c40e
2021-08-04 10:18:22 -0700 to 2021-08-31 05:42:38 +0900
- update lifetime-elision to show what elided code under `rust_2018_idi… (rust-lang/nomicon#306)
- Change code for `into_iter` on the `RawVec` section for consistency/soundness (rust-lang/nomicon#302)

## cargo

8 commits in f559c109cc79fe413a8535fb620a5a58b3823d94..18751dd3f238d94d384a7fe967abfac06cbfe0b9
2021-08-26 22:54:55 +0000 to 2021-09-01 14:26:00 +0000
- print the full destination path when no track duplicates (rust-lang/cargo#9850)
- Stabilize 2021 edition (rust-lang/cargo#9800)
- Stabilize patch-in-config (and prefer config over manifest) (rust-lang/cargo#9839)
- Adding the cargo doc --examples subcommand (rust-lang/cargo#9808)
- Make library created with `cargo new` clippy happy (rust-lang/cargo#9796)
- Swap out some outdated repo urls in documentation (rust-lang/cargo#9862)
- Change `cargo fix --edition` to only fix edition lints. (rust-lang/cargo#9846)
- Show desc of well known subcommands (fmt, clippy) in cargo --list (rust-lang/cargo#9848)

## reference

1 commits in da6ea9b03f74cae0a292f40315723d7a3a973637..0e5ed7a4bec065f0cc18c35d1c904639e095314d
2021-08-19 21:28:10 -0700 to 2021-08-29 17:33:21 +0900
- expressions.md: Attempt fixing broken grammar in Mutability paragraph (rust-lang/reference#1084)

## book

1 commits in 687e21bde2ea10c261f79fa14797c5137425098d..fcb5e0ea68112d85a1d29a7a7335978ef2a02181
2021-08-18 20:48:38 -0400 to 2021-08-31 21:26:19 -0400
- Improve the reading of the code (rust-lang/book#2845)

## rustc-dev-guide

7 commits in cf0e151b7925a40f13fbc6573c6f97d5f94c7c17..95f1acf9a39d6f402f654e917e2c1dfdb779c5fc
2021-08-22 11:47:02 -0300 to 2021-08-31 12:38:30 -0500
- Add link to `Span`
- Add rustc-source to suggested rust-analyzer config (rust-lang/rustc-dev-guide#1189)
- Fix typo, clarify backtick wording, and use inline code
- Trailing date comments in a line inside of a paragraph caused beginning of a new paragraph. (rust-lang/rustc-dev-guide#1196)
- Fix warning "Renderer command uses a path relative to the renderer output directory ..." (rust-lang/rustc-dev-guide#1194)
- Fix a code block containing ```rust
- date-check: Recognize capitalized 'Date' as well

## edition-guide

1 commits in 3710b0cae783d0bcd2b42452a63b081473f5970a..2d9b1b9da706de24650fdc5c3b0182f55c82115d
2021-07-26 11:34:46 -0700 to 2021-08-31 10:44:09 +0200
- Update for 2021 stabilization (rust-lang/edition-guide#266)

## embedded-book

1 commits in 4f9fcaa30d11ba52b641e6fd5206536d65838af9..c3a51e23859554369e6bbb5128dcef0e4f159fb5
2021-08-06 17:43:12 +0000 to 2021-08-26 07:04:58 +0000
- Make glossary more linkable and add more detail  (rust-embedded/book#299)

2 years agoUpdate cargo, books
Eric Huss [Wed, 1 Sep 2021 16:27:57 +0000 (09:27 -0700)]
Update cargo, books

2 years agoAuto merge of #88269 - prconrad:doctest-persist-binaries, r=jyn514
bors [Wed, 1 Sep 2021 14:33:37 +0000 (14:33 +0000)]
Auto merge of #88269 - prconrad:doctest-persist-binaries, r=jyn514

Doctest persist full binaries when persisting

Tested by adding an extra debug to echo the whole compiler line. Trimmed significantly:

Persisted but not running -> full compile so we get binaries (new behavior).
```
$ rustdoc -Zunstable-options --test --persist-doctests doctests --no-run --extern t=libt.rlib t.rs

DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "doctests/t_rs_8_0/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "doctests/t_rs_2_0/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
test t.rs - foople (line 2) - compile ... ok
test t.rs - florp (line 8) - compile ... ok
```

Persisted and running -> full compile.
```
$ rustdoc -Zunstable-options --test --persist-doctests doctests --extern t=libt.rlib t.rs

DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "doctests/t_rs_8_0/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "doctests/t_rs_2_0/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--target" "x86_64-unknown-linux-gnu" "--color" "always"

```

Running but not persisted -> full compile only
```
$ rustdoc --test --extern t=libt.rlib t.rs

DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "/tmp/rustdoctestixWAUI/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "/tmp/rustdoctestKEaJQu/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "--target" "x86_64-unknown-linux-gnu" "--color" "always"

```

Not running and not persisting -> save time and only run metadata.
```
RUSTDOC_LOG=rustdoc=debug,std::test=debug rustdoc -Zunstable-options --no-run --test --extern t=libt.rlib t.rs

DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "/tmp/rustdoctest8twt2c/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--emit=metadata" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
DEBUG rustdoc::doctest run_test compiler "rustc" "--crate-type" "bin" "--edition" "2015" "-o" "/tmp/rustdoctest3miSqv/rust_out" "--extern" "t=libt.rlib" "-Ccodegen-units=1" "-Z" "unstable-options" "--emit=metadata" "--target" "x86_64-unknown-linux-gnu" "--color" "always"
```

I can't see any infrastructure for automating this sort of test. Am I missing it?

2 years agoAuto merge of #88395 - ricky26:llvm-submodule, r=nikic
bors [Wed, 1 Sep 2021 11:47:18 +0000 (11:47 +0000)]
Auto merge of #88395 - ricky26:llvm-submodule, r=nikic

Update LLVM submodule

This will capture the two M68k bugfixes to help with #88321.

2 years agoAuto merge of #88556 - m-ou-se:rollup-q636wyd, r=m-ou-se
bors [Wed, 1 Sep 2021 09:06:24 +0000 (09:06 +0000)]
Auto merge of #88556 - m-ou-se:rollup-q636wyd, r=m-ou-se

Rollup of 9 pull requests

Successful merges:

 - #86376 (Emit specific warning to clarify that `#[no_mangle]` should not be applied on foreign statics or functions)
 - #88040 (BTree: remove Ord bound from new)
 - #88053 (Fix the flock fallback implementation)
 - #88350 (add support for clobbering xer, cr, and cr[0-7] for asm! on OpenPower/PowerPC)
 - #88410 (Remove bolding on associated constants)
 - #88525 (fix(rustc_typeck): produce better errors for dyn auto trait)
 - #88542 (Use the return value of readdir_r() instead of errno)
 - #88548 (Stabilize `Iterator::intersperse()`)
 - #88551 (Stabilize `UnsafeCell::raw_get()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoClean render_impl arguments
Guillaume Gomez [Tue, 31 Aug 2021 10:20:02 +0000 (12:20 +0200)]
Clean render_impl arguments

2 years agoAdd tests for implementors associated types display
Guillaume Gomez [Mon, 30 Aug 2021 14:47:17 +0000 (16:47 +0200)]
Add tests for implementors associated types display

2 years agoRollup merge of #88551 - inquisitivecrystal:unsafe_cell_raw_get, r=m-ou-se
Mara Bos [Wed, 1 Sep 2021 07:23:31 +0000 (09:23 +0200)]
Rollup merge of #88551 - inquisitivecrystal:unsafe_cell_raw_get, r=m-ou-se

Stabilize `UnsafeCell::raw_get()`

This PR stabilizes the associated function `UnsafeCell::raw_get()`. The FCP has [already completed](https://github.com/rust-lang/rust/issues/66358#issuecomment-899095068). While there was some discussion about the naming after the close of the FCP, it looks like people have agreed on this name. Still, it would probably be best if a `libs-api` member had a look at this and stated whether more discussion is needed.

While I was at it, I added some tests for `UnsafeCell`, because there were barely any.

Closes #66358.

2 years agoRollup merge of #88548 - inquisitivecrystal:intersperse, r=m-ou-se
Mara Bos [Wed, 1 Sep 2021 07:23:30 +0000 (09:23 +0200)]
Rollup merge of #88548 - inquisitivecrystal:intersperse, r=m-ou-se

Stabilize `Iterator::intersperse()`

This PR stabilizes the methods `Iterator::intersperse()` and `Iterator::intersperse_with()`. The FCP has [already completed](https://github.com/rust-lang/rust/issues/79524#issuecomment-909663616).

Closes #79524.

2 years agoRollup merge of #88542 - tavianator:readdir_r-errno, r=jyn514
Mara Bos [Wed, 1 Sep 2021 07:23:29 +0000 (09:23 +0200)]
Rollup merge of #88542 - tavianator:readdir_r-errno, r=jyn514

Use the return value of readdir_r() instead of errno

POSIX says:

> If successful, the readdir_r() function shall return zero; otherwise,
> an error number shall be returned to indicate the error.

But we were previously using errno instead of the return value.  This
led to issue #86649.

2 years agoRollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, r=petrochenkov
Mara Bos [Wed, 1 Sep 2021 07:23:28 +0000 (09:23 +0200)]
Rollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, r=petrochenkov

fix(rustc_typeck): produce better errors for dyn auto trait

Fixes #85026

2 years agoRollup merge of #88410 - camelid:fix-assoc-bold, r=GuillaumeGomez
Mara Bos [Wed, 1 Sep 2021 07:23:27 +0000 (09:23 +0200)]
Rollup merge of #88410 - camelid:fix-assoc-bold, r=GuillaumeGomez

Remove bolding on associated constants

Associated types don't get bolded, so it looks off to have one kind
bolded and one not.

2 years agoRollup merge of #88350 - programmerjake:add-ppc-cr-xer-clobbers, r=Amanieu
Mara Bos [Wed, 1 Sep 2021 07:23:26 +0000 (09:23 +0200)]
Rollup merge of #88350 - programmerjake:add-ppc-cr-xer-clobbers, r=Amanieu

add support for clobbering xer, cr, and cr[0-7] for asm! on OpenPower/PowerPC

Fixes #88315

2 years agoRollup merge of #88053 - bjorn3:fix_flock_fallback_impl, r=cjgillot
Mara Bos [Wed, 1 Sep 2021 07:23:25 +0000 (09:23 +0200)]
Rollup merge of #88053 - bjorn3:fix_flock_fallback_impl, r=cjgillot

Fix the flock fallback implementation

2 years agoRollup merge of #88040 - nbdd0121:btreemap, r=m-ou-se
Mara Bos [Wed, 1 Sep 2021 07:23:23 +0000 (09:23 +0200)]
Rollup merge of #88040 - nbdd0121:btreemap, r=m-ou-se

BTree: remove Ord bound from new

`K: Ord` bound is unnecessary on `BTree{Map,Set}::new` and their `Default` impl. No elements exist so there are nothing to compare anyway, so I don't think "future proof" would be a blocker here. This is analogous to `HashMap::new` not having a `K: Eq + Hash` bound.

#79245 originally does this and for some reason drops the change to `new` and `Default`. I can see why changes to other methods like `entry` or `symmetric_difference` need to be careful but I couldn't find out any reason not to do it on `new`.

Removing the bound also makes the stabilisation of `const fn new` not depending on const trait bounds.

cc `@steffahn` who suggests me to make this PR.

r? `@dtolnay`

2 years agoRollup merge of #86376 - asquared31415:extern-no-mangle-84204, r=Mark-Simulacrum
Mara Bos [Wed, 1 Sep 2021 07:23:22 +0000 (09:23 +0200)]
Rollup merge of #86376 - asquared31415:extern-no-mangle-84204, r=Mark-Simulacrum

Emit specific warning to clarify that `#[no_mangle]` should not be applied on foreign statics or functions

Foreign statics and foreign functions should not have `#[no_mangle]` applied, as it does nothing to the name and has some extra hidden behavior that is normally unwanted.  There was an existing warning for this, but it says the attribute is only allowed on "statics or functions", which to the user can be confusing.

This PR adds a specific version of the unused `#[no_mangle]` warning that explains that the target is a *foreign* static or function and that they do not need the attribute.

Fixes #78989

2 years agoAuto merge of #88272 - willcrichton:mutable-sparse-matrix, r=ecstatic-morse
bors [Wed, 1 Sep 2021 06:13:15 +0000 (06:13 +0000)]
Auto merge of #88272 - willcrichton:mutable-sparse-matrix, r=ecstatic-morse

Add bit removal methods to SparseBitMatrix and factor *BitSet relational methods into more extensible trait

I need the ability to clear the bits out of a row from `SparseBitMatrix`. Currently, all the mutating methods only allow insertion of bits, and there is no way to get access to the underlying data.

One approach is simply to make `ensure_row` public, since it grants `&mut` access to the underlying `HybridBitSet`. This PR adds the `pub` modifier. However, presumably this method was private for a reason, so I'm open to other designs. I would prefer general mutable access to the rows, because that way I can add many mutating operations (`clear`, `intersect`, etc.) without filing a PR each time :-)

r? `@ecstatic-morse`

2 years agoAuto merge of #88121 - camelid:better-recursive-alias-error, r=estebank
bors [Wed, 1 Sep 2021 03:43:37 +0000 (03:43 +0000)]
Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebank

Improve errors for recursive type aliases

Fixes #17539.

2 years agoRemove unhelpful `expect()` message
Noah Lev [Wed, 1 Sep 2021 01:10:57 +0000 (18:10 -0700)]
Remove unhelpful `expect()` message

2 years agoBox `GenericArgs::Parenthesized.output`
Noah Lev [Mon, 23 Aug 2021 04:35:01 +0000 (21:35 -0700)]
Box `GenericArgs::Parenthesized.output`

This reduces the size of `GenericArgs` from 104 bytes to 56 bytes,
essentially reducing it by half.

`GenericArgs` is one of the fields of `PathSegment`, so this should
reduce the amount of memory allocated for `PathSegment`s in the cases
where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait.

I also added `static_assert_size!`s to `GenericArgs` and `PathSegment`
to ensure they don't increase in size unexpectedly.

2 years agoAuto merge of #87688 - camsteffen:let-else, r=cjgillot
bors [Wed, 1 Sep 2021 01:02:42 +0000 (01:02 +0000)]
Auto merge of #87688 - camsteffen:let-else, r=cjgillot

Introduce `let...else`

Tracking issue: #87335

The trickiest part for me was enforcing the diverging else block with clear diagnostics. Perhaps the obvious solution is to expand to `let _: ! = ..`, but I decided against this because, when a "mismatched type" error is found in typeck, there is no way to trace where in the HIR the expected type originated, AFAICT. In order to pass down this information, I believe we should introduce `Expectation::LetElseNever(HirId)` or maybe add `HirId` to `Expectation::HasType`, but I left that as a future enhancement. For now, I simply assert that the block is `!` with a custom `ObligationCauseCode`, and I think this is clear enough, at least to start. The downside here is that the error points at the entire block rather than the specific expression with the wrong type. I left a todo to this effect.

Overall, I believe this PR is feature-complete with regard to the RFC.

2 years agoAdd a few tests for `UnsafeCell`
inquisitivecrystal [Tue, 31 Aug 2021 23:32:01 +0000 (16:32 -0700)]
Add a few tests for `UnsafeCell`

2 years agoAuto merge of #88533 - oli-obk:tait_🧊, r=spastorino
bors [Tue, 31 Aug 2021 22:15:26 +0000 (22:15 +0000)]
Auto merge of #88533 - oli-obk:tait_🧊, r=spastorino

Concrete regions can show up in mir borrowck if the originated from there

We used to not encounter them here, because we took regions from typeck's opaque type resolution by renumbering them. We don't do that anymore. Instead mir borrock does all the logic, and it can handle concrete regions just fine, as long as it created them itself.

fixes #83190 which was introduced by #87287

r? `@spastorino`

2 years agoMove test to run-make-fulldeps to avoid compiler flag bug
Patrick Conrad [Tue, 31 Aug 2021 22:06:18 +0000 (18:06 -0400)]
Move test to run-make-fulldeps to avoid compiler flag bug

2 years agoStabilize `Iterator::intersperse()`
inquisitivecrystal [Tue, 31 Aug 2021 21:35:12 +0000 (14:35 -0700)]
Stabilize `Iterator::intersperse()`

2 years agoStabilize `UnsafeCell::raw_get()`
inquisitivecrystal [Tue, 31 Aug 2021 21:44:13 +0000 (14:44 -0700)]
Stabilize `UnsafeCell::raw_get()`

2 years agoAuto merge of #88506 - Mark-Simulacrum:fix-rlibs, r=ehuss
bors [Tue, 31 Aug 2021 19:33:06 +0000 (19:33 +0000)]
Auto merge of #88506 - Mark-Simulacrum:fix-rlibs, r=ehuss

Fix loading large rlibs

Bumps object crate to permit parsing archives with 64-bit table entries. These
are primarily encountered when there's more than 4GB of archive data.

cc https://github.com/gimli-rs/object/issues/365

Helps with https://github.com/rust-lang/rust/issues/88351, but will also need a beta backport

r? `@ehuss` (mostly for the test)

2 years agoLint Abi in ast validation.
Camille GILLOT [Thu, 8 Jul 2021 19:58:05 +0000 (21:58 +0200)]
Lint Abi in ast validation.

2 years agosome low hanging clippy::perf fixes
Matthias Krüger [Mon, 30 Aug 2021 22:54:48 +0000 (00:54 +0200)]
some low hanging clippy::perf fixes

2 years agoUse the return value of readdir_r() instead of errno
Tavian Barnes [Tue, 31 Aug 2021 18:11:42 +0000 (14:11 -0400)]
Use the return value of readdir_r() instead of errno

POSIX says:

> If successful, the readdir_r() function shall return zero; otherwise,
> an error number shall be returned to indicate the error.

But we were previously using errno instead of the return value.  This
led to issue #86649.

2 years agoRemove bolding on associated constants
Noah Lev [Mon, 23 Aug 2021 17:49:56 +0000 (10:49 -0700)]
Remove bolding on associated constants

Associated types don't get bolded, so it looks off to have one kind
bolded and one not.

2 years agoAuto merge of #88535 - m-ou-se:rollup-jeusxbo, r=m-ou-se
bors [Tue, 31 Aug 2021 16:47:06 +0000 (16:47 +0000)]
Auto merge of #88535 - m-ou-se:rollup-jeusxbo, r=m-ou-se

Rollup of 10 pull requests

Successful merges:

 - #85017 (Add carrying_add, borrowing_sub, widening_mul, carrying_mul methods to integers)
 - #86362 (Avoid cloning LocalDecls)
 - #88391 (Fix json tuple struct enum variant )
 - #88399 (Disallow the aapcs CC on Aarch64)
 - #88418 (Allow `~const` bounds on trait assoc functions)
 - #88445 (Clean up the lowering of AST items)
 - #88495 (Add `TcpStream::set_linger` and `TcpStream::linger`)
 - #88501 (Use right span in prelude collision suggestions with macros. )
 - #88504 (Keep turbofish in prelude collision lint.)
 - #88524 (Remove unnecessary `mut` from udp doctests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #88524 - soenkehahn:master, r=jyn514
Mara Bos [Tue, 31 Aug 2021 15:55:02 +0000 (17:55 +0200)]
Rollup merge of #88524 - soenkehahn:master, r=jyn514

Remove unnecessary `mut` from udp doctests

I don't think this `mut` is necessary, since both `recv_from` and `send_to` take `&self`.

2 years agoRollup merge of #88504 - m-ou-se:turbofish-please-stay, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 15:55:00 +0000 (17:55 +0200)]
Rollup merge of #88504 - m-ou-se:turbofish-please-stay, r=oli-obk

Keep turbofish in prelude collision lint.

Fixes https://github.com/rust-lang/rust/issues/88442

2 years agoRollup merge of #88501 - m-ou-se:prelude-collusion-oh-no-macros-help, r=estebank
Mara Bos [Tue, 31 Aug 2021 15:54:59 +0000 (17:54 +0200)]
Rollup merge of #88501 - m-ou-se:prelude-collusion-oh-no-macros-help, r=estebank

Use right span in prelude collision suggestions with macros.

Fixes https://github.com/rust-lang/rust/issues/88347

r? `@estebank`

2 years agoRollup merge of #88495 - ibraheemdev:tcp-linger, r=joshtriplett
Mara Bos [Tue, 31 Aug 2021 15:54:58 +0000 (17:54 +0200)]
Rollup merge of #88495 - ibraheemdev:tcp-linger, r=joshtriplett

Add `TcpStream::set_linger` and `TcpStream::linger`

Adds methods for getting/setting the `SO_LINGER` option on TCP sockets. Behavior is consistent across Unix and Windows.

r? `@joshtriplett` (I noticed you've been reviewing net related PRs)

2 years agoRollup merge of #88445 - inquisitivecrystal:ast-lowering, r=cjgillot
Mara Bos [Tue, 31 Aug 2021 15:54:57 +0000 (17:54 +0200)]
Rollup merge of #88445 - inquisitivecrystal:ast-lowering, r=cjgillot

Clean up the lowering of AST items

This PR simplifies and improves `rustc_ast_lowering::item` in various minor ways. The reasons for the changes should mostly be self evident, though I'm happy to specifically explain anything if needed.

These changes used to be part of #88019, but I removed them after it was pointed out that some of my other changes to `rustc_ast_lowering` were unnecessary. It felt like a bad idea to clean up code which I didn't even need to touch anymore.

r? `@cjgillot`

2 years agoRollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 15:54:56 +0000 (17:54 +0200)]
Rollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obk

Allow `~const` bounds on trait assoc functions

r? `@oli-obk`

2 years agoRollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkov
Mara Bos [Tue, 31 Aug 2021 15:54:55 +0000 (17:54 +0200)]
Rollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkov

Disallow the aapcs CC on Aarch64

This never really worked and makes LLVM assert.

2 years agoRollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, r=camelid,notriddle
Mara Bos [Tue, 31 Aug 2021 15:54:54 +0000 (17:54 +0200)]
Rollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, r=camelid,notriddle

Fix json tuple struct enum variant

Fixes #87887.

cc `@dsherret` `@camelid`

r? `@notriddle`

2 years agoRollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726
Mara Bos [Tue, 31 Aug 2021 15:54:53 +0000 (17:54 +0200)]
Rollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726

Avoid cloning LocalDecls

2 years agoRollup merge of #85017 - clarfonthey:carrying_widening, r=m-ou-se
Mara Bos [Tue, 31 Aug 2021 15:54:52 +0000 (17:54 +0200)]
Rollup merge of #85017 - clarfonthey:carrying_widening, r=m-ou-se

Add carrying_add, borrowing_sub, widening_mul, carrying_mul methods to integers

This comes in part from my own attempts to make (crude) big integer implementations, and also due to the stalled discussion in [RFC 2417](https://github.com/rust-lang/rfcs/pull/2417). My understanding is that changes like these are best offered directly as code and then an RFC can be opened if there needs to be more discussion before stabilisation. Since all of these methods are unstable from the start, I figured I might as well offer them now.

I tried looking into intrinsics, messed around with a few different implementations, and ultimately concluded that these are "good enough" implementations for now to at least put up some code and maybe start bikeshedding on a proper API for these.

For the `carrying_add` and `borrowing_sub`, I tried looking into potential architecture-specific code and realised that even using the LLVM intrinsics for `addcarry` and `subborrow` on x86 specifically, I was getting exactly the same assembly as the naive implementation using `overflowing_add` and `overflowing_sub`, although the LLVM IR did differ because of the architecture-specific code. Longer-term I think that they would be best suited to specific intrinsics as that would make optimisations easier (instructions like add-carry tend to use implicit flags, and thus can only be optimised if they're done one-after-another, and thus it would make the most sense to have compact intrinsics that can be merged together easily).

For `widening_mul` and `carrying_mul`, for now at least, I simply cast to the larger type and perform arithmetic that way, since we currently have no intrinsic that would work better for 128-bit integers. In the future, I also think that some form of intrinsic would work best to cover that case, but for now at least, I think that they're "good enough" for now.

The main reasoning for offering these directly to the standard library even though they're relatively niche optimisations is to help ensure that the code generated for them is optimal. Plus, these operations alone aren't enough to create big integer implementations, although they could help simplify the code required to do so and make it a bit more accessible for the average implementor.

That said, I 100% understand if any or all of these methods are not desired simply because of how niche they are. Up to you. 🤷🏻

2 years agoChange wording to less jaron-y "non-auto trait"
Michael Howell [Tue, 31 Aug 2021 15:52:19 +0000 (08:52 -0700)]
Change wording to less jaron-y "non-auto trait"

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2 years agodisable `tcp_linger` feature in `std`
Ibraheem Ahmed [Tue, 31 Aug 2021 15:19:39 +0000 (11:19 -0400)]
disable `tcp_linger` feature in `std`

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2 years agoConcrete regions can show up in mir borrowck if the originated from there.
Oli Scherer [Tue, 31 Aug 2021 14:38:21 +0000 (14:38 +0000)]
Concrete regions can show up in mir borrowck if the originated from there.

We used to not encounter them here, because we took regions from typeck's opaque type resolution by renumbering them. We don't do that anymore.

2 years agoUse and_then instead of unwrap_or_default.
Mara Bos [Tue, 31 Aug 2021 14:24:58 +0000 (16:24 +0200)]
Use and_then instead of unwrap_or_default.

2 years agoAdd macro test for prelude collision suggestions.
Mara Bos [Mon, 30 Aug 2021 18:37:07 +0000 (20:37 +0200)]
Add macro test for prelude collision suggestions.

2 years agoUse right span in prelude collision suggestions with macros.
Mara Bos [Mon, 30 Aug 2021 18:34:26 +0000 (20:34 +0200)]
Use right span in prelude collision suggestions with macros.

2 years agoPull Span::find_ancestor_inside loop into its own function.
Mara Bos [Mon, 30 Aug 2021 18:17:12 +0000 (20:17 +0200)]
Pull Span::find_ancestor_inside loop into its own function.

2 years agoDelete long-running large rlibs test
Mark Rousskov [Tue, 31 Aug 2021 14:20:49 +0000 (10:20 -0400)]
Delete long-running large rlibs test

This is kept to a separate commit so that the test itself is preserved in the
commit history.

2 years agoAvoid cloning LocalDecls
Paul Trojahn [Thu, 3 Jun 2021 17:24:48 +0000 (19:24 +0200)]
Avoid cloning LocalDecls

2 years agoAuto merge of #88527 - m-ou-se:rollup-az6xtc5, r=m-ou-se
bors [Tue, 31 Aug 2021 11:20:32 +0000 (11:20 +0000)]
Auto merge of #88527 - m-ou-se:rollup-az6xtc5, r=m-ou-se

Rollup of 14 pull requests

Successful merges:

 - #88394 (Document `std::env::current_exe` possible rename behaviour)
 - #88406 (Tait nest infer test)
 - #88408 (Add inference cycle TAIT test)
 - #88409 (Add auto trait leakage TAIT test)
 - #88413 (Add weird return types TAIT test)
 - #88450 (fix(rustc_parse): correct span in `maybe_whole_expr!`)
 - #88462 (rustdoc: Stop using resolver for macro loading)
 - #88465 (Adding examples to docs of `std::time` module)
 - #88486 (Remove unused arena macro args)
 - #88492 (Use MaybeUninit::write in functor.rs)
 - #88496 (Fix prelude collision lint suggestion for generics with lifetimes)
 - #88497 (Fix prelude collision suggestions for glob imported traits. )
 - #88503 (Warn when [T; N].into_iter() is ambiguous in the new edition. )
 - #88509 (Don't suggest extra <> in dyn suggestion.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #88509 - m-ou-se:dyn-no-left-shift-right-shift-just-single-angle...
Mara Bos [Tue, 31 Aug 2021 08:41:30 +0000 (10:41 +0200)]
Rollup merge of #88509 - m-ou-se:dyn-no-left-shift-right-shift-just-single-angle-brackets-please-thanks, r=petrochenkov

Don't suggest extra <> in dyn suggestion.

Fixes https://github.com/rust-lang/rust/issues/88508

2 years agoRollup merge of #88503 - m-ou-se:array-into-inter-ambiguous, r=cjgillot
Mara Bos [Tue, 31 Aug 2021 08:41:29 +0000 (10:41 +0200)]
Rollup merge of #88503 - m-ou-se:array-into-inter-ambiguous, r=cjgillot

Warn when [T; N].into_iter() is ambiguous in the new edition.

Fixes https://github.com/rust-lang/rust/issues/88475

In https://github.com/rust-lang/rust/issues/88475, a situation was found where `[T; N].into_iter()` becomes *ambiguous* in the new edition. This is different than the case where `(&[T; N]).into_iter()` resolves differently, which was the only case handled by the `array_into_iter` lint. This is almost identical to the new-traits-in-the-prelude problem. Effectively, due to the array-into-iter hack disappearing in Rust 2021, we effectively added `IntoIterator` to the 'prelude' in Rust 2021 specifically for arrays.

This modifies the prelude collisions lint to detect that case and emit a `array_into_iter` lint in that case.

2 years agoRollup merge of #88497 - m-ou-se:prelude-collision-glob, r=nikomatsakis
Mara Bos [Tue, 31 Aug 2021 08:41:28 +0000 (10:41 +0200)]
Rollup merge of #88497 - m-ou-se:prelude-collision-glob, r=nikomatsakis

Fix prelude collision suggestions for glob imported traits.

Fixes https://github.com/rust-lang/rust/issues/88471

cc `@nikomatsakis`

2 years agoRollup merge of #88496 - m-ou-se:prelude-collision-lifetime-generics, r=petrochenkov
Mara Bos [Tue, 31 Aug 2021 08:41:27 +0000 (10:41 +0200)]
Rollup merge of #88496 - m-ou-se:prelude-collision-lifetime-generics, r=petrochenkov

Fix prelude collision lint suggestion for generics with lifetimes

Fixes https://github.com/rust-lang/rust/issues/88470

cc `@nikomatsakis`

2 years agoRollup merge of #88492 - est31:maybe_uninit_write, r=wesleywiser
Mara Bos [Tue, 31 Aug 2021 08:41:26 +0000 (10:41 +0200)]
Rollup merge of #88492 - est31:maybe_uninit_write, r=wesleywiser

Use MaybeUninit::write in functor.rs

MaybeUninit::write is stable as of 1.55.0.

2 years agoRollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726
Mara Bos [Tue, 31 Aug 2021 08:41:25 +0000 (10:41 +0200)]
Rollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726

Remove unused arena macro args

2 years agoRollup merge of #88465 - marcospb19:master, r=joshtriplett
Mara Bos [Tue, 31 Aug 2021 08:41:24 +0000 (10:41 +0200)]
Rollup merge of #88465 - marcospb19:master, r=joshtriplett

Adding examples to docs of `std::time` module

And adding missing link to `Duration` from `Instant`.

2 years agoRollup merge of #88462 - petrochenkov:macstore, r=jyn514
Mara Bos [Tue, 31 Aug 2021 08:41:23 +0000 (10:41 +0200)]
Rollup merge of #88462 - petrochenkov:macstore, r=jyn514

rustdoc: Stop using resolver for macro loading

r? `@jyn514`

2 years agoRollup merge of #88450 - notriddle:notriddle/maybe_whole_expr, r=cjgillot
Mara Bos [Tue, 31 Aug 2021 08:41:22 +0000 (10:41 +0200)]
Rollup merge of #88450 - notriddle:notriddle/maybe_whole_expr, r=cjgillot

fix(rustc_parse): correct span in `maybe_whole_expr!`

Fixes #87812

2 years agoRollup merge of #88413 - spastorino:weird-return-types-tait-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:21 +0000 (10:41 +0200)]
Rollup merge of #88413 - spastorino:weird-return-types-tait-test, r=oli-obk

Add weird return types TAIT test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88409 - spastorino:autoleakage-tait-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:20 +0000 (10:41 +0200)]
Rollup merge of #88409 - spastorino:autoleakage-tait-test, r=oli-obk

Add auto trait leakage TAIT test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:19 +0000 (10:41 +0200)]
Rollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obk

Add inference cycle TAIT test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:18 +0000 (10:41 +0200)]
Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk

Tait nest infer test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett
Mara Bos [Tue, 31 Aug 2021 08:41:17 +0000 (10:41 +0200)]
Rollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett

Document `std::env::current_exe` possible rename behaviour

It might not be obvious that the "path of the current running executable" may (or may not) imply "at the time it was loaded".

This came up recently in chat so I thought it might be worth documenting.

2 years agoAuto merge of #88491 - RalfJung:miri, r=RalfJung
bors [Tue, 31 Aug 2021 08:32:31 +0000 (08:32 +0000)]
Auto merge of #88491 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/88473

2 years agoAuto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis
bors [Tue, 31 Aug 2021 06:01:52 +0000 (06:01 +0000)]
Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis

2229: Drop any deref in move closure

Fixes: #88431
r? `@nikomatsakis`

2 years agoUpdate E0785.md
Michael Howell [Tue, 31 Aug 2021 05:18:55 +0000 (22:18 -0700)]
Update E0785.md

2 years agofix(rustc_typeck): produce better errors for dyn auto trait
Michael Howell [Tue, 31 Aug 2021 05:11:25 +0000 (22:11 -0700)]
fix(rustc_typeck): produce better errors for dyn auto trait

Fixes #85026

2 years agoRemove unnecessary `mut` from udp doctests
Sönke Hahn [Tue, 31 Aug 2021 04:31:34 +0000 (22:31 -0600)]
Remove unnecessary `mut` from udp doctests

2 years agoAuto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank
bors [Tue, 31 Aug 2021 03:34:22 +0000 (03:34 +0000)]
Auto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank

Don't use `guess_head_span` in `predicates_of` for foreign span

Previously, the result of `predicates_of` for a foreign trait
would depend on the *current* state of the corresponding source
file in the foreign crate. This could lead to ICEs during incremental
compilation, since the on-disk contents of the upstream source file
could potentially change without the upstream crate being recompiled.

Additionally, this ensure that that the metadata we produce for a crate
only depends on its *compiled* upstream dependencies (e.g an rlib or
rmeta file), *not* the current on-disk state of the upstream crate
source files.

2 years agoFix tests
Cameron Steffen [Mon, 2 Aug 2021 00:55:48 +0000 (19:55 -0500)]
Fix tests

2 years agoAdd let-else tests
Cameron Steffen [Mon, 2 Aug 2021 00:18:50 +0000 (19:18 -0500)]
Add let-else tests

2 years agoHandle irrufutable or unreachable let-else
Cameron Steffen [Fri, 30 Jul 2021 22:14:34 +0000 (17:14 -0500)]
Handle irrufutable or unreachable let-else

2 years agoCalculate LetSource later
Cameron Steffen [Fri, 27 Aug 2021 17:53:50 +0000 (12:53 -0500)]
Calculate LetSource later

2 years agoHandle let-else initializer edge case errors
Cameron Steffen [Fri, 30 Jul 2021 22:12:11 +0000 (17:12 -0500)]
Handle let-else initializer edge case errors

2 years agoEnforce diverging let...else
Cameron Steffen [Fri, 30 Jul 2021 16:30:12 +0000 (11:30 -0500)]
Enforce diverging let...else

2 years agoTemporary fix rustfmt for let-else
Cameron Steffen [Sun, 25 Jul 2021 23:28:08 +0000 (18:28 -0500)]
Temporary fix rustfmt for let-else

2 years agoFix clippy for let-else
Cameron Steffen [Sun, 25 Jul 2021 23:27:44 +0000 (18:27 -0500)]
Fix clippy for let-else

2 years agoAdd let_else feature gate
Cameron Steffen [Wed, 23 Jun 2021 21:40:06 +0000 (16:40 -0500)]
Add let_else feature gate

2 years agoLower let-else to HIR
Cameron Steffen [Sun, 29 Aug 2021 22:48:05 +0000 (17:48 -0500)]
Lower let-else to HIR

2 years agoRefactor lower_stmts
Cameron Steffen [Wed, 4 Aug 2021 17:47:58 +0000 (12:47 -0500)]
Refactor lower_stmts

2 years agoMove some methods to block module
Cameron Steffen [Wed, 4 Aug 2021 18:09:02 +0000 (13:09 -0500)]
Move some methods to block module

2 years agoAdd let-else to AST
Cameron Steffen [Tue, 22 Jun 2021 18:00:58 +0000 (13:00 -0500)]
Add let-else to AST

2 years agoAuto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se
bors [Tue, 31 Aug 2021 01:03:55 +0000 (01:03 +0000)]
Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se

Make Edition 2021 Stable

An item of #87959.

This is an "on-demand" pull request, which means it will be merged when it is the right time to.

2 years agoAuto merge of #88369 - lcnr:cec-rename, r=oli-obk
bors [Mon, 30 Aug 2021 22:21:01 +0000 (22:21 +0000)]
Auto merge of #88369 - lcnr:cec-rename, r=oli-obk

update const generics feature gates

**tl;dr: split const generics into three features: `adt_const_params`, `const_generics_defaults` and `generic_const_exprs`**

continuing the work of `@BoxyUwU` in #88324, this PR
- renames `feature(const_evaluatable_checked)` to `feature(generic_const_exprs)` which now doesn't need any other feature gate to work. Previously `feature(const_evaluatable_checked)` was only useful in combination with `feature(const_generics)`.
- completely removes `feature(lazy_normalization_consts)`. This feature only supplied the parents generics to anonymous constants, which is pretty useless as generic anon consts are only allowed with `feature(generic_const_exprs)` anyways.
- moves the ability to use additional const param types from `feature(const_generics)` into `feature(adt_const_params)`. As `feature(const_generics)` is now mostly useless without `feature(generic_const_exprs)` we also remove that feature flag.
- updates tests, removing duplicates and unnecessary revisions in some cases and also deletes all unused `*.stderr` files.

I not also remove the ordering restriction for const and type parameters if any of the three const generics features is active.
This ordering restriction feels like the only "real" use of the current `feature(const_generics)` right now so this change isn't a perfect solution, but as I intend to stabilize the ordering - and `feature(const_generics_defaults)` -  in the very near future, I think this is acceptable for now.

---

cc `@rust-lang/project-const-generics` about the new feature names and this change in general.

I don't think we need any external approval for this change but I do intend to publish an update to the const generics tracking issue the day this PR lands, so I don't want this merged yet.

Apologies to whoever ends up reviewing this PR :sweat_smile: :heart:

r? rust-lang/project-const-generics

2 years agoTurn to ifs into a match.
Mara Bos [Mon, 30 Aug 2021 21:57:16 +0000 (23:57 +0200)]
Turn to ifs into a match.