Fix items_after_statements for use statements

This commit is contained in:
Devon Hollowood
2018-10-07 17:05:28 -07:00
parent 87f6d9e7f9
commit 6528749083
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -265,6 +265,8 @@ fn multi(&mut self, vec: &[Expr]) -> Option<Vec<Constant>> {
/// lookup a possibly constant expression from a ExprKind::Path
fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
use crate::rustc::mir::interpret::GlobalId;
let def = self.tables.qpath_def(qpath, id);
match def {
Def::Const(def_id) | Def::AssociatedConst(def_id) => {
@@ -279,7 +281,7 @@ fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
instance,
promoted: None,
};
use crate::rustc::mir::interpret::GlobalId;
let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?;
let ret = miri_to_const(self.tcx, result);
if ret.is_some() {
+1 -1
View File
@@ -246,6 +246,7 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
}
fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -> (Option<String>, Option<Expr>) {
use crate::fmt_macros::*;
let tts = TokenStream::from(tts.clone());
let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false);
let mut expr: Option<Expr> = None;
@@ -264,7 +265,6 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -
Ok(token) => token.0.to_string(),
Err(_) => return (None, expr),
};
use crate::fmt_macros::*;
let tmp = fmtstr.clone();
let mut args = vec![];
let mut fmt_parser = Parser::new(&tmp, None);