Skip to content

Commit 444f2ba

Browse files
committed
Refine the message to at least *mention* the attribute itself.
Update pre-existing test's diagnostic output accordingly.
1 parent 64edaec commit 444f2ba

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/librustc_codegen_llvm/consts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ fn check_and_apply_linkage(
116116
let llty2 = if let ty::RawPtr(ref mt) = ty.sty {
117117
cx.layout_of(mt.ty).llvm_type(cx)
118118
} else {
119-
cx.sess().span_fatal(span, "must have type `*const T` or `*mut T`")
119+
cx.sess().span_fatal(
120+
span, "must have type `*const T` or `*mut T` due to `#[linkage]` attribute")
120121
};
121122
unsafe {
122123
// Declare a symbol `foo` with the desired linkage.

src/test/ui/linkage-attr/linkage2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
extern {
99
#[linkage = "extern_weak"] static foo: i32;
10-
//~^ ERROR: must have type `*const T` or `*mut T`
10+
//~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
1111
}
1212

1313
fn main() {

src/test/ui/linkage-attr/linkage2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: must have type `*const T` or `*mut T`
1+
error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute
22
--> $DIR/linkage2.rs:9:32
33
|
44
LL | #[linkage = "extern_weak"] static foo: i32;

0 commit comments

Comments
 (0)