rustc_trans::DIAGNOSTICS
[−]
[src]
pub const DIAGNOSTICS: [(&'static str, &'static str); 2usize]=
[("E0510", "\n`return_address` was used in an invalid context. Erroneous code example:\n\n```compile_fail\n#![feature(intrinsics)]\n\nextern \"rust-intrinsic\" {\n fn return_address() -> *const u8;\n}\n\nunsafe fn by_value() -> i32 {\n let _ = return_address();\n // error: invalid use of `return_address` intrinsic: function does\n // not use out pointer\n 0\n}\n```\n\nReturn values may be stored in a return register(s) or written into a so-called\nout pointer. In case the returned value is too big (this is\ntarget-ABI-dependent and generally not portable or future proof) to fit into\nthe return register(s), the compiler will return the value by writing it into\nspace allocated in the caller\'s stack frame. Example:\n\n```\n#![feature(intrinsics)]\n\nextern \"rust-intrinsic\" {\n fn return_address() -> *const u8;\n}\n\nunsafe fn by_pointer() -> String {\n let _ = return_address();\n String::new() // ok!\n}\n```\n"), ("E0511", "\nInvalid monomorphization of an intrinsic function was used. Erroneous code\nexample:\n\n```compile_fail\n#![feature(platform_intrinsics)]\n\nextern \"platform-intrinsic\" {\n fn simd_add<T>(a: T, b: T) -> T;\n}\n\nunsafe { simd_add(0, 1); }\n// error: invalid monomorphization of `simd_add` intrinsic\n```\n\nThe generic type has to be a SIMD type. Example:\n\n```\n#![feature(repr_simd)]\n#![feature(platform_intrinsics)]\n\n#[repr(simd)]\n#[derive(Copy, Clone)]\nstruct i32x1(i32);\n\nextern \"platform-intrinsic\" {\n fn simd_add<T>(a: T, b: T) -> T;\n}\n\nunsafe { simd_add(i32x1(0), i32x1(1)); } // ok!\n```\n")]
Unstable (
rustc_private
)