about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-10-22Rollup merge of #117034 - Nadrieril:fix-117033, r=cjgillotMatthias Krüger-0/+7
Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint Oops Fixes https://github.com/rust-lang/rust/issues/117033
2023-10-22Auto merge of #116932 - Kobzol:fix-stage1-tests, r=Mark-Simulacrumbors-2/+4
Fix x86_64-gnu-llvm-15 CI tests The CI script was broken - if there was a test failure in the first command chain (inside the `if`), CI would not report the failure. It happened because there were two command chains separated by `&&` in the script, and since `set -e` doesn't exit for chained commands, if the first chain has failed, the script would happily continue forward, ignoring any test failures. This could be fixed e.g. by adding some `|| exit 1` to the first chain, but I suppose that the `&&` chaining is unnecessary here anyway. Reported [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/test.20failure.20didn't.20stop.20CI). Fixes: https://github.com/rust-lang/rust/issues/116867
2023-10-21Fix #117033Nadrieril-0/+7
2023-10-21Rollup merge of #116992 - estebank:issue-69492, r=oli-obkMatthias Krüger-0/+11
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-21Mention the syntax for `use` on `mod foo;` if `foo` doesn't existEsteban Küber-0/+11
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-21Auto merge of #117020 - matthiaskrgr:rollup-cg62m4h, r=matthiaskrgrbors-5/+34
Rollup of 3 pull requests Successful merges: - #106601 (Suggest `;` after bare `match` expression E0308) - #116975 (Move `invalid-llvm-passes` test to `invalid-compile-flags` folder) - #117019 (fix spans for removing `.await` on `for` expressions) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-21Rollup merge of #117019 - lukas-code:for-await, r=compiler-errorsMatthias Krüger-1/+19
fix spans for removing `.await` on `for` expressions We need to use a span with the outer syntax context of a desugared `for` expression to join it with the `.await` span. fixes https://github.com/rust-lang/rust/issues/117014
2023-10-21Rollup merge of #116975 - ojeda:move-invalid-test, r=NilstriebMatthias Krüger-0/+0
Move `invalid-llvm-passes` test to `invalid-compile-flags` folder Nowadays there is an `invalid-compile-flags` folder, thus move this one there.
2023-10-21Rollup merge of #106601 - estebank:match-semi, r=cjgillotMatthias Krüger-4/+15
Suggest `;` after bare `match` expression E0308 Fix #72634.
2023-10-21fix spans for removing `.await` on `for` expressionsLukas Markeffsky-1/+19
2023-10-21Auto merge of #116734 - Nadrieril:lint-per-column, r=cjgillotbors-110/+232
Lint `non_exhaustive_omitted_patterns` by columns This is a rework of the `non_exhaustive_omitted_patterns` lint to make it more consistent. The intent of the lint is to help consumers of `non_exhaustive` enums ensure they stay up-to-date with all upstream variants. This rewrite fixes two cases we didn't handle well before: First, because of details of exhaustiveness checking, the following wouldn't lint `Enum::C` as missing: ```rust match Some(x) { Some(Enum::A) => {} Some(Enum::B) => {} _ => {} } ``` Second, because of the fundamental workings of exhaustiveness checking, the following would treat the `true` and `false` cases separately and thus lint about missing variants: ```rust match (true, x) { (true, Enum::A) => {} (true, Enum::B) => {} (false, Enum::C) => {} _ => {} } ``` Moreover, it would correctly not lint in the case where the pair is flipped, because of asymmetry in how exhaustiveness checking proceeds. A drawback is that it no longer makes sense to set the lint level per-arm. This will silently break the lint for current users of it (but it's behind a feature gate so that's ok). The new approach is now independent of the exhaustiveness algorithm; it's a separate pass that looks at patterns column by column. This is another of the motivations for this: I'm glad to move it out of the algorithm, it was akward there. This PR is almost identical to https://github.com/rust-lang/rust/pull/111651. cc `@eholk` who reviewed it at the time. Compared to then, I'm more confident this is the right approach.
2023-10-21Rollup merge of #116995 - estebank:issue-69944, r=compiler-errorsMatthias Krüger-1/+6
Point at assoc fn definition on type param divergence When the number of type parameters in the associated function of an impl and its trait differ, we now *always* point at the trait one, even if it comes from a foreign crate. When it is local, we point at the specific params, when it is foreign, we point at the whole associated item. Fix #69944.
2023-10-21Rollup merge of #116990 - estebank:issue-68445, r=cjgillotMatthias Krüger-0/+4
Mention `into_iter` on borrow errors suggestions when appropriate If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest `into_iter`. Fix #68445.
2023-10-21Rollup merge of #116974 - Zalathar:signature-spans, r=oli-obk,cjgillotMatthias Krüger-10/+192
coverage: Fix inconsistent handling of function signature spans While doing some more cleanup of `spans`, I noticed a strange inconsistency in how function signatures are handled. Normally the function signature span is treated as though it were executable as part of the start of the function, but in some cases the signature span disappears entirely from coverage, for no obvious reason. This is caused by the fact that spans created by `CoverageSpan::for_fn_sig` don't add the span to their `merged_spans` field (unlike normal statement/terminator spans). In cases where the span-processing code looks at those merged spans, it thinks the signature span is no longer visible and deletes it. Adding the signature span to `merged_spans` resolves the inconsistency. (Prior to #116409 this wouldn't have been possible, because there was no case in the old `CoverageStatement` enum representing a signature. Now that `merged_spans` is just a list of spans, that's no longer an obstacle.)
2023-10-21Rollup merge of #116964 - celinval:smir-mono-body, r=oli-obkMatthias Krüger-1/+25
Add stable Instance::body() and RustcInternal trait The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed. The tests here are very simple, and I'm planning on creating more exhaustive tests in the project-mir repo. But I was hoping to get some feedback here first. r? ```@oli-obk```
2023-10-21Rollup merge of #116961 - estebank:issue-60164, r=oli-obkMatthias Krüger-0/+24
Typo suggestion to change bindings with leading underscore When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix #60164.
2023-10-21Rollup merge of #116911 - estebank:issue-85378, r=oli-obkMatthias Krüger-0/+44
Suggest relaxing implicit `type Assoc: Sized;` bound Fix #85378.
2023-10-21coverage: Handle fn signature spans more consistently near `?`Zalathar-20/+22
2023-10-21coverage: Add a test showing the inconsistent handling of function signaturesZalathar-0/+180
2023-10-20Point at assoc fn definition on type param divergenceEsteban Küber-1/+6
When the number of type parameters in the associated function of an impl and its trait differ, we now *always* point at the trait one, even if it comes from a foreign crate. When it is local, we point at the specific params, when it is foreign, we point at the whole associated item. Fix #69944.
2023-10-20Replace all uses of `generator` in markdown documentation with `coroutine`Oli Scherer-12/+12
2023-10-20bless ui-fulldepsOli Scherer-2/+2
2023-10-20Bless coverage mapOli Scherer-3/+3
2023-10-20Rename `generator` folderOli Scherer-0/+0
2023-10-20Rename lots of files that had `generator` in their nameOli Scherer-81/+81
2023-10-20Rename `Gen` to `Coro` in testsOli Scherer-12/+12
2023-10-20s/generator/coroutine/Oli Scherer-734/+734
2023-10-20s/Generator/Coroutine/Oli Scherer-349/+349
2023-10-20Mention `into_iter` on borrow errors suggestions when appropriateEsteban Küber-0/+4
If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest `into_iter`. Fix #68445.
2023-10-20Typo suggestion to change bindings with leading underscoreEsteban Küber-0/+24
When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix #60164.
2023-10-20Auto merge of #116965 - estebank:issue-65329, r=cjgillotbors-19/+64
Move where doc comment meant as comment check The new place makes more sense and covers more cases beyond individual statements. ``` error: expected one of `.`, `;`, `?`, `else`, or an operator, found doc comment `//!foo --> $DIR/doc-comment-in-stmt.rs:25:22 | LL | let y = x.max(1) //!foo | ^^^^^^ expected one of `.`, `;`, `?`, `else`, or an operator | help: add a space before `!` to write a regular comment | LL | let y = x.max(1) // !foo | + ``` Fix #65329.
2023-10-20Move `invalid-llvm-passes` test to `invalid-compile-flags` folderMiguel Ojeda-0/+0
Nowadays there is an `invalid-compile-flags` folder, thus move this one there. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-10-20Auto merge of #116899 - compiler-errors:closure-sig-infer, r=lcnrbors-0/+36
Add a test showing failing closure signature inference in new solver Been thinking a bit about how to make this test pass... but we don't actually have any good tests exercising this behavior in the suite. r? lcnr
2023-10-20Move where doc comment meant as comment checkEsteban Küber-19/+64
The new place makes more sense and covers more cases beyond individual statements. ``` error: expected one of `.`, `;`, `?`, `else`, or an operator, found doc comment `//!foo --> $DIR/doc-comment-in-stmt.rs:25:22 | LL | let y = x.max(1) //!foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `.`, `;`, `?`, `else`, or an operator | help: add a space before `!` to write a regular comment | LL | let y = x.max(1) // !foo | + ``` Fix #65329.
2023-10-20Auto merge of #116838 - gurry:116836-dup-macro-invoc-diag, r=petrochenkovbors-42/+9
Fix duplicate labels emitted in `render_multispan_macro_backtrace()` This PR replaces the `Vec` used to store labels with an `FxIndexSet` in order to eliminate duplicates Fixes #116836
2023-10-19Add stable Instance::body() and RustcInternal traitCelina G. Val-1/+25
The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.
2023-10-19Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errorsbors-5/+166
Implement rustc part of RFC 3127 trim-paths This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes. `@rustbot` label: +F-trim-paths
2023-10-19FileCheck transmute.Camille GILLOT-2/+44
2023-10-19FileCheck inline_shims.Camille GILLOT-1/+4
2023-10-19FileCheck issue_106141.Camille GILLOT-1/+6
2023-10-19Mention skip in README.Camille GILLOT-0/+2
2023-10-19FileCheck lower_slice_len.Camille GILLOT-2/+3
2023-10-19FileCheck lower_array_len.Camille GILLOT-1/+14
2023-10-19FileCheck lower_intrinsics.Camille GILLOT-1/+87
2023-10-19FileCheck casts.Camille GILLOT-50/+53
2023-10-19FileCheck combine_transmutes.Camille GILLOT-1/+22
2023-10-19FileCheck duplicate_switch_targets.Camille GILLOT-4/+5
2023-10-19FileCheck intrinsic_asserts.Camille GILLOT-37/+46
2023-10-19FileCheck combine_clone_of_primitives.Camille GILLOT-8/+11
2023-10-19FileCheck bool_compare.Camille GILLOT-103/+191