Misleading error message for bad export statement

de98899
Opened by Brian Anderson at 2013-02-07 23:03:08
export output_format::{};
export output_styl::{};
export config;

#[doc = "The type of document to output"]
enum output_format {
    #[doc = "Markdown"]
    markdown,
    #[doc = "HTML, via markdown and pandoc"]
    pandoc_html
}

#[doc = "How to organize the output"]
enum output_style {
    #[doc = "All in a single document"]
    one_doc,
    #[doc = "Each module in its own document"]
    doc_per_mod
}

#[doc = "The configuration for this rustdoc session"]
type config = {
    output_dir: str,
    output_format: output_format,
    output_style: output_style,
    pandoc_cmd: option<str>
};
../src/rustdoc/config.rs:2:7: 2:23 error: error: undefined id output_styl in an export
../src/rustdoc/config.rs:2 export output_styl::{};

An 'id' isn't a language concept so probably shouldn't appear in the UI. Maybe 'identifier', or even 'enum' if we actually know this is checking enums.

  1. Also, we don't need to write 'error' a second time.

    Brian Anderson at 2012-02-27 00:28:51

  2. And maybe also enclose the id in backticks, like in undefined id output_styl in an export.

    kud1ing at 2012-03-07 09:21:32

  3. Yeah, should use backticks. I happened to remove the extra 'error' in a cleanup fit yesterday.

    Brian Anderson at 2012-03-07 19:33:35

  4. The error message comes from resolve, so assigning @marijnh

    Tim Chevalier at 2012-03-08 23:57:26

  5. Had to make some changes to keep the example up to date, but note that it compiles despite the fact that it exports something that doesn't exist.

    export output_format;
    export output_styl;
    export config;
    
    #[doc = "The type of document to output"]
    enum output_format {
        #[doc = "Markdown"]
        markdown,
        #[doc = "HTML, via markdown and pandoc"]
        pandoc_html
    }
    
    #[doc = "How to organize the output"]
    enum output_style {
        #[doc = "All in a single document"]
        one_doc,
        #[doc = "Each module in its own document"]
        doc_per_mod
    }
    
    #[doc = "The configuration for this rustdoc session"]
    type config = {
        output_dir: &str,
        output_format: output_format,
        output_style: output_style,
        pandoc_cmd: option<&str>
    };
    

    Compiled with rustc --lib 1908.rs.

    bstrie at 2012-07-16 23:17:06

  6. Blocked on #1893 (export statements will go away altogether).

    Tim Chevalier at 2012-07-18 18:19:47

  7. Since exports are on the way out, this is obsolete.

    Tim Chevalier at 2013-02-07 23:03:07