Document rustc_public lib.rs and update README#159347
Conversation
Add module-level documentation with usage example, crate discovery guide, and status section. Document all public types, methods, and free functions in lib.rs. Update README to reflect the crate rename from stable_mir/rustc_smir to rustc_public/rustc_public_bridge.
|
r? @scottmcm rustbot has assigned @scottmcm. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| pub mod ty; | ||
| pub mod visitor; | ||
|
|
||
| /// Use String for now but we should replace it. |
There was a problem hiding this comment.
Does this no longer need replacing? It reads like it should be a FIXME
There was a problem hiding this comment.
true... let me expand this. I was actually thinking of changing it to be an opaque type for now. But I didn't want to change it as part of this PR.
| /// Returns `true` if this item, or any of its parent definitions, has type | ||
| /// or const generic parameters. This applies to functions, constants, statics, | ||
| /// and any item nested inside a generic context. |
There was a problem hiding this comment.
What is a parent definition precisely?🤔
There was a problem hiding this comment.
I'd say a parent definition is the DefId of the enclosing item of this item, and this item inherits the enclosing item's generic parameters.
There was a problem hiding this comment.
Hmm, maybe:
| /// Returns `true` if this item, or any of its parent definitions, has type | |
| /// or const generic parameters. This applies to functions, constants, statics, | |
| /// and any item nested inside a generic context. | |
| /// Returns `true` if this item has type or const generic parameters or is | |
| /// defined inside an item that does. This applies to functions, constants, statics, | |
| /// and any item nested inside a generic context. |
| //! access to the API within a callback. All queries must be performed inside this callback | ||
| //! since the data structures are tied to the compiler's thread-local state. | ||
| //! | ||
| //! ```rust,ignore (requires compiler session) |
There was a problem hiding this comment.
| //! ```rust,ignore (requires compiler session) | |
| //! ```rust,no_run (requires compiler session) |
There was a problem hiding this comment.
I don't think this will compile either
There was a problem hiding this comment.
I'm quite wary of untested doc examples, especially here...from my experience they eventually bitrot away.
There was a problem hiding this comment.
The example can't be tested as a doctest today because it requires linking against the stage2 of the rustc_driver library. As part of publishing rustc_public, we are working on CI improvements of the rustc_public repository. There we should be able to configure CI to keep examples tested.
For now I'll keep it simple with ignore, or would you rather I drop it entirely until we can properly test it?
| //! // ... analyze items ... | ||
| //! ControlFlow::Continue(()) | ||
| //! }); | ||
| //! ``` |
There was a problem hiding this comment.
Can this example actually do something? Considering the other items documented in this pr, maybe a check that you aren't using multiple versions of the same crate? See https://github.com/TheBevyFlock/bevy_cli/blob/main/bevy_lint/src/lints/nursery/duplicate_bevy_dependencies.rs for example.
| /// Returns `true` if this item, or any of its parent definitions, has type | ||
| /// or const generic parameters. This applies to functions, constants, statics, | ||
| /// and any item nested inside a generic context. |
There was a problem hiding this comment.
What is a parent definition precisely?🤔
| /// Returns `true` if this item, or any of its parent definitions, has type | ||
| /// or const generic parameters. This applies to functions, constants, statics, | ||
| /// and any item nested inside a generic context. |
There was a problem hiding this comment.
I'd say a parent definition is the DefId of the enclosing item of this item, and this item inherits the enclosing item's generic parameters.
- Add a concrete code example (duplicate crate detection) - Clarify requires_monomorphization doc - Add FIXME for Symbol type alias Co-authored-by: Bruno Kolenbrander <[email protected]>
…uwer Rollup of 6 pull requests Successful merges: - #159524 (Gather PGO profiles in parallel) - #158850 (Avoid underflow for splatted rust-call receivers) - #159215 ([compiletest] Differentiate between LLVM LLDB and Apple LLDB) - #159347 (Document rustc_public lib.rs and update README) - #159469 (Reorganize `tests/ui/issues` [27/N]) - #159512 (Add regression tests for fixed dead-code issues)
Rollup merge of #159347 - celinval:docs/rpub-lib, r=mejrs Document rustc_public lib.rs and update README Add module-level documentation with usage example, crate discovery guide, and status section. Document all public types, methods, and free functions in lib.rs. Update README to reflect the crate rename from `stable_mir`/`rustc_smir` to `rustc_public`/`rustc_public_bridge`. Disclaimer: I used AI to help me generate the documentation.
Add module-level documentation with usage example, crate discovery guide, and status section. Document all public types, methods, and free functions in lib.rs. Update README to reflect the crate rename from
stable_mir/rustc_smirtorustc_public/rustc_public_bridge.Disclaimer: I used AI to help me generate the documentation.