Commit Graph

255789 Commits

Author SHA1 Message Date
Matthias Krüger
d747148ba8
Rollup merge of #125514 - compiler-errors:builtin-index, r=lcnr
Structurally resolve before `builtin_index` in EUV

r? lcnr
2024-05-25 12:54:37 +02:00
Matthias Krüger
3fc8fe0490
Rollup merge of #125513 - compiler-errors:impossible-drop, r=jackh726
Don't eagerly monomorphize drop for types that are impossible to instantiate

Self-explanatory title I think

Fixes #125509
2024-05-25 12:54:36 +02:00
Matthias Krüger
00c51bda3f
Rollup merge of #125510 - lcnr:change-proof-trees-to-be-shallow, r=compiler-errors
remove proof tree formatting, make em shallow

Debugging via tracing `RUSTC_LOG=rustc_trait_selection::solve=debug` is now imo slightly more readable then the actual proof tree formatter. Removing everything that's not needed for the `analyse` visitor allows us to remove a bunch of code.

I personally believe that we should continue to use tracing over proof trees for debugging:
- it eagerly prints, allowing us to debug ICEs
- the proof tree builder ends up going out of sync with the actual runtime behavior, which is confusing
- using shallow proof trees is a lot more performant as we frequently do not recurse into all nested goals when using an analyse visitor
- this allows us to clean up the implementation and remove some code

r? ```@compiler-errors```
2024-05-25 12:54:36 +02:00
Matthias Krüger
4d13c96c65
Rollup merge of #125498 - zmodem:avx512er, r=workingjubilee
Stop using the avx512er and avx512pf x86 target features

They are no longer supported by LLVM 19.

Fixes #125492
2024-05-25 12:54:35 +02:00
Matthias Krüger
e58a0a8961
Rollup merge of #125478 - Urgau:check-cfg-config-bump-stage0, r=Mark-Simulacrum
Bump bootstrap compiler to the latest beta compiler

This PR updates the bootstrap compiler, aka stage0 to the latest beta version, since it contains rust-lang/cargo#13925.

It removes those unconditional Cargo warnings:

```
warning: [...]/rust/library/core/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/std/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/alloc/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
```

for all contributors/users of this repository (including CI).

I don't know if that's something we do, or if it's even advisable, feel free to close.

r? `@Mark-Simulacrum`
2024-05-25 12:54:35 +02:00
Matthias Krüger
7ea507e041
Rollup merge of #125451 - oli-obk:const_type_mismatch, r=compiler-errors
Fail relating constants of different types

fixes #121585
fixes #121858
fixes #124151

I gave this several attempts before, but we lost too many important diagnostics until I managed to make compilation never bail out early. We have reached this point, so now we can finally fix all those ICEs by bubbling up an error instead of continueing when we encounter a bug.
2024-05-25 12:54:34 +02:00
Matthias Krüger
f28d36899c
Rollup merge of #125271 - RalfJung:posix_memalign, r=workingjubilee
use posix_memalign on almost all Unix targets

Seems nice to be able to use a single common codepath for all of them. :) The `libc` crate says this symbol exists for all Unix targets. I did locally do check-builds to ensure this still builds, but I can't really test more than that.

