Closed
Description
Rust incorrectly accepts the following code (which is missing a )
):
pub struct Value {
}
pub fn new() -> Result<Value, ()> {
Ok(Value {
} // Look ma, no `)`!
}
So far this seems to only happen if the code is inside a submodule. Shell script to reproduce:
#!/bin/bash
cargo new --lib this_should_not_build
mkdir this_should_not_build/src/foo
cat >> this_should_not_build/src/lib.rs <<-'EOF'
pub mod foo;
EOF
cat > this_should_not_build/src/foo/mod.rs <<-'EOF'
pub struct Value {
}
pub fn new() -> Result<Value, ()> {
Ok(Value {
}
}
EOF
cd this_should_not_build
cargo build
My compiler version: rustc 1.34.0-nightly (0ea22717a 2019-03-02)