Skip to content

Commit

Permalink
Regression test for issue #59548.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed May 27, 2019
1 parent 444f2ba commit 4e60f53
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs
@@ -0,0 +1,5 @@
#![feature(linkage)]
#![crate_type = "lib"]

#[linkage="external"]
pub static EXTERN: u32 = 0;
10 changes: 10 additions & 0 deletions src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs
@@ -0,0 +1,10 @@
// rust-lang/rust#59548: We used to ICE when trying to use a static
// with a type that violated its own `#[linkage]`.

// aux-build:def_illtyped_external.rs

extern crate def_illtyped_external as dep;

fn main() {
println!("{:p}", &dep::EXTERN);
}
8 changes: 8 additions & 0 deletions src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr
@@ -0,0 +1,8 @@
error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
--> $DIR/auxiliary/def_illtyped_external.rs:5:1
|
LL | pub static EXTERN: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit 4e60f53

Please sign in to comment.