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

rustdoc --test does not work on windows #16275

Closed
alexcrichton opened this issue Aug 5, 2014 · 1 comment
Closed

rustdoc --test does not work on windows #16275

alexcrichton opened this issue Aug 5, 2014 · 1 comment
Labels
O-windows Operating system: Windows

Comments

@alexcrichton
Copy link
Member

$ echo 'pub fn foo() {}' > foo.rs
$ rustdoc --test foo.rs
foo.rs:1:1 1:1 error can't find crate for `std`
foo.rs:1 pub fn foo() {}
         ^
error: aborting due to previous error
@alexcrichton
Copy link
Member Author

Dupe of #13259

alexcrichton added a commit to alexcrichton/rust that referenced this issue Aug 6, 2014
There's a good long comment explaining why. The tl;dr; is that I have no idea
why this is necessary, but it gets --test to work on windows which is something,
right?

cc rust-lang#13259
cc rust-lang#16275
cc rust-lang/cargo#302
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 15, 2024
…ykril

fix: Fix `ast::Path::segments` implementation

calling `ast::Path::segments` on a qualifier currently returns all the segments of the top path instead of just the segments of the qualifier.

The issue can be summarized by the simple failing test below:
```rust
#[test]
fn path_segments() {
    //use ra_ap_syntax::ast;
    let path: ast::Path = ...; // e.g. `ast::Path` for "foo::bar::item".

    let path_segments: Vec<_> = path.segments().collect();
    let qualifier_segments: Vec<_> = path.qualifier().unwrap().segments().collect();
    assert_eq!(path_segments.len(), qualifier_segments.len() + 1); // Fails because `LHS = RHS`.
}
```

This PR:
- Fixes the implementation of `ast::Path::segments`
- Fixes `ast::Path::segments` callers that either implicitly relied on behavior of previous implementation or exhibited other "wrong" behavior directly related to the result of `ast::Path::segments` (all callers have been reviewed, only one required modification)
- Removes unnecessary (and now unused) `ast::Path::segments` alternatives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

1 participant