Commit Graph

170828 Commits

Author SHA1 Message Date
Camille GILLOT
87c841e190 Remove the region terminology. 2022-06-19 22:28:53 +02:00
bors
bb8c2f4117 Auto merge of #98247 - jackh726:regionkind-rustc-type-ir, r=compiler-errors
Move RegionKind to rustc_type_ir

(Also UniverseIndex)

r? rust-lang/types
2022-06-19 19:55:45 +00:00
jmaargh
95dc353006 Fix documentation for with_capacity and reserve families of methods
Documentation for the following methods

    with_capacity
    with_capacity_in
    with_capacity_and_hasher
    reserve
    reserve_exact
    try_reserve
    try_reserve_exact

was inconsistent and often not entirely correct where they existed on the following types

    Vec
    VecDeque
    String
    OsString
    PathBuf
    BinaryHeap
    HashSet
    HashMap
    BufWriter
    LineWriter

since the allocator is allowed to allocate more than the requested capacity in all such cases, and will frequently "allocate" much more in the case of zero-sized types (I also checked BufReader, but there the docs appear to be accurate as it appears to actually allocate the exact capacity).

Some effort was made to make the documentation more consistent between types as well.

Fix with_capacity* methods for Vec

Fix *reserve*  methods for Vec

Fix docs for *reserve* methods of VecDeque

Fix docs for String::with_capacity

Fix docs for *reserve* methods of String

Fix docs for OsString::with_capacity

Fix docs for *reserve* methods on OsString

Fix docs for with_capacity* methods on HashSet

Fix docs for *reserve methods of HashSet

Fix docs for with_capacity* methods of HashMap

Fix docs for *reserve methods on HashMap

Fix expect messages about OOM in doctests

Fix docs for BinaryHeap::with_capacity

Fix docs for *reserve* methods of BinaryHeap

Fix typos

Fix docs for with_capacity on BufWriter and LineWriter

Fix consistent use of `hasher` between `HashMap` and `HashSet`

Fix warning in doc test

Add test for capacity of vec with ZST

Fix doc test error
2022-06-19 20:46:49 +01:00
bors
2b646bd533 Auto merge of #98224 - eddyb:proc-macro-spurious-repr, r=bjorn3
proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.

Not sure how this happened, maybe some of these were passed through the bridge a long time ago?

r? `@bjorn3`
2022-06-19 17:32:12 +00:00
bjorn3
b4b536d34d Preserve the path of the target spec json file for usage by rustdoc 2022-06-19 15:33:09 +00:00
KaDiWa4
f0144aea74
typos in IntoFuture docs 2022-06-19 17:13:48 +02:00
bors
68d0b29098 Auto merge of #98255 - Dylan-DPC:rollup-hr129rg, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #98105 (rustdoc: remove tuple link on round braces)
 - #98136 (Rename `impl_constness` to `constness`)
 - #98146 (Remove --memory-init-file flag when linking with Emscripten)
 - #98219 (Skip late bound regions in GATSubstCollector)
 - #98233 (Remove accidental uses of `&A: Allocator`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-19 14:51:28 +00:00
Dylan DPC
6a2a56da45
Rollup merge of #98233 - RalfJung:ref-alloc, r=thomcc
Remove accidental uses of `&A: Allocator`

Cc https://github.com/rust-lang/rust/issues/98232

Fixes https://github.com/rust-lang/rust/issues/98176 (for real this time)
2022-06-19 15:26:31 +02:00
Dylan DPC
cf3245e7c3
Rollup merge of #98219 - eggyal:gatsubstcollector-without-folding, r=jackh726
Skip late bound regions in GATSubstCollector

#93227 liberated late bound regions when collecting GAT substs in wfcheck.  It should simply skip late bound regions instead.

r? ``@compiler-errors``
2022-06-19 15:26:30 +02:00
Dylan DPC
88cb597e7a
Rollup merge of #98146 - hoodmane:remove-memory-init-flag, r=petrochenkov
Remove --memory-init-file flag when linking with Emscripten

This flag does nothing. It only applies when generating asmjs JavaScript.
``@sbc100``
2022-06-19 15:26:29 +02:00
Dylan DPC
6e8f541fff
Rollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obk
Rename `impl_constness` to `constness`

The current code is a basis for `is_const_fn_raw`, and `impl_constness`
is no longer a valid name, which is previously used for determining the
constness of impls, and not items in general.

r? `@oli-obk`
2022-06-19 15:26:28 +02:00
Dylan DPC
3174a694e0
Rollup merge of #98105 - notriddle:notriddle/tuple-links, r=jsha
rustdoc: remove tuple link on round braces

This is #98069 but for tuples. The reasoning is the same:

* This PR also changes it so that tuples with all-generic elements still link to the primitive.tuple.html page, just like slices. So there still plenty of on-ramps for anybody who doesn't know about it.
* It's too hard to see when round braces are a separate link from the type inside of them.
* It's too hard to click even if you do notice them.

Before:

* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for [(](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)[IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)[)](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)K, V[)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>

After:

* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for ([IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html))
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(K, V)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>
2022-06-19 15:26:27 +02:00
bjorn3
7643f82e01 Small refactoring 2022-06-19 12:56:31 +00:00
bjorn3
18c6fe5798 Remove the source archive functionality of ArchiveWriter
We now build archives through strictly additive means rather than taking
an existing archive and potentially substracting parts.
2022-06-19 12:56:31 +00:00
bjorn3
7ff0df5102 Fix "Remove src_files and remove_file" 2022-06-19 12:56:31 +00:00
bors
67404f7200 Auto merge of #98238 - cjgillot:lint-mod, r=oli-obk
Make some lints incremental.

Those lints do not track a state, so don't need to be performed for the full crate at once.
2022-06-19 12:28:59 +00:00
Takayuki Maeda
094d8cc954 fix tests including dead_code warnings 2022-06-19 21:00:25 +09:00
Takayuki Maeda
3a023e7e58 collapse dead code warnings into a single diagnostic
add comments in `store_dead_field_or_variant`

support multiple log level

add a item ident label

fix ui tests

fix a ui test

fix a rustdoc ui test

use let chain

refactor: remove `store_dead_field_or_variant`

fix a tiny bug
2022-06-19 18:32:56 +09:00
Takayuki Maeda
da27551f3a emit only one note per unused struct field 2022-06-19 18:32:56 +09:00
bors
15fc228d0d Auto merge of #97791 - m-ou-se:const-locks, r=m-ou-se
Make {Mutex, Condvar, RwLock}::new() const.

This makes it possible to have `static M: Mutex<_> = Mutex::new(..);` 🎉

Our implementations [on Linux](https://github.com/rust-lang/rust/pull/95035), [on Windows](https://github.com/rust-lang/rust/pull/77380), and various BSDs and some tier 3 platforms have already been using a non-allocating const-constructible implementation. As of https://github.com/rust-lang/rust/pull/97647, the remaining platforms (most notably macOS) now have a const-constructible implementation as well. This means we can finally make these functions publicly const.

Tracking issue: https://github.com/rust-lang/rust/issues/93740
2022-06-19 08:20:36 +00:00
Camille GILLOT
1e7ec943a8 Bless 32bit ui tests. 2022-06-19 09:53:00 +02:00
Camille GILLOT
47b8d26eff Use ensure for UnusedBrokenConst. 2022-06-19 09:44:32 +02:00
bors
5fb8a39266 Auto merge of #97367 - WaffleLapkin:stabilize_checked_slice_to_str_conv, r=dtolnay
Stabilize checked slice->str conversion functions

This PR stabilizes the following APIs as `const` functions in Rust 1.63:
```rust
// core::str

pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error>;

impl Utf8Error {
    pub const fn valid_up_to(&self) -> usize;
    pub const fn error_len(&self) -> Option<usize>;
}
```

Note that the `from_utf8_mut` function is not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: https://github.com/rust-lang/rust/issues/91006#issuecomment-1134593095

[unstable in const context]: https://github.com/rust-lang/rust/issues/57349
2022-06-19 05:51:42 +00:00
Jack Huey
1e9f8df6bb Move RegionKind to rustc_type_ir 2022-06-19 00:20:27 -04:00
bors
6c9be6e4e9 Auto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrum
Update FreeBSD toolchain to 12.3

Update the FreeBSD toolchain to 12.3. FreeBSD 11 is EOL since September 30, 2021.

I've locally verified that the `dist-x86_64-freebsd` docker image builds successfully.

r? `@Mark-Simulacrum`
2022-06-19 03:30:05 +00:00
Hood Chatham
3fb6d45af9 ENH Move --memory-init-file flag from EmLinker to asmjs target spec 2022-06-18 17:48:00 -07:00
bors
3b98c08288 Auto merge of #98242 - matthiaskrgr:rollup-qbbkwtf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97511 (Don't build the compiler before building rust-demangler)
 - #98165 (once cell renamings)
 - #98207 (Update cargo)
 - #98229 (Add new eslint checks)
 - #98230 (Fix weird js condition)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-19 00:25:25 +00:00
Matthias Krüger
267fe3bf81
Rollup merge of #98230 - GuillaumeGomez:weird-js-condition, r=notriddle
Fix weird js condition

While going around the code, I found this weird condition. Fixing also affects the generated results in some cases apparently (could only find this one).

Any idea maybe `@notriddle?`

r? `@notriddle`
2022-06-19 00:17:16 +02:00
Matthias Krüger
0a66e3a552
Rollup merge of #98229 - GuillaumeGomez:eslint-checks, r=Dylan-DPC
Add new eslint checks

r? ```@Dylan-DPC```
2022-06-19 00:17:15 +02:00
Matthias Krüger
d13bead874
Rollup merge of #98207 - arlosi:update-cargo, r=Dylan-DPC
Update cargo

4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19
2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000
- Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764)
- chore: Upgrade to clap 3.2 (rust-lang/cargo#10753)
- Improve testing framework for http registries (rust-lang/cargo#10738)
- doc: Improve example of using the links field (rust-lang/cargo#10728)
2022-06-19 00:17:14 +02:00
Matthias Krüger
f351f347b8
Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se
once cell renamings

This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128

- Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}`
- Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}`

(I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc)

```@rustbot``` label +T-libs-api -T-libs
2022-06-19 00:17:13 +02:00
Matthias Krüger
e6d28d2ea2
Rollup merge of #97511 - jyn514:faster-cargo-build, r=Mark-Simulacrum
Don't build the compiler before building rust-demangler

This saves a lot of time compiling, since rust-demangler doesn't actually use any unstable features.

This is not quite ideal because it uses ToolStd, not ToolBootstrap, so rust-demangler would be able to add unstable library features in the future. But it's a lot better than before, and `builder.cargo` doesn't currently know how to handle stages other than 0.
2022-06-19 00:17:12 +02:00
Camille GILLOT
dae1d97468 Make some lints incremental. 2022-06-19 00:00:36 +02:00
bors
8e430bfa9a Auto merge of #98237 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/98107
r? `@ghost` Cc `@rust-lang/miri`
2022-06-18 21:44:34 +00:00
Guillaume Gomez
5fef77d30e Remove weird JS condition 2022-06-18 20:36:42 +02:00
Ralf Jung
5609c38c62 update Miri 2022-06-18 11:31:21 -07:00
bors
21e9336fe8 Auto merge of #96501 - jyn514:individual-paths, r=Mark-Simulacrum
Pass all paths to `Step::run` at once when using `ShouldRun::krate`

Helps with https://github.com/rust-lang/rust/pull/95503. The goal is to run `cargo test -p rustc_data_structures -p rustc_lint_defs` instead of `cargo test -p rustc_data_structures; cargo test -p rustc_lint_defs`, which should both recompile less and avoid replaying cached warnings.

This was surprisingly complicated. The main changes are:
1. Invert the order of iteration in `StepDescription::run`.

    Previously, it did something like:
    ```python
    for path in paths:
    for (step, should_run) in should_runs:
        if let Some(set) = should_run.pathset_for_path(path):
        step.run(builder, set)
    ```

    That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
    (since `pathset_for_paths` only had one path available to it).
    Change it to instead look at the intersection of `paths` and `should_run.paths`:

    ```python
    for (step, should_run) in should_runs:
    if let Some(set) = should_run.pathset_for_paths(paths):
        step.run(builder, set)
    ```

2. Change `pathset_for_path` to take multiple pathsets.

    The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
    The changes here are similarly subtle, to use the intersection between the paths rather than all
    paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.

    Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
    See the documentation added in the next commit for more detail.

3. Change `StepDescription::run` to explicitly handle 0 paths.

    Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
    Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).

4. Change `RunDescription` to have a list of pathsets, rather than a single path.

5. Remove paths as they're matched

    This allows checking at the end that no invalid paths are left over.
    Note that if two steps matched the same path, this will no longer run both;
    but that's a bug anyway.

6. Handle suite paths separately from regular sets.

    Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
    The respective test Steps already handle this by introspecting the original paths.

    Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.

`@rustbot` label +A-rustbuild
2022-06-18 18:02:39 +00:00
Michael Howell
29a9f36685 Fix bug when using --bless 2022-06-18 10:36:12 -07:00
Michael Howell
b068e6aeb7 Add test cases for tuples with links 2022-06-18 10:35:19 -07:00
Mark Rousskov
44364dcdcb Add release notes for 1.62 2022-06-18 11:20:51 -04:00
bors
ec21d7ea3c Auto merge of #97924 - cuviper:unguarded-poison, r=Mark-Simulacrum
Avoid `thread::panicking()` in non-poisoning methods of `Mutex` and `RwLock`

`Mutex::lock()` and `RwLock::write()` are poison-guarded against panics,
in that they set the poison flag if a panic occurs while they're locked.
But if we're already in a panic (`thread::panicking()`), they leave the
poison flag alone.

That check is a bit of a waste for methods that never set the poison
flag though, namely `get_mut()`, `into_inner()`, and `RwLock::read()`.
These use-cases are now split to avoid that unnecessary call.
2022-06-18 15:18:50 +00:00
Camille GILLOT
bf38ba260d Separate AnonymousCreateParameter and ReportElidedInPath. 2022-06-18 16:59:27 +02:00
Camille GILLOT
237e267b80 Refactor visit_fn. 2022-06-18 16:59:19 +02:00
Joshua Nelson
fca6dbd9af Add tests for fixed bugs 2022-06-18 09:58:29 -05:00
Camille GILLOT
80c6a1f275 Rustfmt resolve_implementation. 2022-06-18 16:58:18 +02:00
Camille GILLOT
228def7e20 Extract AssocItem handling. 2022-06-18 16:56:30 +02:00
Joshua Nelson
0da0a2196d Pass all paths to Step::run at once when using ShouldRun::krate
This was surprisingly complicated. The main changes are:
1. Invert the order of iteration in `StepDescription::run`.

    Previously, it did something like:
    ```python
    for path in paths:
    for (step, should_run) in should_runs:
        if let Some(set) = should_run.pathset_for_path(path):
        step.run(builder, set)
    ```

    That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
    (since `pathset_for_paths` only had one path available to it).
    Change it to instead look at the intersection of `paths` and `should_run.paths`:

    ```python
    for (step, should_run) in should_runs:
    if let Some(set) = should_run.pathset_for_paths(paths):
        step.run(builder, set)
    ```

2. Change `pathset_for_path` to take multiple pathsets.

    The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
    The changes here are similarly subtle, to use the intersection between the paths rather than all
    paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.

    Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
    See the documentation added in the next commit for more detail.

3. Change `StepDescription::run` to explicitly handle 0 paths.

   Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
   Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).

4. Change `RunDescription` to have a list of pathsets, rather than a single path.

5. Remove paths as they're matched

   This allows checking at the end that no invalid paths are left over.
   Note that if two steps matched the same path, this will no longer run both;
   but that's a bug anyway.

6. Handle suite paths separately from regular sets.

   Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
   The respective test Steps already handle this by introspecting the original paths.

   Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
2022-06-18 09:54:35 -05:00
Ralf Jung
b05d71f880 make std not use &A: Allocator instance 2022-06-18 07:38:28 -07:00
Ralf Jung
7952205bc8 make btree not use &A: Allocator instance 2022-06-18 07:37:41 -07:00
Guillaume Gomez
ec78ff4cd1 Adding new eslint checks:
* no-sequences
 * no-throw-literal
2022-06-18 16:02:44 +02:00