Skip to content

Tracking issue for the functions for debug escaping char_escape_debug #35068

Closed
@tbu-

Description

@tbu-
Contributor

std::char::escape_debug, std::char::EscapeDebug.

Activity

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
B-unstableBlocker: Implemented in the nightly compiler and unstable.
on Jul 27, 2016
nikonthethird

nikonthethird commented on Nov 12, 2016

@nikonthethird

I hope this is the correct spot to mention that all examples of std::char::escape_debug use std::char::escape_default.

https://doc.rust-lang.org/std/primitive.char.html#method.escape_debug

Mark-Simulacrum

Mark-Simulacrum commented on May 16, 2017

@Mark-Simulacrum
Member

The above has been fixed; the function is correctly documented. Nominating for libs team discussion as to stabilization, I don't think we're going to get much information out of usage since this is such a niche API. I'm personally not certain I like the name: escape_debug seems odd to me, it's not really anything related to debugging I think.

cc @rust-lang/libs

tbu-

tbu- commented on May 16, 2017

@tbu-
ContributorAuthor

debug refers to the fact that it is used for the Debug implementation of String and &str.

I would prefer to call these functions just escape (best would be escape_default, but that one is taken). Could we maybe permanently deprecate escape_default in favor of something like escape_nonascii to make it clear that escaping all non-ASCII code points has nothing to do with "default"?

(I don't suggest ever removing escape_default, just deprecating it.)

sfackler

sfackler commented on May 23, 2017

@sfackler
Member

@rfcbot fcp merge

rfcbot

rfcbot commented on May 23, 2017

@rfcbot
Collaborator

Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams:

Concerns:

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

BurntSushi

BurntSushi commented on May 27, 2017

@BurntSushi
Member

Sorry, but I've lost context on this change and this issue doesn't appear to link to anything. What is the purpose of this new method? Is it just a rename?

tbu-

tbu- commented on May 27, 2017

@tbu-
ContributorAuthor

The function escapes characters the way the Debug implementation for str and char does.

dtolnay

dtolnay commented on Jun 3, 2017

@dtolnay
Member

If we are doing this, I would also like to have a plan for #27791 which includes <str>::escape_debug. Looks like there were concerns about consistency between char's and str's escape_default in #27791 (comment).

@rfcbot concern str

brson

brson commented on Jun 6, 2017

@brson
Contributor

Please change this sentence in the docs: "This will escape the characters similar to the Debug implementations of str or char." I assume this is not just similar, it is the implementation of 'Debug'.

tbu-

tbu- commented on Jun 6, 2017

@tbu-
ContributorAuthor

Currently. What if we wanted to change either of these but not the other? escape_default couldn't be changed because the documentation was too concrete.

6 remaining items

tbu-

tbu- commented on Jun 23, 2017

@tbu-
ContributorAuthor

See the original pull request: #34485.

dtolnay

dtolnay commented on Jul 20, 2017

@dtolnay
Member

@rfcbot resolved str

char::escape_debug is good to go. We will address the consistency question as part of #27791.

added
final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
on Jul 20, 2017
rfcbot

rfcbot commented on Jul 20, 2017

@rfcbot
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Jul 22, 2017
added a commit that references this issue on Aug 12, 2017
1206c80
leo60228

leo60228 commented on Apr 21, 2020

@leo60228
Contributor

I'm not sure of a better place to put this. Is this function guaranteed so that format!("\"{}\"", x.escape_debug()) returns valid Rust code that represents a value equal to x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@brson@BurntSushi@aturon@sfackler

        Issue actions

          Tracking issue for the functions for debug escaping `char_escape_debug` · Issue #35068 · rust-lang/rust