Skip to content

Remove old syntax for structs implementing a trait #3296

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
erickt opened this issue Aug 29, 2012 · 2 comments
Closed

Remove old syntax for structs implementing a trait #3296

erickt opened this issue Aug 29, 2012 · 2 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@erickt
Copy link
Contributor

erickt commented Aug 29, 2012

The rust grammar still allows for this old-style struct implementing a trait:

trait T { ... }
struct S: T { ... }

Using this form is no longer safe though, as I experienced in #3276. The new min/max style works though:

trait T { }
struct S { ... }
impl S: T { ... }
@Blei
Copy link
Contributor

Blei commented Sep 14, 2012

This seems to have been fixed in the mean time. I'm getting errors like:

failstruct.rs:3:22: 3:25 error: obsolete syntax: class traits
failstruct.rs:3 struct Deserializer : std::serialization::deserializer{
                                      ^~~
note: implemented traits are specified on the impl, as in `impl foo : bar {`
failstruct.rs:5:4: 5:7 error: obsolete syntax: struct constructor
failstruct.rs:5     new() { self.x = (); }

...

When trying to compile the example in the linked bug report.

@catamorphism
Copy link
Contributor

Yes, this is done.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Feb 17, 2024
jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
In rust-lang#1812 we removed standard library includes and instead provided
forward declarations of `free`, `calloc`, and `memcpy` -- but seemingly
forgot to include `malloc`, which we also use.

This avoids a warning seen when dialling up `goto-cc` verbosity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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

3 participants