Commit Graph

269370 Commits

Author SHA1 Message Date
bors
5f5c243ca0 Auto merge of #132215 - onur-ozkan:bootstrap-git, r=Kobzol
simplify force-recompile logic for "library"

It’s kind of self-explanatory when looking at it commit by commit.
2024-10-27 13:03:40 +00:00
bors
9fa0146c4a Auto merge of #132191 - Urgau:midpoint_signed_towards_zero, r=dtolnay
Round negative signed integer towards zero in `iN::midpoint`

This PR changes the implementation of `iN::midpoint` (the signed variants) to round negative signed integers **towards zero** *instead* of negative infinity as is currently the case.

This is done so that the obvious expectations[^1] of `midpoint(a, b) == midpoint(b, a)` and `midpoint(-a, -b) == -midpoint(a, b)` are true, which makes the even more obvious implementation `(a + b) / 2` always true.

The unsigned variants `uN::midpoint` (which are being [FCP-ed](https://github.com/rust-lang/rust/pull/131784#issuecomment-2417188117)) already rounds towards zero, so there is no consistency issue.

cc `@scottmcm`
r? `@dtolnay`

[^1]: https://github.com/rust-lang/rust/issues/110840#issuecomment-2336753931
2024-10-27 10:42:36 +00:00
bors
e454c45f13 Auto merge of #132091 - Zalathar:graph-loops, r=saethlin
coverage: Don't rely on the custom traversal to find enclosing loops

This opens up the possibility of modifying or removing the custom graph traversal used in coverage counter creation, without losing access to the heuristics that care about a node's enclosing loops.

Actually changing the traversal is left for future work, because this PR on its own doesn't change the emitted coverage mappings at all.
2024-10-27 08:19:16 +00:00
bors
de7cef75be Auto merge of #132213 - workingjubilee:rollup-tg1g3l5, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #132123 (allow type-based search on foreign functions)
 - #132183 (Fix code HTML items making big blocks if too long)
 - #132192 (expand: Stop using artificial `ast::Item` for macros loaded from metadata)
 - #132205 (docs: Correctly link riscv32e from platform-support.md)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-27 05:56:58 +00:00
onur-ozkan
74bfa661a5 simplify force-recompile logic for "library"
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-27 08:55:52 +03:00
onur-ozkan
a8261333e1 don't use absolute paths on git(Some(self.src))
It will run at the project root, so resolving absolute/top-level paths
is unnecessary.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-27 08:38:20 +03:00
Jubilee
b61d3f6f93
Rollup merge of #132205 - workingjubilee:rv32e-platform-docs-mislinked, r=tgross35
docs: Correctly link riscv32e from platform-support.md

Correctly link the riscv32e platform support page.

Just a mistake during the iteration of https://github.com/rust-lang/rust/pull/130555 that was missed in review. Presumably the rv32e-none and rv32i-none pages eventually should get merged, but this is a relatively recent addition to the ISA definition so it is not clear the current RISCV Embedded group has the expertise on-hand... nor did it have their consent.
2024-10-26 21:58:40 -07:00
Jubilee
b3ac6d339c
Rollup merge of #132192 - petrochenkov:macfa, r=compiler-errors
expand: Stop using artificial `ast::Item` for macros loaded from metadata

You don't need a full `Item` for that, and not using a piece of AST helps with https://github.com/rust-lang/rust/pull/131808.
2024-10-26 21:58:40 -07:00
Jubilee
b80593995d
Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddle
Fix code HTML items making big blocks if too long

Encountered this bug randomly where `code` item in docblocks would look like this:

![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e)

With this fix it looks like this:

![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365)

r? ``@notriddle``
2024-10-26 21:58:39 -07:00
Jubilee
05f784c955
Rollup merge of #132123 - lolbinarycat:rustdoc-search-foreign-func, r=notriddle
allow type-based search on foreign functions

fixes https://github.com/rust-lang/rust/issues/131804

preferably will be merged after #129708, but that may take a while to be approved due to being a new feature, whereas this is definitely a bug, and should be fixed.
2024-10-26 21:58:39 -07:00
bors
be33e4f3d6 Auto merge of #132167 - Zalathar:llvm-wrappers, r=jieyouxu
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.
2024-10-27 03:24:54 +00:00
bors
f7cf41c973 Auto merge of #131900 - mrkajetanp:target-feature-pauth-lr, r=Amanieu
rustc_target: Add pauth-lr aarch64 target feature

Add the pauth-lr target feature, corresponding to aarch64 FEAT_PAuth_LR. This feature has been added in LLVM 19.
It is currently not supported by the Linux hwcap and so we cannot add runtime feature detection for it at this time.

r? `@Amanieu`
2024-10-27 00:09:49 +00:00
Zalathar
d976ca8701 Use LLVM-C APIs for getting/setting visibility 2024-10-27 11:05:33 +11:00
Jubilee Young
2ebb8ecbc4 docs: Correctly link riscv32e from platform-support.md 2024-10-26 15:02:42 -07:00
bors
4dce9138d7 Auto merge of #131715 - tgross35:add-const_sockaddr_setters, r=Amanieu
Add an unstable `const_sockaddr_setters` feature

Unstably add `const` to the `sockaddr_setters` methods. Included API:

```rust
// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
}
```

Tracking issue: <https://github.com/rust-lang/rust/issues/131714>
2024-10-26 21:47:35 +00:00
Urgau
74b9de4af2 Add test for all midpoint expectations 2024-10-26 22:08:34 +02:00
Vadim Petrochenkov
b93a2dd0ef expand: Stop using artificial ast::Item for macros loaded from metadata 2024-10-26 22:08:55 +03:00
bors
9b18a122f7 Auto merge of #132190 - matthiaskrgr:rollup-rsocfiz, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #131875 (Add WASM | WASI | Emscripten groups to triagebot.toml)
 - #132019 (Document `PartialEq` impl for `OnceLock`)
 - #132182 (Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to `allow`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-26 19:00:57 +00:00
Guillaume Gomez
88f4425dd2 Update GUI test 2024-10-26 20:40:59 +02:00
Urgau
00444bab26 Round negative signed integer towards zero in iN::midpoint
Instead of towards negative infinity as is currently the case.

This done so that the obvious expectations of
`midpoint(a, b) == midpoint(b, a)` and
`midpoint(-a, -b) == -midpoint(a, b)` are true, which makes the even
more obvious implementation `(a + b) / 2` true.

https://github.com/rust-lang/rust/issues/110840#issuecomment-2336753931
2024-10-26 18:46:41 +02:00
Matthias Krüger
5dd60103fa
Rollup merge of #132182 - jieyouxu:downgrade-untranslatable, r=compiler-errors
Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to `allow`

Current implementation of translatable diagnostics infrastructure unfortunately causes some friction for compiler contributors. While we don't have a redesign that causes less friction in place, let's downgrade the internal `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints so we don't indicate to contributors that they *have* to use the current translation infra.

I purposefully left `#[allow(untranslatable_diagnostic)]` and `#[allow(diagnostic_outside_of_impl)]` instances untouched because that seems like unnecessary additional churn.

See <https://github.com/rust-lang/rust/issues/132181> for context.

r? `@davidtwco` (or wg-diagnostics/compiler)
2024-10-26 18:45:34 +02:00
Matthias Krüger
1f6cb859ee
Rollup merge of #132019 - daboross:document-partialeq-oncelock, r=Mark-Simulacrum
Document `PartialEq` impl for `OnceLock`

Adds documentation to `std::sync::OnceLock`'s `PartialEq` implementation: specifies publicly that `OnceLock`s are compared based on their contents, and nothing else.

Created in response to, but not directly related to, https://github.com/rust-lang/rust/issues/131959.

## ne

This doesn't create and document `PartialEq::ne`. There's precedent for this in [`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html#impl-PartialEq-for-RefCell%3CT%3E).
2024-10-26 18:45:33 +02:00
Matthias Krüger
13ec1b0c97
Rollup merge of #131875 - juntyr:wasm-notification-groups-triage, r=Mark-Simulacrum
Add WASM | WASI | Emscripten groups to triagebot.toml

Tracking issue: https://github.com/rust-lang/compiler-team/issues/799

~~This is blocked on amending the notification group section so that the instructions links point somewhere: https://github.com/rust-lang/rustc-dev-guide/pull/2100~~
2024-10-26 18:45:33 +02:00
bors
4d88de2acd Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillot
(Big performance change) Do not run lints that cannot emit

Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had `#![allow]`ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!)

So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either:
- Manually `#![allow]`ed in the whole crate,
- Allowed in the command line, or
- Not manually enabled with `#[warn]` or similar, and its default level is `Allow`

As some lints **need** to run, this PR also adds **loadbearing lints**. On a lint declaration, you can use the ``@eval_always` = true` marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run)

Fixes #106983
2024-10-26 16:37:43 +00:00
Jieyou Xu
5f4739157a Downgrade untranslatable_diagnostic and diagnostic_outside_of_impl to allow
See <https://github.com/rust-lang/rust/issues/132181> for more context.
2024-10-26 14:11:59 +00:00
bors
9260be36b2 Auto merge of #132184 - jieyouxu:rollup-81ht12w, r=jieyouxu
Rollup of 5 pull requests

Successful merges:

 - #132124 (coverage: Consolidate creation of covmap/covfun records)
 - #132140 (Enable LSX feature for LoongArch Linux targets)
 - #132169 (Deny calls to non-`#[const_trait]` methods in MIR constck)
 - #132174 (x86 target features: make pclmulqdq imply sse2)
 - #132180 (Print unsafety of attribute in AST pretty print)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-26 14:08:18 +00:00
许杰友 Jieyou Xu (Joe)
50e78b8b3c
Rollup merge of #132180 - Urgau:ast_pretty-unsafe-attr, r=compiler-errors
Print unsafety of attribute in AST pretty print

This PR fixes the AST pretty print, which was missing the unsafety for unsafe attributes.

Related to https://github.com/rust-lang/rust/pull/131558#discussion_r1807736204
2024-10-26 22:01:14 +08:00
许杰友 Jieyou Xu (Joe)
656a2ec0bd
Rollup merge of #132174 - RalfJung:pclmulqdq, r=calebzulawski
x86 target features: make pclmulqdq imply sse2

Based on comments in https://github.com/rust-lang/stdarch/issues/1661

Fixes https://github.com/rust-lang/stdarch/issues/1661
2024-10-26 22:01:13 +08:00
许杰友 Jieyou Xu (Joe)
bafe790a2d
Rollup merge of #132169 - fee1-dead-contrib:consttraitsck, r=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.

45089ec19e/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 https://github.com/rust-lang/project-const-traits/issues/12.
2024-10-26 22:01:13 +08:00
许杰友 Jieyou Xu (Joe)
7981acaf7e
Rollup merge of #132140 - heiher:loong-lsx, r=Urgau
Enable LSX feature for LoongArch Linux targets

Enable 128-bit vector (LSX) feature for `loongarch64-unknown-linux-{gnu, musl}` targets.

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
2024-10-26 22:01:12 +08:00
许杰友 Jieyou Xu (Joe)
c26280a8ba
Rollup merge of #132124 - Zalathar:consolidate-covstar, r=jieyouxu
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).
2024-10-26 22:01:12 +08:00
Guillaume Gomez
ae66380da0 Add GUI regression test for code in doc blocks 2024-10-26 15:45:17 +02:00
Guillaume Gomez
dd3dc103fc Fix code HTML items making big blocks if too long 2024-10-26 15:45:05 +02:00
bors
17f8215394 Auto merge of #131527 - ZuseZ4:enable-llvm-offload-runtime, r=Kobzol
Enable the llvm offload build configuration

Tracking:

- https://github.com/rust-lang/rust/issues/131513
2024-10-26 11:44:57 +00:00
Urgau
f5b6f938ce Print unsafety of attribute in AST unpretty 2024-10-26 13:33:36 +02:00
Urgau
f249fdd962 Add AST unpretty test for unsafe attribute 2024-10-26 13:31:24 +02:00
Zalathar
96993a9b5e Use LLVM-C APIs for getting/setting linkage 2024-10-26 20:20:20 +11:00
Zalathar
ec41e6d1b0 Add a wrapper type for raw enum values returned by LLVM 2024-10-26 20:20:20 +11:00
Zalathar
b114040afb Use safe wrappers get_visibility and set_visibility 2024-10-26 20:20:20 +11:00
Zalathar
983d258be3 Use safe wrappers get_linkage and set_linkage 2024-10-26 20:20:18 +11:00
Zalathar
144a12acdd Add a macro that derives TryFrom<u32> for fieldless enums 2024-10-26 20:19:53 +11:00
Ralf Jung
867640e24d x86 target features: make pclmulqdq imply sse2 2024-10-26 09:48:39 +02:00
bors
80d0d927d5 Auto merge of #132171 - matthiaskrgr:rollup-tp75ge7, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #132114 (Use `Enabled{Lang,Lib}Feature`  instead of n-tuples)
 - #132163 (Update Fuchsia CI script for package serving)
 - #132168 (Effects cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-26 06:53:53 +00:00
Zalathar
0d653a5866 coverage: Add links to LLVM docs for the coverage mapping format 2024-10-26 17:37:04 +11:00
Matthias Krüger
56463df1be
Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors
Effects cleanup

- removed extra bits from predicates queries that are no longer needed in the new system
- removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers

r? compiler-errors
2024-10-26 06:29:48 +02:00
Matthias Krüger
42a0e40e46
Rollup merge of #132163 - claywilkinson:master, r=tmandry
Update Fuchsia CI script for package serving

This updates the "start" and "stop" methods
of the test runner to use the standalone package
server.

r? `@tmandry`
2024-10-26 06:29:47 +02:00
Matthias Krüger
8207d89b5e
Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead
Use `Enabled{Lang,Lib}Feature`  instead of n-tuples

Instead of passing around e.g. `(gate_name, attr_span, stable_since)` 3-tuples for enabled lang features or `(gate_name, attr_span)` 2-tuples for enabled lib features, use `Enabled{Lang,Lib}Feature` structs with named fields.

Also did some minor code-golfing of involved iterator chains to hopefully make them easier to follow.

Follow-up to https://github.com/rust-lang/rust/pull/132098#issuecomment-2434523431 cc `@RalfJung.`
2024-10-26 06:29:47 +02:00
bors
ae4c6b6640 Auto merge of #132152 - lqd:revert-127731, r=compiler-errors
Revert #127731 "Emit error when calling/declaring functions with unavailable …"

This reverts #127731 due to the unexpected [perf regressions](https://github.com/rust-lang/rust/pull/127731#issuecomment-2438687094) and to give time to mitigate the regressions before re-landing it.

r? `@RalfJung` cc `@veluca93`
2024-10-26 04:24:31 +00:00
Deadbeef
f2f67232a5 Deny calls to non-#[const_trait] methods in MIR constck 2024-10-26 11:35:56 +08:00
Deadbeef
f6fea83342 Effects cleanup
- removed extra bits from predicates queries that are no longer needed in the new system
- removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-26 10:19:07 +08:00