diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-08-01 14:30:46 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-08-10 17:59:03 +1200 |
| commit | 177cbe01bee8cd7ee0929253b5cab0e8f5df0ce1 (patch) | |
| tree | 1a702a686ddebc49abbad37e007b9eacb3013aa2 /src/libsyntax/ext | |
| parent | ba1d065ffa3606b61201ef69fec3ad0bfc5b2f7b (diff) | |
| download | rust-177cbe01bee8cd7ee0929253b5cab0e8f5df0ce1.tar.gz rust-177cbe01bee8cd7ee0929253b5cab0e8f5df0ce1.zip | |
Some tidying up around include!
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 3cdd3a4b2c3..4d385d5e9ee 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -183,13 +183,14 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke // resolve a file-system path to an absolute file-system path (if it // isn't already) fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf { - // NB: relative paths are resolved relative to the compilation unit + // Relative paths are resolved relative to the file in which they are found + // after macro expansion (that is, they are unhygienic). if !arg.is_absolute() { let callsite = sp.source_callsite(); - let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite)); - cu.pop(); - cu.push(arg); - cu + let mut path = PathBuf::from(&cx.codemap().span_to_filename(callsite)); + path.pop(); + path.push(arg); + path } else { arg.to_path_buf() } |
