Bug fixes

This commit is contained in:
Nick Cameron 2015-03-24 13:50:14 +13:00
parent e7122a5a09
commit 7e3ee02006
4 changed files with 3 additions and 25 deletions

View File

@ -381,29 +381,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
None
}
}
(&ty::ty_trait(ref data_a), &ty::ty_trait(ref data_b)) => {
// For now, we only support upcasts from
// `Foo+Send` to `Foo` (really, any time there are
// fewer builtin bounds then before). These are
// convenient because they don't require any sort
// of change to the vtable at runtime.
if data_a.bounds.builtin_bounds != data_b.bounds.builtin_bounds &&
data_a.bounds.builtin_bounds.is_superset(&data_b.bounds.builtin_bounds)
{
let bounds_a1 = ty::ExistentialBounds {
region_bound: data_a.bounds.region_bound,
builtin_bounds: data_b.bounds.builtin_bounds,
projection_bounds: data_a.bounds.projection_bounds.clone(),
};
let ty_a1 = ty::mk_trait(tcx, data_a.principal.clone(), bounds_a1);
match self.fcx.infcx().try(|_| self.subtype(ty_a1, ty_b)) {
Ok(_) => Some((ty_b, ty::UnsizeUpcast(ty_b))),
Err(_) => None,
}
} else {
None
}
}
(_, &ty::ty_trait(ref data)) => {
Some((ty_b, ty::UnsizeVtable(ty::TyTrait {
principal: data.principal.clone(),

View File

@ -109,7 +109,7 @@ impl Iterator for Env {
if *self.cur == 0 { return None }
let p = &*self.cur;
let mut len = 0;
while *(p as *const _).offset(len) != 0 {
while *(p as *const u16).offset(len) != 0 {
len += 1;
}
let p = p as *const u16;

View File

@ -176,6 +176,7 @@ macro_rules! __thread_local_inner {
}
};
#[allow(trivial_casts)]
#[cfg(any(not(any(target_os = "macos", target_os = "linux")), target_arch = "aarch64"))]
const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = {
::std::thread::__local::__impl::KeyInner {

View File

@ -126,7 +126,7 @@ impl<T: Write+Send+'static> WinConsole<T> {
}
Some(box WinConsole { buf: out,
def_foreground: fg, def_background: bg,
foreground: fg, background: bg } as Box<Terminal<T>+Send>)
foreground: fg, background: bg })
}
}