Rollup merge of #22664 - lfairy:just-say-no, r=alexcrichton
Leading hyphens already don't work (#22661), so no code should break from this change. Closes #22661.
This commit is contained in:
commit
5a41536462
2 changed files with 5 additions and 0 deletions
|
|
@ -81,6 +81,8 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
|
|||
};
|
||||
if s.len() == 0 {
|
||||
err("crate name must not be empty");
|
||||
} else if s.char_at(0) == '-' {
|
||||
err(&format!("crate name cannot start with a hyphen: {}", s));
|
||||
}
|
||||
for c in s.chars() {
|
||||
if c.is_alphanumeric() { continue }
|
||||
|
|
|
|||
|
|
@ -10,3 +10,6 @@ all:
|
|||
cp foo.rs $(TMPDIR)/+foo+bar
|
||||
$(RUSTC) $(TMPDIR)/+foo+bar 2>&1 \
|
||||
| grep "invalid character.*in crate name:"
|
||||
cp foo.rs $(TMPDIR)/-foo.rs
|
||||
$(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \
|
||||
| grep "crate name cannot start with a hyphen:"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue