You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following library, innocent enough, contains an allowed visibility conundrum:
// foo.rs// Compiled with rustc --lib foo.rs#[link(name = "foo", vers = "1.0", package_id = "foo")];structFoo{// ** should be public, but isn't, by human error ** //a:i8}implFoo{pubfnbar(&self){}}
The following driver:
// bug.rs// Compiled by rustc bug.rs -L.externmod foo;fnmain(){let f = foo::Foo{a:0};
f.bar();}
The compiler will believe Foo is public, and attempt to link the function bar (visible to the compiler, but not to the linker) causing the following linking error:
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64''-L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib''-o''bug''bug.o''-Wl,--as-needed''-L.''-L/home/wilkie/rust-bug/.rust''-L/home/wilkie/rust-bug''-L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib''-lstd-6425b930ca146ae9-0.9-pre''-L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib''-lrustuv-a13edc95d75df17-0.9-pre''-L.''-lfoo-167086a786d07119-1.0''-lpthread''-lrt''-ldl''-lm''-lpthread''-lstdc++''-lmorestack''-Wl,-rpath,$ORIGIN/../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib''-Wl,-rpath,$ORIGIN/.''-Wl,-rpath,/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib''-Wl,-rpath,/home/wilkie/rust-bug'
note: bug.o: In function`main::h7f81f851c09f62ah::v0.0':
bug.rc:(.text+0x3d): undefined reference to `Foo::bar::hbf8f903627fe5f220fad::v1.0'collect2: error: ld returned 1 exit statuserror: aborting due to previous error
If I readelf -Ws libfoo-167086a786d07119-1.0.so, that exact symbol does exist with the correct hash.
If I put 'pub' in front of the struct definition, it works as expected.
I'm compiling a new version from master and will report later, but right now my rust --version is:
[`cast_lossless`]: Suggest type alias instead of the aliased type
Fixesrust-lang#11285
Still an issue with the "from" side, i.e., `I8::from(1) as I64` shows as `i8 to I64`, but this should be ok. Not possible to reliably fix currently anyway.
changelog: [`cast_lossless`]: Suggest type alias instead of the aliased type
The following library, innocent enough, contains an allowed visibility conundrum:
The following driver:
The compiler will believe Foo is public, and attempt to link the function bar (visible to the compiler, but not to the linker) causing the following linking error:
If I
readelf -Ws libfoo-167086a786d07119-1.0.so
, that exact symbol does exist with the correct hash.If I put 'pub' in front of the struct definition, it works as expected.
I'm compiling a new version from master and will report later, but right now my rust --version is:
The text was updated successfully, but these errors were encountered: