Port LinkageConstOrMutType error
This commit is contained in:
parent
5d79d3c4bb
commit
60ee496c74
@ -1,7 +1,7 @@
|
||||
use crate::base;
|
||||
use crate::common::{self, CodegenCx};
|
||||
use crate::debuginfo;
|
||||
use crate::errors::InvalidMinimumAlignment;
|
||||
use crate::errors::{InvalidMinimumAlignment, LinkageConstOrMutType};
|
||||
use crate::llvm::{self, True};
|
||||
use crate::llvm_util;
|
||||
use crate::type_::Type;
|
||||
@ -147,9 +147,7 @@ fn set_global_alignment<'ll>(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align:
|
||||
match Align::from_bits(min) {
|
||||
Ok(min) => align = align.max(min),
|
||||
Err(err) => {
|
||||
cx.sess().emit_err(InvalidMinimumAlignment {
|
||||
err,
|
||||
});
|
||||
cx.sess().emit_err(InvalidMinimumAlignment { err });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,10 +175,7 @@ fn check_and_apply_linkage<'ll, 'tcx>(
|
||||
let llty2 = if let ty::RawPtr(ref mt) = ty.kind() {
|
||||
cx.layout_of(mt.ty).llvm_type(cx)
|
||||
} else {
|
||||
cx.sess().span_fatal(
|
||||
cx.tcx.def_span(def_id),
|
||||
"must have type `*const T` or `*mut T` due to `#[linkage]` attribute",
|
||||
)
|
||||
cx.sess().emit_fatal(LinkageConstOrMutType { span: cx.tcx.def_span(def_id) })
|
||||
};
|
||||
unsafe {
|
||||
// Declare a symbol `foo` with the desired linkage.
|
||||
|
@ -71,5 +71,12 @@ pub(crate) struct LayoutSizeOverflow {
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(codegen_llvm::invalid_minimum_alignment)]
|
||||
pub(crate) struct InvalidMinimumAlignment {
|
||||
pub err: String
|
||||
pub err: String,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(codegen_llvm::linkage_const_or_mut_type)]
|
||||
pub(crate) struct LinkageConstOrMutType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -30,3 +30,6 @@ codegen_llvm_layout_size_overflow =
|
||||
|
||||
codegen_llvm_invalid_minimum_alignment =
|
||||
invalid minimum global alignment: {$err}
|
||||
|
||||
codegen_llvm_linkage_const_or_mut_type =
|
||||
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user