]> git.lizzy.rs Git - rust.git/commitdiff
Address comments + Fix tests
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 11 May 2019 13:03:27 +0000 (16:03 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 11 May 2019 14:06:55 +0000 (17:06 +0300)
src/librustdoc/clean/cfg.rs
src/libsyntax/ast.rs
src/libsyntax/parse/literal.rs

index 51fe26b374313980cf3312e1aa62cb43a76a7bed..b96ac19c1ea61a4dea12bcadd3b9bc02884873bf 100644 (file)
@@ -416,6 +416,8 @@ mod test {
 
     use syntax_pos::DUMMY_SP;
     use syntax::ast::*;
+    use syntax::attr;
+    use syntax::source_map::dummy_spanned;
     use syntax::symbol::Symbol;
     use syntax::with_globals;
 
index a188f1a9368902929c15ba559becf7ee79858ae5..aa176c892588388eab36d82ea0f931af791f137d 100644 (file)
@@ -1351,12 +1351,17 @@ pub enum StrStyle {
     Raw(u16),
 }
 
-/// A literal.
+/// An AST literal.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Lit {
-    pub node: LitKind,
+    /// The original literal token as written in source code.
     pub token: token::Lit,
+    /// The original literal suffix as written in source code.
     pub suffix: Option<Symbol>,
+    /// The "semantic" representation of the literal lowered from the original tokens.
+    /// Strings are unescaped, hexadecimal forms are eliminated, etc.
+    /// FIXME: Remove this and only create the semantic representation during lowering to HIR.
+    pub node: LitKind,
     pub span: Span,
 }
 
index 2c7ba13fbef82d64f2d49931b5e52408f726bb84..53195421ddceeb90f3cb4b25a14a0fab54aa9683 100644 (file)
@@ -27,7 +27,7 @@ macro_rules! err {
 
 impl LitKind {
     /// Converts literal token with a suffix into a semantic literal.
-    /// Works speculatively and may return `None` is diagnostic handler is not passed.
+    /// Works speculatively and may return `None` if diagnostic handler is not passed.
     /// If diagnostic handler is passed, always returns `Some`,
     /// possibly after reporting non-fatal errors and recovery.
     fn from_lit_token(
@@ -166,7 +166,7 @@ pub fn to_lit_token(&self) -> (token::Lit, Option<Symbol>) {
 
 impl Lit {
     /// Converts literal token with a suffix into an AST literal.
-    /// Works speculatively and may return `None` is diagnostic handler is not passed.
+    /// Works speculatively and may return `None` if diagnostic handler is not passed.
     /// If diagnostic handler is passed, may return `Some`,
     /// possibly after reporting non-fatal errors and recovery, or `None` for irrecoverable errors.
     crate fn from_token(