Skip to content

Commit fd12c34

Browse files
committed
Revert a change to the relative path for macro-expanded include!s
1 parent ad7fe65 commit fd12c34

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libsyntax/ext/source_util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
197197
fn res_rel_file(cx: &mut ExtCtxt, sp: codemap::Span, arg: &Path) -> PathBuf {
198198
// NB: relative paths are resolved relative to the compilation unit
199199
if !arg.is_absolute() {
200-
let mut cu = PathBuf::from(&cx.codemap().span_to_filename(sp));
200+
let callsite = cx.codemap().source_callsite(sp);
201+
let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite));
201202
cu.pop();
202203
cu.push(arg);
203204
cu

0 commit comments

Comments
 (0)