Skip to content

Rollup of 6 pull requests - #108602

Closed
matthiaskrgr wants to merge 18 commits into
rust-lang:masterfrom
matthiaskrgr:rollup-kci1s5i
Closed

Rollup of 6 pull requests#108602
matthiaskrgr wants to merge 18 commits into
rust-lang:masterfrom
matthiaskrgr:rollup-kci1s5i

Conversation

@matthiaskrgr

Copy link
Copy Markdown
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

notriddleand others added 18 commits February 16, 2023 18:16
instead of the span of the token after the semicolon
The extra query is unnecessary in the common case of not having fuel.
Co-Authored-By: GuillaumeGomez <guillaume1.gomez@gmail.com>
Nothing actually produces it in this commit.
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
This adds the following functions:
* `Option<T>::as_slice(&self) -> &[T]`
* `Option<T>::as_slice_mut(&mut self) -> &[T]`
The `as_slice` and `as_slice_mut` functions benefit from an
optimization that makes them completely branch-free.
Note that the optimization's soundness hinges on the fact that either
the niche optimization makes the offset of the `Some(_)` contents zero
or the mempory layout of `Option<T>` is equal to that of
`Option<MaybeUninit<T>>`.
Add `Option::as_`(`mut_`)`slice`
This adds the following functions:
* `Option<T>::as_slice(&self) -> &[T]`
* `Option<T>::as_mut_slice(&mut self) -> &[T]`
The `as_slice` and `as_mut_slice_mut` functions benefit from an optimization that makes them completely branch-free. ~~Unfortunately, this optimization is not available on by-value Options, therefore the `into_slice` implementations use the plain `match` + `slice::from_ref` approach.~~
Note that the optimization's soundness hinges on the fact that either the niche optimization makes the offset of the `Some(_)` contents zero or the mempory layout of `Option<T>` is equal to that of `Option<MaybeUninit<T>>`.
The idea has been discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Option.3A.3Aas_slice). Notably the idea for the `as_slice_mut` and `into_slice´ methods came from ``@cuviper`` and ``@Sp00ph`` hardened the optimization against niche-optimized Options.
The [rust playground](https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=74f8e4239a19f454c183aaf7b4a969e0) shows that the generated assembly of the optimized method is basically only a copy while the naive method generates code containing a `test dx, dx` on x86_64.
---
EDIT from reviewer: ACP is rust-lang/libs-team#150
…, r=compiler-errors
Use span of semicolon for eager recovery in expression
Instead of the span of the token after the semicolon. This will hopefully cause fewer errors from overlapping spans.
fixesrust-lang#108242
based on rust-lang#108239
rustc_middle: Remove trait `DefIdTree`
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
…tion-fuel, r=WaffleLapkin
Lazily compute crate name for consider_optimizing
The extra query is unnecessary in the common case of not having fuel.
Add `CastKind::Transmute` to MIR
~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~
Includes lowering `transmute` calls to it, so it's used.
Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 1, 2023
@matthiaskrgr

Copy link
Copy Markdown
MemberAuthor

@bors r+ rollup=never p=6

@bors

bors commented Mar 1, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 951426b has been approved by matthiaskrgr

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2023
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:ac593985615ec2ede58e132d2e21d2b1cbd6127c)
Download action repository 'rust-lang/simpleinfra@master' (SHA:e58f560dd5e72b61cf9aeebf432d862b23ac76a8)
Complete job name: PR (x86_64-gnu-llvm-14, false, ubuntu-20.04-xl)
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
CI_JOB_NAME: x86_64-gnu-llvm-14
---
........................................................................................ 14520/14538
..................
failures:
---- [ui] tests/ui/argument-suggestions/issue-108242-semicolon-recovery.rs stdout ----
- error: expected one of `)`, `,`, `.`, `?`, or an operator, found `foo`
- --> $DIR/issue-108242-semicolon-recovery.rs:4:5
- LL | foo(;
- | -
- | |
- | |
- | expected one of `)`, `,`, `.`, `?`, or an operator
- | help: missing `,`
- LL | foo(;
- 12 error: mismatched closing delimiter: `}`
13 --> $DIR/issue-108242-semicolon-recovery.rs:4:8
14 |
---
To only update this specific test, also pass `--test-args argument-suggestions/issue-108242-semicolon-recovery.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/issue-108242-semicolon-recovery.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/argument-suggestions/issue-108242-semicolon-recovery" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/argument-suggestions/issue-108242-semicolon-recovery/auxiliary"
stdout: none
--- stderr -------------------------------
--> fake-test-src-base/argument-suggestions/issue-108242-semicolon-recovery.rs:4:8
|
LL | fn main() {
| - closing delimiter possibly meant for this
| - closing delimiter possibly meant for this
LL | foo(; //~ ERROR this function takes 0 arguments but 2 arguments were supplied
LL | foo(; //~ ERROR this function takes 0 arguments but 1 argument was supplied
| ^ unclosed delimiter
LL | //~^ ERROR expected one of
LL | } //~ ERROR mismatched closing delimiter
| ^ mismatched closing delimiter
error: aborting due to previous error
------------------------------------------

@matthiaskrgr
matthiaskrgr deleted the rollup-kci1s5i branch March 16, 2024 18:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollupA PR which is a rollupS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@matthiaskrgr@bors@rust-log-analyzer@rustbot@notriddle@Noratrieb@scottmcm@petrochenkov@llogiq