Commit Graph

255772 Commits

Author SHA1 Message Date
onur-ozkan
56dddd4c7e Remove deprecated field dist.missing-tools
It's been 5 months since this field was deprecated.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-25 10:35:07 +03: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
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
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
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
Nicholas Nethercote
c1ac4a2f28 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 15:17:21 +10:00
bors
7601adcc76 Auto merge of #125463 - GuillaumeGomez:rollup-287wx4y, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #125263 (rust-lld: fallback to rustc's sysroot if there's no path to the linker in the target sysroot)
 - #125345 (rustc_codegen_llvm: add support for writing summary bitcode)
 - #125362 (Actually use TAIT instead of emulating it)
 - #125412 (Don't suggest adding the unexpected cfgs to the build-script it-self)
 - #125445 (Migrate `run-make/rustdoc-with-short-out-dir-option` to `rmake.rs`)
 - #125452 (Cleanup check-cfg handling in core and std)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-24 03:04:06 +00:00
bors
78dd504f2f Auto merge of #123724 - joboet:static_tls, r=m-ou-se
Rewrite TLS on platforms without threads

The saga of #110897 continues!

r? `@m-ou-se` if you have time
2024-05-24 00:56:29 +00:00
Michael Goulet
a02aba7c54 Only suppress binop error in favor of semicolon suggestion if we're in an assignment statement 2024-05-23 19:22:55 -04:00
León Orell Valerian Liehr
39d9b840bb
Handle trait/impl GAC mismatches when inferring missing/placeholder types 2024-05-24 00:42:32 +02:00
León Orell Valerian Liehr
24afa42a90
Properly deal with missing/placeholder types inside GACs 2024-05-24 00:36:32 +02:00
Guillaume Gomez
a8a71d093e
Rollup merge of #125452 - Urgau:check-cfg-libraries-cleanup, r=bjorn3
Cleanup check-cfg handling in core and std

Follow-up to https://github.com/rust-lang/rust/pull/125296 where we:
 - expect any feature cfg in std, due to `#[path]` imports
 - move some check-cfg args inside the `build.rs` as per Cargo recommendation
 - and replace the fake Cargo feature `"restricted-std"` by the custom cfg `restricted_std`

Fixes https://github.com/rust-lang/rust/pull/125296#issuecomment-2127009301
r? `@bjorn3` (maybe, feel free to re-roll)
2024-05-23 23:39:29 +02:00
Guillaume Gomez
0de052acd8
Rollup merge of #125445 - GuillaumeGomez:rustdoc-migrate-short-out-dir, r=jieyouxu
Migrate `run-make/rustdoc-with-short-out-dir-option` to `rmake.rs`

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

r? `@jieyouxu`
2024-05-23 23:39:28 +02:00
Guillaume Gomez
56427d3372
Rollup merge of #125412 - Urgau:check-cfg-less-build-rs, r=wesleywiser
Don't suggest adding the unexpected cfgs to the build-script it-self

This PR adds a check to avoid suggesting to add the unexpected cfgs inside the build-script when building the build-script it-self, as it won't have any effect, since build-scripts applies to their descended target.

Fixes #125368
2024-05-23 23:39:28 +02:00
Guillaume Gomez
1e4bde1cb9
Rollup merge of #125362 - joboet:tait_hack, r=Nilstrieb
Actually use TAIT instead of emulating it

`core`'s `impl_fn_for_zst` macro is just a hacky way of emulating TAIT. TAIT has become stable enough to be used [in other places](e8fbd99128/library/std/src/backtrace.rs (L431)) inside the standard library, so let's use it in `core` as well.
2024-05-23 23:39:27 +02:00
Guillaume Gomez
4ee97fc3db
Rollup merge of #125345 - durin42:thin-link-bitcode, r=bjorn3
rustc_codegen_llvm: add support for writing summary bitcode

Typical uses of ThinLTO don't have any use for this as a standalone file, but distributed ThinLTO uses this to make the linker phase more efficient. With clang you'd do something like `clang -flto=thin -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o (full of bitcode) and foo.indexing.o (just the summary or index part of the bitcode). That's then usable by a two-stage linking process that's more friendly to distributed build systems like bazel, which is why I'm working on this area.

I talked some to `@teresajohnson` about naming in this area, as things seem to be a little confused between various blog posts and build systems. "bitcode index" and "bitcode summary" tend to be a little too ambiguous, and she tends to use "thin link bitcode" and "minimized bitcode" (which matches the descriptions in LLVM). Since the clang option is thin-link-bitcode, I went with that to try and not add a new spelling in the world.

Per `@dtolnay,` you can work around the lack of this by using `lld --thinlto-index-only` to do the indexing on regular .o files of bitcode, but that is a bit wasteful on actions when we already have all the information in rustc and could just write out the matching minimized bitcode. I didn't test that at all in our infrastructure, because by the time I learned that I already had this patch largely written.
2024-05-23 23:39:26 +02:00
Guillaume Gomez
d6a1f1d3fc
Rollup merge of #125263 - lqd:lld-fallback, r=petrochenkov
rust-lld: fallback to rustc's sysroot if there's no path to the linker in the target sysroot

As seen in #125246, some sysroots don't expect to contain `rust-lld` and want to keep it that way, so we fallback to the default rustc sysroot if there is no path to the linker in any of the sysroot tools search paths. This is how we locate codegen-backends' dylibs already.

People also have requested an error if none of these search paths contain the self-contained linker directory, so there's also an error in that case.

r? `@petrochenkov` cc `@ehuss` `@RalfJung`

I'm not sure where we check for `rust-lld`'s existence on the targets where we use it by default, and if we just ignore it when missing or emit a warning (as I assume we don't emit an error), so I just checked for the existence of `gcc-ld`, where `cc` will look for the lld-wrapper binaries.

<sub>*Feel free to point out better ways to do this, it's the middle of the night here.*</sub>

Fixes #125246
2024-05-23 23:39:26 +02:00
bors
8679004993 Auto merge of #125434 - nnethercote:rm-more-extern-tracing, r=jackh726
Remove more `#[macro_use] extern crate tracing`

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. Continuing the work from #124511 and #124914.

r? `@jackh726`
2024-05-23 21:36:54 +00:00
bors
5baee04b63 Auto merge of #125456 - fmease:rollup-n8608gc, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #122382 (Detect unused structs which implement private traits)
 - #124389 (Add a warning to proc_macro::Delimiter::None that rustc currently does not respect it.)
 - #125224 (Migrate `run-make/issue-53964` to `rmake`)
 - #125227 (Migrate `run-make/issue-30063` to `rmake`)
 - #125336 (Add dedicated definition for intrinsics)
 - #125401 (Migrate `run-make/rustdoc-scrape-examples-macros` to `rmake.rs`)
 - #125454 (Improve the doc of query associated_item)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-23 19:27:20 +00:00