about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-07-18Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`León Orell Valerian Liehr-2/+168
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-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-12Stabilize io_slice_advanceEduardo Sánchez Muñoz-12/+4
2024-07-12Added the `xop` target feature and `xop_target_feature` gatesayantn-2/+26
2024-07-12Rename the internal `const_strlen` to just `strlen`Trevor Gross-2/+2
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-12Auto merge of #127636 - nnethercote:fix-Parser-look_ahead, r=oli-obkbors-30/+147
Fix `Parser::look_ahead` `Parser::look_ahead` has a slow but simple general case, and a fast special case that is hit most of the time. But the special case is buggy and behaves differently to the general case. There are also no unit tests. This PR fixes all of this, resulting in a `Parser::look_ahead` that is equally fast, slightly simpler, more correct, and better tested. r? `@davidtwco`
2024-07-12fix interleaved panic outputjyn-34/+37
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 would be interleaved with the backtrace. now, we hold the lock for the full duration of the hook, and the output is ordered.
2024-07-12rewrite env-dep-info to rmakeOneirical-27/+47
2024-07-12rewrite rustc-macro-dep-files to rmakeOneirical-12/+13
2024-07-12rewrite and rename issue-83045 to rmakeOneirical-33/+39
2024-07-12Auto merge of #127653 - matthiaskrgr:rollup-72bqgvp, r=matthiaskrgrbors-807/+1408
Rollup of 8 pull requests Successful merges: - #124980 (Generalize `fn allocator` for Rc/Arc.) - #126639 (Add AMX target-features and `x86_amx_intrinsics` feature flag) - #126827 (Use pidfd_spawn for faster process spawning when a PidFd is requested) - #127433 (Stabilize const_cstr_from_ptr (CStr::from_ptr, CStr::count_bytes)) - #127552 (remove unnecessary `git` usages) - #127613 (Update dist-riscv64-linux to binutils 2.40) - #127627 (generalize search graph to enable fuzzing) - #127648 (Lower timeout of CI jobs to 4 hours) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-12rewrite and rename issue-85019-moved-src-dir to rmakeOneirical-31/+38
2024-07-12rewrite extra-filename-with-temp-outputs to rmakeOneirical-8/+28
2024-07-12Rollup merge of #127648 - Kobzol:ci-lower-timeout, r=pietroalbiniMatthias Krüger-1/+1
Lower timeout of CI jobs to 4 hours The previous value, 10 hours, is unnecessarily long, since most of our jobs finish within 2.5 hours currently. This could help us detect abnormally long CI runs. r? ``@pietroalbini``
2024-07-12Rollup merge of #127627 - lcnr:rustc_search_graph, r=compiler-errorsMatthias Krüger-757/+982
generalize search graph to enable fuzzing I do not believe it to be feasible to correctly implement the search graph without fuzzing. This PR enables this by requiring a fuzzer to only implement three new traits: - `Cx`: implemented by all `I: Interner` - `ProofTreeBuilder`: implemented by `struct ProofTreeBuilder<D>` for all `D: SolverDelegate` - `Delegate`: implemented for a new `struct SearchGraphDelegate<D>` for all `D: SolverDelegate` It also moves the evaluation cache implementation into `rustc_type_ir`, requiring `Interner` to provide methods to create and access arbitrary `WithDepNode<T>` and to provide mutable access to a given `GlobalCache`. It otherwise does not change the API surface for users of the shared library. This change should not impact behavior in any way. r? ``@compiler-errors``
2024-07-12Rollup merge of #127613 - nikic:riscv-update, r=cuviperMatthias Krüger-1/+216
Update dist-riscv64-linux to binutils 2.40 binutils 2.40 is required by LLVM 19, as older versions do not know about the zmmul extension. I've had to backport some patches to glibc and gcc as well, as they don't build with binutils 2.40. Alternatively, we could also switch to glibc 2.35 and gcc 10 (I think). I figured we'd want to avoid the glibc version change, but if that's fine for riscv I can go with that instead. r? `````@cuviper````` try-job: dist-riscv64-linux
2024-07-12Rollup merge of #127552 - onur-ozkan:unnecessary-git-usage, r=KobzolMatthias Krüger-16/+7
remove unnecessary `git` usages `Config::src` already contains the top-level path, so we don't need to add git overhead just to reach this path.
2024-07-12Rollup merge of #127433 - dtolnay:conststrlen, r=workingjubileeMatthias Krüger-4/+5
Stabilize const_cstr_from_ptr (CStr::from_ptr, CStr::count_bytes) Completed the pair of FCPs https://github.com/rust-lang/rust/issues/113219#issuecomment-2016939401 + https://github.com/rust-lang/rust/issues/114441#issuecomment-2016942566. `CStr::from_ptr` is covered by just the first FCP on its own. `CStr::count_bytes` requires the approval of both FCPs. The second paragraph of the first link and the last paragraph of the second link explain the relationship between the two FCPs. As both have been approved, we can proceed with stabilizing `const` on both of these already-stable functions.
2024-07-12Rollup merge of #126827 - the8472:pidfd-spawn, r=workingjubileeMatthias Krüger-6/+131
Use pidfd_spawn for faster process spawning when a PidFd is requested glibc 2.39 added `pidfd_spawnp` and `pidfd_getpid` which makes it possible to get pidfds while staying on the CLONE_VFORK path. verified that vfork gets used with strace: ``` $ strace -ff -e pidfd_open,clone3,openat,execve,waitid,close ./x test std --no-doc -- pidfd [...] [pid 2820532] clone3({flags=CLONE_VM|CLONE_PIDFD|CLONE_VFORK|CLONE_CLEAR_SIGHAND, pidfd=0x7b7f885fec6c, exit_signal=SIGCHLD, stack=0x7b7f88aff000, stack_size=0x9000}strace: Process 2820533 attached <unfinished ...> [pid 2820533] execve("/home/the8472/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/home/the8472/.cargo/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/usr/local/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */) = -1 ENOENT (No such file or directory) [pid 2820533] execve("/usr/bin/sleep", ["sleep", "1000"], 0x7ffdd0e268d8 /* 107 vars */ <unfinished ...> [pid 2820532] <... clone3 resumed> => {pidfd=[3]}, 88) = 2820533 [pid 2820533] <... execve resumed>) = 0 [pid 2820532] openat(AT_FDCWD, "/proc/self/fdinfo/3", O_RDONLY|O_CLOEXEC) = 4 [pid 2820532] close(4) = 0 ``` Tracking issue: #82971
2024-07-12Rollup merge of #126639 - sayantn:amx, r=AmanieuMatthias Krüger-2/+30
Add AMX target-features and `x86_amx_intrinsics` feature flag This is an effort towards #126622. This adds support for all 5 target-features for `AMX`, and introduces the feature flag `x86_amx_intrinsics`, which would gate these target-features and the yet-to-be-implemented amx intrinsics in stdarch.
2024-07-12Rollup merge of #124980 - zachs18:rc-allocator, r=AmanieuMatthias Krüger-20/+36
Generalize `fn allocator` for Rc/Arc. Split out from #119761 - For `Rc`/`Arc`, the existing associated `fn`s are changed to allow unsized pointees. - For `Weak`s, new methods are added. `````@rustbot````` label +A-allocators
2024-07-12Auto merge of #127479 - Urgau:rustc-stable-hash, r=michaelwoeristerbors-1049/+30
Use rustc-stable-hash in the compiler Following https://github.com/rust-lang/compiler-team/issues/755 and the release of the crate on crates.io, let's now use it in the compiler and remove the old implementation. cc `@michaelwoerister` r? ghost
2024-07-12enable fuzzing of `SearchGraph`lcnr-757/+982
fully move it into `rustc_type_ir` and make it independent of `Interner`.
2024-07-12Adjust tests for x86 "Rust" ABI changesbeetrees-8/+34
2024-07-12Lower timeout of CI jobs to 4 hoursJakub Beránek-1/+1
The previous value, 10 hours, is unnecessarily long, since most of our jobs finish within 2.5 hours currently.
2024-07-12Add rustdoc-json support for use<>Michael Goulet-1/+13
2024-07-12Add rustdoc support for use<> in (local) RPITsMichael Goulet-3/+41
2024-07-11Add instability attribute on private const_strlen functionDavid Tolnay-0/+1
A `rustc_const_stable` attribute by itself has nonintuitive purpose when placed in a public module. Separately, it would probably be okay to rename `const_strlen` to just `strlen` to make it more clear this is our general-purpose implementation of strlen now, not something specifically for const (avoiding confusion like in PR 127444).
2024-07-12Auto merge of #127635 - matthiaskrgr:rollup-foopajr, r=matthiaskrgrbors-585/+506
Rollup of 6 pull requests Successful merges: - #127164 (match lowering: Clarify the main loop of the algorithm) - #127422 (as_simd: fix doc comment to be in line with align_to) - #127596 (More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>`) - #127607 (compiletest: Better error message for bad `normalize-*` headers) - #127622 (Mark `builtin_syntax` as internal) - #127625 (Revert accidental comment deletion) r? `@ghost` `@rustbot` modify labels: rollup