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 6 pull requests #97909

Closed
wants to merge 15 commits into from
Closed

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

evanrichter and others added 15 commits May 19, 2022 14:59
* For read and read_buf, only the front slice of a discontiguous
VecDeque is copied. The VecDeque is advanced after reading, making any
back slice available for reading with a second call to Read::read(_buf).

* For write, the VecDeque always appends the entire slice to the end,
growing its allocation when necessary.
Previously, the linker script forcefully kept all `.lib.stub` sections,
unnecessarily bloating the binary. Now, the script is LTO and
`--gc-sections` friendly.

`--nmagic` was also added to the linker, because page alignment is not
required on the PSP. This further reduces binary size.

Accompanying changes for the PSP crate are found in:
overdrivenpotato/rust-psp#118
The output of IR formatting changed slightly in upstream rev
a0bc67e
(https://reviews.llvm.org/D123096). I'm not actually sure what any of
that means, as I don't even know what hexagon is in this context, but
this change allows the test to pass on both old and new LLVMs.

r? @nikic
This resolves rust-lang#85821. See also the discussion here:
emscripten-core/emscripten#17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
impl Read and Write for VecDeque<u8>

Implementing `Read` and `Write` for `VecDeque<u8>` fills in the VecDeque api surface where `Vec<u8>` and `Cursor<Vec<u8>>` already impl Read and Write. Not only for completeness, but VecDeque in particular is a very handy mock interface for a TCP echo service, if only it supported Read/Write.

Since this PR is just an impl trait, I don't think there is a way to limit it behind a feature flag, so it's "insta-stable". Please correct me if I'm wrong here, not trying to rush stability.
…lett

Stabilize `$$` in Rust 1.63.0

# Stabilization proposal

This PR proposes the stabilization of a subset of `#![feature(macro_metavar_expr)]` or more specifically, the stabilization of dollar-dollar (`$$`).

Tracking issue: rust-lang#83527
Version: 1.63 (2022-06-28 => beta, 2022-08-11 => stable).

## What is stabilized

```rust
macro_rules! foo {
    () => {
        macro_rules! bar {
            ( $$( $$any:tt )* ) => { $$( $$any )* };
        }
    };
}

fn main() {
    foo!();
}
```

## Motivation

For more examples, see the [RFC](https://github.com/markbt/rfcs/blob/macro_metavar_expr/text/0000-macro-metavar-expr.md).

Users must currently resort to a tricky and not so well-known hack to declare nested macros with repetitions.

```rust
macro_rules! foo {
    ($dollar:tt) => {
        macro_rules! bar {
            ( $dollar ( $any:tt )* ) => { $dollar ( $any )* };
        }
    };
}
fn main() {
    foo!($);
}
```

As seen above, such hack is fragile and makes work with declarative macros much more unpleasant. Dollar-dollar (`$$`), on the other hand, makes nested macros more intuitive.

## What isn't stabilized

`count`, `ignore`, `index` and `length` are not being stabilized due to the lack of consensus.

## History

* 2021-02-22, [RFC: Declarative macro metavariable expressions](rust-lang/rfcs#3086)
* 2021-03-26, [Tracking Issue for RFC 3086: macro metavariable expressions](rust-lang#83527)
* 2022-02-01, [Implement macro meta-variable expressions](rust-lang#93545)
* 2022-02-25, [[1/2] Implement macro meta-variable expressions](rust-lang#94368)
* 2022-03-11, [[2/2] Implement macro meta-variable expressions](rust-lang#94833)
* 2022-03-12, [Fix remaining meta-variable expression TODOs](rust-lang#94884)
* 2019-03-21, [[macro-metavar-expr] Fix generated tokens hygiene](rust-lang#95188)
* 2022-04-07, [Kickstart the inner usage of macro_metavar_expr](rust-lang#95761)
* 2022-04-07, [[macro_metavar_expr] Add tests to ensure the feature requirement](rust-lang#95764)

## Non-stabilized expressions

rust-lang#83527 lists several concerns about some characteristics of `count`, `index` and `length` that effectively make their stabilization unfeasible. `$$` and `ignore`, however, are not part of any discussion and thus are suitable for stabilization.

It is not in the scope of this PR to detail each concern or suggest any possible converging solution. Such thing should be restrained in this tracking issue.

## Tests

This list is a subset of https://github.com/rust-lang/rust/tree/master/src/test/ui/macros/rfc-3086-metavar-expr

* [Ensures that nested macros have correct behavior](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs)

* [Compares produced tokens to assert expected outputs](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs)

* [Checks the declarations of the feature](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/required-feature.rs)

* [Verifies all possible errors that can occur due to incorrect user input](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs)

## Possible future work

Once consensus is achieved, other nightly expressions can be stabilized.

Thanks `@markbt` for creating the RFC and thanks to `@petrochenkov` and `@mark-i-m` for reviewing the implementations.
hexagon: adapt test for upstream output changes

The output of IR formatting changed slightly in upstream rev
a0bc67e
(https://reviews.llvm.org/D123096). I'm not actually sure what any of
that means, as I don't even know what hexagon is in this context, but
this change allows the test to pass on both old and new LLVMs.

r? `@nikic`
…woerister

Relax mipsel-sony-psp's linker script

Previously, the linker script forcefully kept all `.lib.stub` sections, unnecessarily bloating the binary. Now, the script is LTO and `--gc-sections` friendly.

`--nmagic` was also added to the linker, because page alignment is not required on the PSP. This further reduces binary size.

Accompanying changes for the `psp` crate are found in: overdrivenpotato/rust-psp#118
rewrite combine doc comment

it was from 2014 and somewhat outdated
… r=Amanieu

Don't use __gxx_personality_v0 in panic_unwind on emscripten target

This resolves rust-lang#85821. See also the discussion here:
emscripten-core/emscripten#17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
@rustbot rustbot added 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. rollup A PR which is a rollup labels Jun 9, 2022
@JohnTitor
Copy link
Member Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Jun 9, 2022

📌 Commit 03b0f41 has been approved by JohnTitor

@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 Jun 9, 2022
@bors
Copy link
Contributor

bors commented Jun 9, 2022

⌛ Testing commit 03b0f41 with merge 33e0c56c5321581298fc28076966b447a82be0ea...

@rust-log-analyzer
Copy link
Collaborator

The job wasm32 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    |
114 |     version: c_int,
    |     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_version`
    |
    = note: `-D unused-variables` implied by `-D warnings`
error: unused variable: `actions`
   --> library/panic_unwind/src/emcc.rs:115:5
    |
    |
115 |     actions: uw::_Unwind_Action,
    |     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_actions`
error: unused variable: `exception_class`
   --> library/panic_unwind/src/emcc.rs:116:5
    |
    |
116 |     exception_class: uw::_Unwind_Exception_Class,
    |     ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_exception_class`
error: unused variable: `exception_object`
   --> library/panic_unwind/src/emcc.rs:117:5
    |
    |
117 |     exception_object: *mut uw::_Unwind_Exception,
    |     ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_exception_object`
error: unused variable: `context`
   --> library/panic_unwind/src/emcc.rs:118:5
    |
    |
118 |     context: *mut uw::_Unwind_Context,
    |     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_context`
[RUSTC-TIMING] panic_unwind test:false 0.091
error: could not compile `panic_unwind` due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] std_detect test:false 0.128

@bors
Copy link
Contributor

bors commented Jun 9, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 9, 2022
@JohnTitor JohnTitor closed this Jun 9, 2022
@JohnTitor JohnTitor deleted the rollup-981ygiu branch June 9, 2022 10:20
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants