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

rustc stack overflow: pub use super::* in public inner mod. #21601

Closed
ptal opened this issue Jan 24, 2015 · 9 comments
Closed

rustc stack overflow: pub use super::* in public inner mod. #21601

ptal opened this issue Jan 24, 2015 · 9 comments
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ptal
Copy link

ptal commented Jan 24, 2015

The RUST_BACKTRACE=1 doesn't generate anything. I ran the compiler with valgrind and the output can be found here http://pastebin.com/TUE2WznG

rustc --version
rustc 1.0.0-dev (0430a43d6 2015-01-24 13:04:39 +0000)
@kmcallister kmcallister added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jan 24, 2015
@arielb1
Copy link
Contributor

arielb1 commented Jan 27, 2015

Yuck metadata. Could you give the code at least?

@ptal
Copy link
Author

ptal commented Jan 28, 2015

I don't have time to make a minimal example, you can reproduce the bug with cargo build for the project ptal/oak@e0f3568

Regex seems broken for now but you can just remove the dependency to term in the Cargo.toml, it'll stack overflow anyways.

rustc --version
rustc 1.0.0-dev (d77f6d536 2015-01-27 11:07:26 +0000)

@ptal
Copy link
Author

ptal commented Feb 15, 2015

Minimal example:

LibA (libA/lib.rs):

#![crate_type = "dylib"]
pub mod access
{
  pub use super::*; // <--- removing the public visibility makes the compiler not stack overflow.
}

LibB (libB/lib.rs):

#![crate_type = "dylib"]
#![feature(collections, rustc_private)]

extern crate syntax;

// One of the following item produces a `stack overflow` of rustc if
// one is commented. It's weird that it works with Deref.... The three cases:

// OK
// extern crate attribute;
// use std::ops::Deref;

// KO
extern crate attribute;
// use std::ops::Deref;

// OK
// // extern crate attribute;
// use std::ops::Deref;

pub use std::string::String;
pub use syntax::parse::token::get_ident;
pub use syntax::ast::Ident;

pub fn id_to_string(id: Ident) -> String
{
  String::from_str(get_ident(id).deref())
}

Compilation:

libA> rustc lib.rs --crate-name attribute --crate-type dylib
libB> rustc lib.rs --extern attribute=../libA/libattribute.so

thread 'rustc' has overflowed its stack

@ptal ptal changed the title rustc stack overflow: illegal hardware instruction (core dumped) rustc stack overflow: pub use super::* in public mod. Feb 15, 2015
@ptal ptal changed the title rustc stack overflow: pub use super::* in public mod. rustc stack overflow: pub use super::* in public inner mod. Feb 15, 2015
@tamird
Copy link
Contributor

tamird commented Apr 22, 2015

extern crate attribute; no longer works, so I'm not able to reproduce this.

@ptal
Copy link
Author

ptal commented Apr 22, 2015

I just tried this, and it still stack overflow with rustc 1.0.0-dev (9539627ac 2015-04-10) (built 2015-04-10). However, my example is misguiding because attribute is the libA, look at the --crate-name attribute option.

@steveklabnik
Copy link
Member

Hmm, this now gives

error: unresolved import `syntax::parse::token::get_ident`. There is no `get_ident` in `syntax::parse::token`

I haven't kept up with syntax extensions to know how to update this example.

@ptal
Copy link
Author

ptal commented Nov 5, 2015

libB/lib.rs becomes:

#![crate_type = "dylib"]
#![feature(rustc_private)]

extern crate syntax;

// One of the following item produces a `stack overflow` of rustc if
// one is commented. It's weird that it works with Deref.... The three cases:

// OK
// extern crate attribute;
// use std::ops::Deref;

// KO
extern crate attribute;
// use std::ops::Deref;

// OK
// // extern crate attribute;
// use std::ops::Deref;

pub use std::string::String;
pub use syntax::ast::Ident;

pub fn id_to_string(id: Ident) -> String
{
  id.to_string()
}

And I have this error:

➜  libB  rustc lib.rs --extern attribute=../libA/libattribute.so
error: cannot satisfy dependencies so `std` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `core` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `collections` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `rustc_unicode` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `alloc` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `rand` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot satisfy dependencies so `libc` only shows up once
help: having upstream crates all available in one format will likely make this go away
error: cannot link together two allocators: alloc_jemalloc and alloc_system
error: aborting due to 8 previous errors

But I guess this is unrelated and that I am compiling it wrong...

@steveklabnik
Copy link
Member

@ptal syntax extensions change all the time, and I can't figure out what "attribute" was here. Are you still seeing this bug?

@steveklabnik
Copy link
Member

oh, looks like attribute is https://github.com/ptal/Rust.attribute which no longer compiles.

I'm going to consider this one stale and give it a close, if you can reproduce today, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants