Rfcs: Make `str` a `struct str([u8])`

Created on 23 Apr 2019  ·  1Comment  ·  Source: rust-lang/rfcs

This was previously attempted in https://github.com/rust-lang/rust/pull/19612, but since https://github.com/rust-lang/rust/pull/45225 some of the issues are no longer relevant, so it may be feasible to try this again.

See also Make bool an enum.

A-primitive A-string T-lang

Most helpful comment

https://github.com/rust-lang/rust/pull/19612#issuecomment-66661255

Allows for inherent methods on str -- but note, it does not allow us to do away with extension traits because some of the operators must be defined in liballoc.

These days we do have inherent methods on str, both in libcore and in liballoc, through lang items that allow these impl blocks despite usual impl coherence rules. If str becomes a struct in libcore, it will still need at least a lang item for liballoc methods.

>All comments

https://github.com/rust-lang/rust/pull/19612#issuecomment-66661255

Allows for inherent methods on str -- but note, it does not allow us to do away with extension traits because some of the operators must be defined in liballoc.

These days we do have inherent methods on str, both in libcore and in liballoc, through lang items that allow these impl blocks despite usual impl coherence rules. If str becomes a struct in libcore, it will still need at least a lang item for liballoc methods.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rudolfschmidt picture rudolfschmidt  ·  3Comments

silversolver1 picture silversolver1  ·  3Comments

3442853561 picture 3442853561  ·  3Comments

rust-highfive picture rust-highfive  ·  4Comments

onelson picture onelson  ·  3Comments