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 #103832

Merged
merged 17 commits into from
Nov 1, 2022
Merged

Rollup of 6 pull requests #103832

merged 17 commits into from
Nov 1, 2022

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

zbyrn and others added 17 commits October 27, 2022 00:49
The new implementation doesn't use weak lang items and instead changes
`#[alloc_error_handler]` to an attribute macro just like
`#[global_allocator]`.

The attribute will generate the `__rg_oom` function which is called by
the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom`
function is defined in any crate then the compiler shim will call
`__rdl_oom` in the alloc crate which will simply panic.

This also fixes link errors with `-C link-dead-code` with
`default_alloc_error_handler`: `__rg_oom` was previously defined in the
alloc crate and would attempt to reference the `oom` lang item, even if
it didn't exist. This worked as long as `__rg_oom` was excluded from
linking since it was not called.

This is a prerequisite for the stabilization of
`default_alloc_error_handler` (rust-lang#102318).
…r, r=bjorn3

Rewrite implementation of `#[alloc_error_handler]`

The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`.

The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic.

This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called.

This is a prerequisite for the stabilization of `default_alloc_error_handler` (rust-lang#102318).
Remove bounds check when array is indexed by enum

As the title says, this reverts the behavior introduced with 1.64.

Fixes rust-lang#102303

r? `@oli-obk`
Fix E0433 No Typo Suggestions

Fixes rust-lang#48676
Fixes rust-lang#87791
Fixes rust-lang#96625
Fixes rust-lang#95462
Fixes rust-lang#101637
Follows up PR rust-lang#72923

Several open issues refer to the problem that E0433 does not suggest typos like other errors normally do. This fix augments the implementation of PR rust-lang#72923.

**Background**
When the path of a function call, e.g. `Struct::foo()`, involves names that cannot be resolved, there are two errors that could be emitted by the compiler:
 - If `Struct` is not found, it is ``E0433: failed to resolve: use of undeclared type `Struct` ``.
 - If `foo` is not found in `Struct`, it is ``E0599: no function or associated item named `foo` found for struct `Struct` in the current scope``

When a name is used as a type, `e.g. fn foo() -> Struct`, and the name cannot be resolved, it is ``E0412: cannot find type `Struct` in this scope``.

Before rust-lang#72923, `E0433` does not implement any suggestions, and the PR introduces suggestions for missing `use`s. When a resolution error occurs in the path of a function call, it tries to smart resolve just the type part of the path, e.g. `module::Struct` of a call to `module::Struct::foo()`. However, along with the suggestions, the smart-resolve function will report `E0412` since it only knows that it is a type that we cannot resolve instead of being a part of the path. So, the original implementation swap out `E0412` errors returned by the smart-resolve function with the real `E0433` error, but keeps the "missing `use`" suggestions to be reported to the programmer.

**Issue**
The current implementation only reports if there are "missing `use`" suggestions returned by the smart-resolve function; otherwise, it would fall back the normal reporting, which does not emit suggestions. But the smart-resolve function could also produce typo suggestions, which are omitted currently.

Also, it seems like that not all info has been swapped out when there are missing suggestions. The error message underlining the name in the snippet still says ``not found in this scope``, which is a `E0412` messages, if there are `use` suggestions, but says the normal `use of undeclared type` otherwise.

**Fixes**
This fix swaps out all fields in `Diagnostic` returned by the smart-resolve function except for `suggestions` with the current error, and merges the `suggestions` of the returned error and that of the current error together. If there are `use` suggestions, the error is saved to `use_injection` to be reported at the end; otherwise, the error is emitted immediately as `Resolver::report_error` does.

Some tests are updated to use the correct underlining error messages, and one additional test for typo suggestion is added to the test suite.

r? rust-lang/diagnostics
…i-obk

interpret: fix align_of_val on packed types

Fixes rust-lang/miri#2632

r? `@oli-obk`
Use `adt_def` during type collection.

This removes a wrapper which is close to what `adt_def` does.
Fix a typo in std::net mod doc comment

net-doc syntax
@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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. rollup A PR which is a rollup labels Nov 1, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Nov 1, 2022

📌 Commit 5d30bfc has been approved by Dylan-DPC

It is now in the queue for this repository.

@bors bors 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 Nov 1, 2022
@bors
Copy link
Contributor

bors commented Nov 1, 2022

⌛ Testing commit 5d30bfc with merge c493bae...

@bors
Copy link
Contributor

bors commented Nov 1, 2022

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 1, 2022
@bors bors merged commit c493bae into rust-lang:master Nov 1, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 1, 2022
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Perf Build Sha
#103809 963cce96f21fe6e3b32784291a033bd1d9fdaa90
#103759 d34fb6383fcf05b4fe10978201c972eee2b09971
#103729 6cc6135b2ddee657b84608afa648c33f3e5f913a
#103706 78a573e7711a6a509e265c7e1dd4f8551631ca5f
#103584 a9f146d8477060a43b0a21756c858b53c2f4d2a4
#103061 62a4e9bc803dfee1c97a25cd316ce8fde3bf42c3

previous master: dc05f60c1f

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c493bae): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.3% [0.4%, 2.2%] 2
Regressions ❌
(secondary)
0.6% [0.3%, 0.9%] 2
Improvements ✅
(primary)
-1.3% [-1.4%, -1.2%] 2
Improvements ✅
(secondary)
-1.9% [-3.9%, -0.3%] 14
All ❌✅ (primary) 0.0% [-1.4%, 2.2%] 4

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

@rustbot rustbot added the perf-regression Performance regression. label Nov 1, 2022
@nnethercote
Copy link
Contributor

cranelift-codegen, keccak, and deeply-nested-multi have been noisy lately, and that's almost all of the perf changes here. So it's probably neutral in reality.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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-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.