- 
                Notifications
    You must be signed in to change notification settings 
- Fork 559
          Update proc_macro_derive to use the attribute template
          #1888
        
          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
          
     Merged
      
      
    
      
        
          +96
        
        
          −75
        
        
          
        
      
    
  
Conversation
  
    
      This file contains hidden or 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 renames it to follow the attribute template. Although I like the old title, since it describes what it does, I would prefer to not make exceptions and stay consistent.
This is to follow the attribute template.
0818af1    to
    46db920      
    Compare
  
    One thing worth highlighting is that we're preferring to say that we "declare" (rather than "define") derive macro helper attributes. A definition is something that says what something is. For these attributes, though, we're just declaring that they exist. In revising, we've clarified that the derive macro function must appear in the root of the crate and that it may be `const` and may use `extern` (with the allowed ABI) but may not use other qualifiers. We've also changed the syntax to use `IDENTIFIER` rather than `SimplePathSegment`. In testing, none of the other things that would be accepted by the latter are allowed, so it seems more correct in terms of user-visible behavior to use `IDENTIFIER` here.
46db920    to
    89789f6      
    Compare
  
    
              
                    traviscross
  
              
              approved these changes
              
                  
                    Aug 3, 2025 
                  
              
              
            
            
    
  tgross35 
      added a commit
        to tgross35/rust
      that referenced
      this pull request
    
      Aug 7, 2025 
    
    
      
  
    
      
    
  
Update books ## rust-lang/book 5 commits in b2d1a0821e12a676b496d61891b8e3d374a8e832..3e9dc46aa563ca0c53ec826c41b05f10c5915925 2025-08-02 01:33:29 UTC to 2025-07-14 21:23:38 UTC - Appendix B and Appendix D from tech review (rust-lang/book#4466) - Chapter 21 from tech review (rust-lang/book#4464) - Chapter 20 from tech review (rust-lang/book#4460) - Chapter 19 from tech review (rust-lang/book#4446) - Chapter 18 from tech review (rust-lang/book#4445) ## rust-lang/reference 12 commits in 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a..1be151c051a082b542548c62cafbcb055fa8944f 2025-08-05 19:51:40 UTC to 2025-07-14 19:49:01 UTC - Fix build output directory in README (rust-lang/reference#1950) - Update `link_name` to use the attribute template (rust-lang/reference#1896) - Update `no_link` to use the attribute template (rust-lang/reference#1898) - Update `proc_macro_derive` to use the attribute template (rust-lang/reference#1888) - Update `automatically_derived` to use the attribute template (rust-lang/reference#1884) - Update `derive` to use the attribute template (rust-lang/reference#1883) - Fix and clarify CR LF normalization and CR in string literals (rust-lang/reference#1944) - glossary.md: tweak description of "dispatch" (rust-lang/reference#1938) - add missing id, r[asm.operand-type.supported-operands.const] (rust-lang/reference#1939) - &str and &[u8] have the same layout (rust-lang/reference#1848) - Rename and rewrite the "question mark operator" (rust-lang/reference#1931) - Change "allocated object" to "allocation". (rust-lang/reference#1930) ## rust-lang/rust-by-example 3 commits in e386be5f44af711854207c11fdd61bb576270b04..bd1279cdc9865bfff605e741fb76a0b2f07314a7 2025-08-04 13:41:04 UTC to 2025-08-02 15:41:59 UTC - Improve the activity instructions in `print_display` (rust-lang/rust-by-example#1948) - Minor fixes (whitespace, typo, i32->u32) (rust-lang/rust-by-example#1947) - Document drawbacks of alternatives to match binding (rust-lang/rust-by-example#1946)
    
  Zalathar 
      added a commit
        to Zalathar/rust
      that referenced
      this pull request
    
      Aug 7, 2025 
    
    
      
  
    
      
    
  
Update books ## rust-lang/book 5 commits in b2d1a0821e12a676b496d61891b8e3d374a8e832..3e9dc46aa563ca0c53ec826c41b05f10c5915925 2025-08-02 01:33:29 UTC to 2025-07-14 21:23:38 UTC - Appendix B and Appendix D from tech review (rust-lang/book#4466) - Chapter 21 from tech review (rust-lang/book#4464) - Chapter 20 from tech review (rust-lang/book#4460) - Chapter 19 from tech review (rust-lang/book#4446) - Chapter 18 from tech review (rust-lang/book#4445) ## rust-lang/reference 12 commits in 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a..1be151c051a082b542548c62cafbcb055fa8944f 2025-08-05 19:51:40 UTC to 2025-07-14 19:49:01 UTC - Fix build output directory in README (rust-lang/reference#1950) - Update `link_name` to use the attribute template (rust-lang/reference#1896) - Update `no_link` to use the attribute template (rust-lang/reference#1898) - Update `proc_macro_derive` to use the attribute template (rust-lang/reference#1888) - Update `automatically_derived` to use the attribute template (rust-lang/reference#1884) - Update `derive` to use the attribute template (rust-lang/reference#1883) - Fix and clarify CR LF normalization and CR in string literals (rust-lang/reference#1944) - glossary.md: tweak description of "dispatch" (rust-lang/reference#1938) - add missing id, r[asm.operand-type.supported-operands.const] (rust-lang/reference#1939) - &str and &[u8] have the same layout (rust-lang/reference#1848) - Rename and rewrite the "question mark operator" (rust-lang/reference#1931) - Change "allocated object" to "allocation". (rust-lang/reference#1930) ## rust-lang/rust-by-example 3 commits in e386be5f44af711854207c11fdd61bb576270b04..bd1279cdc9865bfff605e741fb76a0b2f07314a7 2025-08-04 13:41:04 UTC to 2025-08-02 15:41:59 UTC - Improve the activity instructions in `print_display` (rust-lang/rust-by-example#1948) - Minor fixes (whitespace, typo, i32->u32) (rust-lang/rust-by-example#1947) - Document drawbacks of alternatives to match binding (rust-lang/rust-by-example#1946)
    
  rust-timer 
      added a commit
        to rust-lang/rust
      that referenced
      this pull request
    
      Aug 7, 2025 
    
    
      
  
    
      
    
  
Rollup merge of #145026 - rustbot:docs-update, r=ehuss Update books ## rust-lang/book 5 commits in b2d1a0821e12a676b496d61891b8e3d374a8e832..3e9dc46aa563ca0c53ec826c41b05f10c5915925 2025-08-02 01:33:29 UTC to 2025-07-14 21:23:38 UTC - Appendix B and Appendix D from tech review (rust-lang/book#4466) - Chapter 21 from tech review (rust-lang/book#4464) - Chapter 20 from tech review (rust-lang/book#4460) - Chapter 19 from tech review (rust-lang/book#4446) - Chapter 18 from tech review (rust-lang/book#4445) ## rust-lang/reference 12 commits in 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a..1be151c051a082b542548c62cafbcb055fa8944f 2025-08-05 19:51:40 UTC to 2025-07-14 19:49:01 UTC - Fix build output directory in README (rust-lang/reference#1950) - Update `link_name` to use the attribute template (rust-lang/reference#1896) - Update `no_link` to use the attribute template (rust-lang/reference#1898) - Update `proc_macro_derive` to use the attribute template (rust-lang/reference#1888) - Update `automatically_derived` to use the attribute template (rust-lang/reference#1884) - Update `derive` to use the attribute template (rust-lang/reference#1883) - Fix and clarify CR LF normalization and CR in string literals (rust-lang/reference#1944) - glossary.md: tweak description of "dispatch" (rust-lang/reference#1938) - add missing id, r[asm.operand-type.supported-operands.const] (rust-lang/reference#1939) - &str and &[u8] have the same layout (rust-lang/reference#1848) - Rename and rewrite the "question mark operator" (rust-lang/reference#1931) - Change "allocated object" to "allocation". (rust-lang/reference#1930) ## rust-lang/rust-by-example 3 commits in e386be5f44af711854207c11fdd61bb576270b04..bd1279cdc9865bfff605e741fb76a0b2f07314a7 2025-08-04 13:41:04 UTC to 2025-08-02 15:41:59 UTC - Improve the activity instructions in `print_display` (rust-lang/rust-by-example#1948) - Minor fixes (whitespace, typo, i32->u32) (rust-lang/rust-by-example#1947) - Document drawbacks of alternatives to match binding (rust-lang/rust-by-example#1946)
    
  github-actions bot
      pushed a commit
        to rust-lang/miri
      that referenced
      this pull request
    
      Aug 8, 2025 
    
    
      
  
    
      
    
  
Update books ## rust-lang/book 5 commits in b2d1a0821e12a676b496d61891b8e3d374a8e832..3e9dc46aa563ca0c53ec826c41b05f10c5915925 2025-08-02 01:33:29 UTC to 2025-07-14 21:23:38 UTC - Appendix B and Appendix D from tech review (rust-lang/book#4466) - Chapter 21 from tech review (rust-lang/book#4464) - Chapter 20 from tech review (rust-lang/book#4460) - Chapter 19 from tech review (rust-lang/book#4446) - Chapter 18 from tech review (rust-lang/book#4445) ## rust-lang/reference 12 commits in 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a..1be151c051a082b542548c62cafbcb055fa8944f 2025-08-05 19:51:40 UTC to 2025-07-14 19:49:01 UTC - Fix build output directory in README (rust-lang/reference#1950) - Update `link_name` to use the attribute template (rust-lang/reference#1896) - Update `no_link` to use the attribute template (rust-lang/reference#1898) - Update `proc_macro_derive` to use the attribute template (rust-lang/reference#1888) - Update `automatically_derived` to use the attribute template (rust-lang/reference#1884) - Update `derive` to use the attribute template (rust-lang/reference#1883) - Fix and clarify CR LF normalization and CR in string literals (rust-lang/reference#1944) - glossary.md: tweak description of "dispatch" (rust-lang/reference#1938) - add missing id, r[asm.operand-type.supported-operands.const] (rust-lang/reference#1939) - &str and &[u8] have the same layout (rust-lang/reference#1848) - Rename and rewrite the "question mark operator" (rust-lang/reference#1931) - Change "allocated object" to "allocation". (rust-lang/reference#1930) ## rust-lang/rust-by-example 3 commits in e386be5f44af711854207c11fdd61bb576270b04..bd1279cdc9865bfff605e741fb76a0b2f07314a7 2025-08-04 13:41:04 UTC to 2025-08-02 15:41:59 UTC - Improve the activity instructions in `print_display` (rust-lang/rust-by-example#1948) - Minor fixes (whitespace, typo, i32->u32) (rust-lang/rust-by-example#1947) - Document drawbacks of alternatives to match binding (rust-lang/rust-by-example#1946)
    
  github-actions bot
      pushed a commit
        to rust-lang/rust-analyzer
      that referenced
      this pull request
    
      Aug 11, 2025 
    
    
      
  
    
      
    
  
Update books ## rust-lang/book 5 commits in b2d1a0821e12a676b496d61891b8e3d374a8e832..3e9dc46aa563ca0c53ec826c41b05f10c5915925 2025-08-02 01:33:29 UTC to 2025-07-14 21:23:38 UTC - Appendix B and Appendix D from tech review (rust-lang/book#4466) - Chapter 21 from tech review (rust-lang/book#4464) - Chapter 20 from tech review (rust-lang/book#4460) - Chapter 19 from tech review (rust-lang/book#4446) - Chapter 18 from tech review (rust-lang/book#4445) ## rust-lang/reference 12 commits in 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a..1be151c051a082b542548c62cafbcb055fa8944f 2025-08-05 19:51:40 UTC to 2025-07-14 19:49:01 UTC - Fix build output directory in README (rust-lang/reference#1950) - Update `link_name` to use the attribute template (rust-lang/reference#1896) - Update `no_link` to use the attribute template (rust-lang/reference#1898) - Update `proc_macro_derive` to use the attribute template (rust-lang/reference#1888) - Update `automatically_derived` to use the attribute template (rust-lang/reference#1884) - Update `derive` to use the attribute template (rust-lang/reference#1883) - Fix and clarify CR LF normalization and CR in string literals (rust-lang/reference#1944) - glossary.md: tweak description of "dispatch" (rust-lang/reference#1938) - add missing id, r[asm.operand-type.supported-operands.const] (rust-lang/reference#1939) - &str and &[u8] have the same layout (rust-lang/reference#1848) - Rename and rewrite the "question mark operator" (rust-lang/reference#1931) - Change "allocated object" to "allocation". (rust-lang/reference#1930) ## rust-lang/rust-by-example 3 commits in e386be5f44af711854207c11fdd61bb576270b04..bd1279cdc9865bfff605e741fb76a0b2f07314a7 2025-08-04 13:41:04 UTC to 2025-08-02 15:41:59 UTC - Improve the activity instructions in `print_display` (rust-lang/rust-by-example#1948) - Minor fixes (whitespace, typo, i32->u32) (rust-lang/rust-by-example#1947) - Document drawbacks of alternatives to match binding (rust-lang/rust-by-example#1946)
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  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.
  
    
  
    
New rules:
macro.proc.derive.syntaxmacro.proc.derive.allowed-positionsmacro.proc.derive.duplicatesRenamed rules:
macro.proc.derive.defis nowmacro.proc.derive.allowed-positions