diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2019-05-18 15:56:53 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2019-07-23 17:17:31 +0200 |
| commit | 138e08ccf6f6c6caf55a135bd0edcba8e6855df5 (patch) | |
| tree | 87eabfe1808c8fad13278d5e1e7f802f1526caeb /src/libsyntax/ext | |
| parent | ba78db310b2ddf9b5f8e6c87a58e8ea8df374e16 (diff) | |
| download | rust-138e08ccf6f6c6caf55a135bd0edcba8e6855df5.tar.gz rust-138e08ccf6f6c6caf55a135bd0edcba8e6855df5.zip | |
Make #[doc(include)] paths behave like other paths
This makes them relative to the containing file instead of the crate root
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ae72f1fd108..6cfcfdfbf7d 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -17,6 +17,7 @@ use crate::symbol::{sym, Symbol}; use crate::tokenstream::{TokenStream, TokenTree}; use crate::visit::{self, Visitor}; use crate::util::map_in_place::MapInPlace; +use crate::util::path; use errors::{Applicability, FatalError}; use smallvec::{smallvec, SmallVec}; @@ -1253,7 +1254,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { return noop_visit_attribute(at, self); } - let filename = self.cx.root_path.join(file.to_string()); + let filename = path::resolve(&*file.as_str(), it.span(), self.cx.source_map()); match fs::read_to_string(&filename) { Ok(src) => { let src_interned = Symbol::intern(&src); @@ -1302,10 +1303,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { ); err.span_label(lit.span, "couldn't read file"); - if e.kind() == ErrorKind::NotFound { - err.help("external doc paths are relative to the crate root"); - } - err.emit(); } } |
