Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow file names to end with '>' #115304

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ pub enum FileName {

impl From<PathBuf> for FileName {
fn from(p: PathBuf) -> Self {
assert!(!p.to_string_lossy().ends_with('>'));
FileName::Real(RealFileName::LocalPath(p))
}
}
Expand Down
18 changes: 18 additions & 0 deletions tests/run-make/silly-file-names/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ignore-cross-compile we need to execute the binary
# ignore-windows we create files with < and > in their names

include ../tools.mk

ifdef RUSTC_BLESS_TEST
RUSTC_TEST_OP = cp
else
RUSTC_TEST_OP = $(DIFF)
endif

all:
echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
workingjubilee marked this conversation as resolved.
Show resolved Hide resolved
cp silly-file-names.rs "$(TMPDIR)/silly-file-names.rs"
$(RUSTC) "$(TMPDIR)/silly-file-names.rs" -o "$(TMPDIR)/silly-file-names"
"$(TMPDIR)/silly-file-names" > "$(TMPDIR)/silly-file-names.run.stdout"
$(RUSTC_TEST_OP) "$(TMPDIR)/silly-file-names.run.stdout" silly-file-names.run.stdout
4 changes: 4 additions & 0 deletions tests/run-make/silly-file-names/silly-file-names.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!(include!("<leading-lt"));
println!(include!("trailing-gt>"));
}
2 changes: 2 additions & 0 deletions tests/run-make/silly-file-names/silly-file-names.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
comes from a file with a name that begins with <
comes from a file with a name that ends with >
Loading