mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
Fix items_after_statements for use statements
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user