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 upRustc asks for Reflect, which is unstable, when it could be asking for Any which is stable #33807
Comments
This comment has been minimized.
This comment has been minimized.
|
There is supposed to be a note: Lines 456 to 457 in 34fd686 But it's not triggering. It used to work on stable, but is broken on beta. cc @GuillaumeGomez |
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
added
the
regression-from-stable-to-beta
label
May 26, 2016
This comment has been minimized.
This comment has been minimized.
|
@tinco: Do you have a shorter code sample by any chance? |
sanxiyn
added
the
A-diagnostics
label
Jun 23, 2016
This comment has been minimized.
This comment has been minimized.
|
Reproduction: use std::any::Any;
fn log<T>(value: &T) {
let value_any = value as &Any;
// try to convert our value to a String. If successful, we want to
// output the String's length as well as its value. If not, it's a
// different type: just print it out unadorned.
match value_any.downcast_ref::<String>() {
Some(as_string) => {
}
None => {
}
}
}
fn main() {}
Looks like it does mention |
This comment has been minimized.
This comment has been minimized.
|
That's what I got as well so I concluded it wasn't what he did. But maybe this is already solved in nightly? |
This comment has been minimized.
This comment has been minimized.
|
It mentions |
This comment has been minimized.
This comment has been minimized.
|
This was tagged regression-from-stable-to-beta but that was a cycle ago so it is now a regression-from-stable-to-stable (albeit a quite minor one). rustc 1.8.0 prints this in response to @jonas-schievink's code:
The fifth line (first note) is not printed by 1.9.0 or later versions. |
GuillaumeGomez
added
regression-from-stable-to-stable
and removed
regression-from-stable-to-beta
labels
Jun 27, 2016
This comment has been minimized.
This comment has been minimized.
|
@durka: I updated the tag. |
nrc
added
I-nominated
T-compiler
labels
Aug 18, 2016
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/compiler and/or @durka is this likely to get fixed or should we give up on this? Does seem a shame to live with this regression, but given that it's been on stable for a while (and Reflect will probably disappear anyway) perhaps it is not worth fixing? |
This comment has been minimized.
This comment has been minimized.
|
@nrc It's good idea to track the underlying diagnostics regression (@jonathandturner may be interested). |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Do we have any code that actually reproduces the problem? |
This comment has been minimized.
This comment has been minimized.
|
current error message:
|
This comment has been minimized.
This comment has been minimized.
|
Conclusion for @rust-lang/compiler meeting: current behavior appears to be correct, so we believe problem is fixed, can call this I-needs-test. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-low |
rust-highfive
added
P-low
and removed
I-nominated
labels
Aug 18, 2016
nikomatsakis
added
I-nominated
E-needstest
and removed
P-low
labels
Aug 18, 2016
This comment has been minimized.
This comment has been minimized.
|
Actually, this was misunderstood. The problem is that at some point we decided (perhaps incorrectly) that this kind of message we see now is higher priority that |
nikomatsakis
removed
the
I-nominated
label
Aug 18, 2016
This comment has been minimized.
This comment has been minimized.
|
OK, that's weird to me (why not print both), but if it was deliberate then this can be closed. |
This comment has been minimized.
This comment has been minimized.
|
Closing per previous comments. |
tinco commentedMay 23, 2016
Hi,
I had a latenight coding session and ran into this error:
Seems like an easy fix, add Reflect to the type constraint of the T, but that yields this exception:
That #27749 looks like it won't soon be solved and probably #31844 will supersede it in some way. So this advice from the compiler of adding Reflect is not very nice.
Perhaps we could have it recommend implementing Any instead? Or at least mention Any would do it as well? Most rookies won't know that Any is basically Reflect+'static.
Here's my forum question about this topic with the code that threw the error.