Commit Graph

300570 Commits

Author SHA1 Message Date
Samuel Tardieu
ebdbd7cfc0 doc_nested_refdefs: do not falsely report checkboxes as refdefs (#15146)
changelog: [`doc_nested_refdefs`]: fix false positive where [task
lists](http://pulldown-cmark.github.io/pulldown-cmark/third_party/gfm_tasklist.html)
are reported as refdefs
2025-07-01 22:31:15 +00:00
Antoni Boucher
1d2b874b84 Remove OVERWRITE_TARGET_TRIPLE env var now that config.sh is gone 2025-07-01 18:29:17 -04:00
Samuel Tardieu
fc3d5e6827 Remove unneeded .as_bytes()
`&str` already implements `AsRef<[u8]>`
2025-07-02 00:25:37 +02:00
bors
a51c494d20 Auto merge of #143036 - compiler-errors:no-dyn-star, r=oli-obk
Remove support for `dyn*` from the compiler

This PR removes support for `dyn*` (https://github.com/rust-lang/rust/issues/102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait).

It doesn't seem like we are going to need `dyn*` types -- even in an not-exposed-to-the-user way[^1] -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose of `dyn*` types, I don't really see a compelling reason to have to maintain their implementation in the compiler.

[^1]: Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like `async {}`.

We've learned quite a lot from `dyn*`, but I think at this point its current behavior leads to more questions than answers. For example, `dyn*` support today remains somewhat fragile; it ICEs in many cases where the current "normal" `dyn Trait` types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below.

```rust
#![feature(dyn_star)]

trait Foo {
    fn hello(self);
}

impl Foo for usize {
    fn hello(self) {
        println!("hello, world");
    }
}

fn main() {
    let x: dyn* Foo = 1usize;
    x.hello();
}
```

And:

```rust
#![feature(dyn_star)]

trait Trait {
    type Out where Self: Sized;
}

fn main() {
    let x: <dyn* Trait as Trait>::Out;
}
```

...and probably many more problems having to do with the intersection of dyn-compatibility and `Self: Sized` bounds that I was too lazy to look into like:
* GATs
* Methods with invalid signatures
* Associated consts

Generally, `dyn*` types also end up getting in the way of working with [normal `dyn` types](https://github.com/rust-lang/rust/issues/102425#issuecomment-1712604409) to an extent that IMO outweighs the benefit of experimentation.

I recognize that there are probably other, more creative usages of `dyn*` that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions between `dyn*` and dyn-compatibility before we think about reimplementing them in the type system.

---

I'm planning on removing the `DynKind` enum and the `PointerLike` built-in trait from the compiler after this PR lands.

Closes rust-lang/rust#102425.

cc `@eholk` `@rust-lang/lang` `@rust-lang/types`

Closes rust-lang/rust#116979.
Closes rust-lang/rust#119694.
Closes rust-lang/rust#134591.
Closes rust-lang/rust#104800.
2025-07-01 21:50:21 +00:00
bors
085c24790e Auto merge of #143036 - compiler-errors:no-dyn-star, r=oli-obk
Remove support for `dyn*` from the compiler

This PR removes support for `dyn*` (https://github.com/rust-lang/rust/issues/102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait).

It doesn't seem like we are going to need `dyn*` types -- even in an not-exposed-to-the-user way[^1] -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose of `dyn*` types, I don't really see a compelling reason to have to maintain their implementation in the compiler.

[^1]: Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like `async {}`.

We've learned quite a lot from `dyn*`, but I think at this point its current behavior leads to more questions than answers. For example, `dyn*` support today remains somewhat fragile; it ICEs in many cases where the current "normal" `dyn Trait` types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below.

```rust
#![feature(dyn_star)]

trait Foo {
    fn hello(self);
}

impl Foo for usize {
    fn hello(self) {
        println!("hello, world");
    }
}

fn main() {
    let x: dyn* Foo = 1usize;
    x.hello();
}
```

And:

```rust
#![feature(dyn_star)]

trait Trait {
    type Out where Self: Sized;
}

fn main() {
    let x: <dyn* Trait as Trait>::Out;
}
```

...and probably many more problems having to do with the intersection of dyn-compatibility and `Self: Sized` bounds that I was too lazy to look into like:
* GATs
* Methods with invalid signatures
* Associated consts

Generally, `dyn*` types also end up getting in the way of working with [normal `dyn` types](https://github.com/rust-lang/rust/issues/102425#issuecomment-1712604409) to an extent that IMO outweighs the benefit of experimentation.

I recognize that there are probably other, more creative usages of `dyn*` that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions between `dyn*` and dyn-compatibility before we think about reimplementing them in the type system.

---

I'm planning on removing the `DynKind` enum and the `PointerLike` built-in trait from the compiler after this PR lands.

Closes rust-lang/rust#102425.

cc `@eholk` `@rust-lang/lang` `@rust-lang/types`

Closes rust-lang/rust#116979.
Closes rust-lang/rust#119694.
Closes rust-lang/rust#134591.
Closes rust-lang/rust#104800.
2025-07-01 21:50:21 +00:00
Esteban Küber
bb74f47327 Do not suggest borrow that is already there in fully-qualified call
When encountering `&str::from("value")` do not suggest `&&str::from("value")`.

Fix #132041.
2025-07-01 21:49:56 +00:00
Pavel Grigorenko
8bb7fdb236 NoArgsAttributeParser: use an assoc const instead 2025-07-02 00:21:12 +03:00
Chris Denton
62949cd2d6 Rename mingw-* CI jobs to pr-* 2025-07-01 20:25:56 +00:00
Samuel Tardieu
ad15b60022 Fix std-instead-of-core FP when not all items come from the new crate (#15165)
Closes rust-lang/rust-clippy#15143

Covering edge cases missed in rust-lang/rust-clippy#15016

changelog: [`std-instead-of-core`] fix FP when not all items come from
the new crate
2025-07-01 19:06:03 +00:00
Michael Goulet
eeaa63f39a Remove support for dyn* 2025-07-01 19:00:21 +00:00
Michael Goulet
2516c33982 Remove support for dyn* 2025-07-01 19:00:21 +00:00
Kivooeo
1fb5e0149f moved tests 2025-07-01 23:33:59 +05:00
bors
71e4c005ca Auto merge of #143287 - GuillaumeGomez:rollup-fdjcti9, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#136801 (Implement `Random` for tuple)
 - rust-lang/rust#141867 (Describe Future invariants more precisely)
 - rust-lang/rust#142760 (docs(fs): Touch up grammar on lock api)
 - rust-lang/rust#143181 (Improve testing and error messages for malformed attributes)
 - rust-lang/rust#143210 (`tests/ui`: A New Order [19/N] )
 - rust-lang/rust#143212 (`tests/ui`: A New Order [20/N])
 - rust-lang/rust#143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious)
 - rust-lang/rust#143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …)
 - rust-lang/rust#143255 (Do not enable LLD by default in the dist profile)
 - rust-lang/rust#143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`)
 - rust-lang/rust#143269 (bootstrap: make comment more clear)
 - rust-lang/rust#143279 (Remove `ItemKind::descr` method)

Failed merges:

 - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-01 18:09:52 +00:00
Josh Stone
5b073e5ba6 Ignore float_minimum_maximum doctests on i586 2025-07-01 10:55:49 -07:00
Josh Stone
e851e3e16e Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
Ralf Jung
8797d54812 make Box::into_raw compatible with Stacked Borrows again 2025-07-01 19:54:38 +02:00
Josh Stone
a58050b753 Update STAGE0_MISSING_TARGETS 2025-07-01 10:54:33 -07:00
Josh Stone
47a3bf36bc Update stage0 to 1.89.0-beta.1 2025-07-01 10:54:33 -07:00
Josh Stone
9ce8930da6 Update version placeholders 2025-07-01 10:54:33 -07:00
Kivooeo
e9191ec57e moved tests 2025-07-01 21:42:20 +05:00
Amanieu d'Antras
15bd619d5f Change {Box,Arc,Rc,Weak}::into_raw to only work with A = Global
Also applies to `Vec::into_raw_parts`.

The expectation is that you can round-trip these methods with
`from_raw`, but this is only true when using the global allocator. With
custom allocators you should instead be using
`into_raw_with_allocator` and `from_raw_in`.

The implementation of `Box::leak` is changed to use
`Box::into_raw_with_allocator` and explicitly leak the allocator (which
was already the existing behavior). This is because, for `leak` to be
safe, the allocator must not free its underlying backing store. The
`Allocator` trait only guarantees that allocated memory remains valid
until the allocator is dropped.
2025-07-01 18:25:30 +02:00
Hayashi Mikihiro
6f1369b771 Migrate wrap_unwrap_cfg_attr assist to use SyntaxEditor
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-07-02 01:18:22 +09:00
Eric Huss
cda9bfef6f Fix x clean with a fifo
`x clean` was failing when it encountered a special file like a fifo
because it thought it was a directory.
2025-07-01 09:14:18 -07:00
Guillaume Gomez
189bfc1e63 Rollup merge of #143279 - GuillaumeGomez:rm-itemkind-descr, r=oli-obk
Remove `ItemKind::descr` method

Follow-up of rust-lang/rust#143234.

After this PR is merged, it will remain two `descr` methods:

 * `hir::GenericArg::descr`
 * `hir::AssocItemConstraintKind::descr`

For both these enums, I don't think there is the right equivalent in `hir::DefKind` so unless I missed something, we can't remove these two methods because we can't convert these enums into `hir::DefKind`.

r? `@oli-obk`
2025-07-01 17:47:06 +02:00
Guillaume Gomez
d2463c9a60 Rollup merge of #143269 - tshepang:patch-1, r=Kobzol
bootstrap: make comment more clear

Reading that at first made me think the code block ensures that the said artefacts are created
2025-07-01 17:47:06 +02:00
Guillaume Gomez
b47008a7c2 Rollup merge of #143262 - dianqk:non_exhaustive, r=oli-obk
mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`

Ensure they are always created using constructors.

r? oli-obk
2025-07-01 17:47:05 +02:00
Guillaume Gomez
8b0e7d7cc9 Rollup merge of #143255 - Kobzol:disable-lld-by-default, r=jieyouxu
Do not enable LLD by default in the dist profile

History of us building & shipping LLD for `dist` builds:
1) We used to unconditionally build & ship LLD in bootstrap
2) This was causing problems for people doing custom `dist` builds (https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)
3) https://github.com/rust-lang/rust/pull/126701 made shipping of LLD optional, but to preserve previous behavior, it forcefully enabled `rust.lld = true` in the `dist` profile by default, and overwrote the default to `false` on our CI for external LLVM builds.
    - This also didn't match the documentation of `rust.lld` in `bootstrap.example.toml`, which I previously missed.
4) However, since the external LLVM opt-out was only implemented for our CI, and not for all `dist` users, this started causing issues for people `dist`ing with external LLVM (https://github.com/rust-lang/rust/issues/143076). The problem is that the default shouldn't be "true", but "LLD is enabled when LLVM isn't external", but this is not possible to do only in TOML.

So this PR reverses the behavior. LLD is not enabled by default in `dist` anymore. We switch our CI to *opt into* disting LLD, unless an external LLVM is used. External `dist` users can still opt into enabling LLD, but if they do so while also using external LLVM, they will now get a [hard error](https://github.com/rust-lang/rust/pull/143175).

r? `@jieyouxu`

try-job: `x86_64-mingw*`
try-job: dist-x86_64-linux
2025-07-01 17:47:05 +02:00
Guillaume Gomez
61bb076459 Rollup merge of #143240 - JonathanBrouwer:object_lifetime_default_parser, r=oli-obk
Port `#[rustc_object_lifetime_default]` to the new attribute parsing …

Ports rustc_object_lifetime_default to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-01 17:47:04 +02:00
Guillaume Gomez
cb451cf4c9 Rollup merge of #143230 - jieyouxu:compiletest-maintenance-2, r=Kobzol
[COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious

This PR makes some compiletest errors/warnings/help more visually obvious. Note that this is only intended to help visually -- the error handling in compiletest is still a mess.

![Screenshot 2025-06-30 170010](https://github.com/user-attachments/assets/a56b7857-1926-48f8-a309-9e7fcf84df7f)

r? ghost
2025-07-01 17:47:03 +02:00
Guillaume Gomez
65942afb97 Rollup merge of #143212 - Kivooeo:tf20, r=tgross35
`tests/ui`: A New Order [20/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@tgross35`
2025-07-01 17:47:03 +02:00
Guillaume Gomez
ff0a5f5ad7 Rollup merge of #143210 - Kivooeo:tf19, r=tgross35
`tests/ui`: A New Order [19/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@tgross35`
2025-07-01 17:47:02 +02:00
Guillaume Gomez
1f881177b2 Rollup merge of #143181 - JonathanBrouwer:malformed-attrs, r=oli-obk
Improve testing and error messages for malformed attributes

This PR has been split into 5 commits for reviewability, I recommend reviewing them one-by-one.
This first commit introduces more tests, the other 4 commits fix 4 bugs discovered by the test.

r? `@oli-obk`
cc `@jdonszelmann`

Fixes https://github.com/rust-lang/rust/issues/143136
2025-07-01 17:47:01 +02:00
Guillaume Gomez
827cd29a4c Rollup merge of #142760 - epage:lock, r=tgross35
docs(fs): Touch up grammar on lock api
2025-07-01 17:47:01 +02:00
Guillaume Gomez
988710840b Rollup merge of #141867 - Diggsey:db-improve-future-docs, r=tgross35
Describe Future invariants more precisely
2025-07-01 17:47:00 +02:00
Guillaume Gomez
ad6503983d Rollup merge of #136801 - sorairolake:add-random-for-tuple, r=joshtriplett
Implement `Random` for tuple

Implement `Random` for tuples of arity 12 or less. Each element is expected to implement `Random`.

I think it's OK to implement this trait for the following types:

- Primitive integer types and `bool`
- Arrays and tuples of the above values
- ~~`NonZero<T>`~~, `Saturating<T>` and `Wrapping<T>`

The necessity of this trait is debated (<https://github.com/rust-lang/rust/issues/130703#issuecomment-2508889577>), but if we decide to keep it in the future when the `random` module is stabilized, I think it would be useful to have this trait implemented for tuples.

Tracking issue: #130703

r? `@joboet`
2025-07-01 17:46:59 +02:00
Guillaume Gomez
4793fd1c46 Update clippy source code to make use of TyCtxt::def_descr instead of ItemKind::descr 2025-07-01 17:27:48 +02:00
Guillaume Gomez
711c6166bc Update clippy source code to make use of TyCtxt::def_descr instead of ItemKind::descr 2025-07-01 17:27:48 +02:00
bors
4e97337005 Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errors
Start moving wf checking away from HIR

I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better.

I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks.

Especially b862d8828e is interesting here, because I think it improves spans in all cases
2025-07-01 14:59:58 +00:00
yanglsh
9eb8512255 fix: std-instead-of-core FP when not all items come from the new crate 2025-07-01 22:46:24 +08:00
Jonathan Brouwer
57a5e3b6d2 Fix duplicate errors for link_section, rustc_layout_scalar_valid_range_start and rustc_layout_scalar_valid_range_end 2025-07-01 16:40:47 +02:00
Jonathan Brouwer
1e474c2c6c Port #[rustc_object_lifetime_default] to the new attribute parsing infrastructure 2025-07-01 16:31:23 +02:00
Kivooeo
1549585f26 moved tests 2025-07-01 19:28:14 +05:00
Jonathan Brouwer
d22ce4c5eb Fix duplicate help on export_name and others
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer
0b67d14b31 Fix #[rustc_macro_transparency] giving two errors
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer
149bdde97e Fix #[must_use = 1] not giving an error
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:05 +02:00
Jonathan Brouwer
86b54d5729 Fix double error for export_name
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:02 +02:00
Jonathan Brouwer
0fcf295b64 New test for malformed attributes
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:02 +02:00
Folkert de Vries
8fdf0ef0ae loop match: handle opaque patterns
fixes issue 143203
2025-07-01 15:53:52 +02:00
Folkert de Vries
aa7cc5d2f4 loop match: run exhaustiveness check 2025-07-01 15:53:50 +02:00
Laurențiu Nicola
47687a4a64 Merge pull request #20136 from Hmikihiro/migrate-toggle_macro_delimiter
Migrate `toggle_macro_delimiter` Assist to use `SyntaxEditor`
2025-07-01 13:53:02 +00:00