Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make unsatisfied trait bounds note multiline #41489

Merged
merged 1 commit into from
May 16, 2017

Conversation

estebank
Copy link
Contributor

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`

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@estebank estebank force-pushed the trait-bounds-diagnosstic branch from 0dfc9b5 to f1203f0 Compare April 24, 2017 01:57
@eddyb
Copy link
Member

eddyb commented Apr 24, 2017

r? @jonathandturner

@rust-highfive rust-highfive assigned sophiajt and unassigned eddyb Apr 24, 2017
@carols10cents carols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 24, 2017
@sophiajt
Copy link
Contributor

Hmm, I mean it's a little better, but I'm wishing we could make the error itself clearer. I'm still not 100% sure is going on when I read either of these errors.

@estebank
Copy link
Contributor Author

@jonathandturner I agree. I noticed this output while working #41488, but it was unrelated to the problem at hand so created this quick PR.

@arielb1
Copy link
Contributor

arielb1 commented May 2, 2017

@jonathandturner - I think this PR fell between the chairs. Do you think it's ready for r+ or are there concerns?

@sophiajt
Copy link
Contributor

sophiajt commented May 3, 2017

@estebank - can you file a followup issue to further improve this error? With that, I don't mind r+ing this as an incremental improvement. I just don't want to lose that more work needs to happen.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2017
@arielb1
Copy link
Contributor

arielb1 commented May 9, 2017

After thinking about this, this looks like a strict improvement over the current state - but I would like a UI test (r=me modulo that). However, we do need to figure out a better way to represent this error. I'll open up an issue about it.

@sophiajt
Copy link
Contributor

Agree with @arielb1 - ui tests here would help us catch regressions.

@estebank estebank force-pushed the trait-bounds-diagnosstic branch from f1203f0 to cb34de5 Compare May 14, 2017 18:08
@sophiajt
Copy link
Contributor

Errors look legit. Maybe there are tests that haven't been updated yet?

[01:02:04] thread 'main' panicked at 'Some tests failed', /checkout/src/tools/compiletest/src/main.rs:315
[01:02:04] 
[01:02:04] ---- [ui] ui/mismatched_types/issue-36053-2.rs stdout ----
[01:02:04] 	ui: /checkout/src/test/ui/mismatched_types/issue-36053-2.rs
[01:02:04] normalized stderr:
[01:02:04] error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope
[01:02:04]   --> $DIR/issue-36053-2.rs:17:55
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                                       ^^^^^
[01:02:04]    |
[01:02:04]    = note: the method `count` exists but the following trait bounds were not satisfied:
[01:02:04]            `[closure@$DIR/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`
[01:02:04]            `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnMut<(&'r str,)>`, but the trait `for<'r> std::ops::FnMut<(&'r &str,)>` is required
[01:02:04]   --> $DIR/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required
[01:02:04]   --> $DIR/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error: aborting due to 3 previous errors
[01:02:04] 
[01:02:04] 
[01:02:04] 
[01:02:04] expected stderr:
[01:02:04] error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope
[01:02:04]   --> $DIR/issue-36053-2.rs:17:55
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                                       ^^^^^
[01:02:04]    |
[01:02:04]    = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`, `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnMut<(&'r str,)>`, but the trait `for<'r> std::ops::FnMut<(&'r &str,)>` is required
[01:02:04]   --> $DIR/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required
[01:02:04]   --> $DIR/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error: aborting due to 3 previous errors
[01:02:04] 
[01:02:04] 
[01:02:04] 
[01:02:04] diff of stderr:
[01:02:04] 
[01:02:04]  error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope
[01:02:04]    --> $DIR/issue-36053-2.rs:17:55
[01:02:04]     |
[01:02:04]  17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]     |                                                       ^^^^^
[01:02:04]     |
[01:02:04] +   = note: the method `count` exists but the following trait bounds were not satisfied:
[01:02:04] +           `[closure@$DIR/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`
[01:02:04] +           `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
[01:02:04] -   = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`, `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
[01:02:04]  
[01:02:04]  error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnMut<(&'r str,)>`, but the trait `for<'r> std::ops::FnMut<(&'r &str,)>` is required
[01:02:04]    --> $DIR/issue-36053-2.rs:17:32
[01:02:04]     |
[01:02:04]  17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]     |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
[01:02:04]     |                                |
[01:02:04]     |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
[01:02:04]     |                                expected &str, found str
[01:02:04]  
[01:02:04]  error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required
[01:02:04]    --> $DIR/issue-36053-2.rs:17:32
[01:02:04]     |
[01:02:04]  17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]     |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
[01:02:04]     |                                |
[01:02:04]     |                                requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
[01:02:04]     |                                expected &str, found str
[01:02:04]  
[01:02:04]  error: aborting due to 3 previous errors
[01:02:04]  
[01:02:04] 
[01:02:04] The actual stderr differed from the expected stderr.
[01:02:04] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mismatched_types/issue-36053-2.stderr
[01:02:04] To update references, run this command from build directory:
[01:02:04] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'mismatched_types/issue-36053-2.rs'
[01:02:04] 
[01:02:04] error: 1 errors occurred comparing output.
[01:02:04] status: exit code: 101
[01:02:04] command: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc /checkout/src/test/ui/mismatched_types/issue-36053-2.rs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui --target=x86_64-unknown-linux-gnu -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mismatched_types/issue-36053-2.stage2-x86_64-unknown-linux-gnu.ui.libaux -C prefer-dynamic -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mismatched_types/issue-36053-2.stage2-x86_64-unknown-linux-gnu -Crpath -O -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers
[01:02:04] stdout:
[01:02:04] ------------------------------------------
[01:02:04] 
[01:02:04] ------------------------------------------
[01:02:04] stderr:
[01:02:04] ------------------------------------------
[01:02:04] error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@/checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:39: 17:53]>` in the current scope
[01:02:04]   --> /checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:55
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                                       ^^^^^
[01:02:04]    |
[01:02:04]    = note: the method `count` exists but the following trait bounds were not satisfied:
[01:02:04]            `[closure@/checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`
[01:02:04]            `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@/checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@/checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnMut<(&'r str,)>`, but the trait `for<'r> std::ops::FnMut<(&'r &str,)>` is required
[01:02:04]   --> /checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error[E0281]: type mismatch: `[closure@/checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required
[01:02:04]   --> /checkout/src/test/ui/mismatched_types/issue-36053-2.rs:17:32
[01:02:04]    |
[01:02:04] 17 |     once::<&str>("str").fuse().filter(|a: &str| true).count();
[01:02:04]    |                                ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
[01:02:04]    |                                |
[01:02:04]    |                                requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
[01:02:04]    |                                expected &str, found str
[01:02:04] 
[01:02:04] error: aborting due to 3 previous errors
[01:02:04] 
[01:02:04] 
[01:02:04] ------------------------------------------
[01:02:04] 
[01:02:04] thread '[ui] ui/mismatched_types/issue-36053-2.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:2472
[01:02:04] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:02:04] 
[01:02:04] 
[01:02:04] failures:
[01:02:04]     [ui] ui/mismatched_types/issue-36053-2.rs
[01:02:04] 
[01:02:04] test result: FAILED. 274 passed; 1 failed; 1 ignored; 0 measured
[01:02:04] 

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`
```
@estebank estebank force-pushed the trait-bounds-diagnosstic branch from cb34de5 to c0d5aa8 Compare May 15, 2017 03:38
@arielb1
Copy link
Contributor

arielb1 commented May 15, 2017

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 15, 2017

📌 Commit c0d5aa8 has been approved by arielb1

frewsxcv added a commit to frewsxcv/rust that referenced this pull request May 15, 2017
…r=arielb1

Make unsatisfied trait bounds note multiline

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`
```
frewsxcv added a commit to frewsxcv/rust that referenced this pull request May 15, 2017
…r=arielb1

Make unsatisfied trait bounds note multiline

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`
```
frewsxcv added a commit to frewsxcv/rust that referenced this pull request May 16, 2017
…r=arielb1

Make unsatisfied trait bounds note multiline

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`
```
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 16, 2017
…r=arielb1

Make unsatisfied trait bounds note multiline

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`
```
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 16, 2017
…r=arielb1

Make unsatisfied trait bounds note multiline

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`
```
@arielb1 arielb1 added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 16, 2017
bors added a commit that referenced this pull request May 16, 2017
Rollup of 8 pull requests

- Successful merges: #41489, #41982, #41994, #41995, #42001, #42005, #42011, #42028
- Failed merges:
@bors bors merged commit c0d5aa8 into rust-lang:master May 16, 2017
@estebank estebank deleted the trait-bounds-diagnosstic branch November 9, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants