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

Misleading error message for bad export statement #1908

Closed
brson opened this issue Feb 27, 2012 · 7 comments
Closed

Misleading error message for bad export statement #1908

brson opened this issue Feb 27, 2012 · 7 comments
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Feb 27, 2012

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.

@brson
Copy link
Contributor Author

brson commented Feb 27, 2012

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

@kud1ing
Copy link

kud1ing commented Mar 7, 2012

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

@brson
Copy link
Contributor Author

brson commented Mar 7, 2012

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

@ghost ghost assigned marijnh Mar 8, 2012
@catamorphism
Copy link
Contributor

The error message comes from resolve, so assigning @marijnh

@bstrie
Copy link
Contributor

bstrie commented Jul 16, 2012

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.

@catamorphism
Copy link
Contributor

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

@catamorphism
Copy link
Contributor

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

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 14, 2022
…5,giraffate

Use `.into_iter()` rather than `.drain(..)`

Replacing `.drain(..)` with `.into_iter()` makes my project's binary size smaller.

Fixes rust-lang#1908

Applicability of this suggestion is `MaybeIncorrect` rather than `MachineApplicable` due to the complexity of "checking otherwise usage" X-|

changelog: Add new lint [`iter_with_drain`]
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
* Use different type in an example

Sentences such as «without the argument u32» were ambiguous, as there were two distincts u32. Having a single one, the one in the monomorphization of the type, remove the ambiguity.

* Update src/ty.md

---------

Co-authored-by: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com>
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
* Use different type in an example

Sentences such as «without the argument u32» were ambiguous, as there were two distincts u32. Having a single one, the one in the monomorphization of the type, remove the ambiguity.

* Update src/ty.md

---------

Co-authored-by: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants