ZhangHanDong / tao-of-rust-codes

《Rust编程之道》随书源码
https://ruststudy.github.io/tao_of_rust_docs/tao_of_rust/
MIT License
1.18k stars 170 forks source link

[第5章] 5.8代码清单5-62中生成的MIR代码与1.67 不一致,建议更新或采用不同分支提供相应代码 #338

Closed m104ngc4594 closed 1 year ago

m104ngc4594 commented 1 year ago

页码与行数


文本或排版错误

暂无


代码错误

// 此处应该是 https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn main() -> () {
    let mut _0: ();                      // return place in scope 0 at [src/main.rs:1:11: 1:11](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a#)
    let _1: i32;                         // in scope 0 at [src/main.rs:2:9: 2:10](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a#)
    scope 1 {
        debug a => _1;                   // in scope 1 at [src/main.rs:2:9: 2:10](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a#)
    }

    bb0: {
        _1 = const 1_i32;                // scope 0 at [src/main.rs:2:13: 2:14](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a#)
        return;                          // scope 0 at [src/main.rs:4:2: 4:2](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=03dc376567f7878ec99f5d6de0d6382a#)
    }
}

Rust版本

$ rustc -V
rustc 1.67.0-stable

错误信息

error: xxxx
xxxx
xxxx
ZhangHanDong commented 1 year ago

@m104ngc4594 感谢反馈,代码会在第二版书中更新