Skip to content

Commit 177cbe0

Browse files
committed
Some tidying up around include!
1 parent ba1d065 commit 177cbe0

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
@@ -183,13 +183,14 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke
183183
// resolve a file-system path to an absolute file-system path (if it
184184
// isn't already)
185185
fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf {
186-
// NB: relative paths are resolved relative to the compilation unit
186+
// Relative paths are resolved relative to the file in which they are found
187+
// after macro expansion (that is, they are unhygienic).
187188
if !arg.is_absolute() {
188189
let callsite = sp.source_callsite();
189-
let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite));
190-
cu.pop();
191-
cu.push(arg);
192-
cu
190+
let mut path = PathBuf::from(&cx.codemap().span_to_filename(callsite));
191+
path.pop();
192+
path.push(arg);
193+
path
193194
} else {
194195
arg.to_path_buf()
195196
}

0 commit comments

Comments
 (0)