Commit Graph

272352 Commits

Author SHA1 Message Date
Matthias Krüger
5530869e0f
Rollup merge of #133804 - GuillaumeGomez:improve-code, r=notriddle
Improve code for FileName retrieval in rustdoc

Some calls were performed twice (first in `is_real_and_local` and then in the function calling it). Also the `FileName` was matched on a few times too.

r? `@notriddle`
2024-12-04 05:42:09 +01:00
Matthias Krüger
9fd0972677
Rollup merge of #133798 - lcnr:nested-bodies-opaques, r=compiler-errors
stop replacing bivariant args with `'static` when computing closure requirements

It is unnecessary, these get constrained when checking that the opaque type is well-formed.

It also results in the opaque type no longer being well formed. If you've got `fn foo<'a>() -> impl Sized + 'a` the opaque is `type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a` where `'aDummy`  is bivariant. If we call `foo::<'b>()`  inside of a closure and its return type ends up in a type test, we start out with the WF `Opaque<'b, 'b>`, and then replace the bivariant `'b` with `'static`. `Opaque<'b, 'static>` is no longer well-formed. Given how these type tests are used, I don't think this caused any practical issues.

r? types
2024-12-04 05:42:08 +01:00
Matthias Krüger
45088fdf68
Rollup merge of #133784 - dtolnay:visitspans, r=compiler-errors
Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans

The `Stmt` case is a bug introduced almost certainly unintentionally by https://github.com/rust-lang/rust/pull/126993. The code _used_ to visit and mutate `span` correctly, but got changed as follows by that PR. Notice how `span` is **copied** into the output by `|kind| Stmt { id, kind, span }` which happens after the mutation in the correct code (red) and before the mutation in the incorrect code (green).

```diff
  pub fn noop_flat_map_stmt<T: MutVisitor>(
      Stmt { kind, mut span, mut id }: Stmt,
      vis: &mut T,
  ) -> SmallVec<[Stmt; 1]> {
      vis.visit_id(&mut id);
-     vis.visit_span(&mut span);
      let stmts: SmallVec<_> = noop_flat_map_stmt_kind(kind, vis)
          .into_iter()
          .map(|kind| Stmt { id, kind, span })
          .collect();
      if stmts.len() > 1 {
          panic!(...);
      }
+     vis.visit_span(&mut span);
      stmts
  }
```
2024-12-04 05:42:08 +01:00
Matthias Krüger
afffc1a865
Rollup merge of #133764 - aDotInTheVoid:rename, r=GuillaumeGomez
rustdoc: Rename `set_back_info` to `restore_module_data`.

Follow-up to #133345, r? `@GuillaumeGomez`

Most of the references to `info` got removed as it was clear that `module_data` makes more sense here. Makes it clearer that `save_module_data` and `restore_module_data` are a pair.
2024-12-04 05:42:07 +01:00
Matthias Krüger
68f8a53f12
Rollup merge of #133651 - scottmcm:nonnull-nonzero-no-field-projection, r=oli-obk
Update `NonZero` and `NonNull` to not field-project (per MCP#807)

https://github.com/rust-lang/compiler-team/issues/807#issuecomment-2506098540 was accepted, so this is the first PR towards moving the library to not using field projections into `[rustc_layout_scalar_valid_range_*]` types.

`NonZero` was already using `transmute` nearly everywhere, so there are very few changes to it.

`NonNull` needed more changes, but they're mostly simple, changing `.pointer` to `.as_ptr()`.

r? libs

cc #133324, which will tidy up some of the MIR from this a bit more, but isn't a blocker.
2024-12-04 05:42:07 +01:00
bors
2633e01929 Auto merge of #133825 - weihanglo:update-cargo, r=weihanglo
Update cargo

17 commits in 4c39aaff66862cc0da52fe529aa1990bb8bb9a22..05f54fdc34310f458033af8a63ce1d699fae8bf6
2024-11-25 16:36:17 +0000 to 2024-12-03 03:14:12 +0000
- test(pgo): only run on nightly (rust-lang/cargo#14887)
- chore: Bump to 0.86.0; update changelog (rust-lang/cargo#14885)
- docs(ref): Finish a sentence on rust-versions (rust-lang/cargo#14884)
- chore(deps): update rust crate cargo_metadata to 0.19.0 (rust-lang/cargo#14878)
- chore(deps): update rust crate gix to 0.68.0 (rust-lang/cargo#14879)
- fix: Remove default registry reference in `info` cmd docs (rust-lang/cargo#14880)
- test(pgo): determine test runnability at compile time (rust-lang/cargo#14874)
- test: `requires` attribute accepts string literals for cmds (rust-lang/cargo#14875)
- chore(deps): update msrv (3 versions) to v1.81 (rust-lang/cargo#14871)
- chore(deps): update msrv (rust-lang/cargo#14867)
- fix(fix): Migrate cargo script manifests across editions (rust-lang/cargo#14864)
- feat(toml): Allow adding/removing from cargo scripts (rust-lang/cargo#14857)
- Add future-incompat warning against keywords in cfgs and add raw-idents (rust-lang/cargo#14671)
- test(build-std): download deps first (rust-lang/cargo#14861)
- test(pgo): ensure PGO works (rust-lang/cargo#14859)
- git-fetch-with-cli: Set `GIT_DIR` for bare repository compatibility (rust-lang/cargo#14860)
- fix(build-std): always link to std when testing proc-macros (rust-lang/cargo#14850)
2024-12-04 04:36:50 +00:00
bors
3b382642ab Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #132937 (a release operation synchronizes with an acquire operation)
 - #133681 (improve TagEncoding::Niche docs, sanity check, and UB checks)
 - #133726 (Add `core::arch::breakpoint` and test)
 - #133768 (Remove `generic_associated_types_extended` feature gate)
 - #133811 ([AIX] change AIX default codemodel=large)
 - #133812 (Update wasm-component-ld to 0.5.11)
 - #133813 (compiletest: explain that UI tests are expected not to compile by default)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-04 00:47:09 +00:00
Boxy
52d1c30d3e Add comment to test 2024-12-04 00:19:26 +00:00
clubby789
8374f7ceb5 tidy: println! -> eprintln! 2024-12-03 23:46:05 +00:00
clubby789
23725619c4 compiletest: println! -> eprintln! 2024-12-03 23:43:10 +00:00
clubby789
3fadb87d76 bootstrap: println! -> eprintln! 2024-12-03 23:41:47 +00:00
Boxy
ec036cda3f Don't try and handle unfed type_of on anon consts 2024-12-03 23:39:51 +00:00
Miguel Ojeda
7cc6f4da88 CI: rfl: move job forward to Linux v6.13-rc1
Linux v6.13-rc1 contains commit 28e848386b92 ("rust: block: fix formatting
of `kernel::block::mq::request` module"), which in turn contains commit
c95bbb59a9b2 ("rust: enable arbitrary_self_types and remove `Receiver`"),
which is why we had a hash rather than a tag.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-12-03 23:39:47 +01:00
Weihang Lo
244afb94d4
Update cargo 2024-12-03 16:46:51 -05:00
Guillaume Gomez
2997ec51a6 Rename is_real_and_local function into filename_real_and_local 2024-12-03 22:42:08 +01:00
Jakub Beránek
d5eb93b7e7
Remove dependency on black 2024-12-03 22:13:50 +01:00
Jakub Beránek
b24d608967
Replace black with ruff for formatting Python code 2024-12-03 22:02:58 +01:00
Jakub Beránek
f676ed2d2c
Fix copy-pasted tool name 2024-12-03 22:02:15 +01:00
Jakub Beránek
733871099c
Fix typo 2024-12-03 21:59:41 +01:00
Matthias Krüger
cd56913663
Rollup merge of #133813 - clubby789:ui-pass-note, r=jieyouxu
compiletest: explain that UI tests are expected not to compile by default

```
error: ui test compiled successfully!
```
is not a very useful message for someone new to the test suite, so change the wording and add a note to explain
2024-12-03 21:55:30 +01:00
Matthias Krüger
fd182ca529
Rollup merge of #133812 - alexcrichton:update-wasm-component-ld, r=jieyouxu
Update wasm-component-ld to 0.5.11

This pulls in an update that supports ``@`-files` used to pass arguments to linkers to fix invocations on Windows that are large.

Closes #133649
2024-12-03 21:55:29 +01:00
Matthias Krüger
9a972146c2
Rollup merge of #133811 - mustartt:change-default-codemodel, r=jieyouxu
[AIX] change AIX default codemodel=large

On AIX, for most libraries, we run out of Table of Contents (TOC) offsets very quickly due to the default 16-bit offset limit. We want the large code model should be used as the default to provide more TOC entries so the end user does not have to specify `-Ccode-model=large` for all their packages. This is even more of an issue with ThinLTO as the ThinLTO globals can very quickly use all available TOC entry.

In addition, on AIX, code with different code-model across different compilation units will not cause undefined behavior, so this is safe to do.
2024-12-03 21:55:29 +01:00
Matthias Krüger
12519a6acd
Rollup merge of #133768 - compiler-errors:gate, r=lcnr,jackh726
Remove `generic_associated_types_extended` feature gate

This PR retires nightly support for the `generic_associated_types_extended` feature. This feature hasn't received much attention in the last two years or so, and I believe the feature still remains both unsound and ICEy to use. I think that if we were to redesign and reimplement it, we'd want to first figure out how to implement it soundly, but in the mean time I'd prefer to clean this up.

r? ``@lcnr`` cc ``@jackh726`` who added this feature gate I think
2024-12-03 21:55:28 +01:00
Matthias Krüger
e66e632479
Rollup merge of #133726 - joshtriplett:breakpoint, r=oli-obk
Add `core::arch::breakpoint` and test

Approved in [ACP 491](https://github.com/rust-lang/libs-team/issues/491).
2024-12-03 21:55:27 +01:00
Matthias Krüger
6e87eb58ed
Rollup merge of #133681 - RalfJung:niches, r=wesleywiser
improve TagEncoding::Niche docs, sanity check, and UB checks

Turns out the `niche_variants` range can actually contain the `untagged_variant`. We should report this as UB in Miri, so this PR implements that.

Also rename `partially_check_layout` to `layout_sanity_check` for better consistency with how similar functions are called in other parts of the compiler.

Turns out my adjustments to the transmutation logic also fix https://github.com/rust-lang/rust/issues/126267.
2024-12-03 21:55:26 +01:00
Matthias Krüger
58fac8fe72
Rollup merge of #132937 - xmh0511:master, r=m-ou-se
a release operation synchronizes with an acquire operation

Change:
1. `Calls to park _synchronize-with_ calls to unpark` to `Calls to unpark _synchronize-with_ calls to park`
2. `park synchronizes-with _all_ prior unpark operations` to `_all_ prior unpark operations synchronize-with park`
2024-12-03 21:55:26 +01:00
Scott McMurray
7afce4f06a Update NonZero and NonNull to not field-project (per MCP807) 2024-12-03 11:13:34 -08:00
clubby789
ab38efefae compiletest: explain that UI tests are expected not to compile by default 2024-12-03 18:43:22 +00:00
Alex Crichton
c0a00b73f8 Update wasm-component-ld to 0.5.11
This pulls in an update that supports `@`-files used to pass arguments
to linkers to fix invocations on Windows that are large.

Closes #133649
2024-12-03 10:22:08 -08:00
bors
c44b3d50fe Auto merge of #133803 - matthiaskrgr:rollup-8ag5ncy, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #132612 (Gate async fn trait bound modifier on `async_trait_bounds`)
 - #133545 (Lint against Symbol::intern on a string literal)
 - #133558 (Structurally resolve in `probe_adt`)
 - #133696 (stabilize const_collections_with_hasher and build_hasher_default_const_new)
 - #133753 (Reduce false positives on some common cases from if-let-rescope lint)
 - #133762 (stabilize const_{size,align}_of_val)
 - #133777 (document -Zrandomize-layout in the unstable book)
 - #133779 (Use correct `hir_id` for array const arg infers)
 - #133796 (Update the definition of `borrowing_sub`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-03 18:16:53 +00:00
Henry Jiang
89b70b9196 change aix default codemodel=large 2024-12-03 12:44:35 -05:00
Michael Goulet
f91fd0cb87 Remove generic_associated_types_extended feature gate 2024-12-03 16:34:44 +00:00
Matthias Krüger
b78ab2fdc1
Rollup merge of #133796 - TDecking:borrowing-sub, r=tgross35
Update the definition of `borrowing_sub`

Complementary PR to https://github.com/rust-lang/rust/pull/133674, which only updated `carrying_add`.
2024-12-03 17:27:11 +01:00
Matthias Krüger
c80286d35e
Rollup merge of #133779 - BoxyUwU:array_const_arg_infer_hir_id, r=compiler-errors
Use correct `hir_id` for array const arg infers

Fixes #133771

`self.next_id()` results in the `DefId` for the const argument, created from the hack introduced by #133468, having no `HirId` associated with it. This then results in an ICE in metadata encoding. Fixing this then results in *another* ICE where `encode_defs` was not skipping encoding `type_of` and other queries for `DefId`s when they correspond to a `ConstArgKind::Infer` node.

This only reproduces with a library crate as metadata is not encoded for binaries, and apparently we had 0 tests for `generic_arg_infer` for array lengths in a library crate so this was not caught :<

cc #133589 `@voidc`

r? `@compiler-errors` `@lcnr`
2024-12-03 17:27:10 +01:00
Matthias Krüger
63231095d5
Rollup merge of #133777 - the8472:document-randomize-layout, r=jieyouxu
document -Zrandomize-layout in the unstable book

tracking issue: #106764
fixes #130462
2024-12-03 17:27:09 +01:00
Matthias Krüger
f224ad85ff
Rollup merge of #133762 - RalfJung:const-size-of-val, r=workingjubilee
stabilize const_{size,align}_of_val

FCP passed [here](https://github.com/rust-lang/rust/issues/46571#issuecomment-2460285288).

Fixes https://github.com/rust-lang/rust/issues/46571.
2024-12-03 17:27:09 +01:00
Matthias Krüger
93781324db
Rollup merge of #133753 - dingxiangfei2009:reduce-false-positive-if-let-rescope, r=jieyouxu
Reduce false positives on some common cases from if-let-rescope lint

r? `@jieyouxu`

We would like to identify a very common case in the ecosystem in which we do not need to apply the lint suggestion for the new Edition 2024 `if let` semantics.

In this patch we excluded linting from `if let`s in statements and block tail expressions. In these simple cases, new Edition 2024 drop orders are identical to those of Edition 2021 and prior.

However, conservatively we should still lint for the other cases, because [this example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2113df5ce78f161d32a1190faf5c7469) shows that the drop order changes are very pronounced, some of which are even sensitive to runtime data.
2024-12-03 17:27:08 +01:00
Matthias Krüger
1ae6f4756e
Rollup merge of #133696 - RalfJung:const-hashmap, r=cuviper
stabilize const_collections_with_hasher and build_hasher_default_const_new

After a lot of preparatory work, finally we can stabilize creating `HashMap` in const context. :)

FCP for const_collections_with_hasher passed in https://github.com/rust-lang/rust/issues/102575.
Fixes https://github.com/rust-lang/rust/issues/102575.

FCP for build_hasher_default_const_new passed in https://github.com/rust-lang/rust/issues/123197.
Fixes https://github.com/rust-lang/rust/issues/123197.

Cc `@Amanieu`
Release notes: https://github.com/rust-lang/rust/issues/133347
2024-12-03 17:27:07 +01:00
Matthias Krüger
49df325cb4
Rollup merge of #133558 - compiler-errors:structurally-resolve-probe-adt, r=lcnr
Structurally resolve in `probe_adt`

fixes #132320

r? lcnr
2024-12-03 17:27:07 +01:00
Matthias Krüger
453a1a8b7f
Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu
Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
2024-12-03 17:27:06 +01:00
Matthias Krüger
c179a15f7a
Rollup merge of #132612 - compiler-errors:async-trait-bounds, r=lcnr
Gate async fn trait bound modifier on `async_trait_bounds`

This PR moves `async Fn()` trait bounds into a new feature gate: `feature(async_trait_bounds)`. The general vibe is that we will most likely stabilize the `feature(async_closure)` *without* the `async Fn()` trait bound modifier, so we need to gate that separately.

We're trying to work on the general vision of `async` trait bound modifier general in: https://github.com/rust-lang/rfcs/pull/3710, however that RFC still needs more time for consensus to converge, and we've decided that the value that users get from calling the bound `async Fn()` is *not really* worth blocking landing async closures in general.
2024-12-03 17:27:05 +01:00
lcnr
1c96ddde11 closure-requirements: add regression tests 2024-12-03 17:26:43 +01:00
Guillaume Gomez
2e1f25bb1c Improve code for FileName retrieval in rustdoc 2024-12-03 17:26:31 +01:00
bors
490b2cc098 Auto merge of #133792 - lqd:jemallocup, r=Mark-Simulacrum
switch `jemalloc-sys` back to `tikv-jemalloc-sys`, and update to 0.6.0

Some context:
- we used to use jemalloc bindings from https://github.com/gnzlbg/jemallocator, since #55238
- that crate was abandoned, picked up as a fork in https://github.com/tikv/jemallocator, so we switched to that in #83152.
- then they were able to publish to the original `jemalloc-sys` bindings crate, and `jemalloc-sys` and `tikv-jemalloc-sys` became the same thing -- so I switched back to the OG crate in #96790
- they're now having publishing problems again: I've been waiting for https://github.com/tikv/jemallocator/pull/96 for the `jemalloc-sys` 0.6.0 update for a few months, but `tikv-jemalloc-sys` is already updated to 0.6.0.

A perf run showed some improvements, so this PR switches back to `tikv-jemalloc-sys` to update to 0.6.0.
2024-12-03 15:33:55 +00:00
David Tolnay
a3cfe2fd08
Visit Stmt span in MutVisitor::flat_map_stmt 2024-12-03 07:03:26 -08:00
David Tolnay
a2eca35c15
Visit BinOp span in MutVisitor::visit_expr 2024-12-03 07:03:26 -08:00
Tobias Decking
8b7d3d3967
Update the definition of borrowing_sub
This ensures that it matches the one in `carrying_add`.
2024-12-03 15:31:00 +01:00
DianQK
605306efef
Update LLVM to 19.1.5 2024-12-03 21:12:47 +08:00
lcnr
65d0b5dc2e small code cleanup 2024-12-03 14:07:04 +01:00
lcnr
8a47b442c4 closure requirements: don't replace bivariant opaque args
It is unnecessary, these get constrained when checking that the
opaque type is well-formed.

It also results in the opaque type no longer being well formed.
If you've got `fn foo<'a>() -> impl Sized + 'a` the opaque is
`type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a` where
`'aDummy`  is bivariant. If we call `foo::<'b>()`  inside of a closure
and its return type ends up in a type test, we start out with the WF
`Opaque<'b, 'b>`, and then replace the bivariant `'b` with `'static`.
`Opaque<'b, 'static>`  is no longer well-formed. Given how these type
tests are used, I don't think this caused any practical issues.
2024-12-03 14:07:04 +01:00