summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2016-11-04Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelixbors-2/+440
detect extra region requirements in impls The current "compare method" check fails to check for the "region obligations" that accrue in the fulfillment context. This branch switches that code to create a `FnCtxt` so that it can invoke the regionck code. Previous crater runs (I haven't done one with the latest tip) have found some small number of affected crates, so I went ahead and introduced a warning cycle. I will kick off a crater run with this branch shortly. This is a [breaking-change] because previously unsound code was accepted. The crater runs also revealed some cases where legitimate code was no longer type-checking, so the branch contains one additional (but orthogonal) change. It improves the elaborator so that we elaborate region requirements more thoroughly. In particular, if we know that `&'a T: 'b`, we now deduce that `T: 'b` and `'a: 'b`. I invested a certain amount of effort in getting a good error message. The error message looks like this: ``` error[E0276]: impl has stricter requirements than trait --> traits-elaborate-projection-region.rs:33:5 | 21 | fn foo() where T: 'a; | --------------------- definition of `foo` from trait ... 33 | fn foo() where U: 'a { } | ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #18937 <https://github.com/rust-lang/rust/issues/18937> note: lint level defined here --> traits-elaborate-projection-region.rs:12:9 | 12 | #![deny(extra_requirement_in_impl)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ ``` Obviously the warning only prints if this is a _new_ error (that resulted from the bugfix). But all existing errors that fit this description are updated to follow the general template. In order to get the lint to preserve the span-labels and the error code, I separate out the core `Diagnostic` type (which encapsulates the error code, message, span, and children) from the `DiagnosticBuilder` (which layers on a `Handler` that can be used to report errors). I also extended `add_lint` with an alternative `add_lint_diagnostic` that takes in a full diagnostic (cc @jonathandturner for those changes). This doesn't feel ideal but feels like it's moving in the right direction =). r? @pnkfelix cc @arielb1 Fixes #18937
2016-11-01move compile-fail tests to ui testsNiko Matsakis-7/+313
gets more comprehensive coverage in `ui`
2016-11-01update ref fileNiko Matsakis-8/+0
2016-11-01compare-method lintNiko Matsakis-9/+36
2016-11-01cleanup error reporting and add `ui` testsNiko Matsakis-2/+115
2016-11-01Improve "Doesn't live long enough" errorMikhail Modin-6/+690
case with different lifetime with spans
2016-10-31Auto merge of #37191 - zackmdavis:we_heard_you_the_first_time_really, ↵bors-0/+54
r=nikomatsakis introing one-time diagnostics: only emit "lint level defined here" once This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part). --- We introduce a new `one_time_diagnostics` field on `rustc::session::Session` to hold a hashset of diagnostic messages we've set once but don't want to see again (as uniquified by span and message text), "lint level defined here" being the motivating example dealt with here. This is in the matter of #24690. --- r? @nikomatsakis
2016-10-26deduplicate one-time diagnostics on lint ID as well as span and messageZack M. Davis-0/+54
Some lint-level attributes (like `bad-style`, or, more dramatically, `warnings`) can affect more than one lint; it seems fairer to point out the attribute once for each distinct lint affected. Also, a UI test is added. This remains in the matter of #24690.
2016-10-26un-break the `construct_witness` logicAriel Ben-Yehuda-0/+103
Fixes #35609.
2016-10-20improve "Doesn't live long enough" errorMikhail Modin-36/+1818
2016-10-17Moved new dropck-eyepatch compile-fail tests to the `ui/` subtree.Felix S. Klock II-0/+470
2016-10-06Better underline for E0057,E0060,E0061Andrea Corradi-0/+34
2016-10-04Rollup merge of #36798 - gavinb:fix/36164, r=GuillaumeGomezManish Goregaokar-6/+58
Improve error message and snippet for "did you mean `x`" - Fixes #36164 - Part of #35233 Based on the standalone example https://is.gd/8STXMd posted by @nikomatsakis and using the third formatting option mentioned in #36164 and agreed by @jonathandturner. Note however this does not address the question of [how to handle an empty or unknown suggestion](https://github.com/rust-lang/rust/issues/36164#issuecomment-244460024). @nikomatsakis any suggestions on how best to address that part?
2016-10-02Improve error message and snippet for "did you mean `x`"Gavin Baker-6/+58
- Fixes #36164 - Part of #35233 - handles unknown fields - uses UI-style tests - update all related tests (cfail, ui, incremental)
2016-09-30Update E0220 error formatJesus Garlea-1/+1
squash! Update E0220 error format Update Error E0220 to new format
2016-09-26Update E0425, E0446, E0449Jonathan Turner-3/+36
2016-09-24Rollup merge of #36498 - jonathandturner:macro_std_lib, r=nikomatsakisGuillaume Gomez-6/+6
Fix wording for out-of-crate macro error This fixes the wording of the note for out-of-crate macro errors to fix https://github.com/rust-lang/rust/issues/36469 The previous wording came from older logic in the PR that was replaced without updating the note.
2016-09-16fix top level attr spansMikhail Modin-0/+32
2016-09-15Specify when type parameter shadows primitive typeEsteban Küber-0/+36
When a type parameter shadows a primitive type, the error message was non obvious. For example, given the file `file.rs`: ```rust trait Parser<T> { fn parse(text: &str) -> Option<T>; } impl<bool> Parser<bool> for bool { fn parse(text: &str) -> Option<bool> { Some(true) } } fn main() { println!("{}", bool::parse("ok").unwrap_or(false)); } ``` The output was: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` = note: found type `bool` error: aborting due to previous error ``` We now show extra information about the type: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) = note: found type `bool` (bool) error: aborting due to previous error ``` Fixes #35030
2016-09-15Fix wording for out-of-crate macro errorJonathan Turner-6/+6
2016-09-12Auto merge of #36354 - mikhail-m1:master, r=jonathandturnerbors-0/+66
fix span for errors E0537, E0535 & E0536 fix #36182 as part of #35233
2016-09-10fix span for errors E0537, E0535 & E0536Mikhail Modin-0/+66
2016-09-04Rollup merge of #36212 - razielgn:updated-e0493-to-new-format, r=jonathandturnerManish Goregaokar-0/+41
Updated e0493 to new format (+ bonus). Part of #35233. Fixes #35999. r? @jonathandturner I'm not satisfied with the bonus part, there has to be an easier way to reach into the `Drop`'s span implementation. I'm all ears. :)
2016-09-02Rollup merge of #36171 - jonathandturner:temporary_value, r=nikomatsakisJonathan Turner-2/+33
Update lifetime errors to specifically note temporaries This PR updates the error message we give in the case of a temporary value not living long enough. Before: <img width="497" alt="screen shot 2016-08-31 at 10 02 47 am" src="https://cloud.githubusercontent.com/assets/547158/18138551/27a06794-6f62-11e6-9ee2-bdf8bed75ca7.png"> Now: <img width="488" alt="screen shot 2016-08-31 at 10 03 01 am" src="https://cloud.githubusercontent.com/assets/547158/18138557/2e5cf322-6f62-11e6-9047-4a78abf3d78c.png"> Specifically, it makes the following changes: * Detects if a temporary is being used. If so, it changes the labels to mention that a temporary value specifically is in question * Simplifies wording of the existing labels to focus on lifetimes rather than values being valid * Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note. r? @nikomatsakis
2016-09-02Moved test on E0493 from compile-fail to ui.Federico Ravasio-0/+41
2016-08-31Update error message for lifetime of borrowed valuesJonathan Turner-2/+33
2016-08-30Guard against platforms on which the sysv64 calling convention is not valid ↵CensoredUsername-1/+1
in non-codegen tests. Remove false positive in a test that relied on the exact formatting of an error string and rewrite the sysv64 register allocation test at it was triggering undefined behaviour
2016-08-27Add UI test for E0379Keith Yeung-0/+39
2016-08-19wording fixes in error messagesJonathan Turner-3/+3
2016-08-18Auto merge of #35732 - jonathandturner:region_error_labels, r=nikomatsakisbors-0/+37
Move 'doesn't live long enough' errors to labels This patch moves the "doesn't live long enough" region-style errors to instead use labels. An example follows. Before: ``` error: `x` does not live long enough --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18 | 26 | let y = &x; | ^ | note: reference must be valid for the block at 23:10... --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:23:11 | 23 | fn main() { | ^ note: ...but borrowed value is only valid for the block suffix following statement 0 at 25:18 --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:25:19 | 25 | let x = 1; | ^ ``` After: ``` error: `x` does not live long enough --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18 | 26 | let y = &x; | ^ does not live long enough ... 32 | }; | - borrowed value only valid until here ... 35 | } | - borrowed value must be valid until here ``` r? @nikomatsakis
2016-08-18Auto merge of #35769 - eddyb:rollup, r=eddybbors-0/+50
Rollup of 12 pull requests - Successful merges: #35346, #35734, #35739, #35740, #35742, #35744, #35749, #35750, #35751, #35756, #35766, #35768 - Failed merges:
2016-08-17Add UI test for E0053Keith Yeung-0/+50
2016-08-17Move 'doesn't live long enough' errors to labelsJonathan Turner-0/+37
2016-08-17Rebase. Fix mutable iteration nit.Jonathan Turner-2/+2
2016-08-17Replace local backtrace with def-use, repair std macro spansJonathan Turner-0/+361
2016-08-17Fix merge conflictJonathan Turner-2/+6
2016-08-17Rollup merge of #35713 - sanxiyn:ui-test, r=nikomatsakisJonathan Turner-0/+53
Use UI test to test spans, instead of forced line break There must be lots more, but these are what I could easily find.
2016-08-16Use UI test to test spans, instead of forced line breakSeo Sanghyeon-0/+53
2016-08-16RUST_NEW_ERROR_FORMAT is no moreSeo Sanghyeon-41/+24
2016-08-12Correct span for pub_restricted fieldSeo Sanghyeon-0/+41
2016-08-05Update E0404 to new format.Ryan Scott-1/+1
2016-08-01Fix fallout in `ui/codemap_tests`.Jeffrey Seyfried-5/+2
2016-07-28Move to {integer} and {float}Jonathan Turner-1/+1
2016-07-28Rename _ to {numerics} for unknown numeric typesJonathan Turner-1/+1
2016-07-14Add unicode test to ui testsJonathan Turner-0/+22
2016-07-14Add fix for tabs. Move error unit tests->ui testsJonathan Turner-0/+391
2016-07-14Fix up some tidy-unfriendly spacingJonathan Turner-4/+4
2016-07-14Fix a couple UI test failuresJonathan Turner-15/+18
2016-05-24Satisfy tidyJonathan Turner-1/+1
2016-05-24Back to single line between errors. Add header space to secondary filesJonathan Turner-3/+0