about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-08-16Enable more debuginfo tests on WindowsBen Kimock-12/+8
2024-08-16Auto merge of #129162 - matthiaskrgr:rollup-r0oxdev, r=matthiaskrgrbors-55/+53
Rollup of 6 pull requests Successful merges: - #128990 (Re-enable more debuginfo tests on freebsd) - #129042 (Special-case alias ty during the delayed bug emission in `try_from_lit`) - #129086 (Stabilize `is_none_or`) - #129149 (Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test) - #129154 (Fix wrong source location for some incorrect macro definitions) - #129161 (Stabilize std::thread::Builder::spawn_unchecked) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-16Rollup merge of #129154 - wafarm:fix-95463, r=estebankMatthias Krüger-6/+6
Fix wrong source location for some incorrect macro definitions Fixes #95463 Currently the code will consume the next token tree after `var` when trying to parse `$var:some_type` even when it's not a `:` (e.g. a `$` when input is `($foo $bar:tt) => {}`). Additionally it will return the wrong span when it's not a `:`. This PR fixes these problems.
2024-08-16Rollup merge of #129149 - GuillaumeGomez:migrate-python-script, r=jieyouxuMatthias Krüger-44/+44
Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test This PR fixes the FIXME I added for future-me who become present-me. :') Since there are multiple `run-make` tests using python scripts, I suppose more of them will migrate to Rust, hence why I added the `jzon` public reexport to the `run-make-support` crate. cc `@jieyouxu` r? `@Kobzol`
2024-08-16Rollup merge of #129042 - Jaic1:fix-116308, r=BoxyUwUMatthias Krüger-1/+3
Special-case alias ty during the delayed bug emission in `try_from_lit` This PR tries to fix #116308. A delayed bug in `try_from_lit` will not be emitted so that the compiler will not ICE when it sees the pair `(ast::LitKind::Int, ty::TyKind::Alias)` in `lit_to_const` (called from `try_from_lit`). This PR is related to an unstable feature `adt_const_params` (#95174). r? ``@BoxyUwU``
2024-08-16Re-enable debuginfo tests on freebsdBen Kimock-4/+0
2024-08-16Reexport `serde_json` crate from run-make-support to give it access to ↵Guillaume Gomez-39/+36
`run-make` tests
2024-08-16Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` testGuillaume Gomez-44/+47
2024-08-16massive refactor of reproducible-build testOneirical-161/+179
2024-08-16rewrite reproducible-build to rmakeOneirical-140/+222
2024-08-16Fix wrong source location for some incorrect macro definitionsWafarm-6/+6
2024-08-16Auto merge of #128913 - saethlin:unignore-debuginfo-tests, r=compiler-errorsbors-72/+48
Enable debuginfo tests that have been "temporarily disabled" for the past 6 years The PR history is a bit of a mess because I had to test this a lot with try-jobs, so I'll try to summarize the non-obvious changes here. A number of tests now have `min-lldb-version: 1800`. Those tests should have gotten an lldb version jump either in https://github.com/rust-lang/rust/pull/124781 or long ago. Note that all such tests with that lldb version requirement do not run in Apple CI. `tests/debuginfo/drop-locations.rs` is staying disabled for now because gdb doesn't know to stop on the drop calls produced by a `}`: https://github.com/rust-lang/rust/issues/128971 `tests/debuginfo/function-arg-initialization.rs` now has `-Zmir-enable-passes=-SingleUseConsts`; without that we initialize the const before the function prelude: https://github.com/rust-lang/rust/issues/128945 `tests/debuginfo/by-value-non-immediate-argument.rs` fails because we don't generate a function prelude for unused non-immediate arguments, even with all optimizations disabled, and this seems to confuse debuggers on aarch64: https://github.com/rust-lang/rust/issues/128973 `tests/debuginfo/pretty-std.rs` is staying disabled on windows-gnu because our test harness doesn't know how to load our pretty-printers on that target: https://github.com/rust-lang/rust/issues/128981 `tests/debuginfo/method-on-enum.rs` and `tests/debuginfo/option-like-enum.rs` encounter some kind of gdb bug on i686-pc-windows-gnu. I don't know enough about that situation to write a good issue. I plan on doing more work on this test suite. There's clearly a lot more basic cleanup work to do here.
2024-08-16Auto merge of #129143 - workingjubilee:rollup-h0hzumu, r=workingjubileebors-196/+468
Rollup of 9 pull requests Successful merges: - #128064 (Improve docs for Waker::noop and LocalWaker::noop) - #128922 (rust-analyzer: use in-tree `pattern_analysis` crate) - #128965 (Remove `print::Pat` from the printing of `WitnessPat`) - #129018 (Migrate `rlib-format-packed-bundled-libs` and `native-link-modifier-bundle` `run-make` tests to rmake) - #129037 (Port `run-make/libtest-json` and `run-make/libtest-junit` to rmake) - #129078 (`ParamEnvAnd::fully_perform`: we have an `ocx`, use it) - #129110 (Add a comment explaining the return type of `Ty::kind`.) - #129111 (Port the `sysroot-crates-are-unstable` Python script to rmake) - #129135 (crashes: more tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-15Rollup merge of #129135 - matthiaskrgr:ITKEEPSCRASHINGAAAAAAAAHH, ↵Jubilee-0/+131
r=compiler-errors crashes: more tests r? ````@jieyouxu````
2024-08-15Rollup merge of #129111 - Zalathar:python-sysroot, r=jieyouxuJubilee-77/+99
Port the `sysroot-crates-are-unstable` Python script to rmake New version of #126231, and a follow-up to #129071. One major difference is that the new version no longer tries to report *all* accidentally-stable crates, because the `run_make_support` helpers tend to halt the test as soon as something goes wrong. That's unfortunate, but I think it won't matter much in practice, and preserving the old behaviour doesn't seem worth the extra effort. --- Part of #110479 (Python purge), with this being one of the non-trivial Python scripts that actually seems feasible and worthwhile to remove. This is *not* part of #121876 (Makefile purge), because the underlying test is already using rmake; this PR just modifies the existing rmake recipe to do all the work itself instead of delegating to Python. So there's no particular urgency here. r? ````@jieyouxu```` try-job: aarch64-gnu try-job: aarch64-apple try-job: test-various try-job: armhf-gnu try-job: x86_64-msvc try-job: i686-mingw
2024-08-15Rollup merge of #129037 - Zalathar:rmake-libtest, r=jieyouxuJubilee-42/+64
Port `run-make/libtest-json` and `run-make/libtest-junit` to rmake Unlike #126773, this is just a straightforward port to `rmake`, without attempting to switch to compiletest or get rid of the (trivial) Python scripts. Part of #121876. r? ````@jieyouxu```` try-job: x86_64-msvc try-job: i686-mingw try-job: test-various try-job: aarch64-gnu try-job: aarch64-apple
2024-08-15Rollup merge of #129018 - Oneirical:nmemonic-artifice, r=jieyouxuJubilee-77/+174
Migrate `rlib-format-packed-bundled-libs` and `native-link-modifier-bundle` `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: test-various (ATTEMPTED: IGNORE RESTORED) try-job: x86_64-msvc try-job: aarch64-apple try-job: aarch64-gnu try-job: x86_64-mingw try-job: i686-mingw
2024-08-16Auto merge of #128725 - nnethercote:fix-assoc-expr-collect-problems, ↵bors-2/+87
r=petrochenkov Fix problems with assoc expr token collection There are several cases involving assoc exprs and attributes where the current code does the wrong thing. This PR adds some tests that demonstrate the problems and then fixes them. r? `@petrochenkov`
2024-08-16Special-case alias ty in `try_from_lit`Jaic1-1/+3
2024-08-16Overhaul token collection.Nicholas Nethercote-16/+50
This commit does the following. - Renames `collect_tokens_trailing_token` as `collect_tokens`, because (a) it's annoying long, and (b) the `_trailing_token` bit is less accurate now that its types have changed. - In `collect_tokens`, adds a `Option<CollectPos>` argument and a `UsePreAttrPos` in the return type of `f`. These are used in `parse_expr_force_collect` (for vanilla expressions) and in `parse_stmt_without_recovery` (for two different cases of expression statements). Together these ensure are enough to fix all the problems with token collection and assoc expressions. The changes to the `stringify.rs` test demonstrate some of these. - Adds a new test. The code in this test was causing an assertion failure prior to this commit, due to an invalid `NodeRange`. The extra complexity is annoying, but necessary to fix the existing problems.
2024-08-16Add some attribute `stringify!` tests.Nicholas Nethercote-2/+53
A couple of these are marked `FIXME` because they demonstrate existing bugs with token collection.
2024-08-15Auto merge of #128787 - Oneirical:infohazardous-deprogram, r=jieyouxubors-63/+37
Coalesce `dep-info`, `dep-info-spaces` and `dep-info-doesnt-run-much` `run-make` tests into `dep-info` rmake.rs 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 one of the most ancient tests in the `run-make` directory and its Makefile does some unexpected things, like creating and deleting a `done` directory over and over, sleeping at certain times (this is the [commit](https://github.com/rust-lang/rust/pull/13288/commits/0d9fd8e2a1f8aa43b4cf66272eaa3cf695bbdcd9) that added the `sleep`). I tried to preserve the intent of the test, which is smoke-testing that `dep-info` works. try-job: x86_64-msvc try-job: i686-mingw try-job: aarch64-gnu try-job: aarch64-apple try-job: test-various try-job: armhf-gnu try-job: dist-various-1
2024-08-15Disable macro-stepping on current lldbBen Kimock-1/+2
2024-08-15crashes: more testsMatthias Krüger-0/+131
2024-08-15Rollup merge of #129122 - ↵Matthias Krüger-20/+20
GuillaumeGomez:remove-duplicated-rustdoc-output-methods, r=Kobzol Remove duplicated `Rustdoc::output` method from `run-make-support` lib I discovered recently that `--output` is deprecated in rustdoc and that `--out-dir` is doing the exact same thing. To keep things along with the current rustdoc status, I removed the `Rustdoc::output` method. cc `@jieyouxu` r? `@Kobzol`
2024-08-15Rollup merge of #129101 - compiler-errors:deref-on-parent-by-ref, r=lcnrMatthias Krüger-0/+34
Fix projections when parent capture is by-ref but child capture is by-value in the `ByMoveBody` pass This fixes a somewhat strange bug where we build the incorrect MIR in #129074. This one is weird, but I don't expect it to actually matter in practice since it almost certainly results in a move error in borrowck. However, let's not ICE. Given the code: ``` #![feature(async_closure)] // NOT copy. struct Ty; fn hello(x: &Ty) { let c = async || { *x; //~^ ERROR cannot move out of `*x` which is behind a shared reference }; } fn main() {} ``` The parent coroutine-closure captures `x: &Ty` by-ref, resulting in an upvar of `&&Ty`. The child coroutine captures `x` by-value, resulting in an upvar of `&Ty`. When constructing the by-move body for the coroutine-closure, we weren't applying an additional deref projection to convert the parent capture into the child capture, resulting in an type error in assignment, which is a validation ICE. As I said above, this only occurs (AFAICT) in code that eventually results in an error, because it is only triggered by HIR that attempts to move a non-copy value out of a ref. This doesn't occur if `Ty` is `Copy`, since we'd instead capture `x` by-ref in the child coroutine. Fixes #129074
2024-08-15Rollup merge of #129072 - ↵Matthias Krüger-0/+49
compiler-errors:more-powerful-async-closure-inference, r=lcnr Infer async closure args from `Fn` bound even if there is no corresponding `Future` bound on return In #127482, I implemented the functionality to infer an async closure signature when passed into a function that has `Fn` + `Future` where clauses that look like: ``` fn whatever(callback: F) where F: Fn(Arg) -> Fut, Fut: Future<Output = Out>, ``` However, #127781 demonstrates that this is still incomplete to address the cases users care about. So let's not bail when we fail to find a `Future` bound, and try our best to just use the args from the `Fn` bound if we find it. This is *fine* since most users of closures only really care about the *argument* types for inference guidance, since we require the receiver of a `.` method call to be known in order to probe methods. When I experimented with programmatically rewriting `|| async {}` to `async || {}` in #127827, this also seems to have fixed ~5000 regressions (probably all coming from usages `TryFuture`/`TryStream` from futures-rs): the [before](https://github.com/rust-lang/rust/pull/127827#issuecomment-2254061733) and [after](https://github.com/rust-lang/rust/pull/127827#issuecomment-2255470176) crater runs. Fixes #127781.
2024-08-15Rollup merge of #128348 - ↵Matthias Krüger-0/+34
dingxiangfei2009:allow-shadow-call-stack-sanitizer, r=tmandry Unconditionally allow shadow call-stack sanitizer for AArch64 It is possible to do so whenever `-Z fixed-x18` is applied. cc ``@Darksonn`` for context The reasoning is that, as soon as reservation on `x18` is forced through the flag `fixed-x18`, on AArch64 the option to instrument with [Shadow Call Stack sanitizer](https://clang.llvm.org/docs/ShadowCallStack.html) is then applicable regardless of the target configuration. At the every least, we would like to relax the restriction on specifically `aarch64-unknonw-none`. For this option, we can include a documentation change saying that users of compiled objects need to ensure that they are linked to runtime with Shadow Call Stack instrumentation support. Related: #121972
2024-08-15rewrite native-link-modifier-bundle to rmakeOneirical-46/+101
2024-08-15rewrite rlib-format-packed-bundled-libs to rmakeOneirical-39/+81
2024-08-15coalesce dep-info-spaces and dep-info-doesnt-run-much into dep-infoOneirical-63/+37
2024-08-15Auto merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxubors-0/+38
Support reading thin archives in ArArchiveBuilder And switch to using ArArchiveBuilder with the LLVM backend too now that all regressions are fixed. Fixes https://github.com/rust-lang/rust/issues/107407 Fixes https://github.com/rust-lang/rust/issues/107162 https://github.com/rust-lang/rust/issues/107495 has been fixed in a previous PR already.
2024-08-15About rmake testsGuillaume Gomez-20/+20
2024-08-15Auto merge of #128861 - khuey:mir-inlining-parameters-debuginfo, r=wesleywiserbors-5/+5
Rework MIR inlining debuginfo so function parameters show up in debuggers. Line numbers of multiply-inlined functions were fixed in #114643 by using a single DISubprogram. That, however, triggered assertions because parameters weren't deduplicated. The "solution" to that in #115417 was to insert a DILexicalScope below the DISubprogram and parent all of the parameters to that scope. That fixed the assertion, but debuggers (including gdb and lldb) don't recognize variables that are not parented to the subprogram itself as parameters, even if they are emitted with DW_TAG_formal_parameter. Consider the program: ```rust use std::env; #[inline(always)] fn square(n: i32) -> i32 { n * n } #[inline(never)] fn square_no_inline(n: i32) -> i32 { n * n } fn main() { let x = square(env::vars().count() as i32); let y = square_no_inline(env::vars().count() as i32); println!("{x} == {y}"); } ``` When making a release build with debug=2 and rustc 1.82.0-nightly (8b3870784 2024-08-07) ``` (gdb) r Starting program: /ephemeral/tmp/target/release/tmp [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Breakpoint 1, tmp::square () at src/main.rs:5 5 n * n (gdb) info args No arguments. (gdb) info locals n = 31 (gdb) c Continuing. Breakpoint 2, tmp::square_no_inline (n=31) at src/main.rs:10 10 n * n (gdb) info args n = 31 (gdb) info locals No locals. ``` This issue is particularly annoying because it removes arguments from stack traces. The DWARF for the inlined function looks like this: ``` < 2><0x00002132 GOFF=0x00002132> DW_TAG_subprogram DW_AT_linkage_name _ZN3tmp6square17hc507052ff3d2a488E DW_AT_name square DW_AT_decl_file 0x0000000f /ephemeral/tmp/src/main.rs DW_AT_decl_line 0x00000004 DW_AT_type 0x00001a56<.debug_info+0x00001a56> DW_AT_inline DW_INL_inlined < 3><0x00002142 GOFF=0x00002142> DW_TAG_lexical_block < 4><0x00002143 GOFF=0x00002143> DW_TAG_formal_parameter DW_AT_name n DW_AT_decl_file 0x0000000f /ephemeral/tmp/src/main.rs DW_AT_decl_line 0x00000004 DW_AT_type 0x00001a56<.debug_info+0x00001a56> < 4><0x0000214e GOFF=0x0000214e> DW_TAG_null < 3><0x0000214f GOFF=0x0000214f> DW_TAG_null ``` That DW_TAG_lexical_block inhibits every debugger I've tested from recognizing 'n' as a parameter. This patch removes the additional lexical scope. Parameters can be easily deduplicated by a tuple of their scope and the argument index, at the trivial cost of taking a Hash + Eq bound on DIScope.
2024-08-15Auto merge of #128037 - beetrees:repr128-c-style-use-natvis, r=michaelwoeristerbors-0/+50
Use the `enum2$` Natvis visualiser for repr128 C-style enums Use the preexisting `enum2$` Natvis visualiser to allow PDB debuggers to display fieldless `#[repr(u128)]]`/`#[repr(i128)]]` enums correctly. Tracking issue: #56071 try-job: x86_64-msvc
2024-08-15Port the `sysroot-crates-are-unstable` Python script to rmakeZalathar-77/+99
2024-08-15Rollup merge of #128963 - GuillaumeGomez:output-to-stdout, r=aDotInTheVoidMatthias Krüger-0/+26
Add possibility to generate rustdoc JSON output to stdout Fixes #127165. I think it's likely common to want to get rustdoc json output directly instead of reading it from a file so I added this option to allow it. It's unstable and only works with `--output-format=json`. r? `@aDotInTheVoid`
2024-08-15Rollup merge of #128925 - dingxiangfei2009:smart-ptr-helper-attr, ↵Matthias Krüger-12/+164
r=compiler-errors derive(SmartPointer): register helper attributes Fix #128888 This PR enables built-in macros to register helper attributes, if any, to support correct name resolution in the correct lexical scope under the macros. Also, `#[pointee]` is moved into the scope under `derive(SmartPointer)`. cc `@Darksonn` `@davidtwco`
2024-08-15Rollup merge of #127905 - BKPepe:powerpc-muslspe, r=wesleywiserMatthias Krüger-0/+3
Add powerpc-unknown-linux-muslspe compile target This is almost identical to already existing targets: - powerpc_unknown_linux_musl.rs - powerpc_unknown_linux_gnuspe.rs It has support for PowerPC SPE (muslspe), which can be used with GCC version up to 8. It is useful for Freescale or IBM cores like e500. This was verified to be working with OpenWrt build system for CZ.NIC's Turris 1.x routers, which are using Freescale P2020, e500v2, so add it as a Tier 3 target. Follow-up of https://github.com/rust-lang/rust/pull/100860
2024-08-15Rollup merge of #125970 - RalfJung:before_exec, r=m-ou-seMatthias Krüger-0/+28
CommandExt::before_exec: deprecate safety in edition 2024 Similar to `set_var`, we had to find out after 1.0 was released that `before_exec` should have been unsafe. We partially rectified this by deprecating that function a long time ago, but since https://github.com/rust-lang/rust/pull/124636 we have the ability to also deprecate the safety of the old function and make it a *hard error* to call the old function outside `unsafe` in the next edition. So just in case anyone still uses the old function, let's ensure this can't be ignored when moving code to the new edition. Cc `@rust-lang/libs-api` Tracking: - https://github.com/rust-lang/rust/issues/124866
2024-08-14Infer async closure args from Fn bound even if there is no corresponding ↵Michael Goulet-0/+49
Future bound
2024-08-14Auto merge of #128407 - Oneirical:feline-dotestication, r=jieyouxubors-46/+82
Migrate `min-global-align` and `no-alloc-shim` `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: aarch64-apple try-job: test-various try-job: armhf-gnu try-job: aarch64-gnu try-job: aarch64-gnu
2024-08-14Fix projections when parent capture is by-refMichael Goulet-0/+34
2024-08-14Apply some suggestions to the test rmake filebjorn3-8/+3
2024-08-14rewrite no-alloc-shim to rmakeOneirical-26/+57
2024-08-14rewrite min-global-align to rmakeOneirical-22/+27
2024-08-14Rollup merge of #129071 - Zalathar:sysroot-unstable, r=jieyouxu许杰友 Jieyou Xu (Joe)-2/+5
Port `run-make/sysroot-crates-are-unstable` to rmake I already have a more elaborate draft at #126231 that tries to port the underlying Python script to rmake, but there's no need for the removal of Makefiles to be held up on complex tasks like that, so this PR simply takes the trivial Makefile and converts it into a trivial rmake recipe. Part of #121876. r? ``@jieyouxu``
2024-08-14Rollup merge of #129059 - compiler-errors:subtyping-correct-type, r=lcnr许杰友 Jieyou Xu (Joe)-3/+50
Record the correct target type when coercing fn items/closures to pointers Self-explanatory. We were previously not recording the *target* type of a coercion as the output of an adjustment. This should remedy that. We must also modify the function pointer casts in MIR typeck to use subtyping, since those broke since #118247. r? lcnr
2024-08-14Rollup merge of #128954 - zachs18:fromresidual-no-default, r=scottmcm许杰友 Jieyou Xu (Joe)-3/+3
Explicitly specify type parameter on FromResidual for Option and ControlFlow. ~~Remove type parameter default `R = <Self as Try>::Residual` from `FromResidual`~~ _Specify default type parameter on `FromResidual` impls in the stdlib_ to work around https://github.com/rust-lang/rust/issues/99940 / https://github.com/rust-lang/rust/issues/87350 ~~as mentioned in https://github.com/rust-lang/rust/issues/84277#issuecomment-1773259264~~. This does not completely fix the issue, but works around it for `Option` and `ControlFlow` specifically (`Result` does not have the issue since it already did not use the default parameter of `FromResidual`). ~~(Does this need an ACP or similar?)~~ ~~This probably needs at least an FCP since it changes the API described in [the RFC](https://github.com/rust-lang/rfcs/pull/3058). Not sure if T-lang, T-libs-api, T-libs, or some combination (The tracking issue is tagged T-lang, T-libs-api).~~ This probably doesn't need T-lang input, since it is not changing the API of `FromResidual` from the RFC? Maybe needs T-libs-api FCP?
2024-08-14Rollup merge of #128570 - folkertdev:stabilize-asm-const, r=Amanieu许杰友 Jieyou Xu (Joe)-328/+264
Stabilize `asm_const` tracking issue: https://github.com/rust-lang/rust/issues/93332 reference PR: https://github.com/rust-lang/reference/pull/1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`