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: Fix source-links for files with absolute-paths #31835

Merged
merged 2 commits into from Feb 25, 2016

Conversation

Projects
None yet
3 participants
@mitaa
Copy link
Contributor

mitaa commented Feb 23, 2016

@mitaa mitaa force-pushed the mitaa:rdoc-global-src branch 2 times, most recently from 53bd2ee to 78ca2e2 Feb 23, 2016

-include ../tools.mk

all:
printf "#[path=\"%s/%s\"] pub mod baz;\n" `pwd` "bar/baz.rs" > foo.rs

This comment has been minimized.

@alexcrichton

alexcrichton Feb 23, 2016

Member

Perhaps this could be a unix-only rustdoc test which has a module with the path as /dev/null? That would avoid run-make and you could still check for the module page, right?

This comment has been minimized.

@mitaa

mitaa Feb 23, 2016

Author Contributor

Didn't think of that, but it seems like rustdoc doesn't generate files for empty public modules.

That did make another bug clear though, namely that absolute paths not contained in the root directory are still broken just like before.
(I'm gonna try to put these in a src/__root__ directory; for example /dev/null -> src/__root__/dev/null.html)

This comment has been minimized.

@alexcrichton

alexcrichton Feb 23, 2016

Member

Hm ok, I just try to avoid run-make like the plague as makefiles are basically impossible to get right on both windows and unix...

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 23, 2016

@mitaa mitaa force-pushed the mitaa:rdoc-global-src branch from 78ca2e2 to 0db42c3 Feb 23, 2016

@mitaa

This comment has been minimized.

Copy link
Contributor Author

mitaa commented Feb 23, 2016

I pushed an update so that this also works for absolute paths not contained in the root directory.

That would unfortunately be even worse to test, so I didn't include one. (works locally though)

p.to_path_buf()
}
}
};

This comment has been minimized.

@alexcrichton

alexcrichton Feb 23, 2016

Member

This seems kinda sketchy, perhaps the iterator below could use components on Path to only look at the Component::Normal parts?

@mitaa mitaa force-pushed the mitaa:rdoc-global-src branch from 0db42c3 to 4037a7d Feb 23, 2016

@mitaa

This comment has been minimized.

Copy link
Contributor Author

mitaa commented Feb 23, 2016

(updated)

I've preserved the Component::ParentDir -> "up" renaming, so this does not look only at Component::Normal. (maybe this can be dropped?)

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 23, 2016

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 24, 2016

⌛️ Testing commit 4037a7d with merge 4159981...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 24, 2016

💔 Test failed - auto-win-gnu-32-nopt-t

mitaa added some commits Feb 24, 2016

Fix source-links for files with absolute-paths
`clean_srcpath` tries to make the source-path relative to `src_root`,
but this didn't work since `src_root` itself wasn't absolute.

@mitaa mitaa force-pushed the mitaa:rdoc-global-src branch from 4037a7d to cf76fcf Feb 24, 2016

@mitaa

This comment has been minimized.

Copy link
Contributor Author

mitaa commented Feb 24, 2016

I think I've made your /dev/null suggestion work, removing the run-make test.

This has required commit mitaa@27ca250, because .is_file() returns false for /dev/null.
(the utility of this aside from this test seems questionable, but I hope that's okay..)
(also the same check for extern macros has been used in the same file before here, when emitting source files)

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 25, 2016

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 25, 2016

bors added a commit that referenced this pull request Feb 25, 2016

bors added a commit that referenced this pull request Feb 25, 2016

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 25, 2016

bors added a commit that referenced this pull request Feb 25, 2016

@bors bors merged commit cf76fcf into rust-lang:master Feb 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mitaa mitaa deleted the mitaa:rdoc-global-src branch Feb 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.