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

Rustup #2702

Merged
merged 17 commits into from Nov 27, 2022
Merged

Rustup #2702

merged 17 commits into from Nov 27, 2022

Conversation

RalfJung
Copy link
Member

No changes happened on the rustc side, but I want to do a push next and would rather make josh's life easier by integrating some recent history first.

…er-errors

Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` rust-lang/lang-team#88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
Check fat pointer metadata compatibility modulo regions

Regions don't really mean anything anyways during hir typeck.

If this `erase_regions` makes anyone nervous, it's probably equally valid to just equate the types using a type relation, but regardless we should _not_ be using strict type equality while region variables are present.

Fixes #103384
update Miri

r? `@thomcc` for the lib changes (removing a `cfg(miri)` that is no longer needed)
Pass 128-bit C-style enum enumerator values to LLVM

Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform).

Tracking issue: #56071
Support using `Self` or projections inside an RPIT/async fn

I reuse the same idea as rust-lang/rust#103449 to use variances to encode whether a lifetime parameter is captured by impl-trait.

The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`.  This PR changes the scheme
```rust
impl<'a> Foo<'a> {
    fn foo<'b, T>() -> impl Into<Self> + 'b { ... }
}

opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b;
impl<'a> Foo<'a> {
    // OLD
    fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... }
                             ^^^^^^^ the `Self` becomes `Foo<'static>`

    // NEW
    fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... }
                             ^^ the `Self` stays `Foo<'a>`
}
```

There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one.

This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more.  The same trick allows to use projections like `T::Assoc` where `Self` is allowed.  The feature is gated behind a `impl_trait_projections` feature gate.

The implementation relies on 2 tweaking rules for opaques in 2 places:
- we only relate substs that correspond to captured lifetimes during TypeRelation;
- we only list captured lifetimes in choice region computation.

For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques.

Impl-trait that do not reference `Self` or projections will have their variances as:
- `o` (invariant) for each parent type or const;
- `*` (bivariant) for each parent lifetime --> will not participate in borrowck;
- `o` (invariant) for each own lifetime.

Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck.  In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`.

r? types
cc `@compiler-errors` , as you asked about the issue with `Self` and projections.
Reduce `PlaceBuilder` cloning

Some API tweaks with an eye towards reducing clones.
Fix perf regression by correctly matching keywords

This should (hopefully) fix regression from #99918

r? `@estebank`
Use `as_deref` in compiler (but only where it makes sense)

This simplifies some code :3

(there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
Reverts check done by #100757

As my `fix` caused more issues than it resolved it's better to revert it.
( #103274 #104322 rust-lang/rust#104606)

r? `@compiler-errors`

Reopens #95134
Use an IndexVec to cache queries with index-like key

Revival of an old idea. Let's see if it has more effect.

r? `@ghost`
…lacrum

Build macOS distribution artifacts with XCode 13

After all of the `rust-lang/rust` Apple runners started using macOS 12, the builds created by CI began to use XCode 14.0.1. Due to this (as far as we can tell), XCode's build tools started to ignore the `MACOSX_DEPLOYMENT_TARGET` being defined by us for the distributed builds that let both `rustc` and `libstd` work on older versions. The current idea is that since XCode 14's macOS SDK doesn't support deployment targets before 10.13, it uses some default of its own. You can see the difference between stable's and the most recent nighty's supported versions [here](rust-lang/rust#104570 (comment)).

I wasn't able to confirm my SDK versioning hypothesis locally since I think there's something jammed with my XCode installation, but hopefully this should still fix it for releases.

Closes rust-lang/rust#104570

r? `@Mark-Simulacrum`
…ulacrum

Enable profiler in dist-riscv64-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on riscv64-linux.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
…ttmcm

Manually implement PartialEq for Option<T> and specialize non-nullable types

This PR manually implements `PartialEq` and `StructuralPartialEq` for `Option`, which seems to produce slightly better codegen than the automatically derived implementation.

It also allows specializing on the `core::num::NonZero*` and `core::ptr::NonNull` types, taking advantage of the niche optimization by transmuting the `Option<T>` to `T` to be compared directly, which can be done in just two instructions.

A comparison of the original, new and specialized code generation is available [here](https://godbolt.org/z/dE4jxdYsa).
@RalfJung
Copy link
Member Author

Ah actually josh can do the push just fine without this.

@RalfJung RalfJung closed this Nov 27, 2022
@RalfJung RalfJung reopened this Nov 27, 2022
@RalfJung
Copy link
Member Author

Ah, but it would duplicate some things from rust-lang/rust#104617.

Between two josh pushes there must always be a josh pull!

@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

📌 Commit 3dc3daa has been approved by RalfJung

It is now in the queue for this repository.

bors added a commit that referenced this pull request Nov 27, 2022
Rustup

No changes happened on the rustc side, but I want to do a push next and would rather make josh's life easier by integrating some recent history first.
@bors
Copy link
Collaborator

bors commented Nov 27, 2022

⌛ Testing commit 3dc3daa with merge 5b6f0f1...

@RalfJung
Copy link
Member Author

@bors retry r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

📌 Commit 5e30ce8 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout rustup (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self rustup --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging src/stacked_borrows/mod.rs
CONFLICT (content): Merge conflict in src/stacked_borrows/mod.rs
Automatic merge failed; fix conflicts and then commit the result.

@RalfJung
Copy link
Member Author

@bors retry r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

📌 Commit 55aa540 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

⌛ Testing commit 55aa540 with merge 76ae2f5...

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 76ae2f5 to master...

@bors bors merged commit 76ae2f5 into rust-lang:master Nov 27, 2022
@RalfJung RalfJung deleted the rustup branch November 27, 2022 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants