Skip to content
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

Index cross-mod type definition and implementation properly in rustdoc #12752

Merged
merged 1 commit into from
Mar 8, 2014

Conversation

edwardw
Copy link
Contributor

@edwardw edwardw commented Mar 7, 2014

A structure's definition and implementation may be cross-module. If the
implementing module is parsed before defining module, the fully
qualified name of the structure won't be present for the implementation
to use when being indexed. So caches such 'orphan' implementation and
indexes it at the end of crate parsing.

Closes #10284.

@edwardw
Copy link
Contributor Author

edwardw commented Mar 7, 2014

The ugly clone has been eliminated. r?

let path = match self.paths.find(last) {
Some(&(_, "trait")) =>
Some(self.stack.slice_to(self.stack.len() - 1)),
Some(&(ref fqp, "struct")) => Some(fqp.slice_to(fqp.len() - 1)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here about what this is doing? Just something indicating that our stack has no correlation for where the type was defined.

I think this also needs to handle enums.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why enum? There's no definition implementation split problem for them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean its variants?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I has the same problem as structs:

mod b {
    impl ::a::Test {
        fn foo(&self) {}
    }
}

mod a {
    pub enum Test { Test1 }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One can impl an enum? I wasn't aware of that :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

A structure's definition and implementation may be cross-module. If the
implementing module is parsed before defining module, the fully
qualified name of the structure won't be present for the implementation
to use when being indexed. So caches such 'orphan' implementation and
indexes it at the end of crate parsing.

Closes rust-lang#10284.
@edwardw
Copy link
Contributor Author

edwardw commented Mar 7, 2014

All comments addressed.

bors added a commit that referenced this pull request Mar 8, 2014
A structure's definition and implementation may be cross-module. If the
implementing module is parsed before defining module, the fully
qualified name of the structure won't be present for the implementation
to use when being indexed. So caches such 'orphan' implementation and
indexes it at the end of crate parsing.

Closes #10284.
@bors bors closed this Mar 8, 2014
@bors bors merged commit a337592 into rust-lang:master Mar 8, 2014
@edwardw edwardw deleted the rdoc branch March 8, 2014 05:34
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Aug 24, 2024
…e_for_test, r=blyxyas

Disable assigning_clones for tests

Close: rust-lang#12752
As mentioned at rust-lang#12752 when a test struct is initialized with some default string, this inverts the order of assignee/assignment and makes a bit harder to read/write code

changelog: [`assigning_clones.rs`]: disable assigning_clones for tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc search doesn't handle non-trait impls in a different module to the type definition
3 participants