diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2019-05-24 14:55:15 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2019-05-27 10:26:02 +0200 |
| commit | 444f2bae5920a93677a9de6063897e5ce00491e7 (patch) | |
| tree | fcd9718ff3ad8b204c3895cf332c14bc8cf7cd16 | |
| parent | 64edaec6b35ea32e8dffbe27ff123c4a090869a8 (diff) | |
| download | rust-444f2bae5920a93677a9de6063897e5ce00491e7.tar.gz rust-444f2bae5920a93677a9de6063897e5ce00491e7.zip | |
Refine the message to at least *mention* the attribute itself.
Update pre-existing test's diagnostic output accordingly.
| -rw-r--r-- | src/librustc_codegen_llvm/consts.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/linkage-attr/linkage2.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/linkage-attr/linkage2.stderr | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 23e2bfe1ad1..99b5cf42551 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -116,7 +116,8 @@ fn check_and_apply_linkage( let llty2 = if let ty::RawPtr(ref mt) = ty.sty { cx.layout_of(mt.ty).llvm_type(cx) } else { - cx.sess().span_fatal(span, "must have type `*const T` or `*mut T`") + cx.sess().span_fatal( + span, "must have type `*const T` or `*mut T` due to `#[linkage]` attribute") }; unsafe { // Declare a symbol `foo` with the desired linkage. diff --git a/src/test/ui/linkage-attr/linkage2.rs b/src/test/ui/linkage-attr/linkage2.rs index f9ea5319d54..c8af1a69979 100644 --- a/src/test/ui/linkage-attr/linkage2.rs +++ b/src/test/ui/linkage-attr/linkage2.rs @@ -7,7 +7,7 @@ extern { #[linkage = "extern_weak"] static foo: i32; - //~^ ERROR: must have type `*const T` or `*mut T` + //~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute } fn main() { diff --git a/src/test/ui/linkage-attr/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr index 8326c0baccc..2654ffd67b6 100644 --- a/src/test/ui/linkage-attr/linkage2.stderr +++ b/src/test/ui/linkage-attr/linkage2.stderr @@ -1,4 +1,4 @@ -error: must have type `*const T` or `*mut T` +error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute --> $DIR/linkage2.rs:9:32 | LL | #[linkage = "extern_weak"] static foo: i32; |
