Commit Graph

37 Commits

Author SHA1 Message Date
Henry Boisdequin 26478c81fd Don't show note if `span` is `DUMMY_SP` 2021-03-12 06:18:33 +05:30
Esteban Küber 9e82329c8f Do not suggest using a break label when one is already present 2021-01-21 21:43:29 -08:00
Esteban Küber 8a13abba1d Tweak error for invalid `break expr`
Point at loop head on invalid `break expr`.
Suggest removing `expr` or using label if available.
2021-01-21 21:41:46 -08:00
Esteban Küber a701ff981d Suggest `'a` when given `a` only when appropriate
When encountering a name `a` that isn't resolved, but a label `'a` is
found in the current ribs, only suggest `'a` if this name is the value
expression of a `break` statement.

Solve FIXME.
2021-01-21 21:41:46 -08:00
Daiki Ihara e9ca2909ad Add test case for break expr with misspelled value
Update src/test/ui/loops/loop-break-value.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-12-17 20:22:27 +09:00
Yuki Okushi cdcce11504 Tweak diagnostics on shadowing lifetimes/labels 2020-12-02 11:39:42 +09:00
Yuki Okushi 9a164ff4c5
Skip tests on emscripten 2020-05-08 00:39:02 +09:00
Yuki Okushi e69748ba4f
Move tests from `test/run-fail` to UI 2020-05-06 14:02:55 +09:00
Val Markovic 2155adbc3a Moving more build-pass tests to check-pass
One or two tests became build-pass without the FIXME because they really
needed build-pass (were failing without it).

Helps with #62277
2020-04-23 20:21:38 -07:00
RoccoDev b85c64c3ea
rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
Niko Matsakis 405eefe467 add `#![feature(never_type)]` to tests as needed 2019-12-14 09:01:18 -05:00
Niko Matsakis 1719337d02 Revert "Remove `#![feature(never_type)]` from tests."
This reverts commit 8f6197f39f.
2019-12-14 09:01:04 -05:00
Dylan MacKenzie 5c377f37e4 Reorganize, bless and add tests for const control flow
This creates a new test directory, `ui/consts/control-flow` to hold
tests related to control flow in a const context. It also blesses all
existing tests with the new error messages, and adds new tests for the
`const_if_match` feature.
2019-11-21 16:55:13 -08:00
bors 53712f8637 Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
2019-11-21 17:53:19 +00:00
Mazdak Farrokhzad 8f6197f39f Remove `#![feature(never_type)]` from tests.
Also remove `never_type` the feature-gate test.
2019-11-21 14:55:32 +01:00
Esteban Küber 6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber 94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber b2e6aef073 review comments: tweak prefix strings 2019-11-18 11:02:44 -08:00
Esteban Küber 83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Esteban Küber 0baf61bfdb Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
Alexander Regueiro 022d9c8eb5 Fixed grammar/style in error messages and reblessed tests. 2019-09-06 03:46:08 +01:00
Esteban Küber 799b13ada5 Do not suggest using ! with break 2019-08-09 07:18:05 -07:00
Esteban Küber c076392143 Tweak mismatched types error on break expressions 2019-08-09 07:18:05 -07:00
Samy Kacimi e5e1397adb
normalize use of backticks in compiler messages for librustc/lint
https://github.com/rust-lang/rust/issues/60532
2019-07-17 22:49:48 +02:00
Mazdak Farrokhzad 547735457f Make WhileTrue into an EarlyLintPass lint. 2019-07-06 06:43:58 +02:00
Mazdak Farrokhzad 18081890ea
Rollup merge of #62388 - rust-lang:fix-loop-break-mir-generation, r=eddyb
Break out of the correct number of scopes in loops

We were incorrectly breaking out of one too many drop scopes when
generating MIR for loops and breakable blocks, resulting in use after
free and associated borrow checker warnings.

This wasn't noticed because the scope that we're breaking out of twice
is only used for temporaries that are created for adjustments applied to
the loop. Since loops generally propagate coercions to the `break`
expressions, the only case we see this is when the type of the loop is a
smart pointer to a trait object.

Closes #62312
2019-07-05 13:53:13 +02:00
Matthew Jasper 1b7ffe5300 Break out of the correct number of scopes in loops
We were incorrectly breaking out of one too many drop scopes when
generating MIR for loops and breakable blocks, resulting in use after
free and associated borrow checker warnings.

This wasn't noticed because the scope that we're breaking out of twice
is only used for temporaries that are created for adjustments applied to
the loop. Since loops generally propagate coercions to the `break`
expressions, the only case we see this is when the type of the loop is a
smart pointer to a trait object.
2019-07-04 21:53:46 +01:00
Yuki Okushi c004451a20 Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
memoryruins eb4580a570 Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
Matthew Jasper 8eef102270 update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
Andy Russell b6f148c8bd
hide `--explain` hint if error has no extended info 2019-04-18 13:29:28 -04:00
Vadim Petrochenkov c1cfacfb13 Update NLL tests 2019-03-11 23:18:35 +03:00
Vadim Petrochenkov fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Yuning Zhang 710dcbd381 Improve type mismatch error messages
Replace "integral variable" with "integer" and replace
"floating-point variable" with "floating-point number" to make the
message less confusing.
2018-12-31 20:43:08 -05:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Felix S. Klock II a2e090624e Removed `#[rustc_error]` from tests that are all `// compile-pass`.
I also added `// skip-codegen` to each one, to address potential concerns
that this change would otherwise slow down our test suite spending time
generating code for files that are really just meant to be checks of
compiler diagnostics.

(However, I will say: My preference is to not use `// skip-codegen` if
one can avoid it. We can use all the testing of how we drive LLVM that
we can get...)

(Updated post rebase.)
2018-11-07 13:09:52 +01:00
David Wood 3fc7ab2373
Merged migrated compile-fail tests and ui tests. Fixes #46841. 2018-08-14 11:12:09 +02:00