-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Remove more attributes from metadata #98450
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b12b65c
Add missing @local_only on attributes
GuillaumeGomez 72d6fde
Remove doc comments only for private items or some specific doc comments
GuillaumeGomez ae5108a
Add code comments and documentation
GuillaumeGomez 7f0224e
Add ui test to ensure attributes generated from macros are kept as ex…
GuillaumeGomez 41263d2
Add UI regression test when querying visibility of generic parameter
GuillaumeGomez 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
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,20 @@ | ||
// aux-build:attr-from-macro.rs | ||
// run-pass | ||
|
||
extern crate attr_from_macro; | ||
|
||
attr_from_macro::creator! { | ||
struct Foo; | ||
enum Bar; | ||
enum FooBar; | ||
} | ||
|
||
fn main() { | ||
// Checking the `repr(u32)` on the enum. | ||
assert_eq!(4, std::mem::size_of::<Bar>()); | ||
// Checking the `repr(u16)` on the enum. | ||
assert_eq!(2, std::mem::size_of::<FooBar>()); | ||
|
||
// Checking the Debug impl on the types. | ||
eprintln!("{:?} {:?} {:?}", Foo, Bar::A, FooBar::A); | ||
} |
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,15 @@ | ||
#[macro_export] | ||
macro_rules! creator { | ||
(struct $name1:ident; enum $name2:ident; enum $name3:ident;) => { | ||
#[derive(Debug)] | ||
pub struct $name1; | ||
|
||
#[derive(Debug)] | ||
#[repr(u32)] | ||
pub enum $name2 { A } | ||
|
||
#[derive(Debug)] | ||
#[repr(u16)] | ||
pub enum $name3 { A } | ||
} | ||
} |
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,9 @@ | ||
// check-pass | ||
// Check that it doesn't panic when `Input` gets its visibility checked. | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub trait Layer< | ||
/// Hello. | ||
Input, | ||
> {} |
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.
Why is the handling of
privacy_access_levels
so complicated?What about caching it once in
EncodeContext
and then unconditionally call.get(&def_id)
on it?r=me once perf lands
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.
IIRC it was something like this: to check privacy levels only when necessary (since encoding can be fairly hot in incr benchmarks), we're doing it in
should_encode_attr
. With the encoder cloning the attributes iterator to record 2 pieces of information, that in turn required the cache be moved into the filtering closure. Caching inEncodeContext
instead would conflict with that (or require cloning it...).