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

Allow empty functional updating of structs #8972

Closed
tikue opened this issue Sep 4, 2013 · 2 comments · Fixed by #11911
Closed

Allow empty functional updating of structs #8972

tikue opened this issue Sep 4, 2013 · 2 comments · Fixed by #11911

Comments

@tikue
Copy link
Contributor

tikue commented Sep 4, 2013

struct Foo {
    bar: int,
    baz: int
}

let foo = Foo {
    bar: 0,
    baz: 1
};

let foo_clone = Foo { ..foo }; // error

As @metajack pointed out, this would be useful to avoid special-casing in macros and the like.

@jeremyletang
Copy link
Contributor

triage bump, maybe we can close this issue, it seems that no one is interested about this?

@lilyball
Copy link
Contributor

At the very least the error message is quite misleading:

Untitled.rs:12:25: 12:26 error: expected `;` but found `{`
Untitled.rs:12     let foo_clone = Foo { ..foo }; // error
                                       ^

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2022
feat(new lint): new lint `manual_retain`

close rust-lang#8097

This PR is  a new  lint implementation.
This lint checks if the `retain` method is available.

Thank you in advance.

changelog: add new ``[`manual_retain`]`` lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants