about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-07-13Rollup merge of #127659 - saethlin:manually-drop-bufwriter, r=joboetJubilee-7/+17
Use ManuallyDrop in BufWriter::into_parts The fact that `mem::forget` takes by value means that it interacts very poorly with Stacked Borrows; generally users think of calling it as a no-op, but in Stacked Borrows, the field retagging tends to cause surprise tag invalidation.
2024-07-13Rollup merge of #127558 - nnethercote:more-Attribute-cleanups, r=petrochenkovJubilee-158/+150
More attribute cleanups A follow-up to #127308. r? ```@petrochenkov```
2024-07-13Rollup merge of #127477 - nnethercote:tweak-inner_attr_ranges, r=petrochenkovJubilee-8/+3
Clear `inner_attr_ranges` regularly. There's a comment saying we don't do it for performance reasons, but it doesn't actually affect performance. The commit also tweaks the control flow, to make clearer that two code paths are mutually exclusive. r? ````@petrochenkov````
2024-07-13Rollup merge of #127434 - onur-ozkan:use-bootstrap-instead-of-rustbuild, ↵Jubilee-45/+44
r=Mark-Simulacrum use "bootstrap" instead of "rustbuild" in comments and docs Let's stick with the single name "bootstrap" to refer to the bootstrap project to avoid confusion. This should make it clearer, especially for new contributors.
2024-07-13Rollup merge of #122300 - CastilloDel:master, r=cjgillotJubilee-6/+48
Add FileCheck annotations to mir-opt/dest-prop tests Part of https://github.com/rust-lang/rust/issues/116971, adds FileCheck annotations to MIR-opt tests in tests/mir-opt/dest-prop. I would like some feedback. Also, I don't know how to approach `union.rs`. I couldn't figure out what it is testing. r? cjgillot
2024-07-13Auto merge of #127694 - bjorn3:sync_cg_clif-2024-07-13, r=bjorn3bors-77/+94
Subtree sync for rustc_codegen_cranelift Couple of bug fixes this time. Fixes https://github.com/rust-lang/rust/issues/125545 r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-07-13Auto merge of #126958 - dtolnay:u32char, r=Mark-Simulacrumbors-3/+5
Stabilize const unchecked conversion from u32 to char Closes https://github.com/rust-lang/rust/issues/89259. The functions in this PR were left out of the initial set of `feature(const_char_convert)` stabilizations in https://github.com/rust-lang/rust/pull/102470, but have since been unblocked by https://github.com/rust-lang/rust/pull/118979. If `unsafe { from_u32_unchecked(u) }` is called in const with a value for which `from_u32(u)` returns None, we get the following compile error. ```rust fn main() { let _ = const { unsafe { char::from_u32_unchecked(0xd800) } }; } ``` ```console error[E0080]: it is undefined behavior to use this value --> src/main.rs:2:19 | 2 | let _ = const { unsafe { char::from_u32_unchecked(0xd800) } }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x0000d800, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { 00 d8 00 00 │ .... } note: erroneous constant encountered --> src/main.rs:2:13 | 2 | let _ = const { unsafe { char::from_u32_unchecked(0xd800) } }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2024-07-13Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into ↵bjorn3-77/+94
sync_cg_clif-2024-07-13
2024-07-13Fix rustc test suitebjorn3-1/+0
2024-07-13Rustup to rustc 1.81.0-nightly (c6727fc9b 2024-07-12)bjorn3-1/+1
2024-07-13Auto merge of #127683 - devnexen:macos_fs_update, r=joboetbors-59/+1
std::unix::fs: removing, now useless, layers predating macOs 10.10. fdopendir, openat and unlinkat are available since yosemite but we support sierra as minimum.
2024-07-13Nicer error message when using raw-dylibbjorn3-2/+2
cc rust-lang/rustc_codegen_cranelift#1510
2024-07-13Auto merge of #127435 - GrigorenkoPV:tests-for-112905, r=cjgillotbors-0/+92
Add tests for #112905 This is a part of #105107. Adds the tests from the OP in #112905.
2024-07-13std::unix::fs: removing, now useless, layers predating macOs 10.10.David Carlier-59/+1
fdopendir, openat and unlinkat are available since yosemite but we support sierra as minimum.
2024-07-13Auto merge of #127450 - Kobzol:bootstrap-cmd-refactor-5, r=onur-ozkanbors-84/+193
Bootstrap command refactoring: improve debuggability (step 5) Continuation of https://github.com/rust-lang/rust/pull/127321. This PR improves the debuggability of command execution, by improving the output logged when a command fails (it now includes the exact location where the command was created and where it was executed), and also by adding a "drop bomb", which will panic if a command was created, but not executed (which is probably a bug). Here is how the output of a failed command looks like: ``` Command "git" "foo" "[bar]" (failure_mode=Exit, stdout_mode=Capture, stderr_mode=Capture) did not execute successfully. Expected success, got exit status: 1 Created at: src/core/build_steps/compile.rs:1699:9 Executed at: src/core/build_steps/compile.rs:1699:58 STDOUT ---- STDERR ---- git: 'foo' is not a git command. See 'git --help'. ``` And this is what is printed if you forget to execute a command: ``` thread 'main' panicked at /projects/personal/rust/rust/src/tools/build_helper/src/drop_bomb/mod.rs:42:13: command constructed at `src/core/build_steps/compile.rs:1699:9` was dropped without being executed: `git` ``` Best reviewed commit by commit. Tracking issue: https://github.com/rust-lang/rust/issues/126819 r? `@onur-ozkan`
2024-07-13Avoid more instances of unused command execution in dry runJakub Beránek-15/+7
2024-07-13Auto merge of #127674 - jhpratt:rollup-0dxy3k7, r=jhprattbors-38/+64
Rollup of 3 pull requests Successful merges: - #127654 (Fix incorrect NDEBUG handling in LLVM bindings) - #127661 (Stabilize io_slice_advance) - #127668 (Improved slice documentation) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-13Rollup merge of #127668 - spencer3035:improve-slice-doc, r=jhprattJacob Pratt-10/+50
Improved slice documentation Improve slice documentation to include assert_eq checks for all the cases where there were existing examples. I think it makes things more clear when the documentation explicitly checks against values and shows the reader what it does. I also started a rust internals discussion about it here: https://internals.rust-lang.org/t/improve-slice-documentaion/21168
2024-07-13Rollup merge of #127661 - eduardosm:stabilize-io_slice_advance, r=cuviperJacob Pratt-12/+4
Stabilize io_slice_advance Closes https://github.com/rust-lang/rust/issues/62726 (FCP completed) Stabilized API: ```rust impl<'a> IoSlice<'a> { pub fn advance(&mut self, n: usize); pub fn advance_slices(bufs: &mut &mut [IoSlice<'a>], n: usize); } impl<'a> IoSliceMut<'a> { pub fn advance(&mut self, n: usize); pub fn advance_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize); } ```
2024-07-13Rollup merge of #127654 - nikic:llvm-ndebug-fix, r=cuviperJacob Pratt-16/+10
Fix incorrect NDEBUG handling in LLVM bindings We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled. Split the LLVM_NDEBUG environment variable into two, so that assertions and debuginfo are controlled independently. After this change, `LLVMRustDIBuilderInsertDeclareAtEnd` triggers an assertion failure on LLVM 19 due to an incorrect cast. Fix it by removing the unused return value entirely. r? `@cuviper`
2024-07-13Auto merge of #127397 - jyn514:multi-thread-panic-hook, r=workingjubileebors-30/+53
fix interleaved output in the default panic hook when multiple threads panic simultaneously previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook from one thread would be interleaved with the backtrace from another. now, we hold the lock for the full duration of the hook, and the output is ordered. --- i noticed some odd things while working on this you may or may not already be aware of. - libbacktrace is included as a submodule instead of a normal rustc crate, and as a result uses `cfg(backtrace_in_std)` instead of a more normal `cfg(feature = "rustc-dep-of-std")`. probably this is left over from before rust used a cargo-based build system? - the default panic handler uses `trace_unsynchronized`, etc, in `sys::backtrace::print`. as a result, the lock only applies to concurrent *panic handlers*, not concurrent *threads*. in other words, if another, non-panicking, thread tried to print a backtrace at the same time as the panic handler, we may have UB, especially on windows. - we have the option of changing backtrace to enable locking when `backtrace_in_std` is set so we can reuse their lock instead of trying to add our own.
2024-07-13Auto merge of #126606 - zachs18:patch-2, r=joboetbors-0/+77
Guard against calling `libc::exit` multiple times on Linux. Mitigates (but does not fix) #126600 by ensuring only one thread which calls Rust `exit` actually calls `libc::exit`, and all other callers of Rust `exit` block.
2024-07-12Updated slice documentationSpencer-10/+50
2024-07-12Auto merge of #127665 - workingjubilee:rollup-g90yr21, r=workingjubileebors-690/+1288
Rollup of 11 pull requests Successful merges: - #126502 (Ignore allocation bytes in some mir-opt tests) - #126922 (add lint for inline asm labels that look like binary) - #127209 (Added the `xop` target-feature and the `xop_target_feature` feature gate) - #127310 (Fix import suggestion ice) - #127338 (Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests to rmake) - #127381 (Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests to rmake) - #127535 (Fire unsafe_code lint on unsafe extern blocks) - #127619 (Suggest using precise capturing for hidden type that captures region) - #127631 (Remove `fully_normalize`) - #127632 (Implement `precise_capturing` support for rustdoc) - #127660 (Rename the internal `const_strlen` to just `strlen`) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-12Use ManuallyDrop in BufWriter::into_partsBen Kimock-7/+17
2024-07-12Rollup merge of #127660 - tgross35:const_strlen-rename, r=dtolnayJubilee-2/+2
Rename the internal `const_strlen` to just `strlen` Since the libs and lang teams completed an FCP to allow for const `strlen` ([1]), currently implemented with `const_eval_select`, there is no longer any reason to avoid this specific function or use it only in const. Rename it to reflect this status change. [1]: https://github.com/rust-lang/rust/issues/113219#issuecomment-2016939401
2024-07-12Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, r=fmeaseJubilee-4/+54
Implement `precise_capturing` support for rustdoc Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax. Tests kinda suck. They're really hard to write 😰 r? `@fmease` or re-roll if you're too busy! also cc `@aDotInTheVoid` for the json side Tracking: * https://github.com/rust-lang/rust/issues/127228#issuecomment-2201443216 (not fully fixed for cross-crate-inlined opaques) * https://github.com/rust-lang/rust/issues/123432
2024-07-12Rollup merge of #127631 - compiler-errors:yeet-fully-norm, r=lcnrJubilee-74/+36
Remove `fully_normalize` Yeet this function and replace it w/ some `ObligationCtxt` instead. It wasn't called very often anyways. r? lcnr
2024-07-12Rollup merge of #127619 - compiler-errors:precise-capturing-better-sugg, ↵Jubilee-15/+242
r=oli-obk Suggest using precise capturing for hidden type that captures region Adjusts the "add `+ '_`" suggestion for opaques to instead suggest adding or reusing the `+ use<>` in the opaque. r? oli-obk or please re-roll if you're busy!
2024-07-12Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obkJubilee-0/+41
Fire unsafe_code lint on unsafe extern blocks Fixes #126738
2024-07-12Rollup merge of #127381 - Oneirical:testalt-consciousness, r=jieyouxuJubilee-69/+96
Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests 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). Please try on musl. try-job: dist-x86_64-musl
2024-07-12Rollup merge of #127338 - Oneirical:ready-your-arbatests, r=jieyouxuJubilee-37/+64
Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests 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). Please try: try-job: armhf-gnu // try-job: test-various // already tried try-job: x86_64-msvc try-job: aarch64-apple
2024-07-12Rollup merge of #127310 - chenyukang:yukang-fix-suggest-import-ice, r=estebankJubilee-6/+125
Fix import suggestion ice Fixes #127302 #127302 only crash in edition 2015 #120074 can only reproduced in edition 2021 so I added revisions in test file.
2024-07-12Rollup merge of #127209 - sayantn:xop, r=AmanieuJubilee-2/+26
Added the `xop` target-feature and the `xop_target_feature` feature gate This is an effort towards #127208. This adds the `xop` target feature gated by `xop_target_feature`.
2024-07-12Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebankJubilee-91/+397
add lint for inline asm labels that look like binary fixes #94426 Due to a bug/feature in LLVM, labels composed of only the digits `0` and `1` can sometimes be confused with binary literals, even if a binary literal would not be valid in that position. This PR adds detection for such labels and also as a drive-by change, adds a note to cases such as `asm!(include_str!("file"))` that the label that it found came from an expansion of a macro, it wasn't found in the source code. I expect this PR to upset some people that were using labels `0:` or `1:` without issue because they never hit the case where LLVM got it wrong, but adding a heuristic to the lint to prevent this is not feasible - it would involve writing a whole assembly parser for every target that we have assembly support for. [zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-06-20/near/445870628) r? ``@estebank``
2024-07-12Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebankJubilee-390/+205
Ignore allocation bytes in some mir-opt tests This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order. Fixes #126261
2024-07-12Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubileebors-10/+461
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86 Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
2024-07-12Remove LLVMRustDIBuilderInsertDeclareAtEnd return valueNikita Popov-12/+7
The return value changed from an Instruction to a DbgRecord in LLVM 19. As we don't actually use the result, drop the return value entirely to support both.
2024-07-12Fix incorrect NDEBUG handling in LLVM bindingsNikita Popov-4/+3
We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled. Rename the environment variable to `LLVM_ASSERTIONS` and drive it using the `llvm_assertions` option. Also drop the explicit `debug(false)` call, as cc already sets this up using the cargo `DEBUG` environment variable.
2024-07-12Test `build_helper` with the stage 0 compilerJakub Beránek-3/+2
There is no need to build a stage N toolchain for testing it.
2024-07-12Modify FIXME commentJakub Beránek-1/+1
2024-07-12Simplify command executions for plain source tarballsJakub Beránek-5/+1
If we're in dry run mode, the command will return an empty string, so we can just execute it.
2024-07-12Disarm drop bombs for unexecuted test Cargo commandsJakub Beránek-1/+2
The code for running tests uses a custom command machinery because it streams the output of the command. We thus need to mark the command as executed in a dry run, to avoid a drop bomb panic.
2024-07-12Remove unused rustdoc commandJakub Beránek-4/+0
2024-07-12Fix a case where a RustBook command is potentially not executedJakub Beránek-2/+7
We can move the command creation to a block where it is clear that the command will be executed.
2024-07-12Improve error message of drop bombsJakub Beránek-1/+1
2024-07-12Improve the `Debug` representation of `BootstrapCommand`Jakub Beránek-1/+13
Avoid printing useless information in the `Debug` output.
2024-07-12Print command creation and execution location when it failsJakub Beránek-4/+23
This should make it quicker to debug command failures.
2024-07-12Add `DropBomb` to `BootstrapCommand`Jakub Beránek-0/+20
This makes it harder to accidentally forget to execute a created command in bootstrap.
2024-07-12Make `command` field of `BootstrapCommand` private to force access to it ↵Jakub Beránek-42/+60
through the `as_command_mut` method This will be useful for disarming drop bombs when the inner command is accessed.