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

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

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@czipperz
Copy link
Contributor

czipperz commented Dec 31, 2018

Resolves #57227

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 31, 2018

r? @shepmaster

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

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 31, 2018

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 label Dec 31, 2018

@clarcharr

This comment has been minimized.

Copy link
Contributor

clarcharr commented Jan 2, 2019

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

This comment has been minimized.

Copy link
Contributor

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.

@clarcharr

This comment has been minimized.

Copy link
Contributor

clarcharr commented Jan 2, 2019

...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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

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.

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