Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crosscompiling from x64 to i686 fail for crate macro_rules_attribute #70158

Closed
Kubikx opened this issue Mar 19, 2020 · 3 comments
Closed

crosscompiling from x64 to i686 fail for crate macro_rules_attribute #70158

Kubikx opened this issue Mar 19, 2020 · 3 comments
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Kubikx
Copy link

Kubikx commented Mar 19, 2020

Example

https://docs.rs/macro_rules_attribute/0.0.1/macro_rules_attribute/#example

I found out about the issue after new team member joined and could not compile the the project
we later identified that the cause is that he have nightly-x86_64-pc-windows-msvc as default
using:
cargo build --lib --release --target=i686-pc-windows-msvc --verbose
causes:

     Running `rustc --crate-name macro_rules_attribute --edition=2018 C:\Users\xxxku\.cargo\registry\src\github.com-1ecc6299db9ec823\macro_rules_attribute-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=6d33a2ac94d8afdd -C extra-filename=-6d33a2ac94d8afdd --out-dir D:\cpp\proxy\target\i686-pc-windows-msvc\release\deps --target i686-pc-windows-msvc -L dependency=D:\cpp\proxy\target\i686-pc-windows-msvc\release\deps -L dependency=D:\cpp\proxy\target\release\deps --extern proc_macro=D:\cpp\proxy\target\release\deps\macro_rules_attribute_proc_macro-7dfb63828f9e9ef2.dll --cap-lints allow`
     
thread 'rustc' panicked at 'src\librustc_resolve\imports.rs:897: inconsistent resolution for an import', src\librustc_resolve\lib.rs:1:1
stack backtrace:
   0:     0x7fff443a975f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd03123af32678204
   1:     0x7fff443d645b - core::fmt::write::hd7e4da93b0f3f6cf
   2:     0x7fff44399fbc - <std::io::IoSlice as core::fmt::Debug>::fmt::hde06bc38d6d79e1b
   3:     0x7fff443aea0c - std::panicking::take_hook::h2d1d8b7f3a0f99f0
   4:     0x7fff443ae65f - std::panicking::take_hook::h2d1d8b7f3a0f99f0
   5:     0x7fff2630d28a - rustc_driver::report_ice::h81708fb20c592c8e
   6:     0x7fff443af2a8 - std::panicking::rust_panic_with_hook::hc4844992c2f458f0
   7:     0x7fff2878ffff - <rustc_resolve::imports::UnresolvedImportError as core::fmt::Debug>::fmt::h9734535dfbd031fd
   8:     0x7fff287cd896 - <rustc::middle::resolve_lifetime::Region as rustc_resolve::late::lifetimes::RegionExt>::shifted_out_to_binder::h144e678f8da85146
   9:     0x7fff287cd711 - <rustc::middle::resolve_lifetime::Region as rustc_resolve::late::lifetimes::RegionExt>::shifted_out_to_binder::h144e678f8da85146
  10:     0x7fff287cd673 - <rustc::middle::resolve_lifetime::Region as rustc_resolve::late::lifetimes::RegionExt>::shifted_out_to_binder::h144e678f8da85146
  11:     0x7fff287cd7cf - <rustc::middle::resolve_lifetime::Region as rustc_resolve::late::lifetimes::RegionExt>::shifted_out_to_binder::h144e678f8da85146
  12:     0x7fff287cd777 - <rustc::middle::resolve_lifetime::Region as rustc_resolve::late::lifetimes::RegionExt>::shifted_out_to_binder::h144e678f8da85146
  13:     0x7fff2878cc93 - rustc_resolve::imports::ImportResolver::finalize_imports::hce0049d9c84c8c0c
  14:     0x7fff287862fd - rustc_resolve::imports::ImportResolver::finalize_imports::hce0049d9c84c8c0c
  15:     0x7fff287522ca - rustc_resolve::Resolver::resolve_crate::h81965983eea3f464
  16:     0x7fff264ab32c - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h3229fb634d1de4b6
  17:     0x7fff264c89e9 - rustc_interface::passes::BoxedResolver::complete::h413e13ca6256e1d7
  18:     0x7fff264b5674 - rustc_interface::passes::BoxedResolver::complete::h413e13ca6256e1d7
  19:     0x7fff264a9801 - rustc_interface::callbacks::setup_callbacks::h15cfb8d3c5a1bf19
  20:     0x7fff264cbfb2 - rustc_interface::queries::Queries::expansion::hb88ecea2335ddb8f
  21:     0x7fff26358da7 - <alloc::vec::Vec<rustc_ast::ast::Attribute> as rustc_ast::attr::HasAttrs>::attrs::hcf357fa16ec32aa4
  22:     0x7fff26313676 - <rustc_driver::DEFAULT_HOOK as core::ops::deref::Deref>::deref::h9fb2906f41fb910d
  23:     0x7fff2635bc23 - <alloc::vec::Vec<rustc_ast::ast::Attribute> as rustc_ast::attr::HasAttrs>::attrs::hcf357fa16ec32aa4
  24:     0x7fff44388687 - ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Sync$u2b$core..marker..Send$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
  25:     0x7fff443be6cc - std::sys::windows::thread::Thread::new::hc81dbcd4d803919c
  26:     0x7fff9ddb6fd4 - BaseThreadInitThunk
  27:     0x7fff9e05cf31 - RtlUserThreadStart

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f509b26a7 2020-03-18) running on x86_64-pc-windows-msvc

note: compiler flags: -C opt-level=3 --crate-type lib

we verified it on multiple version up to latest rustc 1.44.0-nightly (f509b26a7 2020-03-18)

@Kubikx Kubikx added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2020
@jonas-schievink jonas-schievink added A-resolve Area: Path resolution I-nominated labels Mar 19, 2020
@Nemo157
Copy link
Member

Nemo157 commented Mar 19, 2020

This appears to happen whenever you re-export from a renamed proc-macro crate while cross-compiling. Minimal copy-pastable reproducer (pasting the {} delimited block into sh should work):

> {
  cargo new --lib foo
  cargo new --lib bar
  echo 'baz = { package = "bar", path = "../bar" }' >> foo/Cargo.toml
  echo '[lib]\nproc-macro = true' >> bar/Cargo.toml
  echo '#[proc_macro_attribute] pub fn foo(input: proc_macro::TokenStream, _: proc_macro::TokenStream) -> proc_macro::TokenStream { input }' > bar/src/lib.rs
  echo 'pub use baz::foo;' > foo/src/lib.rs

  cargo build --manifest-path foo/Cargo.toml --target wasm32-unknown-unknown
}

     Created library `foo` package
     Created library `bar` package
   Compiling bar v0.1.0 (/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.qRqZD3Gc/bar)
   Compiling foo v0.1.0 (/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.qRqZD3Gc/foo)
thread 'rustc' panicked at 'src/librustc_resolve/imports.rs:896: inconsistent resolution for an import', <::std::macros::panic macros>:2:4

@jonas-schievink
Copy link
Contributor

This was an issue before, but I thought it was already fixed?

@jonas-schievink
Copy link
Contributor

Ah, it's a duplicate of #56935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants