Commit Graph

272124 Commits

Author SHA1 Message Date
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
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
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
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
Urgau
72297d4272 Fix f16::midpoint const feature gate 2024-12-02 18:26:00 +01:00
Urgau
43bed16b8b Reduce conflicts for check-cfg target_feature cfg values 2024-12-02 18:22:55 +01:00
Guillaume Gomez
586591f4d6
Rollup merge of #133757 - jyn514:error-handler, r=compiler-errors
`impl Default for EarlyDiagCtxt`

for small rustc_driver programs, most of their imports will currently be related to diagnostics. this change simplifies their code so it's more clear what in the driver is modified from the default.

this is especially important for external drivers which are out of tree and not updated in response to breaking changes. for these drivers, each import is a liability for future code, since it can be broken when refactors happen.

here is an example driver which is simplified by these changes:
```diff
diff --git a/src/main.rs b/src/main.rs
index f81aa3e..11e5f18 100644
--- a/src/main.rs
+++ b/src/main.rs
`@@` -1,16 +1,8 `@@`
 #![feature(rustc_private)]
 extern crate rustc_driver;
 extern crate rustc_interface;
-extern crate rustc_errors;
-extern crate rustc_session;

 use rustc_driver::Callbacks;
-use rustc_errors::{emitter::HumanReadableErrorType, ColorConfig};
 use rustc_interface::interface;
-use rustc_session::config::ErrorOutputType;
-use rustc_session::EarlyDiagCtxt;

 struct DisableSafetyChecks;

`@@` -26,11 +18,7 `@@` fn main() {
         "https://github.com/jyn514/jyn514.github.io/issues/new",
         |_| (),
     );
-    let handler = EarlyDiagCtxt::new(ErrorOutputType::HumanReadable(
-        HumanReadableErrorType::Default,
-        ColorConfig::Auto,
-    ));
-    rustc_driver::init_rustc_env_logger(&handler);
+    rustc_driver::init_rustc_env_logger(&Default::default());
     std::process::exit(rustc_driver::catch_with_exit_code(move || {
         let args: Vec<String> = std::env::args().collect();
         rustc_driver::RunCompiler::new(&args, &mut DisableSafetyChecks).run()
```
2024-12-02 17:36:12 +01:00
Guillaume Gomez
4c68112df1
Rollup merge of #133751 - lcnr:no-trait-solving-on-type, r=compiler-errors
remove `Ty::is_copy_modulo_regions`

Using these functions is likely incorrect if an `InferCtxt` is available, I moved this function to `TyCtxt` (and added it to `LateContext`) and added a note to the documentation that one should prefer `Infer::type_is_copy_modulo_regions` instead.

I didn't yet move `is_sized` and `is_freeze`, though I think we should move these as well.

r? `@compiler-errors` cc #132279
2024-12-02 17:36:11 +01:00
Guillaume Gomez
7c92266fde
Rollup merge of #133749 - lcnr:validator-mir_phase, r=compiler-errors
mir validator: don't store mir phase

it's already stored in the `Body` and we assert that they match.
2024-12-02 17:36:10 +01:00
Guillaume Gomez
7145e4ecce
Rollup merge of #133745 - GuillaumeGomez:default-ids-match, r=notriddle
Remove static HashSet for default IDs list

Follow-up of https://github.com/rust-lang/rust/pull/133345.

Let's see how it impacts performance.

r? `@notriddle`
2024-12-02 17:36:10 +01:00
Guillaume Gomez
ed0880344c
Rollup merge of #133744 - HypheX:typo-fix, r=fmease
Fix typo README.md

Fix typo README.md 2: Electric Boogaloo
Expands on #131144
2024-12-02 17:36:09 +01:00
Guillaume Gomez
1638a5514b
Rollup merge of #133743 - bjoernager:slice-as-array, r=joboet
Fix docs for `<[T]>::as_array`.

Tracking issue: #133508

This PR fixes a small typographical error in the docs entry for `<[T]>::as_array`.
2024-12-02 17:36:08 +01:00
Guillaume Gomez
97cc31a90b
Rollup merge of #133739 - oli-obk:push-zymwlvwttxnr, r=oli-obk
Re-add myself to rotation
2024-12-02 17:36:08 +01:00
Guillaume Gomez
80e0448947
Rollup merge of #133736 - jieyouxu:needs-target-has-atomic, r=compiler-errors
Add `needs-target-has-atomic` directive

Before this PR, the test writer has to specify platforms and architectures by hand for targets that have differing atomic width support. `#[cfg(target_has_atomic="...")]` is not quite the same because (1) you may have to specify additional matchers manually which has to be maintained individually, and (2) the `#[cfg]` blocks does not communicate to compiletest that a test would be ignored for a given target.

This PR implements a `//@ needs-target-has-atomic` directive which admits a comma-separated list of required atomic widths that the target must satisfy in order for the test to run.

```
//@ needs-target-has-atomic: 8, 16, ptr
```

See <https://github.com/rust-lang/rust/issues/87377>.

This PR supersedes #133095 and is co-authored by `@kei519,` because it was somewhat subtle, and it turned out easier to implement than to review.

rustc-dev-guide docs PR: https://github.com/rust-lang/rustc-dev-guide/pull/2154
2024-12-02 17:36:07 +01:00
Guillaume Gomez
8f5a801b5c
Rollup merge of #133730 - dtolnay:parentest, r=compiler-errors
Add pretty-printer parenthesis insertion test

This test demonstrates numerous bugs in rustc_ast_pretty, including all five of:

- Failing to insert parentheses where necessary to preserve the meaning of a syntax tree, producing invalid syntax.
- Failing to insert parentheses, producing valid syntax with the wrong meaning.
- Inserting too many parentheses.
- Inserting parentheses in the wrong place, producing invalid syntax.
- Losing syntactically significant parts of the syntax tree.

