parent
4e60f53280
commit
c8887abf20
5 changed files with 67 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
#![feature(linkage)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
extern {
|
||||
#[linkage="external"]
|
||||
pub static collision: *const i32;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// rust-lang/rust#61232: We used to ICE when trying to detect a
|
||||
// collision on the symbol generated for the external linkage item in
|
||||
// an extern crate.
|
||||
|
||||
// aux-build:def_colliding_external.rs
|
||||
|
||||
extern crate def_colliding_external as dep1;
|
||||
|
||||
#[no_mangle]
|
||||
pub static _rust_extern_with_linkage_collision: i32 = 0;
|
||||
|
||||
mod dep2 {
|
||||
#[no_mangle]
|
||||
pub static collision: usize = 0;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
println!("{:p}", &dep1::collision);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
error: symbol `collision` is already defined
|
||||
--> $DIR/auxiliary/def_colliding_external.rs:6:5
|
||||
|
|
||||
LL | pub static collision: *const i32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#![feature(linkage)]
|
||||
|
||||
mod dep1 {
|
||||
extern {
|
||||
#[linkage="external"]
|
||||
#[no_mangle]
|
||||
pub static collision: *const i32; //~ ERROR symbol `collision` is already defined
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub static _rust_extern_with_linkage_collision: i32 = 0;
|
||||
|
||||
mod dep2 {
|
||||
#[no_mangle]
|
||||
pub static collision: usize = 0;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
println!("{:p}", &dep1::collision);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
error: symbol `collision` is already defined
|
||||
--> $DIR/linkage-detect-local-generated-name-collision.rs:7:9
|
||||
|
|
||||
LL | pub static collision: *const i32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue