Skip to content

Instantly share code, notes, and snippets.

@dotdash

dotdash/a.rs Secret

Last active August 29, 2015 14:26
Show Gist options
  • Save dotdash/1f45130c7580087dc56e to your computer and use it in GitHub Desktop.
Save dotdash/1f45130c7580087dc56e to your computer and use it in GitHub Desktop.
#![crate_type="lib"]
extern crate base;
pub fn foo() -> base::E {
base::E::A(0)
}
#![crate_type="lib"]
extern crate base;
pub fn bar() -> base::E {
base::E::A(0)
}
#![crate_type="lib"]
pub enum E {
A(i32),
B(i32)
}
#![crate_type="staticlib"]
extern crate a;
extern crate b;
pub use a::foo;
pub use b::bar;
rustc -g base.rs
rustc -g -L. a.rs
rustc -g -L. b.rs
rustc -g -L. -Clto c.rs
@pnkfelix
Copy link

a::foo in c.rs ? Is that a typo?

@dotdash
Copy link
Author

dotdash commented Jul 28, 2015

Accidently copied base.rs contents for a.rs, fixed.

@pnkfelix
Copy link

Result on Mac OS X:

% ./x86_64-apple-darwin/stage2/bin/rustc -g -L.  -Clto /tmp/issue_26447/c.rs
note: link against the following native artifacts when linking against this static library
note: the order and any duplication can be significant on some platforms, and so may need to be preserved
note: library: System
note: library: pthread
note: library: c
note: library: m

@pnkfelix
Copy link

(but the original bug was a run time failure... so ... am I supposed to run something here... ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment