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 5 pull requests #99948

Merged
merged 14 commits into from
Jul 30, 2022
Merged

Rollup of 5 pull requests #99948

merged 14 commits into from
Jul 30, 2022

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

WaffleLapkin and others added 14 commits July 28, 2022 17:29
This also fixes the argument names in `report_closure_arg_mismatch`
(confusing expected/found)
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
…, r=cjgillot

change maybe_body_owned_by to take local def id

Issue rust-lang#96341
r? `@cjgillot`
…ompiler-errors

Improve type mismatch w/ function signatures

This PR makes use of `note: expected/found` (instead of labeling types in labels) in type mismatch with function signatures. Pros: it's easier to compare the signatures, cons: the error is a little more verbose now.

This is especially nice when
- The signatures differ in a small subset of parameters (same parameters are elided)
- The difference is in details, for example `isize` vs `usize` (there is a better chance that the types align)

Also this PR fixes the inconsistency in variable names in the edited code (`expected` and `found`).

A zulip thread from which this pr started: [[link]](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Type.20error.20regression.3F.2E.2E.2E/near/289756602).

An example diagnostic:

<table>
<tr>
<th>this pr</th>
<th>nightly</th>
</tr>
<tr>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected due to this
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature defined here
   |
   = note: expected function signature `fn(usize, _, Vec<u64>) -> _`
              found function signature `fn(isize, _, Vec<u32>) -> _`
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast from `fn(isize, u8, Vec<u32>) {f}` to the object type `dyn Trait`
```

</td>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected signature of `fn(usize, u8, Vec<u64>) -> _`
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature of `fn(isize, u8, Vec<u32>) -> _`
   |
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast to the object type `dyn Trait`
```

</td>
</tr>
</table>

<details><summary>code</summary>
<p>

```rust
fn main() {
    fn expect(_: &dyn Trait) {}

    expect(&f);
}

trait Trait {}
impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}

fn f(_: isize, _: u8, _: Vec<u32>) {}
```

</p>
</details>

r? `@compiler-errors`
…t-cast, r=davidtwco

don't call type ascription "cast"

Noticed in rust-lang#99885
Add diagnostic when using public instead of pub

Forwarding from rust-lang#99706

I accidentally broke something(??) in git and the commits in that PR are absolutely not what I did in that branch

Anyways, this is the PR for this now. Adding tests again in a minute.

cc `@davidtwco`
@rustbot rustbot added T-compiler Relevant to the compiler 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 Jul 30, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 30, 2022

📌 Commit df2cf97 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 30, 2022
@bors
Copy link
Contributor

bors commented Jul 30, 2022

⌛ Testing commit df2cf97 with merge 038f9e6...

@bors
Copy link
Contributor

bors commented Jul 30, 2022

☀️ Test successful - checks-actions
Approved by: Dylan-DPC
Pushing 038f9e6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 30, 2022
@bors bors merged commit 038f9e6 into rust-lang:master Jul 30, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 30, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (038f9e6): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
0.3% 0.3% 4
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-3.0% -3.0% 1
Improvements 🎉
(secondary)
-9.6% -9.6% 1
All 😿🎉 (primary) -3.0% -3.0% 1

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 11, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#99311 (change maybe_body_owned_by to take local def id)
 - rust-lang#99862 (Improve type mismatch w/ function signatures)
 - rust-lang#99895 (don't call type ascription "cast")
 - rust-lang#99900 (remove some manual hash stable impls)
 - rust-lang#99903 (Add diagnostic when using public instead of pub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
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. T-compiler Relevant to the compiler 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants