Commit Graph

374 Commits

Author SHA1 Message Date
Esteban Küber
0b2d21e32b Make impl-trait ciclical reference error point to def_span 2017-11-26 12:35:19 -08:00
Esteban Küber
aabb604313 Move "auto trait leak" impl-trait cycle dependency test to ui 2017-11-26 12:32:30 -08:00
Oliver Schneider
8937d6a6cf
Merge cfail and ui tests into ui tests 2017-11-24 11:32:35 +01:00
bors
a6031a2ccf Auto merge of #46024 - estebank:no-variant, r=petrochenkov
Use the proper term when using non-existing variant

When using a non-existing variant, function or associated item, refer to
the proper term, instead of defaulting to "associated item" in
diagnostics.

Fix #28972.

```
error[E0599]: no variant named `Quux` found for type `Foo` in the current scope
 --> file.rs:7:9
  |
7 |         Foo::Quux(..) =>(),
  |         ^^^^^^^^^^^^^
```
2017-11-23 05:53:08 +00:00
Oliver Schneider
a24edb9bce
Add structured suggestions for trait imports 2017-11-20 09:17:27 +01:00
Esteban Küber
055910779a Use local spans only 2017-11-16 16:21:24 -08:00
Oliver Schneider
47c7e430d3
Remove left over dead code from suggestion diagnostic refactoring 2017-11-16 16:36:49 +01:00
Esteban Küber
f796fcd623 Point to ADT definition when not finding variant, method, assoc type 2017-11-15 23:24:58 -08:00
Niko Matsakis
98d5db3350 add a new test featuring two impl traits to show what it looks like 2017-11-15 15:46:01 -05:00
Christopher Vittal
f710d41f77 Add/Fix stderr references for impl Trait ui tests 2017-11-15 15:46:01 -05:00
Niko Matsakis
2786ea662d some tests featuring multiple bounds, other errors 2017-11-15 15:46:01 -05:00
Niko Matsakis
15001ee336 add a UI test showing the current output from an impl trait type 2017-11-15 15:46:01 -05:00
Ariel Ben-Yehuda
9be155d88e remove the hacky selection impl in method::probe 2017-08-29 14:34:43 +03:00
Ariel Ben-Yehuda
fb7ab9e43d report the total number of errors on compilation failure
Prior to this PR, when we aborted because a "critical pass" failed, we
displayed the number of errors from that critical pass. While that's the
number of errors that caused compilation to abort in *that place*,
that's not what people really want to know. Instead, always report the
total number of errors, and don't bother to track the number of errors
from the last pass that failed.

This changes the compiler driver API to handle errors more smoothly,
and therefore is a compiler-api-[breaking-change].

Fixes #42793.
2017-07-02 16:16:44 +03:00
Ariel Ben-Yehuda
77f4022303 Revert "Change error count messages"
This reverts commit 5558c64f33.
2017-07-02 13:49:30 +03:00
bors
13eb0ec9f1 Auto merge of #42383 - estebank:candidate-newline, r=arielb1
Use multiline note for trait suggestion
2017-06-05 13:07:38 +00:00
Esteban Küber
397972f5b0 Separate suggestion in a help and a note 2017-06-04 12:56:57 -07:00
Esteban Küber
e324919ec5 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:

```
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-04 12:52:55 -07:00
Esteban Küber
e935acfa5c Use multiline note for trait suggestion 2017-06-02 10:15:13 -07:00
Eduard-Mihai Burtescu
5fb37beecd tests: fix fallout from changing the span of binop errors. 2017-06-01 08:59:47 +03:00
Mark Simulacrum
d64dddbeaf Rollup merge of #42150 - citizen428:feature/error-count-messages, r=Mark-Simulacrum
Change error count messages

See #33525 for details. r? @Mark-Simulacrum
2017-05-24 19:50:05 -06:00
Michael Kohl
5558c64f33 Change error count messages
See #33525 for details.
2017-05-24 16:14:38 +07:00
Guillaume Gomez
747287a2b3 Add better error message when == operator is badly used 2017-05-17 22:17:53 +02:00
Esteban Küber
be8787dfe5 Explicit help message for binop type missmatch
When trying to do a binary operation with missing implementation, for
example `1 + Some(2)`, provide an explicit help message:

```
note: no implementation for `{integer} + std::option::Option<{integer}>`
```

Use `rustc_on_unimplemented` for the suggestions. Move cfail test to ui.
2017-04-10 14:28:38 -07:00