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 4 pull requests #132177

Closed
wants to merge 16 commits into from
Closed

Conversation

jieyouxu
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Zalathar and others added 16 commits October 25, 2024 12:42
There is no need for this code to be split across multiple functions in
multiple files.
In all the situations where this context is needed, it should always be
available.
Adding an extra `OnceCell` to `CrateCoverageContext` is much nicer than trying
to thread this string through multiple layers of function calls that already
have access to the context.
…eyouxu

coverage: Consolidate creation of covmap/covfun records

This code for creating covmap/covfun records during codegen was split across multiple functions and files for dubious historical reasons. Having it all in one place makes it easier to follow.

This PR also includes two semi-related cleanups:
- Getting the codegen context's `coverage_cx` state is made infallible, since it should always exist when running the code paths that need it.
- The value of `covfun_section_name` is saved in the codegen context, since it never changes at runtime, and the code that needs it has access to the context anyway.

---

Background: Coverage instrumentation generates two kinds of metadata that are embedded in the final binary. There is per-CGU information that goes in the `__llvm_covmap` linker section, and per-function information that goes in the `__llvm_covfun` section (except on Windows, where slightly different section names are used).
Replace some LLVMRust wrappers with calls to the LLVM C API

This PR removes the LLVMRust wrapper functions for getting/setting linkage and visibility, and replaces them with direct calls to the corresponding functions in LLVM's C API.

To make this convenient and sound, two pieces of supporting code have also been added:
- A simple proc-macro that derives `TryFrom<u32>` for fieldless enums
- A wrapper type for C enum values returned by LLVM functions, to ensure soundness if LLVM returns an enum value we don't know about

In a few places, the use of safe wrapper functions means that an `unsafe` block is no longer needed, so the affected code has changed its indentation level.
…=compiler-errors

Deny calls to non-`#[const_trait]` methods in MIR constck

This is a (potentially temporary) fix that closes off the mismatch in assumptions between MIR constck and typeck which does the const traits checking. Before this PR, MIR constck assumed that typeck correctly handled all calls to trait methods in const contexts if effects is enabled. That is not true because typeck only correctly handles callees that are const. For non-const callees (such as methods in a non-const_trait), typeck had never created an error.

https://github.com/rust-lang/rust/blob/45089ec19ebebec88bace6ec237244ff0eaa7ad3/compiler/rustc_hir_typeck/src/callee.rs#L876-L877

I called this potentially temporary because the const checks could be moved to HIR entirely. Alongside the recent refactor in const stability checks where that component could be placed would need more discussion. (cc ``@compiler-errors`` ``@RalfJung)``

Tests are updated, mainly due to traits not being const in core, so tests that call them correctly error.

This fixes rust-lang/project-const-traits#12.
x86 target features: make pclmulqdq imply sse2

Based on comments in rust-lang/stdarch#1661

Fixes rust-lang/stdarch#1661
@rustbot rustbot 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. rollup A PR which is a rollup labels Oct 26, 2024
@jieyouxu
Copy link
Member Author

@bors r+ rollup=never p=4

@bors
Copy link
Contributor

bors commented Oct 26, 2024

📌 Commit 4867569 has been approved by jieyouxu

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 Oct 26, 2024
@bors
Copy link
Contributor

bors commented Oct 26, 2024

⌛ Testing commit 4867569 with merge 87920ee...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 26, 2024
Rollup of 4 pull requests

Successful merges:

 - rust-lang#132124 (coverage: Consolidate creation of covmap/covfun records)
 - rust-lang#132167 (Replace some LLVMRust wrappers with calls to the LLVM C API)
 - rust-lang#132169 (Deny calls to non-`#[const_trait]` methods in MIR constck)
 - rust-lang#132174 (x86 target features: make pclmulqdq imply sse2)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job dist-arm-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] darling_core test:false 4.869
error: `gen` is a keyword in the 2024 edition
  --> compiler/rustc_macros/src/try_from.rs:43:9
   |
43 |         gen impl TryFrom<u32> for @Self {
   |         ^^^ help: you can use a raw identifier to stay compatible: `r#gen`
   = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024!
   = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
   = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
   = note: `-D keyword-idents-2024` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(keyword_idents_2024)]`
[RUSTC-TIMING] yoke test:false 0.263
[RUSTC-TIMING] unic_langid_impl test:false 0.436
[RUSTC-TIMING] hashbrown test:false 1.259
   Compiling indexmap v2.5.0

@bors
Copy link
Contributor

bors commented Oct 26, 2024

💔 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 Oct 26, 2024
@jieyouxu
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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 26, 2024
@jieyouxu jieyouxu closed this Oct 26, 2024
@jieyouxu jieyouxu deleted the rollup-3z4oi8c branch October 26, 2024 11:46
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants