-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
UX bug report: Expected foo but found foo. #15142
Comments
I recently encountered this problem while trying to work around the lack of object safety for the Iterator trait (and obviously making several mistakes in the process :-/ ). Here's a concrete toy example: Code:
Error:
Basically, afaict, |
I've been bitten by this bug a couple of times lately, and had to flounder around trying things until it went away since it gives no hints.
In my code, I was setting XClientMessageEvent.data from rust-xlib with a transmute to I also got the same error for function arguments:
In this case, I'm calling XSendEvent and it's saying the I assume this is some kind of problem with Rust telling me the backed type for the exported type, instead of the proper name, and possibly because of how Rust doesn't support C-style unions and so have to be implemented as improper-sized |
@soltanmm wrote:
@huonw wrote:
I see two issues here (and know that they would bite me if I got near them),
|
@soltanmm's example currently errors with: <anon>:13:13: 13:15 error: lifetime name `'a` shadows a lifetime name that is already in scope
<anon>:13 fn next<'a>(&'a mut self) -> Option<&'a isize> {
^~
<anon>:12:6: 12:8 note: shadowed lifetime `'a` declared here
<anon>:12 impl<'a, T> IntIterator for T where T: Iterator<&'a isize> {
^~
error: aborting due to previous error
playpen: application terminated with error code 101 AFAICT this has been introduced in #24162 |
Ah yes, OP was a year ago! Sorry I didn't re-test before bumping. Looks resolved to me, but I don't understand the implications for rust-lang/cargo#1636 |
The better errors for same type names from different crate versions are tracked elsewhere; this issue should be closed as fixed. |
shadowing lifetimes is now illegal. |
…libs, r=lnicola autopublish: Rename crates after removing libs from workspace
Hi,
The following compiler error is not particularly clear or helpful (formatted to show the non-clarity).
While I understand there's a mismatch here, it's not really helpful in grasping what has to happen in my code to correct the error. In particular, if I passed type "X" but got "X", I'm not led towards a clear solution.
I've included below a fuller scroll, which is an error I have gotten a lot but don't really grok how to avoid yet.
Basically, I'm confused by the errors here and don't find them clarifying, only that I'm doing something vaguely wrong with lifetimes.
The text was updated successfully, but these errors were encountered: