about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-03-15Aggressively ignore write errors during bad-allocJosh Stone-3/+3
2024-03-15Register LLVM handlers for bad-alloc / OOMJosh Stone-3/+26
LLVM's default bad-alloc handler may throw if exceptions are enabled, and `operator new` isn't hooked at all by default. Now we register our own handler that prints a message similar to fatal errors, then aborts. We also call the function that registers the C++ `std::new_handler`.
2024-03-15Auto merge of #122341 - compiler-errors:alias-wfness, r=lcnrbors-26/+68
Consolidate WF for aliases Make RPITs/TAITs/weak (type) aliases/projections all enforce: 1. their nominal predicates 2. their args are WF This possibly does extra work, but is also nice for consistency sake. r? lcnr
2024-03-15Auto merge of #122555 - GuillaumeGomez:rollup-tr6wu54, r=GuillaumeGomezbors-303/+248
Rollup of 6 pull requests Successful merges: - #114651 (rustdoc: add `--test-builder-wrapper` arg to support wrappers such as RUSTC_WRAPPER when building doctests) - #122468 (Cleanup `MirBorrowckCtxt::prefixes`) - #122496 (Greatly reduce GCC build logs) - #122512 (Cursor.rs documentation fix) - #122513 (hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`) - #122530 (less symbol interner locks) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-15Rollup merge of #122530 - klensy:as_str, r=fee1-deadGuillaume Gomez-6/+8
less symbol interner locks This reduces instructions under 1% (in rustdoc run), but essentially free.
2024-03-15Rollup merge of #122513 - petrochenkov:somehir4, r=fmeaseGuillaume Gomez-199/+135
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` Also replace a few `hir_node()` calls with `hir_node_by_def_id()`. Follow up to https://github.com/rust-lang/rust/pull/120943.
2024-03-15Rollup merge of #122512 - baitcode:2024-03-14-buffer-documentation-fix, ↵Guillaume Gomez-0/+2
r=Nilstrieb Cursor.rs documentation fix Reason: I've been learning Rust std library and got confused. Seek trait documentation clearly states that negative indexes will cause an error. And the code in the Cursor example uses negative index. I found myself trying to understand what am I missing until I've actually executed the code and got error. I decided to submit small fix to the documentation.
2024-03-15Rollup merge of #122496 - GuillaumeGomez:reduce-gcc-build-logs, ↵Guillaume Gomez-8/+15
r=Mark-Simulacrum Greatly reduce GCC build logs Fixes https://github.com/rust-lang/rust-log-analyzer/issues/80. Based on [makefile documentation](https://www.gnu.org/software/make/manual/html_node/Options-Summary.html#index-_002d_002dquiet-1) and [configure documentation](https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/configure-Invocation.html). cc `@RalfJung` `@antoyo`
2024-03-15Rollup merge of #122468 - beepster4096:borrowck_prefixes_cleanup, r=NadrierilGuillaume Gomez-88/+28
Cleanup `MirBorrowckCtxt::prefixes` Some of the uses of this method aren't necessary anymore and `PrefixSet::Supporting` is not used anywhere. With `PrefixSet::Supporting` removed, this could technically be moved to an extension trait on `PlaceRef`. However, it would have to be moved back to `MirBorrowckCtxt` when the `Derefer` MIR pass is moved before borrowck so I didn't.
2024-03-15Rollup merge of #114651 - tmfink:rustdoc-rustc-wrapper, r=GuillaumeGomezGuillaume Gomez-2/+60
rustdoc: add `--test-builder-wrapper` arg to support wrappers such as RUSTC_WRAPPER when building doctests Currently, `rustdoc` builds test crates with `rustc` directly instead of using [`RUSTC_WRAPPER`](https://doc.rust-lang.org/cargo/reference/config.html#buildrustc-wrapper) (if any is set). This causes build issues in build systems that use `cargo` but tweak linking flags by setting the `RUSTC_WRAPPER` environment variable. This change is not meant to be final--it's only a minimal proof of concept. Please advise on the best way to proceed. Open questions: - [x] Does supporting the `rustc` wrappers make sense? - yes, `cargo-miri` for example needs a "hack" to workaround the issue - [X] What environment variable(s) should be read for the rustc wrapper? Should `rustdoc` [use the same names as `cargo`](https://doc.rust-lang.org/cargo/reference/config.html#buildrustc-wrapper)? - None, since `rustdoc` takes arguments - [X] What name should be used for a `rustdoc` CLI option? - `--test-builder-wrapper` - [X] Should a separate workspace wrapper (like `RUSTC_WORKSPACE_WRAPPER`) be supported? - `--test-builder-wrapper` can be passed multiple times to get multiple wrappers passed - [X] How/where should this be documented? It's not obvious to all users that `cargo doc` actually causes `rustdoc` to compile tests with rust - Added doc to `src/doc/rustdoc/src/command-line-arguments.md` per `@GuillaumeGomez`
2024-03-15Build GCC with as many threads as availableGuillaume Gomez-3/+3
2024-03-15Greatly reduce GCC build logsGuillaume Gomez-7/+14
2024-03-15Auto merge of #121297 - michaelwoerister:set-pdb-alt-path, r=wesleywiserbors-0/+53
link.exe: Don't embed full path to PDB file in binary. This PR makes `rustc` unconditionally pass `/PDBALTPATH:%_PDB%` to MSVC-style linkers, causing the linker to only embed the filename of the PDB in the binary instead of the full path. This will help implement the [trim-paths RFC](https://github.com/rust-lang/rust/issues/111540) for `*-msvc` targets. Passing `/PDBALTPATH:%_PDB%` to the linker is already done by many projects that need reproducible builds and [debugger's should still be able to find the PDB](https://learn.microsoft.com/cpp/build/reference/pdbpath) if it is in the same directory as the binary. r? `@ghost` Fixes https://github.com/rust-lang/rust/issues/87825
2024-03-15Auto merge of #122538 - RalfJung:miri, r=RalfJungbors-653/+59
Miri subtree update r? `@ghost`
2024-03-15doc: add --test-builder/--test-builder-wrapperTravis Finkenauer-0/+29
2024-03-15Auto merge of #122534 - matthiaskrgr:rollup-p95i3ph, r=matthiaskrgrbors-237/+542
Rollup of 7 pull requests Successful merges: - #121207 (Add `-Z external-clangrt`) - #122174 (diagnostics: suggest `Clone` bounds when noop `clone()`) - #122471 (preserve span when evaluating mir::ConstOperand) - #122515 (Pass the correct DefId when suggesting writing the aliased Self type out) - #122523 (Ensure RPITITs are created before def-id freezing) - #122526 (Docs for `thir::ExprKind::Use` and `thir::ExprKind::Let`) - #122527 (Clean up AstConv) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-15Rollup merge of #122527 - fmease:clean-up-hir-ty-lowering, r=compiler-errorsMatthias Krüger-208/+142
Clean up AstConv Split off from #120926 to make it only contain the renaming & (doc) comment updates. Any changes other than that which have accumulated over time are now part of this PR. Let's be disciplined ;) Inspired by https://github.com/rust-lang/rust/pull/120926#issuecomment-1997984483. --- * Remove `hir_trait_to_predicates` * Unused since #113671 * Inline `create_args_for_ast_trait_ref` * Only had a single call site * Having it as a separate method didn't gain us anything * Use an if-let guard somewhere to avoid unwrapping * Avoid explicit trait object lifetimes * More legible, stylistic-only (the updated code is 100% semantically identical) * Use explicitly elided lifetimes in impl headers, they get elaborated to distinct lifetimes * Make use of [object lifetime defaulting](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) for a trait object type inside of a reference type somewhere * Use preexisting dedicated method `ItemCtxt::to_ty` over `<dyn AstConv<'_>>::ast_ty_to_ty` * Use preexisting dedicated method `AstConv::astconv` over explicit coercions * Simplify the function signature of `create_args_for_ast_path` and of `check_generic_arg_count` * In both cases redundant information was passed rendering the call sites verbose and confusing * No perf impact (tested in [#120926](https://github.com/rust-lang/rust/pull/120926)) * Move diagnostic method `report_ambiguous_associated_type` from `astconv` to `astconv::errors` * The submodule `errors` exists specifically for that purpose * Use it to keep the main module clean & short
2024-03-15Rollup merge of #122526 - Zalathar:thir-expr-docs, r=oli-obkMatthias Krüger-1/+12
Docs for `thir::ExprKind::Use` and `thir::ExprKind::Let` These docs are based on my own recent investigations; hopefully they're reasonably accurate. `Use` was particularly puzzling to me at first, since the name is not very suggestive, and the old docs were quite cryptic.
2024-03-15Rollup merge of #122523 - compiler-errors:ensure-associated-types, r=oli-obkMatthias Krüger-0/+24
Ensure RPITITs are created before def-id freezing From the test: ```rust // `ty::Error` in a trait ref will silence any missing item errors, but will also // prevent the `associated_items` query from being called before def ids are frozen. ``` Essentially, the code that checks that `impl`s have all their items (`check_impl_items_against_trait`) is also (implicitly) responsible for fetching the `associated_items` query before, but since we early return here: https://github.com/rust-lang/rust/blob/c2901f543577af99b9cb708f5c0d28525eb7f08f/compiler/rustc_hir_analysis/src/check/check.rs#L732-L737 ...that means that this never happens for trait refs that reference errors. Fixes #122518 r? oli-obk
2024-03-15Rollup merge of #122515 - jieyouxu:ice-self-ty-mismatch, r=compiler-errorsMatthias Krüger-1/+63
Pass the correct DefId when suggesting writing the aliased Self type out Fixes #122467.
2024-03-15Rollup merge of #122471 - RalfJung:const-eval-span, r=oli-obkMatthias Krüger-7/+192
preserve span when evaluating mir::ConstOperand This lets us show to the user where they were using the faulty const (which can be quite relevant when generics are involved). I wonder if we should change "erroneous constant encountered" to something like "the above error was encountered while evaluating this constant" or so, to make this more similar to what the collector emits when showing a "backtrace" of where things get monomorphized? It seems a bit strange to rely on the order of emitted diagnostics for that but it seems the collector already [does that](https://github.com/rust-lang/rust/blob/da8a8c9223722e17cc0173ce9490076b4a6d263d/compiler/rustc_monomorphize/src/collector.rs#L472-L475).
2024-03-15Rollup merge of #122174 - notriddle:master, r=TaKO8KiMatthias Krüger-10/+88
diagnostics: suggest `Clone` bounds when noop `clone()` Fixes #121524
2024-03-15Rollup merge of #121207 - chriswailes:z-external-clangrt, r=michaelwoeristerMatthias Krüger-10/+21
Add `-Z external-clangrt` This adds the unstable `-Z external-clangrt` flag that will prevent rustc from emitting linker paths for the in-tree LLVM sanitizer runtime library.
2024-03-15rustdoc: create rustc command with an iteratorTravis Finkenauer-4/+6
This avoids unnecessary allocation with a temporary Vec.
2024-03-15rustdoc: fix test's saved stdoutTravis Finkenauer-2/+4
Also reword "test-builder-wrapper" argument help.
2024-03-15rustdoc: add `--test-builder-wrapper` argumentTravis Finkenauer-2/+27
Instead of executing the test builder directly, the test builder wrapper will be called with test builder as the first argument and subsequent arguments. This is similar to cargo's RUSTC_WRAPPER argument. The `--test-builder-wrapper` argument can be passed multiple times to allow "nesting" of wrappers.
2024-03-15less symbols interner locksklensy-6/+8
2024-03-15Auto merge of #3383 - RalfJung:rustup, r=RalfJungbors-1558/+5597
Rustup
2024-03-15fmtRalf Jung-2/+1
2024-03-15Merge from rustcRalf Jung-1556/+5596
2024-03-15Preparing for merge from rustcRalf Jung-1/+1
2024-03-15Clean up AstConvLeón Orell Valerian Liehr-208/+142
2024-03-15Docs for `thir::ExprKind::Use` and `thir::ExprKind::Let`Zalathar-1/+12
2024-03-15Auto merge of #122517 - petrochenkov:bodihash, r=oli-obkbors-20/+49
Fill in HIR hash for associated opaque types Fixes https://github.com/rust-lang/rust/issues/122508
2024-03-14Ensure RPITITs are created before def-id freezingMichael Goulet-0/+24
2024-03-15Auto merge of #122511 - matthiaskrgr:rollup-swzilin, r=matthiaskrgrbors-393/+2023
Rollup of 10 pull requests Successful merges: - #117118 ([AIX] Remove AixLinker's debuginfo() implementation) - #121650 (change std::process to drop supplementary groups based on CAP_SETGID) - #121764 (Make incremental sessions identity no longer depend on the crate names provided by source code) - #122212 (Copy byval argument to alloca if alignment is insufficient) - #122322 (coverage: Initial support for branch coverage instrumentation) - #122373 (Fix the conflict problem between the diagnostics fixes of lint `unnecessary_qualification` and `unused_imports`) - #122479 (Implement `Duration::as_millis_{f64,f32}`) - #122487 (Rename `StmtKind::Local` variant into `StmtKind::Let`) - #122498 (Update version of cc crate) - #122503 (Make `SubdiagMessageOp` well-formed) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-14Auto merge of #3382 - saethlin:sysroots-notification, r=saethlinbors-1/+1
Fix sysroot notification list of broken targets We use this same shell quoting trick on the line above to expand shell variables into the job URL. So this should work a line down as well... right?
2024-03-14Apply the same shell quoting trick we use in the URL toBen Kimock-1/+1
2024-03-14Auto merge of #122514 - workingjubilee:update-backtrace-for-miri, ↵bors-0/+0
r=workingjubilee Use rust-lang/backtrace-rs@6fa4b85 r? `@ghost`
2024-03-14preserve span when evaluating mir::ConstOperandRalf Jung-7/+192
2024-03-14Fill in HIR hash for associated opaque typesVadim Petrochenkov-20/+49
2024-03-14Pass the correct DefId when suggesting writing the aliased Self type out许杰友 Jieyou Xu (Joe)-1/+63
2024-03-14Use rust-lang/backtrace-rs@6fa4b85Jubilee Young-0/+0
2024-03-14hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`Vadim Petrochenkov-199/+135
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
2024-03-14Rollup merge of #122503 - compiler-errors:trait-alias-wf, r=NilstriebMatthias Krüger-1/+2
Make `SubdiagMessageOp` well-formed `WF(Diag<'_, G>)` requires `G: EmissionGuarantee`, but we don't currently check this is true due to limitations in the solver. Probably still worth enforcing. r? `@nnethercote` (or anyone can r+ this, really)
2024-03-14Rollup merge of #122498 - jfgoog:update-cc-crate-version, r=workingjubileeMatthias Krüger-1/+1
Update version of cc crate Reason: In order to build the Windows version of the Rust toolchain for the Android platform, the following patch to the cc is crate is required to avoid incorrectly determining that we are building with the Android NDK: https://github.com/rust-lang/cc-rs/commit/57853c4bf8a89a0f4c9137eb367ac580305c6919 This patch is present in version 1.0.80 and newer versions of the cc crate. The rustc source distribution currently has 3 different versions of cc in the vendor directory, only one of which has the necessary fix. We (the Android Rust toolchain) are currently maintaining local patches to upgrade the cc crate dependency versions, which we would like to upstream.
2024-03-14Rollup merge of #122487 - GuillaumeGomez:rename-stmtkind-local, r=oli-obkMatthias Krüger-103/+103
Rename `StmtKind::Local` variant into `StmtKind::Let` It comes from this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). Starting point was: > I often end up looking at [ExprKind::Let](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.ExprKind.html#variant.Let) instead of Local because of the name. I think renaming it (both the `ExprKind` variant and the Let struct) to `LetPattern` or LetPat could improve the situation as I'm not sure I'm not the only one encountering this issue. And then it evolved into: > It's already `Expr::Let` instead of `StmtKind::Local`. Counterproposal: rename `StmtKind::Local` to `StmtKind::Let`. The goal here is to clear this confusion. r? `@oli-obk`
2024-03-14Rollup merge of #122479 - GrigorenkoPV:duration_millis_float, r=scottmcmMatthias Krüger-0/+42
Implement `Duration::as_millis_{f64,f32}` Implementation of #122451. Linked const-unstability to #72440, so the post there should probably be updated to mentions the 2 new methods when/if this PR is merged.
2024-03-14Rollup merge of #122373 - surechen:fix_121331, r=petrochenkovMatthias Krüger-42/+269
Fix the conflict problem between the diagnostics fixes of lint `unnecessary_qualification` and `unused_imports` fixes #121331 For an `item` that triggers lint unnecessary_qualification, if the `use item` which imports this item is also trigger unused import, fixing the two lints at the same time may lead to the problem that the `item` cannot be found. This PR will avoid reporting lint unnecessary_qualification when conflict occurs. r? ``@petrochenkov``
2024-03-14Rollup merge of #122322 - Zalathar:branch, r=oli-obkMatthias Krüger-59/+1250
coverage: Initial support for branch coverage instrumentation (This is a review-ready version of the changes that were drafted in #118305.) This PR adds support for branch coverage instrumentation, gated behind the unstable flag value `-Zcoverage-options=branch`. (Coverage instrumentation must also be enabled with `-Cinstrument-coverage`.) During THIR-to-MIR lowering (MIR building), if branch coverage is enabled, we collect additional information about branch conditions and their corresponding then/else blocks. We inject special marker statements into those blocks, so that the `InstrumentCoverage` MIR pass can reliably identify them even after the initially-built MIR has been simplified and renumbered. The rest of the changes are mostly just plumbing needed to gather up the information that was collected during MIR building, and include it in the coverage metadata that we embed in the final binary. Note that `llvm-cov show` doesn't print branch coverage information in its source views by default; that needs to be explicitly enabled with `--show-branches=count` or similar. --- The current implementation doesn't have any support for instrumenting `if let` or let-chains. I think it's still useful without that, and adding it would be non-trivial, so I'm happy to leave that for future work.