- For redox, I found indications posix_memalign really exists [here](https://gitlab.redox-os.org/redox-os/relibc/-/merge_requests/271)
- For esp-idf, I found indications [here](c5b297a86f)
- ~~For horizon and vita (these seem to be gaming console OSes? "Horizon OS" also has some hits for a Facebook product but that seems unrelated), they seem to be based on "newlib", where posix_memalign [seems to exist](https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=3ba2c39fb2a12cd7332ef16b1b3e3df994f7c6f5).~~ Turns out no, this 20-year-old standard POSIX function is unfortunately [not supported](https://github.com/rust-lang/rust/pull/125271#issuecomment-2119221419) here.
2024-05-25 12:54:34 +02:00
Michael Goulet
045f448e26 Don't eagerly monomorphize drop for types that are impossible to instantiate 2024-05-24 21:53:39 -04:00
bors
21e6de7eb6 Auto merge of #124187 - compiler-errors:self-ctor, r=petrochenkov
Warn (or error) when `Self` ctor from outer item is referenced in inner nested item

This implements a warning `SELF_CONSTRUCTOR_FROM_OUTER_ITEM` when a self constructor from an outer impl is referenced in an inner nested item. This is a proper fix mentioned https://github.com/rust-lang/rust/pull/117246#discussion_r1374648388.

This warning is additionally bumped to a hard error when the self type references generic parameters, since it's almost always going to ICE, and is basically *never* correct to do.

This also reverts part of https://github.com/rust-lang/rust/pull/117246, since I believe this is the proper fix and we shouldn't need the helper functions (`opt_param_at`/`opt_type_param`) any longer, since they shouldn't really ever be used in cases where we don't have this problem.
2024-05-25 01:17:55 +00:00
bors
36153f1a4e Auto merge of #125521 - matthiaskrgr:rollup-ph2bz3h, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #125467 (Only suppress binop error in favor of semicolon suggestion if we're in an assignment statement)
 - #125483 (compiler: validate.rs belongs next to what it validates)
 - #125485 (Migrate `run-make/rustdoc-with-output-dir-option` to `rmake.rs`)
 - #125497 (Fix some SIMD intrinsics documentation)
 - #125501 (Resolve anon const's parent predicates to direct parent instead of opaque's parent)
 - #125503 (rustdoc-json: Add test for keywords with `--document-private-items`)
 - #125519 (tag more stuff with `WG-trait-system-refactor`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-24 21:10:48 +00:00
Matthias Krüger
ee54e29333
Rollup merge of #125519 - lcnr:tag-next-solver, r=compiler-errors
tag more stuff with `WG-trait-system-refactor`

r? `@compiler-errors`
2024-05-24 23:01:12 +02:00
Matthias Krüger
f1eef384bb
Rollup merge of #125503 - aDotInTheVoid:rdj-keyword-attr, r=GuillaumeGomez
rustdoc-json: Add test for keywords with `--document-private-items`

Turns out this does work as-expected. I was worried that the rustdoc's clean would produce a `ItemKind::KeywordItem` for the module, and loose the module itself. But turns out we get this right.

Prompted by [this discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Where.20to.20find.20keyword.20entries.20in.20JSON.20rustdoc)

r? `@GuillaumeGomez`
2024-05-24 23:01:12 +02:00
Matthias Krüger
104e1a4bf2
Rollup merge of #125501 - compiler-errors:opaque-opaque-anon-ct, r=BoxyUwU
Resolve anon const's parent predicates to direct parent instead of opaque's parent

When an anon const is inside of an opaque, #99801 added a hack to resolve the anon const's parent predicates *not* to the opaque's predicates, but to the opaque's *parent's* predicates. This is insufficient when considering nested opaques.

This means that the `predicates_of` an anon const might reference duplicated lifetimes (installed by `compute_bidirectional_outlives_predicates`) when computing known outlives in MIR borrowck, leading to these ICEs:
Fixes #121574
Fixes #118403

~~Instead, we should be using the `OpaqueTypeOrigin` to acquire the owner item (fn/type alias/etc) of the opaque, whose predicates we're fine to mention.~~

~~I think it's a bit sketchy that we're doing this at all, tbh; I think it *should* be fine for the anon const to inherit the predicates of the opaque it's located inside. However, that would also mean that we need to make sure the `generics_of` that anon const line up in the same way.~~

~~None of this is important to solve right now; I just want to fix these ICEs so we can land #125468, which accidentally fixes these issues in a different and unrelated way.~~

edit: We don't need this special case anyways because we install the right parent item in `generics_of` anyways:
213ad10c8f/compiler/rustc_hir_analysis/src/collect/generics_of.rs (L150)

r? `@BoxyUwU`
2024-05-24 23:01:11 +02:00
Matthias Krüger
363fbb967e
Rollup merge of #125497 - meesfrensel:patch-1, r=calebzulawski
Fix some SIMD intrinsics documentation

Spotted some mistakes in the docs of some SIMD intrinsics.
2024-05-24 23:01:10 +02:00
Matthias Krüger
09047b8700
Rollup merge of #125485 - GuillaumeGomez:migrate-rmake-rustdoc, r=jieyouxu
Migrate `run-make/rustdoc-with-output-dir-option` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-05-24 23:01:10 +02:00
Matthias Krüger
f23ebf0410
Rollup merge of #125483 - workingjubilee:move-transform-validate-to-mir-transform, r=oli-obk
compiler: validate.rs belongs next to what it validates

It's hard to find code that is deeply nested and far away from its callsites, so let's move `rustc_const_eval::transform::validate` into `rustc_mir_transform`, where all of its callers are. As `rustc_mir_transform` already depends on `rustc_const_eval`, the added visible dependency edge doesn't mean the dependency tree got any worse.

This also lets us unnest the `check_consts` module.

I did look into moving everything inside `rustc_const_eval::transform` into `rustc_mir_transform`. It turned out to be a much more complex operation, with more concerns and real edges into the `const_eval` crate, whereas this was both faster and more obvious.
2024-05-24 23:01:09 +02:00
Matthias Krüger
fafe13aea4
Rollup merge of #125467 - compiler-errors:binop-in-bool-expectation, r=estebank
Only suppress binop error in favor of semicolon suggestion if we're in an assignment statement

Similar to #123722, we are currently too aggressive when delaying a binop error with the expectation that we'll emit another error elsewhere. This adjusts that heuristic to be more accurate, at the cost of some possibly poorer suggestions.

Fixes #125458
2024-05-24 23:01:09 +02:00
lcnr
c97ed58c38 tag more stuff with WG-trait-system-refactor 2024-05-24 20:27:47 +00:00
Michael Goulet
61aac551b8 Structurally resolve before builtin_index in EUV 2024-05-24 16:20:48 -04:00
Michael Goulet
1af490de42 Better ICE message for unresolved upvars 2024-05-24 15:47:50 -04:00
bors
697ac29a80 Auto merge of #125499 - matthiaskrgr:rollup-84i5z5w, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #125455 (Make `clamp` inline)
 - #125477 (Run rustfmt on files that need it.)
 - #125481 (Fix the dead link in the bootstrap README)
 - #125482 (Notify kobzol after changes to `opt-dist`)
 - #125489 (Revert problematic opaque type change)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-24 18:53:03 +00:00
lcnr
ebd9f355e2 remove proof tree formatter, make em shallow 2024-05-24 18:41:31 +00:00
Hans Wennborg
3fe3157858 Stop using the avx512er and avx512pf x86 target features
They are no longer supported by LLVM 19.

Fixes #125492
2024-05-24 20:12:42 +02:00
Michael Goulet
de517b79bc Actually just remove the special case altogether 2024-05-24 13:16:06 -04:00
Jubilee Young
14fc3fdb2c miri: receive the blessings of validate.rs 2024-05-24 09:56:56 -07:00
Jubilee Young
584975d606 clippy: unnest check_consts 2024-05-24 09:56:56 -07:00
Jubilee Young
87048a46fc compiler: unnest rustc_const_eval::check_consts 2024-05-24 09:56:56 -07:00
Jubilee Young
db6ec2618a compiler: const_eval/transform/validate.rs -> mir_transform/validate.rs 2024-05-24 09:56:56 -07:00
Alona Enraght-Moony
3ee84983f1 rustdoc-json: Add test for keywords with --document-private-items 2024-05-24 16:40:20 +00:00
Matthias Krüger
1a165ecb9b
Rollup merge of #125489 - oli-obk:revert_stuff_2, r=compiler-errors
Revert problematic opaque type change

fixes https://github.com/rust-lang/rust/issues/124891
fixes https://github.com/rust-lang/rust/issues/125192

reverts https://github.com/rust-lang/rust/pull/123979
2024-05-24 17:48:04 +02:00
Matthias Krüger
54a2bd8e74
Rollup merge of #125482 - Kobzol:triagebot-opt-dist, r=lqd
Notify kobzol after changes to `opt-dist`

r? ``@Mark-Simulacrum``
2024-05-24 17:48:04 +02:00
Matthias Krüger
a2a68f2d3d
Rollup merge of #125481 - iawia002:fix-dead-link, r=lqd
Fix the dead link in the bootstrap README

This link has been changed since https://github.com/rust-lang/rustc-dev-guide/pull/1939
2024-05-24 17:48:03 +02:00
Matthias Krüger
eb6297eb6f
Rollup merge of #125477 - nnethercote:missed-rustfmt, r=compiler-errors
Run rustfmt on files that need it.

Somehow these files aren't properly formatted. By default `x fmt` and `x tidy` only check files that have changed against master, so if an ill-formatted file somehow slips in it can stay that way as long as it doesn't get modified(?)

I found these when I ran `x fmt` explicitly on every `.rs` file in the repo, while working on
https://github.com/rust-lang/compiler-team/issues/750.
2024-05-24 17:48:03 +02:00
Matthias Krüger
268657b40b
Rollup merge of #125455 - blyxyas:opt-clamp, r=joboet
Make `clamp` inline

Context: rust-lang/rust-clippy#12826
This results in slightly more optimized assembly. (And most important, it's now less than lines than just manually clamping a value)
2024-05-24 17:48:02 +02:00
Mees Frensel
a85f6a6640
Fix some SIMD intrinsics documentation 2024-05-24 17:34:12 +02:00
bors
9e297bf54d Auto merge of #122494 - joboet:simplify_key_tls, r=m-ou-se
Simplify key-based thread locals

This PR simplifies key-based thread-locals by:
* unifying the macro expansion of `const` and non-`const` initializers
* reducing the amount of code in the expansion
* simply reallocating on recursive initialization instead of going through `LazyKeyInner`
* replacing `catch_unwind` with the shared `abort_on_dtor_unwind`

It does not change the initialization behaviour described in #110897.
2024-05-24 15:34:07 +00:00
Oli Scherer
526090b901 Add regression tests 2024-05-24 14:01:49 +00:00
Oli Scherer
56c135c925 Revert "Rollup merge of #123979 - oli-obk:define_opaque_types7, r=compiler-errors"
This reverts commit f939d1ff48, reversing
changes made to 183c706305.
2024-05-24 13:21:59 +00:00
bors
213ad10c8f Auto merge of #121150 - Swatinem:debug-ascii-str, r=joboet
Add a fast-path to `Debug` ASCII `&str`

Instead of going through the `EscapeDebug` machinery, we can just skip over ASCII chars that don’t need any escaping.

---

This is an alternative / a companion to https://github.com/rust-lang/rust/pull/121138.

The other PR is adding the fast path deep within `EscapeDebug`, whereas this skips as early as possible.
2024-05-24 12:23:00 +00:00
joboet
0e7e75ebca
std: clean up the TLS implementation 2024-05-24 12:28:05 +02:00
joboet
5f0531da05
std: simplify key-based thread locals 2024-05-24 11:36:50 +02:00
Guillaume Gomez
daff84372d Migrate run-make/rustdoc-with-output-dir-option to rmake.rs 2024-05-24 11:19:30 +02:00
Oli Scherer
d5eb7a71b3 Use regular type equating instead of a custom query 2024-05-24 09:15:43 +00:00
Oli Scherer
9dc76207ff Fail relating constants of different types 2024-05-24 09:15:43 +00:00
bors
464987730a Auto merge of #125479 - scottmcm:validate-vtable-projections, r=Nilstrieb
Validate the special layout restriction on `DynMetadata`

If you look at <https://stdrs.dev/nightly/x86_64-unknown-linux-gnu/std/ptr/struct.DynMetadata.html>, you'd think that `DynMetadata` is a struct with fields.

But it's actually not, because the lang item is special-cased in rustc_middle layout:

7601adcc76/compiler/rustc_middle/src/ty/layout.rs (L861-L864)

That explains the very confusing codegen ICEs I was getting in https://github.com/rust-lang/rust/pull/124251#issuecomment-2128543265

> Tried to extract_field 0 from primitive OperandRef(Immediate((ptr:  %5 = load ptr, ptr %4, align 8, !nonnull !3, !align !5, !noundef !3)) @ TyAndLayout { ty: DynMetadata<dyn Callsite>, layout: Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Scalar(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Primitive, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } })

because there was a `Field` projection despite the layout clearly saying it's [`Primitive`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/enum.FieldsShape.html#variant.Primitive).

Thus this PR updates the MIR validator to check for such a projection, and changes `libcore` to not ever emit any projections into `DynMetadata`, just to transmute the whole thing when it wants a pointer.
2024-05-24 08:53:27 +00:00
Jakub Beránek
e2ef4e1b0d
Notify kobzol after changes to opt-dist 2024-05-24 10:36:44 +02:00
Xinzhao Xu
e78671e61f Fix the dead link in the bootstrap README 2024-05-24 15:44:12 +08:00
bors
7c547894c7 Auto merge of #125457 - fmease:gacs-diag-infer-plac-missing-ty, r=compiler-errors
Properly deal with missing/placeholder types inside GACs

Fixes #124833.

r? oli-obk (#123130)
2024-05-24 06:45:40 +00:00
Scott McMurray
d83f3ca8ca Validate the special layout restriction on DynMetadata 2024-05-23 23:38:44 -07:00
Urgau
02eada8f8d Remove now outdated comment since we bumped stage0 2024-05-24 08:08:41 +02:00