-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
duplicate symbols with enum in boxed closure #2074
Comments
Bug in how |
My fix was a red herring. This relates to #1344 |
After a little more digging (and help from @brson ), here's what I figured about. The following code is similar, but compiles successfully:
In this case, rustc does generate two symbols with the same name (for the two copies of |
Sure. It's there to catch this case, and oblige us to actually produce unique symbols. We need to invent a path prefix for the anonymous closure scope here. The code you have "working" here should also call the unique symbol check. (if we emit duplicate symbols, llvm silently renames them and breaks things worse) |
I reverted c83d61d in order to solve some issues unrelated to this one. |
Reproduced as of a477c5a |
This syntax is terrifyingly old, but this now passes so flagging as needstest fn foo(args: ~[~str]) {
let one: @fn() -> uint = || {
enum r { a }
a as uint
};
let two: @fn() -> uint = || {
enum r { a }
a as uint
};
one(); two();
}
fn main() {} |
Closes rust-lang#2074. Closes rust-lang#5008. Closes rust-lang#7519. Closes rust-lang#7673. Closes rust-lang#7770. Closes rust-lang#8171.
* src/test/run-pass/issue-3559.rs was fixed in rust-lang#4726 * src/test/compile-fail/borrowck-call-sendfn.rs was fixed in rust-lang#2978 * update src/test/compile-fail/issue-5500-1.rs to work with current Rust * removed src/test/compile-fail/issue-5500.rs because it is tested in src/test/run-fail/issue-5500.rs * src/test/compile-fail/view-items-at-top.rs fixed * rust-lang#897 fixed * compile-fail/issue-6762.rs issue was closed as dup of rust-lang#6801 * deleted compile-fail/issue-2074.rs because it became irelevant and is irrelevant rust-lang#2074, a test covering this was added in 4f92f45
* compile-fail/vec-add.rs is obsolete, there are no mutable vectors any more, rust-lang#2711 is closed * compile-fail/issue-1451.rs is obsolete, there are no more structural records, rust-lang#1451 is closed * compile-fail/issue-2074.rs is obsolete, an up to date test is in run-pass/nested-enum-same-names.rs, rust-lang#2074 is closed * compile-fail/omitted-arg-wrong-types.rs is obsolete, rust-lang#2093 is closed
* compile-fail/vec-add.rs is obsolete, there are no mutable vectors any more, rust-lang#2711 is closed * compile-fail/issue-1451.rs is obsolete, there are no more structural records, rust-lang#1451 is closed * compile-fail/issue-2074.rs is obsolete, an up to date test is in run-pass/nested-enum-same-names.rs, rust-lang#2074 is closed * compile-fail/omitted-arg-wrong-types.rs is obsolete, rust-lang#2093 is closed
This program seems correct to me:
If I compile it with rust 0d5d2e5 I get:
This problem only seems to happen with boxed closures (fn@)
The text was updated successfully, but these errors were encountered: