Commit Graph

272190 Commits

Author SHA1 Message Date
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
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
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
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
bors
8575f8f91b Auto merge of #104342 - mweber15:add_file_location_to_more_types, r=wesleywiser
Require `type_map::stub` callers to supply file information

This change attaches file information (`DIFile` reference and line number) to struct debug info nodes.

Before:

```
; foo.ll
...
!5 = !DIFile(filename: "<unknown>", directory: "")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !5, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "4cb373851db92e732c4cb5651b886dd0")
...
```

After:

```
; foo.ll
...
!3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !3, line: 3, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "9e5968c7af39c148acb253912b7f409f")
...
```

Fixes #98678

r? `@wesleywiser`
2024-12-03 12:49:57 +00:00
bors
ae3703cdf2 Auto merge of #133788 - matthiaskrgr:rollup-1p100a8, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #132723 (Unify `sysroot_target_{bin,lib}dir` handling)
 - #133041 (Print name of env var in `--print=deployment-target`)
 - #133325 (Reimplement `~const` trait specialization)
 - #133395 (Add simd_relaxed_fma intrinsic)
 - #133517 (Deeply normalize when computing implied outlives bounds)
 - #133785 (Add const evaluation error UI test.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-03 09:47:39 +00:00
Rémy Rakic
a69fe84ec8 switch jemalloc-sys back to tikv-jemalloc-sys, and update to 0.6.0 2024-12-03 08:56:33 +00:00
Ralf Jung
7ac7b4c285 ./x miri: fix sysroot build 2024-12-03 07:52:01 +01:00
Matthias Krüger
8ae11145ce
Rollup merge of #133785 - HypheX:add-ui-test, r=compiler-errors
Add const evaluation error UI test.

This closes #78834
2024-12-03 07:48:34 +01:00
Matthias Krüger
68279097d4
Rollup merge of #133517 - compiler-errors:deep-norm, r=lcnr
Deeply normalize when computing implied outlives bounds

r? lcnr

Unfortunately resolving regions is still slightly scuffed (though in an unrelated way). Specifically, we should be normalizing our param-env outlives when constructing the `OutlivesEnv`; otherwise, these assumptions (dd2837ec5d/compiler/rustc_infer/src/infer/outlives/env.rs (L78)) are not constructed correctly.

Let me know if you want us to track that somewhere.
2024-12-03 07:48:33 +01:00
Matthias Krüger
9709334061
Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubilee
Add simd_relaxed_fma intrinsic

Adds compiler support for https://github.com/rust-lang/portable-simd/issues/387#issuecomment-2337169786

r? `@workingjubilee`

cc `@RalfJung` is this kind of nondeterminism a problem for miri/opsem?
2024-12-03 07:48:33 +01:00
Matthias Krüger
8aa5853b58
Rollup merge of #133325 - compiler-errors:const-spec, r=lcnr,fee1-dead
Reimplement `~const` trait specialization

Reimplement const specialization. We need this for `PartialEq` constification :)

r? lcnr
2024-12-03 07:48:32 +01:00
Matthias Krüger
3ec21070e2
Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=davidtwco
Print name of env var in `--print=deployment-target`

The deployment target environment variable is OS-specific, and if you're in a place where you're asking `rustc` for the deployment target, you're likely to also wanna know the name of the environment variable. I myself wanted this for some code I'm working on in bootstrap, for example.

Behaviour before this PR:
```console
$ rustc --print=deployment-target --target=aarch64-apple-darwin
deployment_target=11.0
$ rustc --print=deployment-target --target=aarch64-apple-visionos
deployment_target=1.0
```

Behaviour after this PR:
```console
$ rustc --print=deployment-target --target=aarch64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=11.0
$ rustc --print=deployment-target --target=aarch64-apple-visionos
XROS_DEPLOYMENT_TARGET=1.0
```

My _belief_ is that this option is extremely rarely used in general, and a GitHub search for "rustc print deployment-target" seems to confirm this, it revealed only the following actual pieces of code using this:
- b292ef6934/src/build_context.rs (L1199-L1220)
- daab9244b0/src/lib.rs (L3422-L3426)

`maturin` does `.split('=').last()`, so it will continue to work after this change, but `cc v1.0.84` did `.strip_prefix("deployment_target=")` since [this PR](https://github.com/rust-lang/cc-rs/pull/848), so it would break. That's _probably_ fine though, it was broken in a lot of scenarios anyway, and [got](https://github.com/rust-lang/cc-rs/pull/901) [reverted](https://github.com/rust-lang/cc-rs/pull/943) in `v1.0.85`.

So while this is _technically_ a breaking change, I really doubt that anyone is going to observe it, so it's probably fine.

``@BlackHoleFox`` wdyt?

``@rustbot`` label O-apple
r? compiler
2024-12-03 07:48:31 +01:00
Matthias Krüger
481ca6166f
Rollup merge of #132723 - jieyouxu:sysroot-dance-dance-revolution, r=onur-ozkan
Unify `sysroot_target_{bin,lib}dir` handling

Follow-up to https://github.com/rust-lang/rust/pull/131405#discussion_r1826558962 where `sysroot_target_bindir` had to do some dancing because the sysroot ensure logic embedded in `sysroot_target_libdir` returned `$sysroot/$relative_lib/rustlib/$target/lib` and not the `rustlib` parent `$sysroot/$relative_lib/rustlib/`.

This PR pulls out the sysroot ensure logic into a helper, and return `$sysroot/$relative_lib/rustlib/` instead so `sysroot_target_bindir` doesn't have to do parent traversal from the path returned from `sysroot_target_libdir`, and also make them easier to follow in that they are now clearly closely related based on the common target sysroot ensure logic.
2024-12-03 07:48:31 +01:00
bors
efdd9e8020 Auto merge of #133321 - compiler-errors:const-checker, r=wesleywiser
Get rid of HIR const checker

As far as I can tell, the HIR const checker was implemented in https://github.com/rust-lang/rust/pull/66170 because we were not able to issue useful const error messages in the MIR const checker.

This seems to have changed in the last 5 years, probably due to work like #90532. I've tweaked the diagnostics slightly and think the error messages have gotten *better* in fact.

Thus I think the HIR const checker has reached the end of its usefulness, and we can retire it.

cc `@RalfJung`
2024-12-03 04:39:48 +00:00
Xelph
3b2ff90529 Add ui test for const evaluation fail when type is too big. 2024-12-02 20:55:45 -07:00
Matt Weber
e9fbb6f271 Fix tests when using MinGW 2024-12-02 21:59:34 -05:00
bors
41cbe3e4d1 Auto merge of #133770 - GuillaumeGomez:rollup-l62iyyx, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #131713 (Stabilize `const_maybe_uninit_write`)
 - #133535 (show forbidden_lint_groups in future-compat reports)
 - #133610 (Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering)
 - #133701 (Use c"lit" for CStrings without unwrap)
 - #133704 (fix ICE when promoted has layout size overflow)
 - #133705 (add "profiler" and "optimized-compiler-builtins" option coverage for ci-rustc)
 - #133710 (Reducing `target_feature` check-cfg merge conflicts)
 - #133732 (Fix `-Zdump-mir-dataflow`)
 - #133746 (Change `AttrArgs::Eq` to a struct variant)
 - #133763 (Fix `f16::midpoint` const feature gate)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-03 00:51:25 +00:00
Boxy
2807ba77a0 Use correct hir_id for array const arg infers 2024-12-03 00:21:51 +00:00
The 8472
ebb9a382a4 document -Zrandomize-layout in the unstable book 2024-12-03 00:53:55 +01:00
Michael Goulet
0609b99968 Structurally resolve in probe_adt 2024-12-02 23:22:40 +00:00
Michael Goulet
398fd901d5 Assert that obligations are empty before deeply normalizing 2024-12-02 22:51:18 +00:00
Michael Goulet
abfa5c1dca Deeply normalize when computing implied outlives bounds 2024-12-02 22:51:17 +00:00
Michael Goulet
9bda88bb58 Fix const specialization 2024-12-02 22:21:53 +00:00
Michael Goulet
e91fc1bc0c Reimplement specialization for const traits 2024-12-02 22:12:08 +00:00
Guillaume Gomez
73f225acf6
Rollup merge of #133763 - Urgau:f16-midpoint-const-feat, r=Amanieu
Fix `f16::midpoint` const feature gate

cc https://github.com/rust-lang/rust/pull/131784#discussion_r1866074470
2024-12-02 23:08:59 +01:00
Guillaume Gomez
6f9f17fc08
Rollup merge of #133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu
Change `AttrArgs::Eq` to a struct variant

Cleanups for simplifying https://github.com/rust-lang/rust/pull/131808

Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
2024-12-02 23:08:58 +01:00
Guillaume Gomez
3586e4a326
Rollup merge of #133732 - nnethercote:fix-Z-dump-mir-dataflow, r=compiler-errors
Fix `-Zdump-mir-dataflow`

r? `@cjgillot`
2024-12-02 23:08:57 +01:00
Guillaume Gomez
8a26a8bf48
Rollup merge of #133710 - Urgau:target_feature-merge-conflitcs, r=jieyouxu
Reducing `target_feature` check-cfg merge conflicts

It was rightfully pointed in https://github.com/rust-lang/rust/pull/133099#discussion_r1862490542 that the expected values for the `target_feature` cfg are regularly updated and unfortunately the check-cfg tests for it are very merge-conflict prone.

This PR aims at drastically reducing the likely-hood of those, by normalizing the "and X more" diagnostic, as well as making the full expected list multi-line instead of being on a single one.

cc `@RalfJung`
r? `@jieyouxu`
2024-12-02 23:08:57 +01:00
Guillaume Gomez
7d67af98b5
Rollup merge of #133705 - onur-ozkan:profiler-check, r=jieyouxu
add "profiler" and "optimized-compiler-builtins" option coverage for ci-rustc

Adds "profiler" and "optimized-compiler-builtins" option coverage in CI-rustc config compatibility check.

Resolves #133675
2024-12-02 23:08:56 +01:00
Guillaume Gomez
b1a643e599
Rollup merge of #133704 - RalfJung:promoted-size-overflow-ice, r=compiler-errors
fix ICE when promoted has layout size overflow

Turns out there is no reason to distinguish `tainted_by_errors` and `can_be_spurious` here, we can just track whether we allow this even in "infallible" constants.

Fixes https://github.com/rust-lang/rust/issues/125476
2024-12-02 23:08:55 +01:00
Guillaume Gomez
65b0dad824
Rollup merge of #133701 - kornelski:c-str, r=workingjubilee
Use c"lit" for CStrings without unwrap

I've reviewed uses of `CString::new("lit")`.

Some could be changed to `c"lit"`. Some could be changed to `c"lit".to_owned()`, avoiding an `unwrap()`.

Many `CString` documentation examples could be simplified. I deliberately haven't changed all the examples to use the exact same expression, so that they can demonstrate many ways of creating `CString`s.

I've left UI tests mostly unchanged, because `c""` requires edition 2021, but most UI tests use 2015, and I didn't want to accidentally change what the tests are testing.
2024-12-02 23:08:55 +01:00
Guillaume Gomez
6f0d15a144
Rollup merge of #133610 - camelid:move-from_anon_const, r=BoxyUwU
Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering

Fixes #128176.
This accomplishes one of the followup items from #131081.

These operations are much more about lowering the HIR than about
`Const`s themselves. They fit better in hir_ty_lowering with
`lower_const_arg` (formerly `Const::from_const_arg`) and the rest.

To accomplish this, `const_evaluatable_predicates_of` had to be changed
to not use `from_anon_const` anymore. Instead of visiting the HIR and
lowering anon consts on the fly, it now visits the `rustc_middle::ty`
data structures instead and directly looks for `UnevaluatedConst`s. This
approach was proposed in:
https://github.com/rust-lang/rust/pull/131081#discussion_r1821189257

r? `@BoxyUwU`
2024-12-02 23:08:54 +01:00
Guillaume Gomez
f79e09c562
Rollup merge of #133535 - RalfJung:forbidden_lint_groups-future-compat, r=davidtwco
show forbidden_lint_groups in future-compat reports

Part of https://github.com/rust-lang/rust/issues/81670. This has been a future-compat lint for a while, time to dial it up to show up in reports.
2024-12-02 23:08:53 +01:00
Guillaume Gomez
e56e68541b
Rollup merge of #131713 - tgross35:stabilize-const_maybe_uninit_write, r=RalfJung,dtolnay
Stabilize `const_maybe_uninit_write`

Mark the following API const stable:

```rust
impl<T> MaybeUninit<T> {
    pub const fn write(&mut self, val: T) -> &mut T;
}
```

This depends on `const_mut_refs` and [`const_maybe_uninit_assume_init`](https://github.com/rust-lang/rust/issues/86722), both of which have recently been stabilized.

Closes: <https://github.com/rust-lang/rust/issues/63567>
2024-12-02 23:08:52 +01:00
bors
42b4b9c669 Auto merge of #133747 - lqd:osx-aarch64-1cgu, r=Kobzol
build `rustc` with 1 CGU on `aarch64-apple-darwin`

Distribute `aarch64-apple-darwin` artifacts built with `rust.codegen-units=1`, like we already do on Linux/Windows/macOS Intel.

1. Performance results (only wall-time on mac as usual)
- I only did some `ripgrep` check builds (the revision from rustc-perf), because we had noticeable wins in wall-time there back then on linux. It's a ~2-4% (mostly 3%) improvement on local builds.

```console
Benchmark 1: cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q
  Time (mean ± σ):      5.800 s ±  0.087 s    [User: 16.048 s, System: 2.294 s]
  Range (min … max):    5.725 s …  6.028 s    10 runs

Benchmark 2: cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q
  Time (mean ± σ):      5.551 s ±  0.037 s    [User: 15.451 s, System: 2.252 s]
  Range (min … max):    5.477 s …  5.602 s    10 runs

Summary
  'cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q' ran
    1.04 ± 0.02 times faster than 'cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q'
```

```console
Benchmark 1: CARGO_INCREMENTAL=0 cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q
  Time (mean ± σ):      5.743 s ±  0.030 s    [User: 16.005 s, System: 2.249 s]
  Range (min … max):    5.720 s …  5.792 s    5 runs

Benchmark 2: CARGO_INCREMENTAL=0 cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q
  Time (mean ± σ):      5.469 s ±  0.055 s    [User: 15.244 s, System: 2.110 s]
  Range (min … max):    5.404 s …  5.524 s    5 runs

Summary
  'CARGO_INCREMENTAL=0 cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q' ran
    1.05 ± 0.01 times faster than 'CARGO_INCREMENTAL=0 cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q'
```

```console
Benchmark 1: CARGO_INCREMENTAL=0 cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q -j1
  Time (mean ± σ):     15.092 s ±  0.049 s    [User: 11.969 s, System: 1.665 s]
  Range (min … max):   15.052 s … 15.165 s    5 runs

Benchmark 2: CARGO_INCREMENTAL=0 cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q -j1
  Time (mean ± σ):     14.623 s ±  0.035 s    [User: 11.520 s, System: 1.619 s]
  Range (min … max):   14.593 s … 14.682 s    5 runs

Summary
  'CARGO_INCREMENTAL=0 cargo +41f40c97bbff6c8642f5510d0be283551b095b70 check -q -j1' ran
    1.03 ± 0.00 times faster than 'CARGO_INCREMENTAL=0 cargo +caa81728c37f5ccfa9a0979574b9272a67f8a286 check -q -j1'
```

2. Effects on code size on `aarch64-apple-darwin`: it's a 13.24% reduction on `librustc_driver.dylib`
- [before](https://ci-artifacts.rust-lang.org/rustc-builds/caa81728c37f5ccfa9a0979574b9272a67f8a286/rustc-nightly-aarch64-apple-darwin.tar.xz): 173452888 (57.3 MB compressed).
- [after](https://ci-artifacts.rust-lang.org/rustc-builds/41f40c97bbff6c8642f5510d0be283551b095b70/rustc-nightly-aarch64-apple-darwin.tar.xz): 150471368 (55.2 MB compressed, -3.7% here).

3. Effects on CI
- the [1st try build](https://github.com/rust-lang-ci/rust/actions/runs/12118946198/job/33784512526) took 1h31
- the [2nd try build](https://github.com/rust-lang-ci/rust/actions/runs/12121452825/job/33792429553) took 1h28
- I don't know how long the builder usually takes
2024-12-02 22:07:57 +00:00
Noah Lev
dcf332bd9d Fix broken intra-doc link 2024-12-02 19:34:54 +00:00
Noah Lev
277e049d91 Move Const::{from_anon_const,try_from_lit} to hir_ty_lowering
These operations are much more about lowering the HIR than about
`Const`s themselves. They fit better in hir_ty_lowering with
`lower_const_arg` (formerly `Const::from_const_arg`) and the rest.

To accomplish this, `const_evaluatable_predicates_of` had to be changed
to not use `from_anon_const` anymore. Instead of visiting the HIR and
lowering anon consts on the fly, it now visits the `rustc_middle::ty`
data structures instead and directly looks for `UnevaluatedConst`s. This
approach was proposed in:
https://github.com/rust-lang/rust/pull/131081#discussion_r1821189257
2024-12-02 19:34:47 +00:00
Ralf Jung
2b88e4c716 stabilize const_{size,align}_of_val 2024-12-02 20:18:25 +01:00
Trevor Gross
c5fedc2267 Stabilize const_maybe_uninit_write
Mark the following API const stable:

    impl<T> MaybeUninit<T> {
        pub const fn write(&mut self, val: T) -> &mut T;
    }

This depends on `const_mut_refs` and `const_maybe_uninit_assume_init`,
both of which have recently been stabilized.

Tracking issue: <https://github.com/rust-lang/rust/issues/63567>
2024-12-02 14:06:56 -05:00
bors
d49be02cf6 Auto merge of #133760 - GuillaumeGomez:rollup-2c1y8c3, r=GuillaumeGomez
Rollup of 13 pull requests

Successful merges:

 - #133603 (Eliminate magic numbers from expression precedence)
 - #133715 (rustdoc-json: Include safety of `static`s)
 - #133721 (rustdoc-json: Add test for `impl Trait for dyn Trait`)
 - #133725 (Remove `//@ compare-output-lines-by-subset`)
 - #133730 (Add pretty-printer parenthesis insertion test)
 - #133736 (Add `needs-target-has-atomic` directive)
 - #133739 (Re-add myself to rotation)
 - #133743 (Fix docs for `<[T]>::as_array`.)
 - #133744 (Fix typo README.md)
 - #133745 (Remove static HashSet for default IDs list)
 - #133749 (mir validator: don't store mir phase)
 - #133751 (remove `Ty::is_copy_modulo_regions`)
 - #133757 (`impl Default for EarlyDiagCtxt`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-02 18:36:36 +00:00
Kornel
eadea7764e
Use c"lit" for CStrings without unwrap 2024-12-02 18:16:36 +00:00