Skip to content

Commit 63f10cc

Browse files
committed
Add explanation why separate data struct and parsing in rustc_attr_parsing
Signed-off-by: xizheyin <[email protected]>
1 parent e32242c commit 63f10cc

File tree

1 file changed

+10
-3
lines changed
  • compiler/rustc_attr_parsing/src

1 file changed

+10
-3
lines changed

compiler/rustc_attr_parsing/src/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
//! Centralized logic for parsing and attributes.
22
//!
3-
//! This crate is part of a series of crates that handle attribute processing:
4-
//! - rustc_attr_data_structures: Defines the data structures that store parsed attributes
5-
//! - rustc_attr_parsing: This crate, handles the parsing of attributes
3+
//! ## Architecture
4+
//! This crate is part of a series of crates that handle attribute processing.
5+
//! - [rustc_attr_data_structures](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_data_structures/index.html): Defines the data structures that store parsed attributes
6+
//! - [rustc_attr_parsing](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html): This crate, handles the parsing of attributes
67
//! - (planned) rustc_attr_validation: Will handle attribute validation
78
//!
9+
//! The separation between data structures and parsing follows the principle of separation of concerns.
10+
//! Data structures (`rustc_attr_data_structures`) define what attributes look like after parsing.
11+
//! This crate (`rustc_attr_parsing`) handles how to convert raw tokens into those structures.
12+
//! This split allows other parts of the compiler to use the data structures without needing
13+
//! the parsing logic, making the codebase more modular and maintainable.
14+
//!
815
//! ## Background
916
//! Previously, the compiler had a single attribute definition (`ast::Attribute`) with parsing and
1017
//! validation scattered throughout the codebase. This was reorganized for better maintainability

0 commit comments

Comments
 (0)