Commit Graph

269686 Commits

Author SHA1 Message Date
Lukas Markeffsky
8a9f40043f add test for panicking drop in Box/Rc/Arc 2024-10-27 18:32:36 +01:00
Chayim Refael Friedman
709805a5fd Properly resolve prelude paths inside modules inside blocks
I.e. the following situation:
```
fn foo() {
    mod bar {
        fn qux() {
            // Prelude path here (e.g. macro use prelude or extern prelude).
        }
    }
}
```
Those were previously unresolved, because, in order to support `self` and `super` properly, since #15148 we do not ascend block paths when there is a module in between, but only crate def maps register preludes, not block def maps, and we can't change this because block def map prelude can always be overridden by another block. E.g.
```
fn foo() {
    struct WithTheSameNameAsPreludeItem;
    {
        WithTheSameNameAsPreludeItem
    }
}
```
Here `WithTheSameNameAsPreludeItem` refer to the item from the top block, but if we would register prelude items in each block the child block would overwrite it incorrectly.
2024-10-27 19:23:12 +02:00
bors
81d6652e74 Auto merge of #131284 - dingxiangfei2009:rename-smart-ptr-to-coerce-referent, r=compiler-errors
Rename macro `SmartPointer` to `CoercePointee`

As per resolution #129104 we will rename the macro to better reflect the technical specification of the feature and clarify the communication.

- `SmartPointer` is renamed to `CoerceReferent`
- `#[pointee]` attribute is renamed to `#[referent]`
- `#![feature(derive_smart_pointer)]` gate is renamed to `#![feature(derive_coerce_referent)]`.
- Any mention of `SmartPointer` in the file names are renamed accordingly.

r? `@compiler-errors`

cc `@nikomatsakis` `@Darksonn`
2024-10-27 17:04:12 +00:00
David Carlier
4ccaef12a6 Revert "ci update freebsd version proposal, freebsd 12 being eol."
This reverts commit 1239c81c14.

Fix GH-132185 revert for now until early next year/FreeBSD 13.3
becomes EOL.
2024-10-27 16:20:14 +00:00
clubby789
9bb6e0789c Dynamically link run-make support 2024-10-27 14:56:35 +00:00
Shoyu Vanilla
0abb563bf1 fix: Allow public re-export of extern crate import 2024-10-27 23:44:44 +09:00
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
Eric Huss
924ded6b72 Clean up some comments on lint implementation 2024-10-27 04:30:51 -07:00
Lukas Wirth
14607bae1d
Merge pull request #18419 from ChayimFriedman2/leading-or
fix: Put leading `|` in patterns under `OrPat`
2024-10-27 11:25:16 +00:00
Chayim Refael Friedman
f50b201c86 Put leading | in patterns under OrPat
Previously it was one level above, and that caused problems with macros that expand to it, because macros expect to get only one top-level node.
2024-10-27 13:11:38 +02:00
Lukas Wirth
0d441c3b4f
Merge pull request #18410 from Veykril/veykril/push-lvwxpnowqrxk
internal: Invert token iteration order in macro mapping
2024-10-27 10:44:32 +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
Lukas Wirth
6c70806b31 Invert token iteration order in macro mapping 2024-10-27 11:32:12 +01:00
Guillaume Gomez
c50bfda34f Add GUI regression test for doc struct fields margins 2024-10-27 11:26:45 +01:00
Lukas Wirth
66a81d3764
Merge pull request #18418 from ChayimFriedman2/explicitly-disable
feat: Split `macro-error` diagnostic so users can ignore only parts of it
2024-10-27 09:37:56 +00:00
Lukas Wirth
59dd6422cc
Merge pull request #18417 from ChayimFriedman2/hash-string
fix: Correctly handle `#""` in edition <2024
2024-10-27 09:28:47 +00:00
Chayim Refael Friedman
e970e07e10 Support cfg(true) and cfg(false)
As per RFC 3695.
2024-10-27 10:46:49 +02: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
León Orell Valerian Liehr
442f39582d
Move an impl-Trait check from AST validation to AST lowering 2024-10-27 07:41:52 +01: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
Asuna
42fbaf1ddd Add a new trait proc_macro::ToTokens 2024-10-27 03:17:05 +01:00
Chayim Refael Friedman
071bd3c360 Split macro-error diagnostic so users can ignore only parts of it
Split it into `macro-error`, `proc-macros-disabled` and `proc-macro-disabled`.
2024-10-27 02:24:15 +02: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
Chayim Refael Friedman
d6b26588a7 Correctly handle #"" in edition <2024 2024-10-27 00:47:13 +03:00
Mark Rousskov
c1a08f9763 Make clearer that guarantees in ABI compatibility are for Rust only 2024-10-26 17:32:50 -04:00
Michael Goulet
bd95695b94 Pass constness with span into lower_poly_trait_ref 2024-10-26 20:54:38 +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
Michael Goulet
6ab87f8238 Collect item bounds for RPITITs from trait where clauses just like associated types 2024-10-26 17:38:08 +00: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
Oli Scherer
ca0e5df0a6
Merge pull request #3995 from RalfJung/readdir_r
fix error returned from readdir_r when isolation is enabled, and uses of raw_os_error
2024-10-26 16:01:50 +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