Skip to content

Boxes can not be cast to dyn* #102427

Closed
@eholk

Description

@eholk

Example:

#![feature(dyn_star)]
#![allow(incomplete_features)]

use std::fmt::Display;

fn make_dyn_star() -> dyn* Display {
    Box::new(42) as dyn* Display
}

fn main() {
    let x = make_dyn_star();

    println!("{x}");
}

This fails in LLVM:

Invalid InsertValueInst operands!
  %15 = insertvalue { i64, ptr } undef, ptr %2, 0
in function _ZN7scratch13make_dyn_star17h90da983991b1d3f6E
LLVM ERROR: Broken function found, compilation aborted!

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.F-dyn_star`#![feature(dyn_star)]`requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions