Stream: t-lang/pub-macro-rules

Topic: pub macros cross crates


view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:04):

was doing a test that checks how cross crates pub macros fail

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:05):

[santiago@galago pub-macro (pubrules)]$ tree
.
├── auxiliary
│   └── cross-crates.rs
└── cross-crates.rs

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:06):

// auxiliary/cross-crates.rs
#![feature(pub_macro_rules)]

pub mod m {
    pub macro_rules! foo { () => {} }
}

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:06):

// cross-crates.rs
// check-pass
// aux-build:cross-crates.rs

extern crate cross_crates;

fn main() {
    cross_crates::m::foo!();
}

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:06):

and getting ...

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:07):

thread 'rustc' panicked at 'Missing span for DefIndex(4)', compiler/rustc_metadata/src/rmeta/decoder.rs:718:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
end of query stack

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:07):

which I guess it is exactly what is expected to happen

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 19:07):

cc @nikomatsakis

view this post on Zulip nikomatsakis (Feb 19 2021 at 20:05):

@Santiago Pastorino interesting. ok

view this post on Zulip nikomatsakis (Feb 19 2021 at 20:06):

have you looked at this panic location?

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 20:11):

yep

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 20:11):

I guess we need to add the visibility information when we compile and encode the macro

view this post on Zulip Santiago Pastorino (Feb 19 2021 at 20:12):

and then also add the ability to decode it and then properly handle that


Last updated: Jan 26 2022 at 08:34 UTC