summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2017-06-05Auto merge of #42383 - estebank:candidate-newline, r=arielb1bors-6/+502
Use multiline note for trait suggestion
2017-06-04Auto merge of #42362 - estebank:type, r=arielb1bors-0/+65
Show trait method signature when impl differs When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: <pre> error[E0053]: <b>method `fmt` has an incompatible type for trait</b> --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `<b>fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` found type `<b>fn(&MyType, &str)</b>` error[E0050]: <b>method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2</b> --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0186]: <b>method `fmt` has a `&self` declaration in the trait, but not in the impl</b> --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0046]: <b>not all trait items implemented, missing: `fmt`</b> --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` </code></pre> Fix #28011.
2017-06-04Separate suggestion in a `help` and a `note`Esteban Küber-22/+44
2017-06-04Show trait method signature when impl differsEsteban Küber-0/+65
When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: ``` error[E0053]: method `fmt` has an incompatible type for trait --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` found type `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` ```
2017-06-04Auto merge of #41968 - kennytm:fix-unreadable-json-test-output-36516, ↵bors-0/+342
r=nikomatsakis Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. <del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del> Added support of `// run-pass` header to `ui` tests. The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test. 12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2017-06-03Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrusbors-5/+5
Add E0603 error code Part of #42229. cc @Susurrus
2017-06-03Rollup merge of #42368 - estebank:call-site, r=nikomatsakisCorey Farwell-0/+19
Use callsite's span for macro calls on suggestion When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span. ``` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:48:9 | 48 | s = format!("foo"); | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` | = note: expected type `&mut std::string::String` found type `std::string::String` = help: try with `&mut format!("foo")` = note: this error originates in a macro outside of the current crate ``` Fix #41858.
2017-06-02Add E0603 error codeGuillaume Gomez-5/+5
2017-06-02Use multiline note for trait suggestionEsteban Küber-4/+478
2017-06-02Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516.kennytm-0/+342
The 'run-pass' header cause a 'ui' test to execute the result. It is used to test the lint output, at the same time ensure those lints won't cause the source code to become compile-fail. 12 run-pass/run-pass-fulldeps tests gained the header and are moved to ui/ui-fulldeps. After this move, no run-pass/run-pass-fulldeps tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2017-06-01fix ui referenceNiko Matsakis-1/+1
2017-06-01remove `layout_cache` and fix `-Z print-type-sizes`Niko Matsakis-0/+29
now we grow the type-sizes info during execution, rather than walking the cache after the fact
2017-06-01Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakisbors-24/+19
Decompose Adjustment into smaller steps and remove the method map. The method map held method callee information for: * actual method calls (`x.f(...)`) * overloaded unary, binary, indexing and call operators * *every overloaded deref adjustment* (many can exist for each expression) That last one was a historical ~~accident~~ hack, and part of the motivation for this PR, along with: * a desire to compose adjustments more freely * containing the autoderef logic better to avoid mutation within an inference snapshot * not creating `TyFnDef` types which are incompatible with the original one * i.e. we used to take a`TyFnDef`'s `for<'a> &'a T -> &'a U` signature and instantiate `'a` using a region inference variable, *then* package the resulting `&'b T -> &'b U` signature in another `TyFnDef`, while keeping *the same* `DefId` and `Substs` * to fix #3548 by explicitly writing autorefs for the RHS of comparison operators Individual commits tell their own story, of "atomic" changes avoiding breaking semantics. Future work based on this PR could include: * removing the signature from `TyFnDef`, now that it's always "canonical" * some questions of variance remain, as subtyping *still* treats the signature differently * moving part of the typeck logic for methods, autoderef and coercion into `rustc::traits` * allowing LUB coercions (joining multiple expressions) to "stack up" many adjustments * transitive coercions (e.g. reify or unsize after multiple steps of autoderef) r? @nikomatsakis
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-0/+19
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
2017-06-01tests: fix fallout from changing the span of binop errors.Eduard-Mihai Burtescu-24/+19
2017-06-01Rollup merge of #42302 - GuillaumeGomez:new-error-codes-next, r=SusurrusCorey Farwell-7/+7
New error codes next Part #42229. To be merged after #42264. cc @Susurrus
2017-05-31Rollup merge of #42196 - tommyip:explain_closure_err, r=nikomatsakisMark Simulacrum-2/+7
Explain why a closure is `FnOnce` in closure errors. Issue: #42065 @nikomatsakis Am I going the right direction with this? ~~I am stuck in a few bits:~~ ~~1. How to trace the code to get the upvar instead of the original variable's span?~~ ~~2. How to find the node id of the upvar where the move occured?~~
2017-05-31Update closure errors to use `span_note`Tommy Ip-4/+5
2017-05-30Add new error codeGuillaume Gomez-7/+7
2017-05-30Update fn_once-moved testTommy Ip-2/+6
2017-05-29Auto merge of #42264 - GuillaumeGomez:new-error-codes, r=Susurrusbors-156/+156
New error codes Part of #42229.
2017-05-27Add invalid unary operator usage error codeGuillaume Gomez-2/+2
2017-05-27Add new error codes and update testsGuillaume Gomez-154/+154
2017-05-27Auto merge of #42103 - jorendorff:master, r=estebankbors-2/+5
trace_macro: Show both the macro call and its expansion. #42072. See #42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
2017-05-27Stabilize unions with `Copy` fields and no destructorVadim Petrochenkov-2/+0
2017-05-26Auto merge of #42058 - froydnj:thiscall-support, r=nikomatsakisbors-1/+1
add thiscall calling convention support This support is needed for bindgen to work well on 32-bit Windows, and also enables people to begin experimenting with C++ FFI support on that platform. Fixes #42044.
2017-05-24Rollup merge of #42150 - citizen428:feature/error-count-messages, ↵Mark Simulacrum-246/+246
r=Mark-Simulacrum Change error count messages See #33525 for details. r? @Mark-Simulacrum
2017-05-24add thiscall calling convention supportNathan Froyd-1/+1
This support is needed for bindgen to work well on 32-bit Windows, and also enables people to begin experimenting with C++ FFI support on that platform. Fixes #42044.
2017-05-24Change error count messagesMichael Kohl-246/+246
See #33525 for details.
2017-05-23Rollup merge of #42016 - pietroalbini:stabilize/loop_break_value, r=nikomatsakisCorey Farwell-3/+2
Stabilize the loop_break_value feature Tracking issue: #37339. Documentation PRs already sent to the various repositories.
2017-05-23Auto merge of #41559 - GuillaumeGomez:partial-eq-msg, r=estebankbors-24/+24
Add better error message when == operator is badly used Part of #40660. With the following code: ```rust fn foo<T: PartialEq>(a: &T, b: T) { a == b; } fn main() { foo(&1, 1); } ``` It prints: ``` error[E0277]: the trait bound `&T: std::cmp::PartialEq<T>` is not satisfied --> test.rs:2:5 | 2 | a == b; | ^^^^^^ can't compare `&T` with `T` | = help: the trait `std::cmp::PartialEq<T>` is not implemented for `&T` = help: consider adding a `where &T: std::cmp::PartialEq<T>` bound error: aborting due to previous error ```
2017-05-20Rollup merge of #42062 - fhartwig:fix-off-by-one-span, r=nikomatsakisMark Simulacrum-12/+12
Fix off-by-one error in column number in `explain_span`. Fixes #41938
2017-05-19trace_macro: Show both the macro call and its expansion. #42072.Jason Orendorff-2/+5
2017-05-18Add help message if a FnOnce is movedGuillaume Gomez-0/+36
2017-05-18Fix off-by-one error in column number in `explain_span`.Florian Hartwig-12/+12
2017-05-17Add better error message when == operator is badly usedGuillaume Gomez-24/+24
2017-05-17Stabilize the loop_break_value featurePietro Albini-3/+2
2017-05-14Make unsatisfied trait bounds note multilineEsteban Küber-1/+32
Make diagnostic note for existing method with unsatisfied trait bounds multiline for cleaner output. ``` = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>` `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>> [closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` Before: ``` = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`, `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` ```
2017-05-13rustc: use DefId instead of CodeExtent for FreeRegion's scope.Eduard-Mihai Burtescu-48/+36
2017-05-12Rollup merge of #41876 - oli-obk:diagnosing_diagnostics, r=nagisaMark Simulacrum-40/+40
Refactor suggestion diagnostic API to allow for multiple suggestions r? @jonathandturner cc @nrc @petrochenkov
2017-05-10Example usage of multiple suggestionsOliver Schneider-40/+40
2017-05-09Improve E0477 error messageGuillaume Gomez-0/+26
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-0/+24
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-07Auto merge of #40857 - estebank:recursive, r=arielb1bors-0/+63
Point at fields that make the type recursive On recursive types of infinite size, point at all the fields that make the type recursive. ```rust struct Foo { bar: Bar, } struct Bar { foo: Foo, } ``` outputs ``` error[E0072]: recursive type `Foo` has infinite size --> file.rs:1:1 1 | struct Foo { | ^^^^^^^^^^ recursive type has infinite size 2 | bar: Bar, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable error[E0072]: recursive type `Bar` has infinite size --> file.rs:5:1 | 5 | struct Bar { | ^^^^^^^^^^ recursive type has infinite size 6 | foo: Foo, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable ```
2017-05-07Auto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturnerbors-0/+54
Fix issue #41652 Fix issue #41652. Don't print anything in `render_source_line()` if no source code is given. (cc @jonathandturner #34789)
2017-05-06Update the .stderr file for the "an" changesacdenisSK-1/+1
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-10/+7
2017-05-05Move logic to `is_representable` instead of climbing HIREsteban Küber-22/+21
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-0/+27
2017-05-05Rollup merge of #41722 - F001:warnTilde, r=petrochenkovCorey Farwell-0/+23
Suggest `!` for bitwise negation when encountering a `~` Fix #41679 Here is a program ```rust fn main() { let x = ~1; } ``` It's output: ``` error: `~` can not be used as an unary operator --> /home/fcc/temp/test.rs:4:13 | 4 | let x = ~1; | ^^ | = help: use `!` instead of `~` if you meant to bitwise negation ``` cc @bstrie