Add DefId::parent() accessor for rustc_public#144000
Conversation
|
Thanks! Could you please add an ui-test for that, if it's not too much work |
|
Sorry, while I volunteered to help with reviews here I don't really know intent for stuff like this, so re-rolling |
celinval
left a comment
There was a problem hiding this comment.
It looks good. Can you please add a test to the new API? You can just augment https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/rustc_public/check_defs.rs
r=me when you are done
celinval
left a comment
There was a problem hiding this comment.
oops... wrong checkbox.
|
r? celinval |
|
@jacob-greenfield can you add the test required for this? that's the only thing pending here. |
|
☔ The latest upstream changes (presumably #148280) made this pull request unmergeable. Please resolve the merge conflicts. |
7a32307 to
e9d68a5
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I've added a new/separate UI test based on |
|
Hmmm.. let me try again. @bors r+ rollup |
Rollup merge of #144000 - jacob-greenfield:stable-defid-parent, r=celinval Add `DefId::parent()` accessor for `rustc_public` Adds a `parent()` method to `DefId` (the `rustc_pub` version) which exposes the parent path, ie. `foo::bar::baz` -> `foo::bar`. This is useful for organizing/grouping definitions into a tree, and is probably simpler and less brittle than attempting to parse the fully-qualified name into path components (e.g. especially when handling path components with qualified generic parameters).
Rollup of 3 pull requests Successful merges: - rust-lang/rust#144000 (Add `DefId::parent()` accessor for `rustc_public`) - rust-lang/rust#149409 (Test the coexistence of 'stack-protector' and 'safe-stack') - rust-lang/rust#149449 (Remove an unnecessary `unwrap` in `rustc_codegen_gcc`) r? `@ghost` `@rustbot` modify labels: rollup
…nt, r=celinval Add `DefId::parent()` accessor for `rustc_public` Adds a `parent()` method to `DefId` (the `rustc_pub` version) which exposes the parent path, ie. `foo::bar::baz` -> `foo::bar`. This is useful for organizing/grouping definitions into a tree, and is probably simpler and less brittle than attempting to parse the fully-qualified name into path components (e.g. especially when handling path components with qualified generic parameters).
Rollup of 3 pull requests Successful merges: - rust-lang#144000 (Add `DefId::parent()` accessor for `rustc_public`) - rust-lang#149409 (Test the coexistence of 'stack-protector' and 'safe-stack') - rust-lang#149449 (Remove an unnecessary `unwrap` in `rustc_codegen_gcc`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#144000 (Add `DefId::parent()` accessor for `rustc_public`) - rust-lang/rust#149409 (Test the coexistence of 'stack-protector' and 'safe-stack') - rust-lang/rust#149449 (Remove an unnecessary `unwrap` in `rustc_codegen_gcc`) r? `@ghost` `@rustbot` modify labels: rollup
Adds a
parent()method toDefId(therustc_pubversion) which exposes the parent path, ie.foo::bar::baz->foo::bar.This is useful for organizing/grouping definitions into a tree, and is probably simpler and less brittle than attempting to parse the fully-qualified name into path components (e.g. especially when handling path components with qualified generic parameters).