Skip to content

type_name intrinsic returns fully qualified pathes #34557

@nagisa

Description

@nagisa

The type_name intrinsic name implies that the function should only return the name of type, however it returns a fully qualified path of the type.

Try this:

#![feature(core_intrinsics)]

use std::intrinsics::type_name;

fn main(){ 
    let vec: Option<Vec<bool>> = Some(vec![]);
    println!("{}", unsafe { type_name::<Option<Vec<bool>>>() });
}

Expected Option<Vec<bool>>, got std::option::Option<std::vec::Vec<bool>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions