We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 73d5d89 commit b6f55efCopy full SHA for b6f55ef
src/librustc/lint/builtin.rs
@@ -2107,7 +2107,10 @@ impl LintPass for InvalidNoMangleItems {
2107
},
2108
ast::ItemConst(..) => {
2109
if attr::contains_name(it.attrs.as_slice(), "no_mangle") {
2110
- let msg = "const items should never be #[no_mangle]";
+ // Const items do not refer to a particular location in memory, and therefore
2111
+ // don't have anything to attach a symbol to
2112
+ let msg = "const items should never be #[no_mangle], consider instead using \
2113
+ `pub static`";
2114
cx.span_lint(NO_MANGLE_CONST_ITEMS, it.span, msg);
2115
}
2116
0 commit comments