Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listing 11-12: コピーしたコードが不正 #198

Open
kawadakk opened this issue Apr 7, 2022 · 0 comments
Open

Listing 11-12: コピーしたコードが不正 #198

kawadakk opened this issue Apr 7, 2022 · 0 comments

Comments

@kawadakk
Copy link

kawadakk commented Apr 7, 2022

Listing 11-12のコピーボタンを押下するとコンパイルが通らないコード (Playground) が出力されるようです。

// copied code
#![allow(unused)]
fn main() {
pub fn add_two(a: i32) -> i32 {
    internal_adder(a, 2)
}

fn internal_adder(a: i32, b: i32) -> i32 {
    a + b
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn internal() {
        assert_eq!(4, internal_adder(2, 2));
        //            ^^^^^^^^^^^^^^
        // error[E0425]: cannot find function `internal_adder` in this scope
    }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant