Skip to content

Commit 60e6354

Browse files
committed
Some tidying up around include!
1 parent 54279df commit 60e6354

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/libsyntax/ext/source_util.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,14 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke
193193
// resolve a file-system path to an absolute file-system path (if it
194194
// isn't already)
195195
fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf {
196-
// NB: relative paths are resolved relative to the compilation unit
196+
// Relative paths are resolved relative to the file in which they are found
197+
// after macro expansion (that is, they are unhygienic).
197198
if !arg.is_absolute() {
198199
let callsite = sp.source_callsite();
199-
let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite));
200-
cu.pop();
201-
cu.push(arg);
202-
cu
200+
let mut path = PathBuf::from(&cx.codemap().span_to_filename(callsite));
201+
path.pop();
202+
path.push(arg);
203+
path
203204
} else {
204205
arg.to_path_buf()
205206
}

0 commit comments

Comments
 (0)