about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-11-20 01:09:42 +0100
committerGitHub <noreply@github.com>2021-11-20 01:09:42 +0100
commita9858ce78fbcd5697b6854cd07310ba04ecced72 (patch)
treeab919b2e2a238dc31855f289dbf1141a0a4f0397 /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parentcf69f9e2206c708cb0c4535cab9e7a64c23add06 (diff)
parent214ad2f5b5ff529548ce13dabcda8d5841df0bd7 (diff)
downloadrust-a9858ce78fbcd5697b6854cd07310ba04ecced72.tar.gz
rust-a9858ce78fbcd5697b6854cd07310ba04ecced72.zip
Rollup merge of #91026 - notriddle:notriddle/rustdoc-doctest-semicolon, r=jyn514
rustdoc doctest: detect `fn main` after an unexpected semicolon

Fixes #91014

The basic problem with this is that rustdoc, when hunting for `fn main`, will stop parsing after it reaches a fatal error. This unexpected semicolon was a fatal error, so in `src/test/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs`, it would wrap the doctest in an implied main function, turning it into this:

    fn main() {
        struct S {};
        fn main() {
            assert_eq!(0, 1);
        }
    }

This, as it turns out, is totally valid, and it executes no assertions, so *it passes,* even though the user wanted it to execute the assertion.

The Rust parser already has the ability to recover from these unexpected semicolons, but to do so, it needs to use the `parse_mod` function, so this PR changes it to do that.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions