Move span_invalid_monomorphization_error from cg_llvm to cg_ssa
The associated long diagnostic didn't get registered before
This commit is contained in:
parent
5f203d5988
commit
5f6ddb94a6
5 changed files with 42 additions and 46 deletions
|
@ -1,38 +0,0 @@
|
|||
register_diagnostics! {
|
||||
|
||||
E0511: r##"
|
||||
Invalid monomorphization of an intrinsic function was used. Erroneous code
|
||||
example:
|
||||
|
||||
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
|
||||
#![feature(platform_intrinsics)]
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
fn simd_add<T>(a: T, b: T) -> T;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe { simd_add(0, 1); }
|
||||
// error: invalid monomorphization of `simd_add` intrinsic
|
||||
}
|
||||
```
|
||||
|
||||
The generic type has to be a SIMD type. Example:
|
||||
|
||||
```
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
|
||||
#[repr(simd)]
|
||||
#[derive(Copy, Clone)]
|
||||
struct i32x2(i32, i32);
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
fn simd_add<T>(a: T, b: T) -> T;
|
||||
}
|
||||
|
||||
unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
|
||||
```
|
||||
"##,
|
||||
|
||||
}
|
|
@ -20,9 +20,9 @@ use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
|
|||
use rustc::hir;
|
||||
use syntax::ast::{self, FloatTy};
|
||||
|
||||
use rustc_codegen_ssa::common::span_invalid_monomorphization_error;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
|
||||
use rustc::session::Session;
|
||||
use syntax_pos::Span;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
|
@ -1026,10 +1026,6 @@ fn get_rust_try_fn<'ll, 'tcx>(
|
|||
rust_try
|
||||
}
|
||||
|
||||
fn span_invalid_monomorphization_error(a: &Session, b: Span, c: &str) {
|
||||
span_err!(a, b, E0511, "{}", c);
|
||||
}
|
||||
|
||||
fn generic_simd_intrinsic(
|
||||
bx: &mut Builder<'a, 'll, 'tcx>,
|
||||
name: &str,
|
||||
|
|
|
@ -38,7 +38,7 @@ extern crate rustc_fs_util;
|
|||
extern crate rustc_driver as _;
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate syntax;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
extern crate rustc_errors as errors;
|
||||
|
||||
|
@ -64,8 +64,6 @@ use rustc::util::common::ErrorReported;
|
|||
use rustc_codegen_ssa::ModuleCodegen;
|
||||
use rustc_codegen_utils::codegen_backend::CodegenBackend;
|
||||
|
||||
mod error_codes;
|
||||
|
||||
mod back {
|
||||
pub mod archive;
|
||||
pub mod bytecode;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#![allow(non_camel_case_types, non_snake_case)]
|
||||
|
||||
use rustc::ty::{Ty, TyCtxt};
|
||||
use rustc::session::Session;
|
||||
use syntax_pos::Span;
|
||||
|
||||
use rustc::hir::def_id::DefId;
|
||||
|
@ -200,3 +201,7 @@ pub fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
|||
_ => bug!("shift_mask_val: expected Integer or Vector, found {:?}", kind),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn span_invalid_monomorphization_error(a: &Session, b: Span, c: &str) {
|
||||
span_err!(a, b, E0511, "{}", c);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,40 @@
|
|||
syntax::register_diagnostics! {
|
||||
|
||||
E0511: r##"
|
||||
Invalid monomorphization of an intrinsic function was used. Erroneous code
|
||||
example:
|
||||
|
||||
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
|
||||
#![feature(platform_intrinsics)]
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
fn simd_add<T>(a: T, b: T) -> T;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe { simd_add(0, 1); }
|
||||
// error: invalid monomorphization of `simd_add` intrinsic
|
||||
}
|
||||
```
|
||||
|
||||
The generic type has to be a SIMD type. Example:
|
||||
|
||||
```
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
|
||||
#[repr(simd)]
|
||||
#[derive(Copy, Clone)]
|
||||
struct i32x2(i32, i32);
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
fn simd_add<T>(a: T, b: T) -> T;
|
||||
}
|
||||
|
||||
unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
|
||||
```
|
||||
"##,
|
||||
|
||||
E0668: r##"
|
||||
Malformed inline assembly rejected by LLVM.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue