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 8 pull requests #83358

Closed
wants to merge 21 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

thomcc and others added 21 commits January 6, 2021 19:04
Much like rust-lang#72584.

As per rust-lang#58957 there's no blocker for this, and I wanted to use this
today :-)
When bumping the bootstrap version, the name of the generated LLVM
shared object file is changed, even though it's the same contents as
before. If bootstrap tries to use an older version, it will get linking
errors:

```
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
   Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" ... lots of args ...
  = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `rustdoc-tool`
```
…-ou-se

stabilize `feature(osstring_ascii)`

This PR stabilizes `feature(osstring_ascii)`.

Fixes rust-lang#70516.
Make NonNull::as_ref (and friends) return refs with unbound lifetimes

# Rationale:

1. The documentation for all of these functions claims that this is what the functions already do, as they all come with this comment:

    > You must enforce Rust's aliasing rules, *since the returned lifetime 'a is arbitrarily chosen* and does not necessarily reflect the actual lifetime of the data...

    So I think it's just a bug that they weren't this way already. Note that had it not been for this part, I wouldn't be making this PR, so if we decide we won't take this change, I'll follow it up with a docs PR to fix this.

2. This is how the equivalent raw pointer functions behave.

    They also take `self` and not `&self`/`&mut self`, but that can't be changed compatibly at this point. This is the next best thing.

3. Without this fix, often code that uses these methods will find it has to expand the lifetime of the result.

    (I can't speak for others but even in unsafe-heavy code, needing to do this unexpectedly is a huge red flag -- if Rust thinks something should have a specific lifetime, I assume it's for a reason)

### Can this cause existing code to be unsound?

I'm confident this can't cause new unsoundness since the reference exists for at most its lifetime, but you get a borrow checker error if you do something that would require/allow the reference to exist past its lifetime.

Additionally, the aliasing rules of a reference only applies while the reference exists.

This *must* be the case, as it is required by the rules used by safe code. (That said, the documentation in this file sort of contradicts it, but I think it's just ambiguity between the lifetime `'a` in `&'a T` and lifetime of the `&'a T` reference itself...)

We are increasing the lifetime of these references, but they should already have hard bounds on that lifetime, or they'd have borrow checker errors.

(CC `@RalfJung` because I have gone and done the mistake where I say something definitive about aliasing in Rust which is honestly outside the group of things I should make definitive comments about).

# Caveats

1. This is insta-stable (except for on the unstable functions ofc). I don't think there's any other alternative.

2. I don't believe this is a breaking change in practice. In theory someone could be assigning `NonNull::as_ref` to a function pointer of type `fn(&NonNull<T>) -> &T`. Now they'd need to use a slightly different function pointer type which is (probably) incompatible. This seems pathological, but I guess crater could be used if there are concerns.

3. This has no tests. The old version didn't either that I saw. I could add some stuff that fails to compile without it, if that would be useful.

4. Sometimes the NLL borrow checker gives up and decides lifetimes live till the end of the scope, as opposed to the range where they're used. If this change can cause this to happen more, then my soundness rationale is wrong, and it's likely breaking.

    In practice this seems super unlikely.

Anyway. That was a lot of typing.

Fixes rust-lang#80183
…-things, r=m-ou-se

Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators

This should make some `FromIterator` and `.zip()` specializations applicable in a few more cases.

`@rustbot` label libs-impl
…ness, r=m-ou-se

Fix invalid slice access in String::retain

As noted in rust-lang#78499, the previous fix was technically still unsound because it accessed elements of a slice outside its bounds (even though they were still inside the same allocation). This PR addresses that concern by switching to a dropguard approach.
Move `std::sys::unix::platform` to `std::sys::unix::ext`

This moves the operating system dependent alias `platform` (`std::os::{linux, android, ...}`) from `std::sys::unix` to `std::sys::unix::ext` (a.k.a. `std::os::unix`), removing the need for compatibility code in `unix_ext` when documenting on another platform.

This is also a step in making it possible to properly move `std::sys::unix::ext` to `std::os::unix`, as ideally `std::sys` should not depend on the rest of `std`.
slice: Stabilize IterMut::as_slice.

Much like rust-lang#72584.

As per rust-lang#58957 there's no blocker for this, and I wanted to use this
today :-)

Closes rust-lang#58957
Remove Option::{unwrap_none, expect_none}.

This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see rust-lang#62633.

Closes rust-lang#62633
Download a more recent LLVM version if `src/version` is modified

When bumping the bootstrap version, the name of the generated LLVM
shared object file is changed, even though it's the same contents as
before. If bootstrap tries to use an older version, it will get linking
errors:

```
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
   Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" ... lots of args ...
  = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `rustdoc-tool`
```

Helps with rust-lang#81930.
@rustbot rustbot added the rollup A PR which is a rollup label Mar 21, 2021
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 21, 2021

📌 Commit 60ea265 has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 21, 2021
@bors
Copy link
Contributor

bors commented Mar 22, 2021

⌛ Testing commit 60ea265 with merge 77272f023281d6b51558f3e5b79fab3ef4b15607...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] ignore test:false 19.150
error[E0599]: no method named `expect_none` found for enum `Option<Fingerprint>` in the current scope
    --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/lib.rs:2003:48
     |
2003 |                 cache[index].replace(sub_hash).expect_none("Cache slot was filled");

error[E0599]: no method named `expect_none` found for enum `Option<u32>` in the current scope
   --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:121:54
    |
---
   Compiling rls-ipc v0.1.0 (/checkout/src/tools/rls/rls-ipc)
error[E0599]: no method named `expect_none` found for enum `Option<&u32>` in the current scope
    --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:1421:22
     |
1421 |                     .expect_none("Hash collision after disambiguator update!");
     |                      ^^^^^^^^^^^ method not found in `Option<&u32>`
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_ap_rustc_span test:false 1.869
---
   Compiling rustc-ap-rustc_span v705.0.0
error[E0599]: no method named `expect_none` found for enum `Option<Fingerprint>` in the current scope
    --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/lib.rs:2003:48
     |
2003 |                 cache[index].replace(sub_hash).expect_none("Cache slot was filled");

[RUSTC-TIMING] rustc_ap_rustc_data_structures test:false 3.923
error[E0599]: no method named `expect_none` found for enum `Option<u32>` in the current scope
   --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:121:54
---

error[E0599]: no method named `expect_none` found for enum `Option<&u32>` in the current scope
    --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:1421:22
     |
1421 |                     .expect_none("Hash collision after disambiguator update!");
     |                      ^^^^^^^^^^^ method not found in `Option<&u32>`
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_ap_rustc_span test:false 1.896
---
Verifying status of rustfmt...
Verifying status of miri...
Verifying status of embedded-book...
Cloning into 'rust-toolstate'...
error: Tool `rls` has regressed from test-pass to build-fail during beta week.
error: Tool `rustfmt` has regressed from test-pass to build-fail during beta week.
{"rust-by-example":"test-pass","rustfmt":"build-fail","book":"test-pass","edition-guide":"test-pass","cargo-miri":"test-fail","rls":"build-fail","nomicon":"test-pass","embedded-book":"test-pass","reference":"test-pass","rustbook":"test-fail","miri":"test-pass"}failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --stage 2 check-tools

@bors
Copy link
Contributor

bors commented Mar 22, 2021

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 22, 2021
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.