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

Infinite redirect loop on doc page for 'core::str::trait' #16265

Closed
huonw opened this issue Aug 5, 2014 · 2 comments
Closed

Infinite redirect loop on doc page for 'core::str::trait' #16265

huonw opened this issue Aug 5, 2014 · 2 comments
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@huonw
Copy link
Member

huonw commented Aug 5, 2014

http://static.rust-lang.org/doc/master/core/str/traits/index.html

has contents

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="refresh" content="0;URL=../../../core/str/traits/index.html">
</head>
<body>
</body>
</html>

and that URL=... link points to itself, leaving your web-browser refreshing forever.

@huonw huonw added the A-rustdoc label Aug 5, 2014
@tomjakubowski
Copy link
Contributor

Seems to be because the public core::str::traits module contains only impls. This doc page probably shouldn't even be generated or in the search index, but I imagine something is going wrong when rustdoc is collecting impls.

A pretty minimal reproduction:

#![crate_type="lib"]

pub struct Foo;
pub mod traits {
    impl PartialEq for super::Foo {
        fn eq(&self, _: &super::Foo) -> bool { true }
    }
}

Just adding a pub static or something to the traits module removes the infinite redirect.

@Manishearth
Copy link
Member

The following in a crate's lib.rs also causes this:



trait Y{}

impl Y for Option<uint>{}

(The option could be any type from a different crate)

@alexcrichton alexcrichton self-assigned this Apr 7, 2015
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 15, 2024
…=Veykril

fix: Acknowledge `pub(crate)` imports in import suggestions

rust-analyzer has logic that discounts suggesting `use`s for private imports, but that logic is unnecessarily strict - for instance given this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes the code overly verbose (especially in larger code bases), but also is disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken into account when generating the suggestions; considering rustc's behavior, I think this change doesn't warrant any extra configuration flag.

Note that this is my first commit to RA, so I guess the approach taken here might be suboptimal - certainly feels somewhat hacky, maybe there's some better way of finding out the optimal import path 😅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants