-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityregression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
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)
kennytm, acid-chicken, sushruth, weswigham, scottmcm and 5 more
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityregression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.