Skip to content

HIR and TyCtxt disagree about the parents of decl macros #77828

Closed
@jyn514

Description

@jyn514

I tried this code:

#[unstable(feature = "raw_ref_macros", issue = "73394")]
#[rustc_macro_transparency = "semitransparent"]
#[allow_internal_unstable(raw_ref_op)]
pub macro raw_const($e:expr) {
&raw const $e
}

I expected to see this happen: tcx.hir().parent_module(raw_const_hir_id) and tcx.parent(raw_const_def_id).unwrap() are both the module core::ptr.

Instead, this happened: tcx.hir().parent_module(raw_const_hir_id) is core and tcx.parent(raw_const_def_id).unwrap() is core::ptr. I think core::ptr is correct.

Meta

rustc --version: HEAD (8cc82ee)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)C-bugCategory: This is a bug.F-decl_macro`#![feature(decl_macro)]`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