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 #7051

Merged
merged 14 commits into from
Apr 8, 2021
Merged

Rustup #7051

merged 14 commits into from
Apr 8, 2021

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Apr 8, 2021

changelog: none

r? @ghost

flip1995 and others added 12 commits March 25, 2021 19:29
When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344
Add function core::iter::zip

This makes it a little easier to `zip` iterators:

```rust
for (x, y) in zip(xs, ys) {}
// vs.
for (x, y) in xs.into_iter().zip(ys) {}
```

You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and
`iter()`, respectively. This can also support arbitrary nesting, where
it's easier to see the item layout than with arbitrary `zip` chains:

```rust
for ((x, y), z) in zip(zip(xs, ys), zs) {}
for (x, (y, z)) in zip(xs, zip(ys, zs)) {}
// vs.
for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {}
for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {}
```

It may also format more nicely, especially when the first iterator is a
longer chain of methods -- for example:

```rust
    iter::zip(
        trait_ref.substs.types().skip(1),
        impl_trait_ref.substs.types().skip(1),
    )
    // vs.
    trait_ref
        .substs
        .types()
        .skip(1)
        .zip(impl_trait_ref.substs.types().skip(1))
```

This replaces the tuple-pair `IntoIterator` in #78204.
There is prior art for the utility of this in [`itertools::zip`].

[`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html
Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  rust-lang/compiler-team#418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.
Remove attribute `#[link_args]`

Closes rust-lang/rust#29596

The attribute could always be replaced with `-C link-arg`, but cargo didn't provide a reasonable way to pass such flags to rustc.
Now cargo supports `cargo:rustc-link-arg*` directives in build scripts (https://doc.rust-lang.org/cargo/reference/unstable.html#extra-link-arg), so this attribute can be removed.
Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
@flip1995
Copy link
Member Author

flip1995 commented Apr 8, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Apr 8, 2021

📌 Commit 22cda1b has been approved by flip1995

bors added a commit that referenced this pull request Apr 8, 2021
Rustup

changelog: none

r? `@ghost`
@bors
Copy link
Contributor

bors commented Apr 8, 2021

⌛ Testing commit 22cda1b with merge 1539a69...

@bors
Copy link
Contributor

bors commented Apr 8, 2021

💔 Test failed - checks-action_test

@flip1995
Copy link
Member Author

flip1995 commented Apr 8, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Apr 8, 2021

📌 Commit 61eafbb has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 8, 2021

⌛ Testing commit 61eafbb with merge b40ea20...

@bors
Copy link
Contributor

bors commented Apr 8, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing b40ea20 to master...

@bors bors merged commit b40ea20 into rust-lang:master Apr 8, 2021
@flip1995 flip1995 deleted the rustup branch April 8, 2021 15:58
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.