Skip to content

ICE when using Dictionary's each #8

@rroels

Description

@rroels

I am playing around with rust-core-foundation and encountered an ICE when using the dictionary's "each" iteration. The following snippet (part of an unsafe block) illustrates the issue:

let dicPtr: _c_void = CFArrayGetValueAtIndex(arrRef, i as CFIndex);
let dicRef: CFDictionaryRef = cast::transmute::<_c_void, CFDictionaryRef>(dicPtr);
io::println(fmt!("Dic count: %?", CFDictionaryGetCount(dicRef))); // works fine!

let dic: CFDictionary<CFStringRef,CFTypeRef> = CFDictionary::wrap_owned(dicRef);
for dic.each |key, val| { // internal compiler error: unknown tag found in side tables: 5e

}

This results in the following ICE:

error: internal compiler error: unknown tag found in side tables: 5e
rust: task failed at 'explicit failure', /Volumes/Users/xxx/rust/rust/src/libsyntax/diagnostic.rs:93
rust: task failed at 'explicit failure', /Volumes/Users/xxx/rust/rust/src/librustc/rustc.rc:353
rust: domain main @0x7fc96180ba10 root task failed

I realise that this issue is more related to the Rust compiler than this wrapper, but my Rust knowledge is insufficient to pinpoint the problem any closer than this.

EDIT: I was able to reduce the problem to the following code:

extern mod core_foundation;

use core_foundation::base::{CFTypeRef};
use core_foundation::string::{CFStringRef};
use core_foundation::dictionary::{CFDictionary};

fn main() {
    let _dic = CFDictionary::new::<CFStringRef, CFTypeRef>([]);  
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions