about summary refs log tree commit diff
path: root/tests/ui/for-loop-while
AgeCommit message (Collapse)AuthorLines
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-6/+6
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-01-22Auto merge of #134478 - compiler-errors:attr-span, r=oli-obkbors-1/+1
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes #132908 Alternative to #133270 cc `@ehuss` cc `@petrochenkov`
2025-01-21remove support for the #[start] attributeRalf Jung-3/+8
2024-12-21Hash only the spans that we care ended up reading in Span::try_metavarsMichael Goulet-1/+1
2024-12-21Properly record metavar spans for other expansions other than TTMichael Goulet-2/+2
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-11/+0
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-09-13Update tests for hidden references to mutable staticObei Sideg-0/+3
2024-04-30Remove note about iteration count in coerceGurinder Singh-7/+11
and replace it with a simple note suggesting returning a value. The type mismatch error was never due to how many times the loop iterates. It is more because of the peculiar structure of what the for loop desugars to. So the note talking about iteration count didn't make sense
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-62/+62
2024-01-23Remove uses of no-system-llvmNikita Popov-1/+0
It looks like none of these are actually needed.
2023-12-10remove redundant importssurechen-3/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-11-22Provide structured suggestion for type mismatch in loopEsteban Küber-1/+1
We currently provide only a `help` message, this PR introduces the last two structured suggestions instead: ``` error[E0308]: mismatched types --> $DIR/issue-98982.rs:2:5 | LL | fn foo() -> i32 { | --- expected `i32` because of return type LL | / for i in 0..0 { LL | | return i; LL | | } | |_____^ expected `i32`, found `()` | note: the function expects a value to always be returned, but loops might run zero times --> $DIR/issue-98982.rs:2:5 | LL | for i in 0..0 { | ^^^^^^^^^^^^^ this might have zero elements to iterate on LL | return i; | -------- if the loop doesn't execute, this value would never get returned help: return a value for the case when the loop has zero elements to iterate on | LL ~ } LL ~ /* `i32` value */ | help: otherwise consider changing the return type to account for that possibility | LL ~ fn foo() -> Option<i32> { LL | for i in 0..0 { LL ~ return Some(i); LL ~ } LL ~ None | ``` Fix #98982.
2023-06-12Adjust UI tests for `unit_bindings`许杰友 Jieyou Xu (Joe)-5/+5
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-05-24Move testsCaio-0/+11
2023-01-11Move /src/test to /testsAlbert Larsan-0/+1434