about summary refs log tree commit diff
path: root/clippy_lints/src
diff options
context:
space:
mode:
authorMichael Wright <mikerite@lavabit.com>2019-01-20 22:54:04 +0200
committerMichael Wright <mikerite@lavabit.com>2019-01-20 22:56:07 +0200
commita747dbb04f044e37da19f82233ad2dce5d0c1bec (patch)
tree947addcd997129d1e8d8bfbef540b762d01d66c0 /clippy_lints/src
parent8747691bea639835e66c6cef0baf66063f0aae93 (diff)
downloadrust-a747dbb04f044e37da19f82233ad2dce5d0c1bec.tar.gz
rust-a747dbb04f044e37da19f82233ad2dce5d0c1bec.zip
Fix breakage due to rust-lang/rust#57651
Diffstat (limited to 'clippy_lints/src')
-rw-r--r--clippy_lints/src/consts.rs7
-rw-r--r--clippy_lints/src/utils/author.rs1
2 files changed, 8 insertions, 0 deletions
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs
index 5780b9bcfd4..49722e5ad71 100644
--- a/clippy_lints/src/consts.rs
+++ b/clippy_lints/src/consts.rs
@@ -14,6 +14,7 @@ use std::convert::TryInto;
 use std::hash::{Hash, Hasher};
 use syntax::ast::{FloatTy, LitKind};
 use syntax::ptr::P;
+use syntax_pos::symbol::Symbol;
 
 /// A `LitKind`-like enum to fold constant `Expr`s into.
 #[derive(Debug, Clone)]
@@ -38,6 +39,8 @@ pub enum Constant {
     Repeat(Box<Constant>, u64),
     /// a tuple of constants
     Tuple(Vec<Constant>),
+    /// a literal with syntax error
+    Err(Symbol),
 }
 
 impl PartialEq for Constant {
@@ -103,6 +106,9 @@ impl Hash for Constant {
                 c.hash(state);
                 l.hash(state);
             },
+            Constant::Err(ref s) => {
+                s.hash(state);
+            },
         }
     }
 }
@@ -155,6 +161,7 @@ pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant {
             _ => bug!(),
         },
         LitKind::Bool(b) => Constant::Bool(b),
+        LitKind::Err(s) => Constant::Err(s),
     }
 }
 
diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs
index 36eac00b54b..9623c6cbdad 100644
--- a/clippy_lints/src/utils/author.rs
+++ b/clippy_lints/src/utils/author.rs
@@ -260,6 +260,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
                 match lit.node {
                     LitKind::Bool(val) => println!("    if let LitKind::Bool({:?}) = {}.node;", val, lit_pat),
                     LitKind::Char(c) => println!("    if let LitKind::Char({:?}) = {}.node;", c, lit_pat),
+                    LitKind::Err(val) => println!("    if let LitKind::Err({}) = {}.node;", val, lit_pat),
                     LitKind::Byte(b) => println!("    if let LitKind::Byte({}) = {}.node;", b, lit_pat),
                     // FIXME: also check int type
                     LitKind::Int(i, _) => println!("    if let LitKind::Int({}, _) = {}.node;", i, lit_pat),