Use hir::Place instead of Symbol in closure_kind_origin#36
Conversation
| LL | pub trait Debug { | ||
| | --------------- required by this bound in `Debug` | ||
| LL | type A: Iterator<Item: Debug>; | ||
| | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` |
There was a problem hiding this comment.
Still investigating why some of the information is missing from stderr
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
cc6116c to
b6298f5
Compare
| ... | ||
| LL | drop::<&mut U>(_x2); | ||
| | --- closure is `FnMut` because it mutates the variable `_x2` here | ||
| | --- closure is `FnMut` because it mutates the variable `*_x2` here |
There was a problem hiding this comment.
Interesting, I would have not expected this to capture *_x2 :o
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
471af5f to
3fa405c
Compare
|
I added more tests and found another bug (it's actually a known bug, so I'll just modify it so it doesn't error out) Will investigate tomorrow |
11c2bb7 to
1cb3878
Compare
arora-aman
left a comment
There was a problem hiding this comment.
Can you move the tests to
test/ui/closures/2229_closure_analysis/diagnostics/
And add origin to the naming scheme like closure-origin-<>
src/test/ui/closures/2229_closure_analysis/diagnostics/closure-single-variant-diagnostics.rs
Show resolved
Hide resolved
| //~^ WARNING: the feature `capture_disjoint_fields` is incomplete | ||
| //~| `#[warn(incomplete_features)]` on by default | ||
| //~| see issue #53488 <https://github.com/rust-lang/rust/issues/53488> | ||
| struct S(String); |
There was a problem hiding this comment.
can you change this have multiple elements, non copy elements?
| fn main() { | ||
| let s = S(format!("s")); | ||
| let c = || { //~ ERROR expected a closure | ||
| let s = s.0; |
There was a problem hiding this comment.
I have tried it, but it doesn't seem like a valid thing to do
|
|
||
| fn main() { | ||
| let s = S(format!("s")); | ||
| let c = || { //~ ERROR expected a closure |
There was a problem hiding this comment.
can u turn the error into expected closure that implements Fn
There was a problem hiding this comment.
Also can you modify the test like this and use s.1: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=5c03fa69ecf41fc95e30bf12c937a848
There was a problem hiding this comment.
ohh, I see what you want now
784681e to
d73cf5f
Compare
d73cf5f to
b498870
Compare
Modifies closure_kind_origins such that Place is used instead of Symbol to describe which variable influenced the decision of selecting a specific closure kind (FnMut, FnOnce, Fn)
Remainging work: Figure out why for 4 of the tests, some stderr info are missing.
Closes rust-lang/project-rfc-2229/issues/21
This change is