Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDiagnostics for blanket impl of closure traits are suboptimal #24210
Comments
huonw
added
A-diagnostics
A-traits
A-closures
labels
Apr 8, 2015
nikomatsakis
self-assigned this
Apr 8, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: P-high (1.0) I consider this a nice to have, but it's prob not too hard to really improve this error message. |
rust-highfive
added
the
P-medium
label
Apr 8, 2015
rust-highfive
added this to the 1.0 milestone
Apr 8, 2015
This comment has been minimized.
This comment has been minimized.
|
You don’t even need a blanket trait impl to get a poor error message; using an intermediate variable binding also gives no hint as to what stops the closure from implementing fn foo<T: Fn()>(_: T) {}
fn main() {
let a = Box::new(1);
let x = || {
a;
};
foo(x);
}gives
|
This comment has been minimized.
This comment has been minimized.
|
hahahaha yes, I'm glad I'm not the only one that thinks this. I think this is the weakest area I've witnessed in Rust's error diagnostics and I think it will be a major pain-point for newcomers, which will probably lead them to see Rust closures as very complex and difficult to understand. I had a lot of trouble with this myself until I ran into it multiple times and @P1start helped me track down the problem, so I think I know what to look for now. I'm happy to see that this is a high priority! |
steveklabnik
removed this from the 1.0 milestone
May 21, 2015
soltanmm
referenced this issue
Apr 6, 2016
Merged
Replace consider_unification_despite_ambiguity with new obligation variant #32780
bors
added a commit
that referenced
this issue
Apr 13, 2016
brson
added
the
T-compiler
label
Jul 14, 2016
This comment has been minimized.
This comment has been minimized.
|
triage: P-low Note a P-medium issue by today's standards, and also hasn't gone fixed for quite awhile! Also cc @jonathandturner, issue about diagnostics. Also removing the assignee of @nikomatsakis as I believe this isn't actively being worked on |
rust-highfive
added
P-low
and removed
P-medium
labels
Jul 14, 2016
alexcrichton
unassigned
nikomatsakis
Jul 14, 2016
arielb1
self-assigned this
Jul 17, 2016
This comment has been minimized.
This comment has been minimized.
|
@arielb1 Unassigning you since this isn't being worked on as far as I know. with x:
with y:
|
Mark-Simulacrum
unassigned
arielb1
May 7, 2017
This comment has been minimized.
This comment has been minimized.
|
Today, the
|
huonw commentedApr 8, 2015
The
xline giveswhile the
yline gives:The latter doesn't really give much information about the problem (moving out of
y) and, AFAIK, the most effective way to debug is to find the offending statement via binary search commenting out chunks of code. :(