mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-18 02:38:28 +00:00
Fix doubleborrow of refcell in consts.rs
This commit is contained in:
parent
f7fb696fee
commit
1334f2ceae
1 changed files with 5 additions and 0 deletions
|
@ -330,8 +330,13 @@ impl<'c, 'cc> ConstEvalContext<'c, 'cc> {
|
|||
/// lookup a possibly constant expression from a ExprPath
|
||||
fn fetch_path(&mut self, e: &Expr) -> Option<Constant> {
|
||||
if let Some(lcx) = self.lcx {
|
||||
let mut maybe_id = None;
|
||||
if let Some(&PathResolution { base_def: DefConst(id), ..}) =
|
||||
lcx.tcx.def_map.borrow().get(&e.id) {
|
||||
maybe_id = Some(id);
|
||||
}
|
||||
// separate if lets to avoid doubleborrowing the defmap
|
||||
if let Some(id) = maybe_id {
|
||||
if let Some(const_expr) = lookup_const_by_id(lcx.tcx, id, None) {
|
||||
let ret = self.expr(const_expr);
|
||||
if ret.is_some() {
|
||||
|
|
Loading…
Reference in a new issue