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

Deprecate try! macro in favor of ? #61000

Closed
ghost opened this issue May 21, 2019 · 6 comments · Fixed by #62672
Closed

Deprecate try! macro in favor of ? #61000

ghost opened this issue May 21, 2019 · 6 comments · Fixed by #62672
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ghost
Copy link

ghost commented May 21, 2019

I propose to mark the try! macro as deprecated.


Reasons for it:

The ? operator was added to replace try! and should be used instead.


There are no real downsides 😃
(I am happy to wait for #37939 ;)

@Centril Centril added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 21, 2019
@Centril
Copy link
Contributor

Centril commented May 21, 2019

I did some investigation on the playground and it seems that the reason r#try! isn't deprecated yet is because macro_rules! cannot be deprecated at all. cc @petrochenkov

@ghost
Copy link
Author

ghost commented May 21, 2019

Thanks for the response @Centril .
Seems like this is true.

I thought you could deprecate any struct/function/etc 😬

@petrochenkov
Copy link
Contributor

because macro_rules! cannot be deprecated at all

The issue is #49912, someone (not me) needs to do the work.

@ghost
Copy link
Author

ghost commented May 21, 2019

Deprecation and stability checking is actually done after macro expansion

So I assume clippy can't check this either, or am I wrong?

Otherwise we could make a general clippy lint for #[deprecated] on macros
(which would solve #49912 as well).

@petrochenkov
Copy link
Contributor

Deprecation and stability checking is actually done after macro expansion

It can work at any point if name resolution results are available.
Stability checking is already implemented for macros and deprecation checking can be done by analogy.

Centril added a commit to Centril/rust that referenced this issue Jul 7, 2019
Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes rust-lang#34079
Fixes rust-lang#49912
Unblocks rust-lang#62086
Unblocks rust-lang#61000
Centril added a commit to Centril/rust that referenced this issue Jul 7, 2019
Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes rust-lang#34079
Fixes rust-lang#49912
Unblocks rust-lang#62086
Unblocks rust-lang#61000
@tesuji
Copy link
Contributor

tesuji commented Jul 14, 2019

I take this in #62672 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants