Merge pull request #293 from Rupesh-Darimisetti/patch-5

fix: make the exercise editable to edit & run
This commit is contained in:
Sunface 2022-08-12 17:18:13 +08:00 committed by GitHub
commit 2036f44e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ and could then be used to compare a `&'a T` with any lifetime to an `i32`.
Only a higher-ranked bound can be used here, because the lifetime of the reference is shorter than any possible lifetime parameter on the function。 Only a higher-ranked bound can be used here, because the lifetime of the reference is shorter than any possible lifetime parameter on the function。
4、🌟🌟🌟 4、🌟🌟🌟
```rust ```rust,editable
/* Adding HRTB to make it work!*/ /* Adding HRTB to make it work!*/
fn call_on_ref_zero<'a, F>(f: F) where F: Fn(&'a i32) { fn call_on_ref_zero<'a, F>(f: F) where F: Fn(&'a i32) {
let zero = 0; let zero = 0;
@ -236,7 +236,7 @@ struct Ref<'a, T> {
## A difficult exercise ## A difficult exercise
6、🌟🌟🌟🌟 6、🌟🌟🌟🌟
```rust ```rust,editable
/* Make it work */ /* Make it work */
struct Interface<'a> { struct Interface<'a> {
manager: &'a mut Manager<'a> manager: &'a mut Manager<'a>
@ -281,4 +281,4 @@ fn main() {
fn use_list(list: &List) { fn use_list(list: &List) {
println!("{}", list.manager.text); println!("{}", list.manager.text);
} }
``` ```