-
Notifications
You must be signed in to change notification settings - Fork 0
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -29,7 +29,7 @@ LL | let c2 = || { | |||
| ^^ this closure implements `FnMut`, not `Fn` | |||
... | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit
471af5f
to
3fa405c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then use s.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u turn the error into expected closure that implements Fn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh, I see what you want now
784681e
to
d73cf5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit. LGTM otherwise
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