Skip to content

Commit

Permalink
Make intrinsic::Opaque more opaque
Browse files Browse the repository at this point in the history
  • Loading branch information
jld committed Apr 8, 2013
1 parent 04b2c26 commit e9a52f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/librustc/front/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ pub mod intrinsic {
// Remaining fields not listed
}

// FIXME: make this a 0-variant enum; trans/reflect.rs has to match it.
pub type Opaque = ();
pub enum Opaque { }

pub trait TyVisitor {
fn visit_bot(&self) -> bool;
Expand Down
5 changes: 4 additions & 1 deletion src/librustc/middle/trans/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ pub impl Reflector {
let repr = adt::represent_type(bcx.ccx(), t);
let variants = ty::substd_enum_variants(ccx.tcx, did, substs);
let llptrty = T_ptr(type_of(ccx, t));
let (_, opaquety) = *(ccx.tcx.intrinsic_defs.find(&ccx.sess.ident_of(~"Opaque"))
.expect("Failed to resolve intrinsic::Opaque"));
let opaqueptrty = ty::mk_ptr(ccx.tcx, ty::mt { ty: opaquety, mutbl: ast::m_imm });

let make_get_disr = || {
let sub_path = bcx.fcx.path + ~[path_name(special_idents::anon)];
let sym = mangle_internal_name_by_path_and_seq(ccx, sub_path, ~"get_disr");
let args = [ty::arg { mode: ast::expl(ast::by_copy),
ty: ty::mk_nil_ptr(ccx.tcx) }];
ty: opaqueptrty }];
let llfty = type_of_fn(ccx, args, ty::mk_int(ccx.tcx));
let llfdecl = decl_internal_cdecl_fn(ccx.llmod, sym, llfty);
let arg = unsafe {
Expand Down

5 comments on commit e9a52f5

@bors
Copy link
Contributor

@bors bors commented on e9a52f5 Apr 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from graydon
at jld@e9a52f5

@bors
Copy link
Contributor

@bors bors commented on e9a52f5 Apr 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging jld/rust/reflect-abstract-enum = e9a52f5 into auto

@bors
Copy link
Contributor

@bors bors commented on e9a52f5 Apr 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jld/rust/reflect-abstract-enum = e9a52f5 merged ok, testing candidate = 3809a04

@bors
Copy link
Contributor

@bors bors commented on e9a52f5 Apr 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e9a52f5 Apr 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 3809a04

Please sign in to comment.