about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-11-03Auto merge of #132555 - matthiaskrgr:rollup-2d79661, r=matthiaskrgrbors-13/+131
Rollup of 15 pull requests Successful merges: - #129329 (Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`) - #131377 (Add LowerExp and UpperExp implementations to NonZero) - #132393 (Docs: added brief colon explanation) - #132437 (coverage: Regression test for inlining into an uninstrumented crate) - #132499 (unicode_data.rs: show command for generating file) - #132503 (better test for const HashMap; remove const_hash leftovers) - #132511 (stabilize const_arguments_as_str) - #132520 (NFC add known bug nr to test) - #132522 (make codegen help output more consistent) - #132523 (Added regression test for generics index out of bounds) - #132528 (Use `*_opt` typeck results fns to not ICE in fallback suggestion) - #132537 (PassWrapper: adapt for llvm/llvm-project@5445edb5d) - #132540 (Do not format generic consts) - #132543 (add and update some crashtests) - #132550 (compiler: Continue introducing rustc_abi to the compiler) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-03Auto merge of #132514 - Zalathar:print-target-cpus, r=jieyouxubors-0/+39
Port most of `--print=target-cpus` to Rust The logic and formatting needed by `--print=target-cpus` has historically been carried out in C++ code. Originally it used `printf` to write directly to the console, but later it switched over to writing to a `std::ostringstream` and then passing its buffer to a callback function pointer. This PR replaces that C++ code with a very simple function that writes a list of CPU names to a `&RustString`, with the rest of the logic and formatting being handled by ordinary safe Rust code.
2024-11-03Rollup merge of #132543 - cyrgani:master, r=compiler-errorsMatthias Krüger-12/+28
add and update some crashtests Adds tests for #126268 and #132126, updates it for #131050.
2024-11-03Rollup merge of #132528 - compiler-errors:fallback-sugg-opt, r=jieyouxuMatthias Krüger-0/+13
Use `*_opt` typeck results fns to not ICE in fallback suggestion Self-explanatory. Fixes #132517.
2024-11-03Rollup merge of #132523 - ranger-ross:test-issue-117446, r=compiler-errorsMatthias Krüger-0/+57
Added regression test for generics index out of bounds Added a regression test for #117446 This ICE was fixed in Rust 1.75 but a regression test was never added. This PR adds a UI test with a reduced version of the original bug report that does not rely on external crates.
2024-11-03Rollup merge of #132520 - matthiaskrgr:knobu, r=jieyouxuMatthias Krüger-1/+1
NFC add known bug nr to test r? ```````@jieyouxu```````
2024-11-03Rollup merge of #132437 - Zalathar:inline-mixed-regression, r=jieyouxuMatthias Krüger-0/+32
coverage: Regression test for inlining into an uninstrumented crate Regression test for #132395, after I was able to figure out a simple way to reproduce it. See also #132436. In addition to confirming that there is no ICE, this test also demonstrates that the affected code is undercounted, because executing the inlined copy doesn't increment coverage counters.
2024-11-02Auto merge of #125579 - Noratrieb:print-host, r=davidtwcobors-1/+7
Add `--print host-tuple` to print host target tuple People often parse `-vV` output to get to the host tuple, which is annoying to do. It's easier to just get it directly. I called it "host-tuple" instead of "host" because it's clearer that it's just the target name. I'm open to different names, but I think this one is fine. a quick GitHub search for `'^host` reveals many instances of people doing the parsing, for example: https://github.com/japaric/xargo/blob/68e0ca57cd90837fe02f262f074182f9cfeb6227/README.md?plain=1#L369 https://github.com/taiki-e/setup-cross-toolchain-action/blob/0e38473b0c562d6db19a98d3ec20a80f7ac189ae/main.sh#L96 https://github.com/taiki-e/cargo-llvm-cov/blob/8a3553b86551eabf9c30c060b1f72a5bbccb98c6/README.md?plain=1#L625 https://github.com/SiliconLabs/cpc-nvm3/blob/43f3ec39709b30700ef7f39d91fa647974323bf1/do.sh#L35 needs a compiler FCP. I could also do an MCP but I think just an FCP here makes the most sense.
2024-11-02add and update some crashtestscyrgani-12/+28
2024-11-02Add `--print host-triple`Noratrieb-1/+7
People often parse `-vV` output to get to the host triple, which is annoying to do. It's easier to just get it directly.
2024-11-02move deployment-target tests to print-requestNilstrieb-0/+0
2024-11-02Auto merge of #132147 - estebank:long-types-2, r=davidtwcobors-197/+292
Tweak E0277 output when a candidate is available *Follow up to #132086.* Go from ``` error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied --> src/main.rs:7:50 | 7 | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `chumsky::private::ParserSealed<'_, &str, (), chumsky::extra::Full<EmptyErr, (), ()>>` is not implemented for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>`, which is required by `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` | = help: the trait `chumsky::private::ParserSealed<'_, &'a str, ((), ()), chumsky::extra::Full<EmptyErr, (), ()>>` is implemented for `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>` = help: for that trait implementation, expected `((), ())`, found `()` = note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>` note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>` --> src/main.rs:5:16 | 5 | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {} | ^^^^^^^^^^^^^^^^ ^ ---------------------- unsatisfied trait bound introduced here = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt' = note: consider using `--verbose` to print the full type name to the console = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt' = note: consider using `--verbose` to print the full type name to the console ``` to ``` error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied --> src/main.rs:7:50 | 7 | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> { | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound ... 11 | ws.then(parser.map(|_| ())) | --------------------------- return type was inferred to be `Then<Ignored<..., ...>, ..., ..., ..., ...>` here | = help: the trait `ParserSealed<'_, &_, (), Full<_, _, _>>` is not implemented for `Then<Ignored<..., ...>, ..., ..., ..., ...>` but trait `ParserSealed<'_, &'a _, ((), ()), Full<_, _, _>>` is implemented for it = help: for that trait implementation, expected `((), ())`, found `()` = note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>` note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>` --> src/main.rs:5:16 | 5 | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {} | ^^^^^^^^^^^^^^^^ ^ ---------------------- unsatisfied trait bound introduced here = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-df9d52be87eada65.long-type-1337037744507305372.txt' = note: consider using `--verbose` to print the full type name to the console ``` * Remove redundant wording * Introduce trait diff highlighting logic and use it * Fix incorrect "long type written to path" logic (can be split off) * Point at tail expression in more cases in E0277 * Avoid long primary span labels in E0277 by moving them to a `help` Fix #132013. There are individual commits that can be their own PR. If the review load is too big, happy to split them off.
2024-11-02fix testsEsteban Küber-10/+11
Paths in CI can be longer than in devs' machines.
2024-11-02Use opt functions to not ICE in fallback suggestionMichael Goulet-0/+13
2024-11-02Added regression test for 117446ranger-ross-0/+57
2024-11-02Add a run-make test for same-arch `--print=target-cpus`Zalathar-0/+39
2024-11-02NFC add known bug nr to testMatthias Krüger-1/+1
2024-11-02coverage: Regression test for inlining into an uninstrumented crateZalathar-0/+32
2024-11-02Rollup merge of #132481 - lukas-code:doc-stab3, r=GuillaumeGomezMatthias Krüger-14/+100
rustdoc: skip stability inheritance for some item kinds For some item kinds it's incorrect to inherit their parent's stability, because they might be accessible without referring to the parent directly -- This PR removes the stability inheritance for these items and reverts their displayed stability to that before https://github.com/rust-lang/rust/pull/130798. Impl items, both inherent and trait impls, have a stability, but it is ignored when checking for enabled features. However, impl items are automatically unstable if they're nested inside an unstable module -- this caused the children of impl to inherit the instability and lead to https://github.com/rust-lang/rust/issues/132440. Furthermore, for associated items only the stability of the associated item itself is checked and not that of its parent impl. This is true even for trait impls and we have [relied on this behavior in the standard library in the past](https://doc.rust-lang.org/1.37.0/std/slice/trait.SliceConcatExt.html#tymethod.concat), so these also shouldn't inherit the impl's stability. I've also removed the stability inheritance for primitives and keywords so that viewing e.g. [the `i32` docs on `core`](https://doc.rust-lang.org/nightly/core/primitive.i32.html) will no longer show "since 1.6.0". Note that we currently don't annotate stability for the keyword docs, but if we start doing so in the future then this is probably more correct. fixes (after backport) https://github.com/rust-lang/rust/issues/132440
2024-11-02Auto merge of #132497 - matthiaskrgr:rollup-gaskcn0, r=matthiaskrgrbors-16/+147
Rollup of 11 pull requests Successful merges: - #131037 (Move versioned Apple LLVM targets from `rustc_target` to `rustc_codegen_ssa`) - #132170 (Add a Few Codegen Tests) - #132333 (rust_analyzer_helix.toml: add library/ manifest) - #132398 (Add a couple of intra-doc links to str) - #132411 (CI: switch dist-x86_64-musl to free runner) - #132453 (Also treat `impl` definition parent as transparent regarding modules) - #132457 (Remove needless #![feature(asm_experimental_arch)] from loongarch64 inline assembly test) - #132465 (refactor(config): remove FIXME statement in comment of `omit-git-hash`) - #132466 (Account for late-bound depth when capturing all opaque lifetimes.) - #132471 (Add a bunch of mailmap entries) - #132488 (Remove or fix some more `FIXME(async_closure)`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-02Rollup merge of #132488 - compiler-errors:more-fixmes-bye, r=jieyouxuMatthias Krüger-15/+24
Remove or fix some more `FIXME(async_closure)` Self-explanatory
2024-11-02Rollup merge of #132466 - cjgillot:opaque-late, r=compiler-errorsMatthias Krüger-0/+13
Account for late-bound depth when capturing all opaque lifetimes. Fixes https://github.com/rust-lang/rust/issues/132429 r? ````@compiler-errors````
2024-11-02Rollup merge of #132457 - taiki-e:needless-feature, r=workingjubileeMatthias Krüger-1/+1
Remove needless #![feature(asm_experimental_arch)] from loongarch64 inline assembly test inline assembly is already stable on this architecture.
2024-11-02Rollup merge of #132453 - Urgau:non_local_defs-impl-mod-transparent, r=jieyouxuMatthias Krüger-0/+64
Also treat `impl` definition parent as transparent regarding modules This PR changes the `non_local_definitions` lint logic to also consider `impl` definition parent as transparent regarding modules. See tests and explanation in the changes. ``````@rustbot`````` label +L-non_local_definitions Fixes *(after beta-backport)* #132427 cc ``````@leighmcculloch`````` r? ``````@jieyouxu``````
2024-11-02Rollup merge of #132170 - veera-sivarajan:codegen-tests, r=jieyouxuMatthias Krüger-0/+45
Add a Few Codegen Tests Closes #86109 Closes #64219 Those issues somehow got fixed over time. So, this PR adds a couple of codegen tests to ensure we don't regress in the future.
2024-11-02Add a Few Codegen TestsVeera-0/+45
2024-11-02Auto merge of #132352 - DianQK:llvm/19.1.3, r=nikicbors-0/+12
Update LLVM to 19.1.3 Closes #131031. r? nikic
2024-11-02Remove or fix some FIXME(async_closure)Michael Goulet-15/+24
2024-11-02Account for negative bounds in E0277 note and suggestionEsteban Küber-18/+0
Do not suggest `#[derive(Copy)]` when we wanted a `!Copy` type. Do not say "`Copy` is not implemented for `T` but `Copy` is". Do not talk about `Trait` having no implementations when `!Trait` was desired.
2024-11-02On long E0277 primary span label, move it to a `help`Esteban Küber-78/+88
Long span labels don't read well.
2024-11-02Point at tail expression on rpit E0277Esteban Küber-21/+93
``` error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:6:13 | LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` LL | gen { yield 42 } | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` here ``` The secondary span label is new.
2024-11-02Trim output of E0277 in some casesEsteban Küber-32/+0
Remove default note for "trait is not implemented" in favor of the more colorful diff output from the previous commit. Removes duplicated output.
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-73/+135
When a trait is not implemented for a type, but there *is* an `impl` for another type or different trait params, we format the output to use highlighting in the same way that E0308 does for types. The logic accounts for 3 cases: - When both the type and trait in the expected predicate and the candidate are different - When only the types are different - When only the trait generic params are different For each case, we use slightly different formatting and wording.
2024-11-02rustdoc: skip stability inheritance for some item kindsLukas Markeffsky-14/+100
2024-11-01Auto merge of #132470 - GuillaumeGomez:rollup-1a1mkmp, r=GuillaumeGomezbors-52/+400
Rollup of 14 pull requests Successful merges: - #131829 (Remove support for `-Zprofile` (gcov-style coverage instrumentation)) - #132369 (style-guide: Only use the new binop heuristic for assignments) - #132383 (Implement suggestion for never type fallback lints) - #132413 (update offset_of! docs to reflect the stabilization of nesting) - #132438 (Remove unncessary option for default rust-analyzer setting) - #132439 (Add `f16` and `f128` to `invalid_nan_comparison`) - #132444 (rustdoc: Directly use rustc_abi instead of reexports) - #132445 (Cleanup attributes around unchecked shifts and unchecked negation in const) - #132448 (Add missing backtick) - #132450 (Show actual MIR when MIR building forgot to terminate block) - #132451 (remove some unnecessary rustc_allow_const_fn_unstable) - #132455 (make const_alloc_layout feature gate only about functions that are already stable) - #132456 (Move remaining inline assembly test files into asm directory) - #132459 (feat(byte_sub_ptr): unstably add ptr::byte_sub_ptr) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-02Rollup merge of #132456 - taiki-e:test-asm-dir, r=jieyouxuGuillaume Gomez-0/+0
Move remaining inline assembly test files into asm directory Before: ``` tests/assembly/asm/* tests/assembly/asm-comments.rs tests/codegen/asm-target-clobbers.rs tests/codegen/asm-goto.rs tests/codegen/asm-maybe-uninit.rs tests/codegen/asm-msp430-clobbers.rs tests/codegen/asm-options.rs tests/codegen/asm-clobbers.rs tests/codegen/asm-may_unwind.rs tests/codegen/asm-arm64ec-clobbers.rs tests/codegen/asm-powerpc-clobbers.rs tests/codegen/asm-sanitize-llvm.rs tests/codegen/asm-s390x-clobbers.rs tests/codegen/asm-clobber_abi.rs tests/codegen/asm-multiple-options.rs tests/codegen/global_asm.rs tests/codegen/global_asm_include.rs tests/codegen/global_asm_x2.rs tests/ui/asm/* ``` After: ``` tests/assembly/asm/* tests/codegen/asm/* tests/ui/asm/* ``` I moved the remaining standalone test files into the asm directory, and then either removed the "asm-" suffix or for x86-specific registers tests replaced the "asm-" suffix with the "x86-" suffix. (Then I noticed that there is no test for clobber_abi for already stabilized aarch64, arm, riscv, and loongarch64 asm... I don't believe there is a problem like https://github.com/rust-lang/rust/pull/131332, but I plan to add tests for them later.) r? ``@Amanieu`` ``@rustbot`` label +A-inline-assembly
2024-11-02Rollup merge of #132448 - chengehe:master, r=NoratriebGuillaume Gomez-1/+1
Add missing backtick
2024-11-02Rollup merge of #132439 - tgross35:f16-f128-nan-lint, r=jieyouxuGuillaume Gomez-29/+295
Add `f16` and `f128` to `invalid_nan_comparison` Currently `f32_nan` and `f64_nan` are used to provide the `invalid_nan_comparison` lint. Since we have `f16_nan` and `f128_nan`, hook these up so the new float types get the same lints.
2024-11-02Rollup merge of #132383 - compiler-errors:never-type-fallback-sugg, ↵Guillaume Gomez-0/+104
r=WaffleLapkin Implement suggestion for never type fallback lints r? ```@WaffleLapkin``` Just opening this up for vibes; it's not done yet. I'd still like to make this suggestable in a few more cases before merge: - [x] Try to annotate `_` -> `()` - [x] Try to annotate local variables if they're un-annotated: `let x = ...` -> `let x: () = ...` - [x] Try to annotate the self type of a `Trait::method()` -> `<() as Trait>::method()`. The only other case we may want to suggest is a missing turbofish, like `f()` -> `f::<()>()`. That may be possible, but seems overly annoying. This partly addresses https://github.com/rust-lang/rust/issues/132358; the other half of fixing that would be to make the error message a bit better, perhaps just special casing the `?` operator 🤔 I don't think I'll do that part.
2024-11-02Rollup merge of #131829 - Zalathar:goodbye-zprofile, r=chenyukangGuillaume Gomez-22/+0
Remove support for `-Zprofile` (gcov-style coverage instrumentation) Tracking issue: #42524 MCP: https://github.com/rust-lang/compiler-team/issues/798 --- This PR removes the unstable `-Zprofile` flag, which enables ”gcov-style” coverage instrumentation, along with its associated `-Zprofile-emit` configuration flag. (The profile flag predates and is almost entirely separate from the stable `-Cinstrument-coverage` flag.) Notably, the `-Zprofile` flag: - Is largely untested in-tree, having only one run-make test that does not check whether its output is correct or useful. - Has no known maintainer. - Has seen no push towards stabilization. - Has at least one severe regression reported in 2022 that apparently remains unaddressed. - #100125 - Is confusingly named, since it appears to be more about coverage than performance profiling, and has nothing to do with PGO. - Is fundamentally limited by relying on counters auto-inserted by LLVM, with no knowledge of Rust beyond debuginfo.
2024-11-01Use more minimized test.Camille GILLOT-38/+6
2024-11-01Account for late-bound depth when capturing all opaque lifetimes.Camille GILLOT-0/+45
2024-11-01Completely deny calling functions with const conditions in MIR const check ↵Michael Goulet-23/+107
unless const_trait_impl is enabled This will help us make sure that we never leak any conditionally const functions into stable.
2024-11-01Double-check conditional constness in MIRMichael Goulet-3/+10
To prevent any conditional constness from leaking through during MIR lowering
2024-11-01Also treat `impl` definition parent as transparent regarding modulesUrgau-0/+64
2024-11-01Remove needless #![feature(asm_experimental_arch)] from loongarch64 inline ↵Taiki Endo-1/+1
assembly test
2024-11-01Move remaining inline assembly test files into asm directoryTaiki Endo-0/+0
2024-11-01Add missing backtickchengehe-1/+1
2024-10-31Add `f16` and `f128` to `invalid_nan_comparison`Trevor Gross-29/+295
Currently `f32_nan` and `f64_nan` are used to provide the `invalid_nan_comparison` lint. Since we have `f16_nan` and `f128_nan`, hook these up so the new float types get the same lints.
2024-11-01And also suggest for qpathsMichael Goulet-0/+72