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

Create a string type that represents either ~str or &'static str #6874

Closed
brson opened this issue Jun 1, 2013 · 2 comments
Closed

Create a string type that represents either ~str or &'static str #6874

brson opened this issue Jun 1, 2013 · 2 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Jun 1, 2013

There are a few places in the runtime where it is nice to pass strings around to identify things, and many but not all the strings are known statically. Examples include failure messages, logging messages, task names, test names, condition and error messages.

Failure already does this using the FailureWithCause trait, which could be refactored into a single function over this string type. std::test does similar optimizations.

@catamorphism
Copy link
Contributor

A "String" trait, perhaps?

@alexcrichton
Copy link
Member

This is actually implemented as SendStr in src/libstd/send_str.rs, added in 76c3e8a, closing

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 11, 2021
Refactor casts lint

Ref: rust-lang#6724

Changes:
1. Separate the `casts` group from the `types` group.
2. Reorganize the lints of the `casts` group into their own modules.

Notes:
1. I didn't `fix` rust-lang#6874 in order to maintain this PR as small as possible.

---
changelog: none
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 25, 2021
replace span_lint with span_lint_and_sugg along with error message

fixes: rust-lang#6874
changelog: none

apologies if this may not be the most idiomatic way of doing it, any advice on changes (if any) would be greatly appreciated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants