V
V
Vladimir T2018-04-29 09:51:24
Rust
Vladimir T, 2018-04-29 09:51:24

What does ->! in Rust?

Example from source:

pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {

What type does the function return and what does it mean: "-> !"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Lesnikov, 2018-04-29
@32bit_me

For incomprehensible pieces of syntax, there is an excellent page - https://doc.rust-lang.org/book/first-edition/synta...
There is an easy item "!: always empty Never type. See Diverging Functions", referring to the details in the first edition of the Book:
- https://doc.rust-lang.org/book/first-edition/funct...
- https://rurust.github.io/rust_book_ru/src/function...
Very briefly , such a return type of a function means that it will never return control.

M
Mikhail Potanin, 2018-06-21
@potan

The function never returns, which allows it to be called as if it were returning any given type.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question