-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Pretty-print #[deprecated]
attribute in HIR.
#138019
Merged
+141
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
#[deprecated] | ||
pub struct PlainDeprecated; | ||
|
||
#[deprecated = "here's why this is deprecated"] | ||
pub struct DirectNote; | ||
|
||
#[deprecated(note = "here's why this is deprecated")] | ||
pub struct ExplicitNote; | ||
|
||
#[deprecated(since = "1.2.3", note = "here's why this is deprecated")] | ||
pub struct SinceAndNote; | ||
|
||
#[deprecated(note = "here's why this is deprecated", since = "1.2.3")] | ||
pub struct FlippedOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
#[deprecated] | ||
struct PlainDeprecated; | ||
|
||
#[deprecated = "here's why this is deprecated"] | ||
struct DirectNote; | ||
|
||
#[deprecated = "here's why this is deprecated"] | ||
struct ExplicitNote; | ||
|
||
#[deprecated(since = "1.2.3", note = "here's why this is deprecated"] | ||
struct SinceAndNote; | ||
|
||
#[deprecated(since = "1.2.3", note = "here's why this is deprecated"] | ||
struct FlippedOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
#[diagnostic::on_unimplemented( | ||
message = "My Message for `ImportantTrait<{A}>` implemented for `{Self}`", | ||
label = "My Label", | ||
note = "Note 1", | ||
note = "Note 2" | ||
)] | ||
pub trait ImportantTrait<A> {} | ||
|
||
#[diagnostic::do_not_recommend] | ||
impl<T> ImportantTrait<T> for T where T: Clone {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
#[diagnostic::on_unimplemented(message = | ||
"My Message for `ImportantTrait<{A}>` implemented for `{Self}`", label = | ||
"My Label", note = "Note 1", note = "Note 2")] | ||
trait ImportantTrait<A> { } | ||
|
||
#[diagnostic::do_not_recommend] | ||
impl <T> ImportantTrait<T> for T where T: Clone | ||
{#![diagnostic::do_not_recommend] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated but it may be nice to import these directly, or at least via a shorter name like
use rustc_attr_parsing as attr;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no opinion one way or the other, happy to make the change. My personal preference is also to import things, but I know some codebases are conservative with what gets imported so I was playing it safe :)