Port #[custom_mir(..)] to the new attribute system#145206
Port #[custom_mir(..)] to the new attribute system#145206bors merged 1 commit intorust-lang:masterfrom
#[custom_mir(..)] to the new attribute system#145206Conversation
|
|
|
Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_hir/src/attrs Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
This comment has been minimized.
This comment has been minimized.
| let (dialect, span) = dialect?; | ||
|
|
||
| let dialect = match dialect.as_str() { | ||
| "analysis" => MirDialect::Analysis, |
There was a problem hiding this comment.
I think you can match directly on symbols here, so sym::analysis
|
|
||
| let phase = match phase.as_str().to_ascii_lowercase().as_str() { | ||
| "initial" => MirPhase::Initial, | ||
| "post_cleanup" | "post-cleanup" | "postcleanup" => MirPhase::PostCleanup, |
There was a problem hiding this comment.
Did the original impl have 3 variants? This feels like something that should be specified and then changed to one of these 3
|
|
||
| #[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)] | ||
| #[derive(HashStable_Generic, PrintAttribute)] | ||
|
|
There was a problem hiding this comment.
How did i end up inserting a newline here?!
| return; | ||
| }; | ||
|
|
||
| let string_of_dialect = || match dialect { |
There was a problem hiding this comment.
you could implement a trait that allows these to be used in diagnostics directly. I forgot which, maybe IntoDiagnosticsValue? Something like that. It's from rustc_errors
There was a problem hiding this comment.
Inherent method name is usually a simple enough way to do that.
compiler/rustc_middle/src/mir/mod.rs
Outdated
|
|
||
| impl RuntimePhase { | ||
| pub fn parse(phase: Option<String>) -> Self { | ||
| pub fn parse(phase: Option<attrs::MirPhase>) -> Self { |
There was a problem hiding this comment.
Should this method be inlined into its use sites now that it's so simple? Like the other *Phase::parse?
| return; | ||
| }; | ||
|
|
||
| let string_of_dialect = || match dialect { |
There was a problem hiding this comment.
Inherent method name is usually a simple enough way to do that.
|
@cjgillot yea I told sasha off-github the same yesterday. Let's just collapse all those alternate syntaxes into one and make them symbols. :) |
|
(i'm kinda busy trying to unbreak the tests, i'll go through all these discussions once i have something that works (i was convinced i ran the tests before opening the PR, but apparently no --')) |
22677db to
4acaec2
Compare
|
@cjgillot @jdonszelmann I think I addressed everything you raised in this PR :) |
This comment has been minimized.
This comment has been minimized.
4acaec2 to
e854013
Compare
|
awesome, looks good! @bors r+ rollup |
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? `@jdonszelmann`
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ``@jdonszelmann``
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ```@jdonszelmann```
Rollup of 11 pull requests Successful merges: - #139345 (Extend `QueryStability` to handle `IntoIterator` implementations) - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - #139345 (Extend `QueryStability` to handle `IntoIterator` implementations) - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ``@jdonszelmann``
Rollup of 10 pull requests Successful merges: - #140794 (Add information about group a lint belongs to) - #144476 (rustdoc-search: search backend with partitioned suffix tree) - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ```@jdonszelmann```
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ````@jdonszelmann````
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? `````@jdonszelmann`````
Rollup of 10 pull requests Successful merges: - #144476 (rustdoc-search: search backend with partitioned suffix tree) - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) - #145489 (library: Migrate from `cfg_if` to `cfg_select`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #144476 (rustdoc-search: search backend with partitioned suffix tree) - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ``````@jdonszelmann``````
Rollup of 10 pull requests Successful merges: - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ```````@jdonszelmann```````
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? ````````@jdonszelmann````````
…szelmann Port `#[custom_mir(..)]` to the new attribute system r? `````````@jdonszelmann`````````
Rollup of 10 pull requests Successful merges: - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #144838 (Fix outdated doc comment) - #145206 (Port `#[custom_mir(..)]` to the new attribute system) - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - #145309 (Fix `-Zregparm` for LLVM builtins) - #145355 (Add codegen test for issue 122734) - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - #145451 (Add static glibc to the nix dev shell) - #145460 (Speedup `copy_src_dirs` in bootstrap) - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - #145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145206 - scrabsha:push-uxovoqzrxnlx, r=jdonszelmann Port `#[custom_mir(..)]` to the new attribute system r? ``````````@jdonszelmann``````````
r? @jdonszelmann