mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-08 13:55:25 +00:00
syntax: Don't put quotes around filenames in codemap
This ends up propagating all the way out to the output of dep-info which then makes Cargo think that files are not existent (it thinks the files have quotes in their name) when they in fact do.
This commit is contained in:
parent
70b13a7c7c
commit
0dac568578
@ -364,9 +364,10 @@ impl CodeMap {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Append '\n' in case it's not already there.
|
// Append '\n' in case it's not already there.
|
||||||
// This is a workaround to prevent CodeMap.lookup_filemap_idx from accidentally
|
// This is a workaround to prevent CodeMap.lookup_filemap_idx from
|
||||||
// overflowing into the next filemap in case the last byte of span is also the last
|
// accidentally overflowing into the next filemap in case the last byte
|
||||||
// byte of filemap, which leads to incorrect results from CodeMap.span_to_*.
|
// of span is also the last byte of filemap, which leads to incorrect
|
||||||
|
// results from CodeMap.span_to_*.
|
||||||
if src.len() > 0 && !src.ends_with("\n") {
|
if src.len() > 0 && !src.ends_with("\n") {
|
||||||
src.push('\n');
|
src.push('\n');
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
let bytes = match File::open(&file).read_to_end() {
|
let bytes = match File::open(&file).read_to_end() {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
cx.span_err(sp,
|
cx.span_err(sp,
|
||||||
&format!("couldn't read {:?}: {}",
|
&format!("couldn't read {}: {}",
|
||||||
file.display(),
|
file.display(),
|
||||||
e)[]);
|
e)[]);
|
||||||
return DummyResult::expr(sp);
|
return DummyResult::expr(sp);
|
||||||
@ -146,7 +146,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
Ok(src) => {
|
Ok(src) => {
|
||||||
// Add this input file to the code map to make it available as
|
// Add this input file to the code map to make it available as
|
||||||
// dependency information
|
// dependency information
|
||||||
let filename = format!("{:?}", file.display());
|
let filename = format!("{}", file.display());
|
||||||
let interned = token::intern_and_get_ident(&src[]);
|
let interned = token::intern_and_get_ident(&src[]);
|
||||||
cx.codemap().new_filemap(filename, src);
|
cx.codemap().new_filemap(filename, src);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
cx.span_err(sp,
|
cx.span_err(sp,
|
||||||
&format!("{:?} wasn't a utf-8 file",
|
&format!("{} wasn't a utf-8 file",
|
||||||
file.display())[]);
|
file.display())[]);
|
||||||
return DummyResult::expr(sp);
|
return DummyResult::expr(sp);
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
match File::open(&file).read_to_end() {
|
match File::open(&file).read_to_end() {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
cx.span_err(sp,
|
cx.span_err(sp,
|
||||||
&format!("couldn't read {:?}: {}", file.display(), e)[]);
|
&format!("couldn't read {}: {}", file.display(), e)[]);
|
||||||
return DummyResult::expr(sp);
|
return DummyResult::expr(sp);
|
||||||
}
|
}
|
||||||
Ok(bytes) => {
|
Ok(bytes) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user