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 7 pull requests #99077

Closed
wants to merge 27 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

nrc and others added 27 commits July 5, 2022 06:38
DWARF version 5 brings a number of improvements over version 4. Quoting from
the announcement [1]:

> Version 5 incorporates improvements in many areas: better data compression,
> separation of debugging data from executable files, improved description of
> macros and source files, faster searching for symbols, improved debugging
> optimized code, as well as numerous improvements in functionality and
> performance.

On platforms where DWARF version 5 is supported (Linux, primarily), this commit
adds support for it behind a new `-Z dwarf-version=5` flag.

[1]: https://dwarfstd.org/Public_Review.php
The deriving code has inconsistent terminology to describe args.

In some places it distinguishes between:
- the `&self` arg (if present), versus
- all other args.

In other places it distinguishes between:
- the `&self` arg (if present) and any other arguments with the same
  type (in practice there is at most one, e.g. in `PartialEq::eq`),
  versus
- all other args.

The terms "self_args" and "nonself_args" are sometimes used for the
former distinction, and sometimes for the latter. "args" is also
sometimes used for "all other args".

This commit makes the code consistently uses "self_args"/"nonself_args"
for the former and "selflike_args"/"nonselflike_args" for the latter.
This change makes the code easier to read.

The commit also adds a panic on an impossible path (the `Self_` case) in
`extract_arg_details`.
Use `self_exprs` and `other_selflike_exprs` in a manner similar to the
previous commit.
It's unused. This also removes the need for the lifetime on `FieldInfo`,
which is nice.
The deriving code has some complex parts involving iterations over
selflike args and also fields within structs and enum variants.

The return types for a few functions demonstrate this:

- `TraitDef::create_{struct_pattern,enum_variant_pattern}` returns a
  `(P<ast::Pat>, Vec<(Span, Option<Ident>, P<Expr>)>)`
- `TraitDef::create_struct_field_accesses` returns a `Vec<(Span,
  Option<Ident>, P<Expr>)>`.

This results in per-field data stored within per-selflike-arg data, with
lots of repetition within the per-field data elements. This then has to
be "transposed" in two places (`expand_struct_method_body` and
`expand_enum_method_body`) into per-self-like-arg data stored within
per-field data. It's all quite clumsy and confusing.

This commit rearranges things greatly. Data is obtained in the needed
form up-front, avoiding the need for transposition. Also, various
functions are split, removed, and added, to make things clearer and
avoid tuple return values.

The diff is hard to read, which reflects the messiness of the original
code -- there wasn't an easy way to break these changes into small
pieces. (Sorry!) It's a net reduction of 35 lines and a readability
improvement. The generated code is unchanged.
When deriving functions for zero-variant enums, we just generated a
function body that calls `std::instrincs::unreachable`. There is a large
comment with some not-very-useful historical discussion about
alternatives, including some discussion of feature-gating zero-variant
enums, which is clearly irrelevant today.

This commit cuts the comment down greatly.
This makes `cs_cmp`, `cs_partial_cmp`, and `cs_op` (for `PartialEq`)
more similar. It also fixes some out of date comments.
`cs_fold` has four distinct cases, covered by three different function
arguments:

- first field
- combine current field with previous results
- no fields
- non-matching enum variants

This commit clarifies things by replacing the three function arguments
with one that takes a new `CsFold` type with four slightly different)
cases

- single field
- combine result for current field with results for previous fields
- no fields
- non-matching enum variants

This makes the code shorter and clearer.
Implement support for DWARF version 5.

DWARF version 5 brings a number of improvements over version 4. Quoting from
the announcement [1]:

> Version 5 incorporates improvements in many areas: better data compression,
> separation of debugging data from executable files, improved description of
> macros and source files, faster searching for symbols, improved debugging
> optimized code, as well as numerous improvements in functionality and
> performance.

On platforms where DWARF version 5 is supported (Linux, primarily), this commit
adds support for it behind a new `-Z dwarf-version=5` flag.

[1]: https://dwarfstd.org/Public_Review.php

r? `@michaelwoerister`
core::any: replace some generic types with impl Trait

This gives a cleaner API since the caller only specifies the concrete type they usually want to.

r? `@yaahc`
…r=Mark-Simulacrum

Clarify deriving code

A number of clarifications to the deriving code.

r? `@Mark-Simulacrum`
Collapse some weirdly-wrapping derives

self-explanatory
…fJung

Update integer_atomics tracking issue

Updates rust-lang#32976.
Updates rust-lang#99069.

r? `@RalfJung`
@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 Jul 9, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 9, 2022

📌 Commit 6816a8d has been approved by Dylan-DPC

It is now in the queue for this repository.

@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 Jul 9, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rand v0.7.3
    Checking alloc v0.0.0 (/checkout/library/alloc)
    Checking core v0.0.0 (/checkout/library/core)
    Checking std v0.0.0 (/checkout/library/std)
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
145 |             .provide_value::<String, _>(|| "bye".to_owned());
    |              ^^^^^^^^^^^^^           - help: remove this generic argument
    |              expected 1 generic argument
    |
    |
note: associated function defined here, with 1 generic parameter: `T`
    |
    |
901 |     pub fn provide_value<T>(&mut self, fulfil: impl FnOnce() -> T) -> &mut Self
    |            ^^^^^^^^^^^^^ -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
185 |         request_ref::<T, _>(self)
    |         ^^^^^^^^^^^      - help: remove this generic argument
    |         expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
847 | pub fn request_ref<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<&'a T>
    |        ^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
154 |     assert_eq!(&**request_ref::<String, _>(obj).unwrap(), "hello");
    |                   ^^^^^^^^^^^           - help: remove this generic argument
    |                   expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
847 | pub fn request_ref<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<&'a T>
    |        ^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
155 |     assert_eq!(&*request_value::<String, _>(obj).unwrap(), "bye");
    |                  ^^^^^^^^^^^^^           - help: remove this generic argument
    |                  expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
156 |     assert_eq!(request_value::<u8, _>(obj), None);
    |                ^^^^^^^^^^^^^       - help: remove this generic argument
    |                expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
164 |     assert_eq!(&**request_ref::<String, _>(&*obj).unwrap(), "hello");
    |                   ^^^^^^^^^^^           - help: remove this generic argument
    |                   expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
847 | pub fn request_ref<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<&'a T>
    |        ^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
165 |     assert_eq!(&*request_value::<String, _>(&*obj).unwrap(), "bye");
    |                  ^^^^^^^^^^^^^           - help: remove this generic argument
    |                  expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
166 |     assert_eq!(request_value::<u8, _>(&*obj), None);
    |                ^^^^^^^^^^^^^       - help: remove this generic argument
    |                expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
174 |     assert_eq!(&**request_ref::<String, _>(&obj).unwrap(), "hello");
    |                   ^^^^^^^^^^^           - help: remove this generic argument
    |                   expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
847 | pub fn request_ref<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<&'a T>
    |        ^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
175 |     assert_eq!(&*request_value::<String, _>(&obj).unwrap(), "bye");
    |                  ^^^^^^^^^^^^^           - help: remove this generic argument
    |                  expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument

error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
    |
    |
176 |     assert_eq!(request_value::<u8, _>(&obj), None);
    |                ^^^^^^^^^^^^^       - help: remove this generic argument
    |                expected 1 generic argument
    |
    |
note: function defined here, with 1 generic parameter: `T`
    |
    |
825 | pub fn request_value<'a, T>(provider: &'a (impl Provider + ?Sized)) -> Option<T>
    |        ^^^^^^^^^^^^^     -
    = note: `impl Trait` cannot be explicitly specified as a generic argument
For more information about this error, try `rustc --explain E0107`.
error: could not compile `core` due to 11 previous errors
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:01:35

@Dylan-DPC
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 9, 2022
@Dylan-DPC Dylan-DPC closed this Jul 9, 2022
@Dylan-DPC Dylan-DPC deleted the rollup-8hfgaum branch July 9, 2022 05:57
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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.