These pretty-printer bugs have consequences for `-Zunpretty=expanded`. The `cargo expand` subcommand cannot work reliably unless rustc can consistently produce valid Rust output. Erroneous syntax cannot be passed through rustfmt, or queried with [syn-select](https://crates.io/crates/syn-select).

The test in this PR is a port of a test from Syn that tests the automatic parenthesis insertion performed by Syn's `ToTokens` impls. In Syn we actually run this test over every expression in every Rust source file in the whole rust-lang/rust repo, including rustc and the standard library and tools and test suites. For the test here, I have only used a small selection of interesting expressions. This will serve as an easy spot to accumulate regression tests as the various bugs get fixed. Once rustc's pretty-printer is in better shape, it's possible that the test can be expanded to cover a larger set of expressions collected automatically like in Syn.
2024-12-02 17:36:06 +01:00
Guillaume Gomez
15fda1e90b
Rollup merge of #133725 - jyn514:remove-compare-output-subset, r=jieyouxu
Remove `//@ compare-output-lines-by-subset`

There was only ever one test which used this flag, and it was removed in https://github.com/rust-lang/rust/pull/132244. I think this is a bad flag that should never have been added; comparing by subset makes the test failures extremely hard to debug. Any test that needs complicated output filtering like this should just use run-make instead.

Note that this does not remove the underlying comparison code, because it's still used if `runner` is set. I don't quite understand what's going on there, but since we still test on other platforms and in CI that the full output is accurate, I think it will be easier to debug than a test that uses compare-by-subset unconditionally.

rustc-dev-guide update PR: https://github.com/rust-lang/rustc-dev-guide/pull/2151
2024-12-02 17:36:05 +01:00
Guillaume Gomez
7fdbde0e18
Rollup merge of #133721 - aDotInTheVoid:rdj-dyn-link, r=GuillaumeGomez
rustdoc-json: Add test for `impl Trait for dyn Trait`

Found while investigating #133719

Helps with #81359

r? `@GuillaumeGomez`
2024-12-02 17:36:05 +01:00
Guillaume Gomez
08f1f28699
Rollup merge of #133715 - aDotInTheVoid:rdj-static, r=GuillaumeGomez
rustdoc-json: Include safety of `static`s

`static`s in an `extern` block can have an associated safety annotation ["because there is nothing guaranteeing that the bit pattern at the static’s memory is valid for the type it is declared with"](https://doc.rust-lang.org/reference/items/external-blocks.html#statics). Rustdoc already knows this and displays in for HTML. This PR also includes it in JSON.

Inspired by https://github.com/obi1kenobi/cargo-semver-checks/issues/975 which needs this, but it's probably useful in other places.

r? `@GuillaumeGomez.` Possibly easier to review commit-by-commit.
2024-12-02 17:36:04 +01:00
Guillaume Gomez
7dd0c8314d
Rollup merge of #133603 - dtolnay:precedence, r=lcnr
Eliminate magic numbers from expression precedence

Context: see https://github.com/rust-lang/rust/pull/133140.

This PR continues on backporting Syn's expression precedence design into rustc. Rustc's design used mysterious integer quantities represented variously as `i8` or `usize` (e.g. `PREC_CLOSURE = -40i8`), a special significance around `0` that is never named, and an extra `PREC_FORCE_PAREN` precedence level that does not correspond to any expression. Syn's design uses a C-like enum with variants that clearly correspond to specific sets of expression kinds.

This PR is a refactoring that has no intended behavior change on its own, but it unblocks other precedence work that rustc's precedence design was poorly suited to accommodate.

- Asymmetrical precedence, so that a pretty-printer can tell `(return 1) + 1` needs parens but `1 + return 1` does not.

- Squashing the `Closure` and `Jump` cases into a single precedence level.

- Numerous remaining false positives and false negatives in rustc pretty-printer's parenthesization of macro metavariables, for example in `$e < rhs` where $e is `lhs as Thing<T>`.

FYI `@fmease` &mdash; you don't need to review if rustbot picks someone else, but you mentioned being interested in the followup PRs.
2024-12-02 17:36:03 +01:00
bors
32eea2f446 Auto merge of #133626 - lcnr:fix-diesel, r=BoxyUwU
check local cache even if global is usable

we store overflow errors locally, even if we can otherwise use the global cache for this goal. should fix #133616, didn't test it locally yet as diesel tends to hit an unrelated debug assertion in rustdoc.

r? types
2024-12-02 15:31:36 +00:00
jyn
42174f0396 impl Default for EarlyDiagCtxt
for small rustc_driver programs, most of their imports will currently be related to diagnostics. this change simplifiers their code so it's more clear what in the driver is modified from the default.

this is especially important for external drivers which are out of tree and not updated in response to breaking changes. for these drivers, each import is a liability for future code, since it can be broken when refactors happen.

here is an example driver which is simplified by these changes:
```
diff --git a/src/main.rs b/src/main.rs
index f81aa3e..11e5f18 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,16 +1,8 @@
 #![feature(rustc_private)]
 extern crate rustc_driver;
 extern crate rustc_interface;
-extern crate rustc_errors;
-extern crate rustc_session;

 use rustc_driver::Callbacks;
-use rustc_errors::{emitter::HumanReadableErrorType, ColorConfig};
 use rustc_interface::interface;
-use rustc_session::config::ErrorOutputType;
-use rustc_session::EarlyDiagCtxt;

 struct DisableSafetyChecks;

@@ -26,11 +18,7 @@ fn main() {
         "https://github.com/jyn514/jyn514.github.io/issues/new",
         |_| (),
     );
-    let handler = EarlyDiagCtxt::new(ErrorOutputType::HumanReadable(
-        HumanReadableErrorType::Default,
-        ColorConfig::Auto,
-    ));
-    rustc_driver::init_rustc_env_logger(&handler);
+    rustc_driver::init_rustc_env_logger(&Default::default());
     std::process::exit(rustc_driver::catch_with_exit_code(move || {
         let args: Vec<String> = std::env::args().collect();
         rustc_driver::RunCompiler::new(&args, &mut DisableSafetyChecks).run()
```
2024-12-02 09:55:04 -05:00
lcnr
e089bead32 remove Ty::is_copy_modulo_regions 2024-12-02 13:57:56 +01:00
lcnr
cfee10ce89 remove outdated comment 2024-12-02 13:43:16 +01:00
lcnr
8b90e70e06 mir validator: don't store mir phase 2024-12-02 13:38:18 +01:00
bors
3bff51ea91 Auto merge of #133728 - jhpratt:rollup-k1i60pg, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - #133589 (Remove `hir::ArrayLen`)
 - #133672 (Remove a bunch of unnecessary const stability noise)
 - #133678 (Stabilize `ptr::fn_addr_eq`)
 - #133727 (Update mailmap)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-02 12:17:12 +00:00
Rémy Rakic
70e0d5893f build rustc with 1 CGU on aarch64-apple-darwin 2024-12-02 11:48:39 +00:00
Oli Scherer
da182b6d95 Deduplicate some matches that always panic in one arm 2024-12-02 11:04:57 +00:00
Oli Scherer
c0b532277b Add a helper method for extracting spans from AttrArgsEq 2024-12-02 11:04:57 +00:00
Guillaume Gomez
b863c0d28b Remove static HashSet for default IDs list 2024-12-02 12:03:32 +01:00
Xelph
c8e0724937 Fix typos on tests/ui/README.md 2024-12-02 03:43:50 -07:00
Oli Scherer
778321d155 Change AttrArgs::Eq into a struct variant 2024-12-02 10:28:58 +00:00
Gabriel Bjørnager Jensen
b1ff3c8b92 Fix docs for '<[T]>::as_array'; 2024-12-02 10:38:40 +01:00
bors
bd36e69d25 Auto merge of #133566 - lcnr:fast-reject-perf, r=compiler-errors
fast-reject: add cache

slightly modified version of #133524

I tried a few alternatives:
- simply bail after recursion for a certain amount of times, however, looking at the number of steps taken while compiling different crates we get the following results[^1]:
- add a cache: results in a bigger performance impact

typenum
```rust
1098842 counts
(  1)   670511 (61.0%, 61.0%): dropping after 1
(  2)   358785 (32.7%, 93.7%): dropping after 0
(  3)    25191 ( 2.3%, 96.0%): dropping after 2
(  4)    10912 ( 1.0%, 97.0%): dropping after 4
(  5)     6461 ( 0.6%, 97.5%): dropping after 3
(  6)     5239 ( 0.5%, 98.0%): dropping after 5
(  7)     2528 ( 0.2%, 98.3%): dropping after 8
(  8)     2188 ( 0.2%, 98.5%): dropping after 1094
(  9)     2097 ( 0.2%, 98.6%): dropping after 6
( 10)     1179 ( 0.1%, 98.7%): dropping after 34
( 11)     1148 ( 0.1%, 98.9%): dropping after 7
( 12)      822 ( 0.1%, 98.9%): dropping after 10
```
bitmaps
```rust
533346 counts
(  1)   526166 (98.7%, 98.7%): dropping after 1
(  2)     4562 ( 0.9%, 99.5%): dropping after 0
(  3)     2072 ( 0.4%, 99.9%): dropping after 1024
(  4)      305 ( 0.1%,100.0%): dropping after 2
(  5)      106 ( 0.0%,100.0%): dropping after 4
(  6)       30 ( 0.0%,100.0%): dropping after 8
(  7)       18 ( 0.0%,100.0%): dropping after 3
(  8)       17 ( 0.0%,100.0%): dropping after 44
(  9)       15 ( 0.0%,100.0%): dropping after 168
( 10)        8 ( 0.0%,100.0%): dropping after 14
( 11)        7 ( 0.0%,100.0%): dropping after 13
( 12)        7 ( 0.0%,100.0%): dropping after 24
```
stage 2 compiler is mostly trivial, but has a few cases where we get >5000
```rust
12987156 counts
(  1)  9280476 (71.5%, 71.5%): dropping after 0
(  2)  2277841 (17.5%, 89.0%): dropping after 1
(  3)   724888 ( 5.6%, 94.6%): dropping after 2
(  4)   204005 ( 1.6%, 96.2%): dropping after 4
(  5)   146537 ( 1.1%, 97.3%): dropping after 3
(  6)    64287 ( 0.5%, 97.8%): dropping after 5
(  7)    43938 ( 0.3%, 98.1%): dropping after 6
(  8)    43758 ( 0.3%, 98.4%): dropping after 8
(  9)    27220 ( 0.2%, 98.7%): dropping after 7
( 10)    17374 ( 0.1%, 98.8%): dropping after 9
( 11)    16015 ( 0.1%, 98.9%): dropping after 10
( 12)    12855 ( 0.1%, 99.0%): dropping after 12
( 13)    10494 ( 0.1%, 99.1%): dropping after 11
( 14)     7553 ( 0.1%, 99.2%): dropping after 14
```

[^1]: i've incremented a counter in the place I now decrement the depth at and then printed it on drop

r? `@compiler-errors`
2024-12-02 09:19:20 +00:00
Oli Scherer
1a976e0180 Re-add myself to rotation 2024-12-02 08:54:25 +00:00
许杰友 Jieyou Xu (Joe)
99c232223f Add needs-target-has-atomic directive
Before this commit, the test writer has to specify platforms and
architectures by hand for targets that have differing atomic width
support. `#[cfg(target_has_atomic)]` is not quite the same because (1)
you may have to specify additional matchers manually which has to be
maintained individually, and (2) the `#[cfg]` blocks does not
communicate to compiletest that a test would be ignored for a given
target.

This commit implements a `//@ needs-target-has-atomic` directive which
admits a comma-separated list of required atomic widths that the target
must satisfy in order for the test to run.

```
//@ needs-target-has-atomic: 8, 16, ptr
```

See <https://github.com/rust-lang/rust/issues/87377>.

Co-authored-by: kei519 <masaki.keigo.q00@kyoto-u.jp>
2024-12-02 14:51:03 +08:00
onur-ozkan
99e726b194 add "optimized-compiler-builtins" option coverage for ci-rustc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-02 08:44:46 +03:00