about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-05-24tag more stuff with `WG-trait-system-refactor`lcnr-1/+4
2024-05-24Auto merge of #122494 - joboet:simplify_key_tls, r=m-ou-sebors-189/+63
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-24Auto merge of #121150 - Swatinem:debug-ascii-str, r=joboetbors-20/+43
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-24std: clean up the TLS implementationjoboet-5/+4
2024-05-24std: simplify key-based thread localsjoboet-185/+60
2024-05-24Auto merge of #125479 - scottmcm:validate-vtable-projections, r=Nilstriebbors-8/+28
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: https://github.com/rust-lang/rust/blob/7601adcc764d42c9f2984082b49948af652df986/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-24Auto merge of #125457 - fmease:gacs-diag-infer-plac-missing-ty, ↵bors-14/+79
r=compiler-errors Properly deal with missing/placeholder types inside GACs Fixes #124833. r? oli-obk (#123130)
2024-05-23Validate the special layout restriction on DynMetadataScott McMurray-8/+28
2024-05-24Auto merge of #125463 - GuillaumeGomez:rollup-287wx4y, r=GuillaumeGomezbors-187/+335
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-24Auto merge of #123724 - joboet:static_tls, r=m-ou-sebors-70/+76
Rewrite TLS on platforms without threads The saga of #110897 continues! r? `@m-ou-se` if you have time
2024-05-24Handle trait/impl GAC mismatches when inferring missing/placeholder typesLeón Orell Valerian Liehr-16/+27
2024-05-24Properly deal with missing/placeholder types inside GACsLeón Orell Valerian Liehr-4/+58
2024-05-23Rollup merge of #125452 - Urgau:check-cfg-libraries-cleanup, r=bjorn3Guillaume Gomez-10/+21
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-23Rollup merge of #125445 - GuillaumeGomez:rustdoc-migrate-short-out-dir, ↵Guillaume Gomez-9/+16
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-23Rollup merge of #125412 - Urgau:check-cfg-less-build-rs, r=wesleywiserGuillaume Gomez-24/+107
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-23Rollup merge of #125362 - joboet:tait_hack, r=NilstriebGuillaume Gomez-117/+44
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](https://github.com/rust-lang/rust/blob/e8fbd991287f637f95016a71ddc13438415bbe59/library/std/src/backtrace.rs#L431) inside the standard library, so let's use it in `core` as well.
2024-05-23Rollup merge of #125345 - durin42:thin-link-bitcode, r=bjorn3Guillaume Gomez-18/+107
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-23Rollup merge of #125263 - lqd:lld-fallback, r=petrochenkovGuillaume Gomez-9/+40
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-23Auto merge of #125434 - nnethercote:rm-more-extern-tracing, r=jackh726bors-65/+193
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-23Auto merge of #125456 - fmease:rollup-n8608gc, r=fmeasebors-114/+322
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-23rustc_codegen_gcc: fix changed method signatureAugie Fackler-1/+1
2024-05-23Process a single not-ASCII-printable `char` per iterationArpad Borsos-8/+5
This avoids having to collect a non-ASCII-printable run before processing it.
2024-05-23cleanup: run rustfmtAugie Fackler-12/+26
2024-05-23cleanup: standardize on summary over index in namesAugie Fackler-11/+11
I did this in the user-facing logic, but I noticed while fixing a minor defect that I had missed it in a few places in the internal details.
2024-05-23thinlto: only build summary file if neededAugie Fackler-14/+17
If we don't do this, some versions of LLVM (at least 17, experimentally) will double-emit some error messages, which is how I noticed this. Given that it seems to be costing some extra work, let's only request the summary bitcode production if we'll actually bother writing it down, otherwise skip it.
2024-05-23Rollup merge of #125454 - mu001999-contrib:master, r=oli-obkLeón Orell Valerian Liehr-1/+1
Improve the doc of query associated_item <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> This query also maps from a impl item to the impl item "descriptor". So it's a bit confused, I skipped it cause it doesn't say it contains impl items. ```rust fn associated_item(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AssocItem { let id = tcx.local_def_id_to_hir_id(def_id); let parent_def_id = tcx.hir().get_parent_item(id); let parent_item = tcx.hir().expect_item(parent_def_id.def_id); match parent_item.kind { hir::ItemKind::Impl(impl_) => { if let Some(impl_item_ref) = impl_.items.iter().find(|i| i.id.owner_id.def_id == def_id) { let assoc_item = associated_item_from_impl_item_ref(impl_item_ref); debug_assert_eq!(assoc_item.def_id.expect_local(), def_id); return assoc_item; } } hir::ItemKind::Trait(.., trait_item_refs) => { if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.owner_id.def_id == def_id) { let assoc_item = associated_item_from_trait_item_ref(trait_item_ref); debug_assert_eq!(assoc_item.def_id.expect_local(), def_id); return assoc_item; } } _ => {} } span_bug!( parent_item.span, "unexpected parent of trait or impl item or item not found: {:?}", parent_item.kind ) } ```
2024-05-23Rollup merge of #125401 - ↵León Orell Valerian Liehr-20/+64
GuillaumeGomez:migrate-rustdoc-scrape-examples-macros, r=jieyouxu Migrate `run-make/rustdoc-scrape-examples-macros` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `````@jieyouxu`````
2024-05-23Rollup merge of #125336 - momvart:smir-77-intrinsic, r=celinvalLeón Orell Valerian Liehr-33/+111
Add dedicated definition for intrinsics Closes rust-lang/project-stable-mir#77
2024-05-23Rollup merge of #125227 - Oneirical:seventh, r=jieyouxuLeón Orell Valerian Liehr-37/+38
Migrate `run-make/issue-30063` to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). (Sorry about the [inconvenience](https://github.com/rust-lang/rust/pull/125224#issuecomment-2118340932) of all these PRs, this is the last one batched for today. I will discuss how we can cut these down a bit.) The last check was previously commented out in the Makefile, and I have readded it. If it fails the CI, this can be reconsidered.
2024-05-23Rollup merge of #125224 - Oneirical:sixth, r=jieyouxuLeón Orell Valerian Liehr-6/+12
Migrate `run-make/issue-53964` to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). This is extremely similar to #125146. Could it be interesting to merge the two in some way? This one seems to do the same thing as the #125146, but with an added check that a useless lint is not shown.
2024-05-23Rollup merge of #124389 - CensoredUsername:master, r=petrochenkovLeón Orell Valerian Liehr-0/+12
Add a warning to proc_macro::Delimiter::None that rustc currently does not respect it. It does not provide the behaviour it is indicated to provide when used in a proc_macro context. This seems to be a bug, (https://github.com/rust-lang/rust/issues/67062), but it is a long standing one, and hard to discover. This pull request adds a warning to inform users of this issue, with a link to the relevant issue, and a version number of the last known affected rustc version.
2024-05-23Rollup merge of #122382 - mu001999:dead_code/enhance, r=petrochenkovLeón Orell Valerian Liehr-17/+84
Detect unused structs which implement private traits Fixes #122361
2024-05-23Auto merge of #117804 - saethlin:no-recursive-panics, r=joboetbors-2/+5
Panic directly in Arguments::new* instead of recursing This has been bothering me because it looks very silly in MIR.
2024-05-23Improve the doc of query associated_itemr0cky-1/+1
2024-05-23emit an error if we can't find a path to the self-contained linkerRémy Rakic-3/+9
2024-05-23rust-lld: fallback to the default default sysroot where rustc is currently ↵Rémy Rakic-9/+26
located
2024-05-23Add conversion from IntrinsicDef to FnDefMohammad Omidvar-6/+16
2024-05-23Auto merge of #116123 - joboet:rewrite_native_tls, r=m-ou-sebors-332/+331
Rewrite native thread-local storage (part of #110897) The current native thread-local storage implementation has become quite messy, uses indescriptive names and unnecessarily adds code to the macro expansion. This PR tries to fix that by using a new implementation that also allows more layout optimizations and potentially increases performance by eliminating unnecessary TLS accesses. This does not change the recursive initialization behaviour I described in [this comment](https://github.com/rust-lang/rust/issues/110897#issuecomment-1525705682), so it should be a library-only change. Changing that behaviour should be quite easy now, however. r? `@m-ou-se` `@rustbot` label +T-libs
2024-05-23Copy core/alloc check-cfg message also in stdUrgau-0/+3
2024-05-23Move some expected cfgs to std build.rs as per Cargo recommandationUrgau-6/+7
2024-05-23Replace fake "restricted-std" Cargo feature by custom cfgUrgau-3/+5
2024-05-23panic_nounwind in Arguments::new* instead of recursingBen Kimock-2/+5
2024-05-23Expect any feature cfg in core and std cratesUrgau-2/+7
2024-05-23Auto merge of #125448 - matthiaskrgr:rollup-vn6nleh, r=matthiaskrgrbors-155/+404
Rollup of 8 pull requests Successful merges: - #124297 (Allow coercing functions whose signature differs in opaque types in their defining scope into a shared function pointer type) - #124516 (Allow monomorphization time const eval failures if the cause is a type layout issue) - #124976 (rustc: Use `tcx.used_crates(())` more) - #125210 (Cleanup: Fix up some diagnostics) - #125409 (Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows`) - #125416 (Use correct param-env in `MissingCopyImplementations`) - #125421 (Rewrite `core-no-oom-handling`, `issue-24445` and `issue-38237` `run-make` tests to new `rmake.rs` format) - #125438 (Remove unneeded string conversion) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-23Rollup merge of #125438 - tbu-:pr_rm_to_string_lossy, r=jieyouxuMatthias Krüger-5/+5
Remove unneeded string conversion
2024-05-23Rollup merge of #125421 - Oneirical:bundle-them-yet-again, r=jieyouxuMatthias Krüger-30/+85
Rewrite `core-no-oom-handling`, `issue-24445` and `issue-38237` `run-make` tests to new `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). The test which is now called `non-pie-thread-local` has an unexplained "only-linux" flag. Could it be worth trying to remove it and changing the CI to test non-Linux platforms on it?
2024-05-23Rollup merge of #125416 - compiler-errors:param-env-missing-copy, r=lcnrMatthias Krüger-5/+25
Use correct param-env in `MissingCopyImplementations` We shouldn't assume the param-env is empty for this lint, since although we check the struct has no parameters, there still may be trivial where-clauses. fixes #125394
2024-05-23Rollup merge of #125409 - tbu-:pr_raw_dylib_only_windows, r=lcnrMatthias Krüger-6/+6
Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows` Frameworks are Apple-specific, no idea why it had "framework" in the name before.
2024-05-23Rollup merge of #125210 - fmease:fix-up-some-diags, r=davidtwcoMatthias Krüger-47/+57
Cleanup: Fix up some diagnostics Several diagnostics contained their error code inside their primary message which is no bueno. This PR moves them out of the message and turns them into structured error codes. Also fixes another occurrence of `->` after a selector in a Fluent message which is not correct. I've fixed two other instances of this issue in #104345 (2022) but didn't update all instances as I've noted here: https://github.com/rust-lang/rust/pull/104345#issuecomment-1312705977 (“the future is now!”).
2024-05-23Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obkMatthias Krüger-47/+54
rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from https://github.com/rust-lang/rust/pull/121167.