Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created October 25, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/b3ba3becdf2009973270d2aef3453670 to your computer and use it in GitHub Desktop.
Save alexcrichton/b3ba3becdf2009973270d2aef3453670 to your computer and use it in GitHub Desktop.
set -ex
rm -rf tmp
mkdir tmp
rustc="rustc --out-dir tmp -L tmp -C debuginfo=2"
$rustc mycore.rs --crate-type rlib
$rustc mystd.rs --crate-type dylib -C prefer-dynamic
$rustc mygetopts.rs --crate-type rlib
$rustc mytest.rs --crate-type dylib -C prefer-dynamic
pub trait Object { fn method(&self) { } }
impl Object for u32 { }
impl Object for () { }
impl<T> Object for &T { }
pub fn unused() {
let ref u = 0_u32;
let _d = &u as &dyn crate::Object;
loop { }
}
extern crate mystd;
use mystd::Object;
pub fn another_dyn_debug() {
let ref u = 1_u32;
let _d = &u as &dyn crate::Object;
loop { }
}
extern crate mycore;
pub use mycore::Object;
extern crate mygetopts;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment