Skip to content

Change char::eq_ignore_ascii_case to take a Borrow<char> instead of &char #57228

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

Conversation

czipperz
Copy link
Contributor

Resolves #57227

@rust-highfive
Copy link
Contributor

r? @shepmaster

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 31, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1a5252d8:start=1546227364068257708,finish=1546227365339012482,duration=1270754774
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:03:27] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:03:27] expected success, got: exit code: 101
[00:03:27] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:03:27] Build completed unsuccessfully in 0:00:10
[00:03:27] Makefile:18: recipe for target 'all' failed
[00:03:27] make: *** [all] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:01ce32dc
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Dec 31 03:39:41 UTC 2018

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Dec 31, 2018
@clarfonthey
Copy link
Contributor

Personally, I'd rather see these deprecated entirely for char. While they avoid allocation for str, x.eq_ignore_ascii_case(y) for char is not any easier than x.to_ascii_lowercase() == y.

@czipperz
Copy link
Contributor Author

czipperz commented Jan 2, 2019

@clarcharr x.eq_ignore_ascii_case(&y) is synonymous with x.to_ascii_lowercase() == y.to_ascii_lowercase(), which is much more verbose.

@clarfonthey
Copy link
Contributor

...right, I don't know how I messed that up.

I'm still not super fond of this method and wonder if there's a more ergonomic way to do this.

@shepmaster
Copy link
Member

shepmaster commented Jan 2, 2019

I'm unclear on how we deal with this backwards compatibility aspect. For example, this shows a form of code that would fail with the proposed changes:

fn before(_: &char, _: &char) -> bool {
    false
}

fn after(_: &char, _: impl std::borrow::Borrow<char>) -> bool {
    false
}

fn example(_: fn(&char, &char) -> bool) {}

fn main() {
    example(before);
    example(after);
}

r? @BurntSushi

@czipperz
Copy link
Contributor Author

czipperz commented Jan 3, 2019

Nice catch @shepmaster . I was hoping Rust would automatically deduce the types. I think for this reason I don't think this PR should be merged. I'm going to work on making tests for these things. I need to get a real development environment set up first.

@TimNN TimNN added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 29, 2019
@TimNN
Copy link
Contributor

TimNN commented Jan 29, 2019

Ping from triage @czipperz: What is the status of this PR? Should it be closed for now? Or do you think you'll be able to work on fixing the issue?

@czipperz
Copy link
Contributor Author

Yeah shoot I forget to close this @TimNN

@czipperz czipperz closed this Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants