mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-23 15:14:35 +02:00
parent
259a8ac08e
commit
13cf920e08
@ -11,7 +11,7 @@ pub extern "C" fn hello_from_rust() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Important**: note that `no_mangle` here is considered a type of unsafety by
|
**Important**: note that `no_mangle` here is considered a type of unsafety by
|
||||||
the Rust compiler, so you'll need to to allow unsafe code in your `gn` target.
|
the Rust compiler, so you'll need to allow unsafe code in your `gn` target.
|
||||||
|
|
||||||
Add this new Rust target as a dependency of `//ui/base:base`. Declare this
|
Add this new Rust target as a dependency of `//ui/base:base`. Declare this
|
||||||
function at the top of `ui/base/resource/resource_bundle.cc` (later, we'll see
|
function at the top of `ui/base/resource/resource_bundle.cc` (later, we'll see
|
||||||
|
@ -44,7 +44,7 @@ fn main() {
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
In this example, the the compiler does not know what lifetime to infer for `p3`.
|
In this example, the compiler does not know what lifetime to infer for `p3`.
|
||||||
Looking inside the function body shows that it can only safely assume that
|
Looking inside the function body shows that it can only safely assume that
|
||||||
`p3`'s lifetime is the shorter of `p1` and `p2`. But just like types, Rust
|
`p3`'s lifetime is the shorter of `p1` and `p2`. But just like types, Rust
|
||||||
requires explicit annotations of lifetimes on function arguments and return
|
requires explicit annotations of lifetimes on function arguments and return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user