Skip to content
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

Convert errors in libcore’s try! macro too. #28722

Closed
wants to merge 1 commit into from

Conversation

SimonSapin
Copy link
Contributor

It is still a separate definition from libstd’s so that $crate expands to std:: in the latter, not core::.

See discussion at #27701. There is an expectation that core::foo is the same as std::foo. We should not have two things with the same name but subtly different behavior.

r? @aturon

It is still a separate definition from libstd’s
so that `$crate` expands to `std::` in the latter, not `core::`.

See discussion at rust-lang#27701 .
There is an expectation that `core::foo` is the same as `std::foo`.
We should not have two things with the same name
but subtly different behavior.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@briansmith
Copy link
Contributor

If the macro in libcore is defined identically to the macro in libstd, then why are there two definitions? It will be problematic to keep them in sync if they are separate.

@SimonSapin
Copy link
Contributor Author

As mentioned, if the macro was only defined in core and re-exported in std, $crate would always expand to core::, which wouldn’t work in crates that don’t have extern crate core;. Having two macros allows having $crate expand to either core:: or std:: depending on which one you use.

@alexcrichton
Copy link
Member

@SimonSapin I think that $crate actually expands to the crate-of-origin so it should actually work to be just "vanilla reexported" from core in std. I just ran a build locally with the reexport and it seems to be going along ok at least!

Perhaps we could try that out?

@SimonSapin
Copy link
Contributor Author

Uh. It sounds like I made incorrect assumptions, but now I’m confused as to how $crate works. I’m not sure how to do the reexport. If you already have it locally, could you make a PR with it?

@alexcrichton
Copy link
Member

Ah you should just be able to move the try macro as-is from the standard library into libcore and then update this list to have try as well, and that should do the trick!

@bors
Copy link
Contributor

bors commented Dec 6, 2015

☔ The latest upstream changes (presumably #30187) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

Ah I landed this in #30187 basically

@SimonSapin
Copy link
Contributor Author

Thanks for taking care of it!

@SimonSapin SimonSapin deleted the unified-try branch December 6, 2015 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants