Merge pull request #1099 from Manishearth/fix

Some small fixes
This commit is contained in:
llogiq
2016-07-14 21:32:45 +02:00
committed by GitHub
7 changed files with 88 additions and 67 deletions

View File

@@ -15,7 +15,7 @@ use std::env;
use std::mem;
use std::str::FromStr;
use syntax::ast::{self, LitKind};
use syntax::codemap::{ExpnFormat, ExpnInfo, MultiSpan, Span};
use syntax::codemap::{ExpnFormat, ExpnInfo, MultiSpan, Span, DUMMY_SP};
use syntax::errors::DiagnosticBuilder;
use syntax::ptr::P;
@@ -723,3 +723,8 @@ pub fn type_is_unsafe_function(ty: ty::Ty) -> bool {
_ => false,
}
}
pub fn is_copy<'a, 'ctx>(cx: &LateContext<'a, 'ctx>, ty: ty::Ty<'ctx>, env: NodeId) -> bool {
let env = ty::ParameterEnvironment::for_item(cx.tcx, env);
!ty.subst(cx.tcx, env.free_substs).moves_by_default(cx.tcx.global_tcx(), &env, DUMMY_SP)
}