diff --git a/src/librustc/middle/infer/freshen.rs b/src/librustc/middle/infer/freshen.rs index 02c52f829676..6bc424fdf952 100644 --- a/src/librustc/middle/infer/freshen.rs +++ b/src/librustc/middle/infer/freshen.rs @@ -135,10 +135,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> { t } - ty::ty_open(..) => { - self.tcx().sess.bug("Cannot freshen an open existential type"); - } - + ty::ty_open(..) | ty::ty_bool | ty::ty_char | ty::ty_int(..) | diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 25a33de1cc7f..756ddd91782b 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -1457,11 +1457,26 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(AmbiguousBuiltin) } + ty::ty_open(ty) => { + // these only crop up in trans, and represent an + // "opened" unsized/existential type (one that has + // been dereferenced) + match bound { + ty::BoundCopy | + ty::BoundSync | + ty::BoundSend => { + Ok(If(vec!(ty))) + } + + ty::BoundSized => { + Err(Unimplemented) + } + } + } ty::ty_err => { Ok(If(Vec::new())) } - ty::ty_open(_) | ty::ty_infer(ty::FreshTy(_)) | ty::ty_infer(ty::FreshIntTy(_)) => { self.tcx().sess.bug( diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index 237fc1856369..057c6619d726 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -50,7 +50,7 @@ use std::vec::Vec; use syntax::ast::Ident; use syntax::ast; use syntax::ast_map::{PathElem, PathName}; -use syntax::codemap::Span; +use syntax::codemap::{DUMMY_SP, Span}; use syntax::parse::token::InternedString; use syntax::parse::token; use util::common::memoized; @@ -114,8 +114,9 @@ pub fn normalize_ty<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { } // Is the type's representation size known at compile time? -pub fn type_is_sized<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool { -ty::type_contents(cx, ty).is_sized(cx) +pub fn type_is_sized<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool { + let param_env = ty::empty_parameter_environment(tcx); + ty::type_is_sized(¶m_env, DUMMY_SP, ty) } pub fn lltype_is_sized<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {