Skip to content

Compiler fails with docstrings over constructor #2920

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

Closed
strangeglyph opened this issue Jul 14, 2012 · 1 comment
Closed

Compiler fails with docstrings over constructor #2920

strangeglyph opened this issue Jul 14, 2012 · 1 comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@strangeglyph
Copy link
Contributor

Currently, class constructors can not be documented with the /** */-style docstrings, else the compiler complains about unexpected tokens.

This code:

fn main() {}

class foo {

    let bar: bool;

    /**
     * Creates a foo object
     */
    new() {
        self.bar = true;
        io::println("foo");
    }
}

produces the following output:

testpad.rs:10:4: 10:7 error: unexpected token: 'new'
testpad.rs:10     new() {
                  ^~~
@ghost ghost assigned catamorphism Jul 14, 2012
@catamorphism
Copy link
Contributor

Thanks for the report -- it turns out doc comments are represented in the compiler as attributes, so this is a dup of #2660. That's certainly not obvious, though.

celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Bumps the cargo group with 2 updates:
[clap](https://github.com/clap-rs/clap) and
[once_cell](https://github.com/matklad/once_cell).

Updates `clap` from 4.4.10 to 4.4.11
Updates `once_cell` from 1.18.0 to 1.19.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants