Remove the return_address intrinsic.
This commit is contained in:
parent
15e8a67c47
commit
b30134dbc3
6 changed files with 0 additions and 125 deletions
|
|
@ -12,44 +12,6 @@
|
|||
|
||||
register_long_diagnostics! {
|
||||
|
||||
E0510: r##"
|
||||
`return_address` was used in an invalid context. Erroneous code example:
|
||||
|
||||
```ignore
|
||||
#![feature(intrinsics)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn return_address() -> *const u8;
|
||||
}
|
||||
|
||||
unsafe fn by_value() -> i32 {
|
||||
let _ = return_address();
|
||||
// error: invalid use of `return_address` intrinsic: function does
|
||||
// not use out pointer
|
||||
0
|
||||
}
|
||||
```
|
||||
|
||||
Return values may be stored in a return register(s) or written into a so-called
|
||||
out pointer. In case the returned value is too big (this is
|
||||
target-ABI-dependent and generally not portable or future proof) to fit into
|
||||
the return register(s), the compiler will return the value by writing it into
|
||||
space allocated in the caller's stack frame. Example:
|
||||
|
||||
```
|
||||
#![feature(intrinsics)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn return_address() -> *const u8;
|
||||
}
|
||||
|
||||
unsafe fn by_pointer() -> String {
|
||||
let _ = return_address();
|
||||
String::new() // ok!
|
||||
}
|
||||
```
|
||||
"##,
|
||||
|
||||
E0511: r##"
|
||||
Invalid monomorphization of an intrinsic function was used. Erroneous code
|
||||
example:
|
||||
|
|
|
|||
|
|
@ -617,18 +617,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
|
|||
|
||||
},
|
||||
|
||||
|
||||
(_, "return_address") => {
|
||||
if !fcx.fn_ty.ret.is_indirect() {
|
||||
span_err!(tcx.sess, span, E0510,
|
||||
"invalid use of `return_address` intrinsic: function \
|
||||
does not use out pointer");
|
||||
C_null(Type::i8p(ccx))
|
||||
} else {
|
||||
PointerCast(bcx, llvm::get_param(fcx.llfn, 0), Type::i8p(ccx))
|
||||
}
|
||||
}
|
||||
|
||||
(_, "discriminant_value") => {
|
||||
let val_ty = substs.types.get(FnSpace, 0);
|
||||
match val_ty.sty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue