Skip to content

Conversation

RalfJung
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

hellow554 and others added 30 commits August 11, 2020 09:22
This commit moves `transparent_newtype_field` and `is_zst` to
`LateContext` where they are used, rather than being on the `VariantDef`
and `TyS` types.

Signed-off-by: David Wood <[email protected]>
This is very similar to the existing `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice.
Thanks, Amanieu

Co-authored-by: Amanieu d'Antras <[email protected]>
Co-authored-by: Ivan Tham <[email protected]>
Trait implementations effectively can't be #[unstable].
Since trait implementations cannot be unstable, we should only add them
when the as_str feature gets stabilized. Until then, only `.as_str()` is
available (behind a feature gate).
m-ou-se and others added 15 commits September 19, 2020 08:23
…acrum

deny(unsafe_op_in_unsafe_fn) in libstd/path.rs

The libstd/path.rs part of rust-lang#73904 . Wraps the two calls to an unsafe fn Initializer::nop() in an unsafe block.
…ion, r=eddyb

lint/ty: move fns to avoid abstraction violation

This PR moves `transparent_newtype_field` and `is_zst` to `LateContext` where they are used, rather than being on the `VariantDef` and `TyS` types, hopefully addressing @eddyb's concern [from this comment](rust-lang#74340 (comment)).
…n-const-fn, r=RalfJung

Use implicit (not explicit) rules for promotability by default in `const fn`

For crater run. See rust-lang/const-eval#54 (comment).

cc rust-lang#75586
Add test for checking duplicated branch or-patterns

This adds a regression test for checking `or-patterns` in MIR as shown in rust-lang#75439.
This doesn't introduce a fix as I'm not sure where it would go(I suspect maybe here: src/librustc_mir_build/build/matches/mod.rs), and I'm not particularly able to fix it.

cc: @lzutao
Add `[T; N]: TryFrom<Vec<T>>` (insta-stable)

This is very similar to the [existing](https://doc.rust-lang.org/nightly/std/convert/trait.TryFrom.html#impl-TryFrom%3CBox%3C%5BT%5D%3E%3E) `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice.

Like the slice equivalents of this, it fails if the length of the vector is not exactly `N`.
This uses `Vec<T>` as the `Error` type to return the input, like how the `Rc<[T]> -> Rc<[T; N]>` (and Arc) ones also reflect the input directly in the error type.

```rust
#[stable(feature = "array_try_from_vec", since = "1.47.0")]
impl<T, const N: usize> TryFrom<Vec<T>> for [T; N] {
    type Error = Vec<T>;
    fn try_from(mut vec: Vec<T>) -> Result<[T; N], Vec<T>>;
}
```

Inspired by this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/APIs.20for.20getting.20stuff.20from.20a.20Vec.20by.20owned/near/209048103
Clean up vec benches bench_in_place style
do not inline black_box when building for Miri

We cannot do the assembly trick in Miri, but let's at least make sure MIR inlining does not circumvent the black_box.

Also use black_box instead of local optimization barriers in a few const tests.
…r=dtolnay

Add associated constant `BITS` to all integer types

Recently I've regularly come across this snippet (in a few different crates, including `core` and `std`):
```rust
std::mem::size_of<usize>() * 8
```

I think it's time for a `usize::BITS`.
…in, r=dtolnay

Add as_str() to string::Drain.

Vec's Drain recently [had its `.as_slice()` stabilized](rust-lang#72584), but String's Drain was still missing the analogous `.as_str()`. This adds that.

Also improves the Debug implementation, which now shows the remaining data instead of just `"Drain { .. }"`.
assert ScalarMaybeUninit size

I noticed most low-level Miri types have such an assert but `ScalarMaybeUninit` does not, so let's add that. Good t see that the `Option`-like optimization kicks in and this is no bigger than `Scalar`. :)

r? @oli-obk
give *even better* suggestion when matching a const range

notice that the err already has "constant defined here"
so this is now *exceedingly clear*

extension to rust-lang#76222

r? @estebank
don't convert types to the same type with try_into (clippy::useless_conversion)
Give a better error message when x.py uses the wrong stage for CI

r? @shepmaster
…yn514

Build fixes for RISC-V 32-bit Linux support

This fixes build issues with the 32-bit RISC-V port.
@RalfJung
Copy link
Member Author

@rustbot modify labels: +rollup
@bors r+ rollup=never p=14

@bors
Copy link
Collaborator

bors commented Sep 19, 2020

📌 Commit b4c3f40 has been approved by RalfJung

@rustbot rustbot added the rollup A PR which is a rollup label Sep 19, 2020
@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 Sep 19, 2020
@RalfJung
Copy link
Member Author

Cc @Dylan-DPC (just realized I might not be at a computer when this runs, so if it fails would be good if you could take a look)

@bors
Copy link
Collaborator

bors commented Sep 19, 2020

⌛ Testing commit b4c3f40 with merge 8e9d5db...

@bors
Copy link
Collaborator

bors commented Sep 19, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: RalfJung
Pushing 8e9d5db to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 19, 2020
@bors bors merged commit 8e9d5db into rust-lang:master Sep 19, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 19, 2020
@RalfJung RalfJung deleted the rollup-q9ur56h branch September 19, 2020 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.