Skip to content

Crashes in debug code - related to %? #7860

Closed
@msullivan

Description

@msullivan

When debugging is enabled for the rustc::middle::trans::meth module, and a program using trait bounded type params is compiled, there is a segfault in the string formatting. (Actually, it is nondeterministic; sometimes there is an assertion failure.)

The particular line that is triggering the failure is

debug!("rcvr_substs=%?", rcvr_substs.map(|t| bcx.ty_to_str(*t)));

(This isn't anything like the nicest way to formulate this debug output, but it should of course still work...)

I have not yet managed to produce a nice small test case, but I can trigger it with the following program (any program that uses trait parameterized functions should do, though)

fn print_thing<T: ToStr>(x: &T) {
    println(x.to_str());
}

fn main() {
    print_thing(&());
}

and the command RUST_LOG=rustc=1,rustc::middle::trans::meth ./x86_64-unknown-linux-gnu/stage1/bin/rustc simple-parametric.rs

I bisected and the commit that introduces the failure is e118555.

Example failure output

rust: ~"trans_method_callee(callee_id=11, this=expr(10: x), mentry=method_map_entry {self_arg: &T, explicit_self: sty_region(None, m_imm), origin: method_param({crate: 1, node: 48446},0,0,0)})"
rust: ~"origin=method_param({trait_id: {crate: 1, node: 48446}, method_num: 0, param_num: 0, bound_num: 0})"
rust: ~"method_ty_param_count: m_id: {crate: 1, node: 48462}, i_id: {crate: 1, node: 48464}"
Segmentation fault (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions