Disallow underscore suffix for string-like literals.

This commit is contained in:
Masaki Hara 2017-05-14 21:37:50 +09:00
parent 94497b73a7
commit ed6c6c9a11
No known key found for this signature in database
GPG Key ID: 7CA7A85E049A82E8
2 changed files with 14 additions and 5 deletions

View File

@ -479,11 +479,7 @@ impl<'a> StringReader<'a> {
}
self.with_str_from(start, |string| {
if string == "_" {
None
} else {
Some(Symbol::intern(string))
}
Some(Symbol::intern(string))
})
}

View File

@ -0,0 +1,13 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let a = "Foo"_; //~ ERROR string literal with a suffix is invalid
}