try gating early, add non-ascii test

This commit is contained in:
Deadbeef 2023-03-07 05:09:19 +00:00
parent 78e3455d37
commit bf3ca5979e
3 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,3 @@
use ast::token;
use rustc_ast as ast; use rustc_ast as ast;
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId}; use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId};

View File

@ -1922,6 +1922,7 @@ pub(super) fn parse_opt_token_lit(&mut self) -> Option<(token::Lit, Span)> {
let recovered = self.recover_after_dot(); let recovered = self.recover_after_dot();
let token = recovered.as_ref().unwrap_or(&self.token); let token = recovered.as_ref().unwrap_or(&self.token);
let span = token.span; let span = token.span;
token::Lit::from_token(token).map(|token_lit| { token::Lit::from_token(token).map(|token_lit| {
self.bump(); self.bump();
(token_lit, span) (token_lit, span)

View File

@ -0,0 +1,10 @@
// run-pass
#![feature(c_str_literals)]
fn main() {
assert_eq!(
c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
&[0xEF, 0x80, 0xF0, 0x9F, 0xA6, 0x80, 0xF0, 0x9F, 0xA6, 0x80, 0x00],
);
}