Skip to content

Fix linkage diagnostic so it doesn't ICE for external crates #61231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Regression test for issue #59548.
  • Loading branch information
pnkfelix committed May 27, 2019
commit 4e60f53280c34d35c29b007b28e32b9a6f695d1b
5 changes: 5 additions & 0 deletions src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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