mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Disallow underscore suffix for string-like literals.
This commit is contained in:
parent
94497b73a7
commit
ed6c6c9a11
@ -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))
|
||||
})
|
||||
}
|
||||
|
||||
|
13
src/test/parse-fail/underscore-suffix-for-string.rs
Normal file
13
src/test/parse-fail/underscore-suffix-for-string.rs
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user