about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-08-03Migrate `print-target-list` to `rmake`Jerry Wang-8/+21
2024-08-03Migrate `run-make/print-calling-conventions` to ui-testJerry Wang-4/+36
2024-08-03Auto merge of #128614 - matthiaskrgr:rollup-d2fextz, r=matthiaskrgrbors-131/+113
Rollup of 7 pull requests Successful merges: - #127921 (Stabilize unsafe extern blocks (RFC 3484)) - #128283 (bootstrap: fix bug preventing the use of custom targets) - #128530 (Implement `UncheckedIterator` directly for `RepeatN`) - #128551 (chore: refactor backtrace style in panic) - #128573 (Simplify `body` usage in rustdoc) - #128581 (Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes) - #128603 (Update run-make/used to use `any_symbol_contains`) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-03Rollup merge of #128603 - ChrisDenton:used, r=jieyouxuMatthias Krüger-7/+3
Update run-make/used to use `any_symbol_contains` This makes it so we don't need `nm` or `llvm-nm`. I also tested that `BAR` is removed. I'm not sure if this is wanted though.
2024-08-03Rollup merge of #128581 - jieyouxu:checked-attr, r=nnethercoteMatthias Krüger-0/+25
Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes ``@oli-obk's`` #128444 with unreachable case removed to avoid that PR bitrotting away. Based on #128402. This PR will make adding a new attribute ICE on any use of that attribute unless it gets a handler added in `rustc_passes::CheckAttrVisitor`. r? ``@nnethercote`` (since you were the reviewer of the original PR)
2024-08-03Rollup merge of #128530 - scottmcm:repeat-n-unchecked, r=joboetMatthias Krüger-1/+14
Implement `UncheckedIterator` directly for `RepeatN` This just pulls the code out of `next` into `next_unchecked`, rather than making the `Some` and `unwrap_unchecked`ing it. And while I was touching it, I added a codegen test that `array::repeat` for something that's just `Clone`, not `Copy`, still ends up optimizing to the same thing as `[x; n]`: <https://rust.godbolt.org/z/YY3a5ajMW>.
2024-08-03Rollup merge of #127921 - spastorino:stabilize-unsafe-extern-blocks, ↵Matthias Krüger-123/+71
r=compiler-errors Stabilize unsafe extern blocks (RFC 3484) # Stabilization report ## Summary This is a tracking issue for the RFC 3484: Unsafe Extern Blocks We are stabilizing `#![feature(unsafe_extern_blocks)]`, as described in [Unsafe Extern Blocks RFC 3484](https://github.com/rust-lang/rfcs/pull/3484). This feature makes explicit that declaring an extern block is unsafe. Starting in Rust 2024, all extern blocks must be marked as unsafe. In all editions, items within unsafe extern blocks may be marked as safe to use. RFC: https://github.com/rust-lang/rfcs/pull/3484 Tracking issue: #123743 ## What is stabilized ### Summary of stabilization We now need extern blocks to be marked as unsafe and items inside can also have safety modifiers (unsafe or safe), by default items with no modifiers are unsafe to offer easy migration without surprising results. ```rust unsafe extern { // sqrt (from libm) may be called with any `f64` pub safe fn sqrt(x: f64) -> f64; // strlen (from libc) requires a valid pointer, // so we mark it as being an unsafe fn pub unsafe fn strlen(p: *const c_char) -> usize; // this function doesn't say safe or unsafe, so it defaults to unsafe pub fn free(p: *mut core::ffi::c_void); pub safe static IMPORTANT_BYTES: [u8; 256]; pub safe static LINES: SyncUnsafeCell<i32>; } ``` ## Tests The relevant tests are in `tests/ui/rust-2024/unsafe-extern-blocks`. ## History - https://github.com/rust-lang/rust/pull/124482 - https://github.com/rust-lang/rust/pull/124455 - https://github.com/rust-lang/rust/pull/125077 - https://github.com/rust-lang/rust/pull/125522 - https://github.com/rust-lang/rust/issues/126738 - https://github.com/rust-lang/rust/issues/126749 - https://github.com/rust-lang/rust/issues/126755 - https://github.com/rust-lang/rust/pull/126757 - https://github.com/rust-lang/rust/pull/126758 - https://github.com/rust-lang/rust/issues/126756 - https://github.com/rust-lang/rust/pull/126973 - https://github.com/rust-lang/rust/pull/127535 - https://github.com/rust-lang/rustfmt/pull/6204 ## Unresolved questions I am not aware of any unresolved questions.
2024-08-03Auto merge of #127324 - DianQK:match-br, r=cjgillotbors-470/+1854
Simplify match based on the cast result of `IntToInt` Continue to complete #124150. The condition in #120614 is wrong, e.g. `-1i8` cannot be converted to `255i16`. I've rethought the issue and simplified the conditional judgment for a more straightforward approach. The new approach is to check **if the case value after the `IntToInt` conversion equals the target value**. In different types, `IntToInt` uses different casting methods. This rule is as follows: - `i8`/`u8` to `i8`/`u8`: do nothing. - `i8` to `i16`/`u16`: sign extension. - `u8` to `i16`/`u16`: zero extension. - `i16`/`u16` to `i8`/`u8`: truncate to the target size. The previous error was a mix of zext and sext. r? mir-opt
2024-08-03Auto merge of #128404 - compiler-errors:revert-dead-code-changes, r=pnkfelixbors-515/+88
Revert recent changes to dead code analysis This is a revert to recent changes to dead code analysis, namely: * efdf219 Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov * a70dc297a899b76793a14c5705f6ec78fd7a57a7 Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix * 31fe9628cf830a08e7194a446f66c668aaea86e9 Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix * 2724aeaaeb127a8073e39461caacbe21a128ce7b Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix * 977c5fd419ade52467f7de79d5bfc25c0c893275 Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov * 13314df21b0bb0cdd02c6760581d1b9f1052fa7e Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this `AnonPipe` type is not publically reachable -- please correct me if I'm wrong cc `@NobodyXu` who added these in ##127153. Some of these reverts (#126315 and #126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs? I apologize for the size of the PR and the churn that it has on the codebase (and for reverting `@mu001999's` work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way. cc `@mu001999` r? `@pnkfelix` Fixes #128272 Fixes #126169
2024-08-03Remove BAR for run-make/used.rsChris Denton-3/+0
2024-08-03Update run-make/used to use `any_symbol_contains`Chris Denton-5/+4
2024-08-03Bless test falloutMichael Goulet-6/+14
2024-08-03Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-180/+61
This reverts commit 13314df21b0bb0cdd02c6760581d1b9f1052fa7e, reversing changes made to 6e534c73c35f569492ed5fb5f349075d58ed8b7e.
2024-08-03Revert "Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov"Michael Goulet-33/+0
This reverts commit 977c5fd419ade52467f7de79d5bfc25c0c893275, reversing changes made to 24c94f0e4f5aa333c665fbbba423172c30176624.
2024-08-03Revert "Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-50/+20
This reverts commit 2724aeaaeb127a8073e39461caacbe21a128ce7b, reversing changes made to d929a42a664c026167800801b26d734db925314f.
2024-08-03Revert "Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix"Michael Goulet-152/+23
This reverts commit 31fe9628cf830a08e7194a446f66c668aaea86e9, reversing changes made to f20307851ead9fbbb9fa88bbffb3258a069230a6.
2024-08-03Revert "Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-65/+0
This reverts commit a70dc297a899b76793a14c5705f6ec78fd7a57a7, reversing changes made to ceae37188b9f1be527bb16c9d657a161be7dbbe3.
2024-08-03Revert "Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov"Michael Goulet-64/+5
This reverts commit 91b18a058c4661f82e420b633dc0a3e1ccd14b88, reversing changes made to 9aedec9313dc8ecf9bdcb5f09c4eb0ad8b9a4875.
2024-08-03Auto merge of #128595 - matthiaskrgr:rollup-7a4qa8b, r=matthiaskrgrbors-2/+265
Rollup of 7 pull requests Successful merges: - #126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate) - #127586 (Add `#[must_use]` to some `into_raw*` functions.) - #128161 (nested aux-build in tests/rustdoc/ tests) - #128303 (Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`) - #128368 (Formatting tweaks) - #128483 (Still more `cfg` cleanups) - #128557 (chore: use shorthand initializer) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-03Rollup merge of #128161 - EtomicBomb:just-compiletest, r=notriddleMatthias Krüger-0/+244
nested aux-build in tests/rustdoc/ tests * Fixes bug that prevented using nested aux-build in `tests/rustdoc/` tests. Before, `fn document` and the auxiliary builder disagreed about where to find the nested aux-build source file (`auxiliary/auxiliary/aux.rs` vs `auxiliary/aux.rs`), preventing them from building. Picked the latter in line with other builders in compiletest. * Adds `//@ doc-flags` header, which forwards flags to rustdoc and not rustc. * Adds `//@ unique-doc-out-dir` header, which sets the --out-dir for the rustdoc invocation to a unique directory: `<root out dir>/docs/<test name>/doc` * Changes working directory of the rustdoc invocation to the root out directory (common among all aux-builds). Prior art: exec_compiled_test in runtest.rs * Adds tests that use nested aux builds and new headers These changes provide useful capabilities for writing rustdoc tests on their own. They are also needed to test the implementation for the [mergable-rustdoc-cross-crate-info](https://github.com/rust-lang/rfcs/pull/3662) RFC. try-job: x86_64-msvc
2024-08-03Rollup merge of #126704 - sayantn:sha, r=AmanieuMatthias Krüger-2/+21
Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate This is an effort towards #126624. This adds support for these 3 target-features and introduces the feature flag `sha512_sm_x86`, which would gate these target-features and the yet-to-be-implemented detection and intrinsics in stdarch.
2024-08-03Auto merge of #128356 - Oneirical:real-estate-reaLTOr, r=jieyouxubors-117/+191
Migrate `cross-lang-lto-clang` and `cross-lang-lto-pgo-smoketest` `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). This has the same problem outlined by #126180, where the tests do not actually run as no test-running CI enviroment has `RUSTBUILD_FORCE_CLANG_BASED_TESTS` set. However, I still find it interesting to turn the Makefiles into the rmake format until the Clang issue is fixed. This should technically be tested on MSVC... if MSVC actually ran Clang tests. try-job: x86_64-gnu-debug
2024-08-03Re-enable SimplifyToExp in match_branches.DianQK-2/+0
2024-08-03Simplify match based on the cast result of `IntToInt`.DianQK-470/+1856
2024-08-03Add test for `coroutine` attributeOli Scherer-0/+25
2024-08-02Auto merge of #128361 - Oneirical:testle-deforestation, r=jieyouxubors-29/+59
Migrate `link-cfg` and `rustdoc-default-output` `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). try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-mingw try-job: x86_64-gnu-llvm-18 try-job: i686-msvc
2024-08-02run cross-lang-lto-pgo-smoketest in CI by renaming itOneirical-135/+29
2024-08-02rewrite cross-lang-lto-pgo-smoketest to rmakeOneirical-0/+144
2024-08-02rewrite cross-lang-lto-clang to rmakeOneirical-25/+61
2024-08-02rewrite rustdoc-default-output to rmakeOneirical-6/+16
2024-08-02rewrite foreign-exceptions to rmakeOneirical-24/+30
2024-08-02rewrite and rename issue-36710 to rmakeOneirical-19/+27
2024-08-02rewrite foreign-double-unwind to rmakeOneirical-12/+21
2024-08-02Auto merge of #128352 - Oneirical:daLTOnist-vision, r=jieyouxubors-57/+110
Migrate `cross-lang-lto` `run-make` test 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: x86_64-msvc try-job: i686-mingw try-job: x86_64-mingw try-job: armhf-gnu try-job: test-various try-job: aarch64-apple try-job: x86_64-gnu-llvm-18
2024-08-01Implement `UncheckedIterator` directly for `RepeatN`Scott McMurray-1/+14
2024-08-02Auto merge of #128529 - matthiaskrgr:rollup-gzq2slo, r=matthiaskrgrbors-45/+36
Rollup of 6 pull requests Successful merges: - #126818 (Better handle suggestions for the already present code and fix some suggestions) - #128436 (Update sysinfo version to 0.31.2) - #128453 (raw_eq: using it on bytes with provenance is not UB (outside const-eval)) - #128491 ([`macro_metavar_expr_concat`] Dogfooding) - #128494 (MIR required_consts, mentioned_items: ensure we do not forget to fill these lists) - #128521 (rustdoc: Remove dead opaque_tys rendering logic) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-02Rollup merge of #128453 - RalfJung:raw_eq, r=saethlinMatthias Krüger-2/+5
raw_eq: using it on bytes with provenance is not UB (outside const-eval) The current behavior of raw_eq violates provenance monotonicity. See https://github.com/rust-lang/rust/pull/124921 for an explanation of provenance monotonicity. It is violated in raw_eq because comparing bytes without provenance is well-defined, but adding provenance makes the operation UB. So remove the no-provenance requirement from raw_eq. However, the requirement stays in-place for compile-time invocations of raw_eq, that indeed cannot deal with provenance. Cc `@rust-lang/opsem`
2024-08-02Rollup merge of #126818 - estebank:suggestions-fix, r=wesleywiserMatthias Krüger-43/+31
Better handle suggestions for the already present code and fix some suggestions When a suggestion part is for code that is already present, skip it. If all the suggestion parts for a suggestion are for code that is already there, do not emit the suggestion. Fix two suggestions that treat `span_suggestion` as if it were `span_help`.
2024-08-02Auto merge of #128147 - lolbinarycat:fmt-write-bloat-rmake, r=jieyouxubors-25/+37
migrate fmt-write-bloat to rmake try-job: aarch64-apple try-job: x86_64-gnu-llvm-18 try-job: dist-x86_64-linux
2024-08-02Auto merge of #127624 - Oneirical:a-test-of-lime, r=jieyouxubors-33/+58
Migrate and rename `issue-47551`, `issue-35164` and `issue-69368` `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). try-job: dist-x86_64-msvc
2024-08-02Add the `sha512`, `sm3` and `sm4` target featuressayantn-2/+21
Add the feature in `core/lib.rs`
2024-08-01Auto merge of #127276 - aDotInTheVoid:no-opaque, r=camelidbors-0/+46
rustdoc: Remove OpaqueTy r? `@ghost` Apparently this works lol?!? try-job: aarch64-apple
2024-08-01Do not underline suggestions for code that is already thereEsteban Küber-43/+31
When a suggestion part is for already present code, do not highlight it. If after that there are no highlights left, do not show the suggestion at all. Fix clippy lint suggestion incorrectly treated as `span_help`.
2024-08-01Rollup merge of #128496 - clubby789:box-syntax-multipart, r=compiler-errorsMatthias Krüger-5/+5
Fix removed `box_syntax` diagnostic if source isn't available Fix #128442
2024-08-01Rollup merge of #128482 - RalfJung:ptr-signed-offset, r=oli-obkMatthias Krüger-23/+23
interpret: on a signed deref check, mention the right pointer in the error When a negative offset (like `ptr.offset(-10)`) goes out-of-bounds, we currently show an error saying that we expect the *resulting* pointer to be inbounds for 10 bytes. That's confusing, so this PR makes it so that instead we say that we expect the *original* pointer `ptr` to have 10 bytes *to the left*. I also realized I can simplify the pointer arithmetic logic and handling of "staying inbounds of a target `usize`" quite a bit; the second commit does that.
2024-08-01rustdoc: Add test for `impl_trait_in_accos_type`Alona Enraght-Moony-0/+46
2024-08-01Fix removed `box_syntax` diagnostic if source isn't availableclubby789-5/+5
2024-08-01fix the way we detect overflow for inbounds arithmetic (and tweak the error ↵Ralf Jung-2/+2
message)
2024-08-01interpret: simplify pointer arithmetic logicRalf Jung-7/+7
2024-08-01on a signed deref check, mention the right pointer in the errorRalf Jung-18/+18