Skip to content

Expand the deriving(ToStr) implementation - #7204

Merged
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:deriving-to-string
Jun 23, 2013
Merged

Expand the deriving(ToStr) implementation#7204
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:deriving-to-string

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

Closes#7180 and #7179.

Before, the deriving(ToStr) attribute was essentially fmt!("%?"). This changes it to recursively invoke to_str() on fields instead of relying on fmt!-style things. This seems more natural to me and what should actually be expected.

@huonw

Copy link
Copy Markdown
Contributor

Much better than the old version! Although this should probably also update the section of the manual that says deriving(ToStr) is the same as fmt!("%?", x).

@alexcrichton

Copy link
Copy Markdown
MemberAuthor

Oh good point! I have noted this now.

bors added a commit that referenced this pull request Jun 23, 2013
Closes#7180 and #7179.
Before, the `deriving(ToStr)` attribute was essentially `fmt!("%?")`. This changes it to recursively invoke `to_str()` on fields instead of relying on `fmt!`-style things. This seems more natural to me and what should actually be expected.
@borsbors closed this Jun 23, 2013
@bors
bors merged commit 30d7559 into rust-lang:masterJun 23, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 27, 2021
Backport of rust-lang#7170 to beta
r? `@ghost`
changelog: none (fixes stack overflow, but this was introduced in this release cycle)
Now actually opened towards the `beta` branch.
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
7205: Fix bug for $crate in LHS of mbe r=edwin0cheng a=edwin0cheng
We treated `$crate` as meta variable in LHS of mbe, which should be an `ident`. Fixesrust-lang#7204
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[deriving(ToStr)] handles generics in a surprising manner.

4 participants

@alexcrichton@huonw@pcwalton@bors