Merge pull request #294 from readlnh/master

15章中有关 cons list的代码无法编译
pull/295/head
KaiserY 6 years ago committed by GitHub
commit 65ac2a3f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -71,7 +71,7 @@ enum List {
<span class="filename">文件名: src/main.rs</span> <span class="filename">文件名: src/main.rs</span>
```rust,ignore ```rust,ignore
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
fn main() { fn main() {
let list = Cons(1, Cons(2, Cons(3, Nil))); let list = Cons(1, Cons(2, Cons(3, Nil)));
@ -145,7 +145,7 @@ enum List {
Nil, Nil,
} }
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
fn main() { fn main() {
let list = Cons(1, let list = Cons(1,

@ -34,7 +34,7 @@ enum List {
Nil, Nil,
} }
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
fn main() { fn main() {
let a = Cons(5, let a = Cons(5,
@ -76,7 +76,7 @@ enum List {
Nil, Nil,
} }
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
use std::rc::Rc; use std::rc::Rc;
fn main() { fn main() {
@ -106,7 +106,7 @@ fn main() {
# Nil, # Nil,
# } # }
# #
# use List::{Cons, Nil}; # use crate::List::{Cons, Nil};
# use std::rc::Rc; # use std::rc::Rc;
# #
fn main() { fn main() {

@ -272,7 +272,7 @@ enum List {
Nil, Nil,
} }
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;

@ -19,7 +19,7 @@ doc tests do; the `use List` fails if this listing is put within a main -->
# fn main() {} # fn main() {}
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
use List::{Cons, Nil}; use crate::List::{Cons, Nil};
#[derive(Debug)] #[derive(Debug)]
enum List { enum List {
@ -46,7 +46,7 @@ impl List {
<span class="filename">Filename: src/main.rs</span> <span class="filename">Filename: src/main.rs</span>
```rust ```rust
# use List::{Cons, Nil}; # use crate::List::{Cons, Nil};
# use std::rc::Rc; # use std::rc::Rc;
# use std::cell::RefCell; # use std::cell::RefCell;
# #[derive(Debug)] # #[derive(Debug)]

Loading…
Cancel
Save