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

as_deref() and as_deref_mut() impls #59628

Closed
wants to merge 3 commits into from
Closed

as_deref() and as_deref_mut() impls #59628

wants to merge 3 commits into from

Conversation

U007D
Copy link

@U007D U007D commented Apr 2, 2019

addresses #50264
renamed deref() -> as_deref()
added deref_mut() impls + tests
fixed breaking changes

@rust-highfive
Copy link
Collaborator

r? @Kimundi

(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 Apr 2, 2019
@joshtriplett
Copy link
Member

LGTM, though I'm not a libs reviewer.

@Kimundi
Copy link
Member

Kimundi commented Apr 4, 2019

@bors: r+

Seems like a sensible change, based on the discussion so far.

@bors
Copy link
Contributor

bors commented Apr 4, 2019

📌 Commit e71e71b has been approved by Kimundi

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 4, 2019
Centril added a commit to Centril/rust that referenced this pull request Apr 4, 2019
`as_deref()` and `as_deref_mut()` impls

addresses rust-lang#50264
renamed `deref()` -> `as_deref()`
added `deref_mut()` impls + tests
fixed breaking changes
@Centril
Copy link
Contributor

Centril commented Apr 4, 2019

@bors r-

Failed in #59692 (comment) due to miri toolstate.
cc @RalfJung

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 4, 2019
@RalfJung
Copy link
Member

RalfJung commented Apr 4, 2019

Looks like the old deref is used by Miri? Then I guess it has to be deprecated instead of removed, so that Miri can be moved to the new thing.

Or land this separately from a Miri update so that breaking Miir is not fatal.

@bors
Copy link
Contributor

bors commented Apr 12, 2019

☔ The latest upstream changes (presumably #59910) made this pull request unmergeable. Please resolve the merge conflicts.

@U007D
Copy link
Author

U007D commented Apr 14, 2019

Hi, @RalfJung,

I'm not fluent with the Rust release process, but can a feature which has never been stable be deprecated? Or are you recommending the method name be reverted from as_deref() back to deref()?

@RalfJung
Copy link
Member

can a feature which has never been stable be deprecated?

Yes. Just add a #[rustc_deprecated] attribute next to the #[unstable].

@Centril
Copy link
Contributor

Centril commented Apr 14, 2019

@U007D We can break miri again so you don't need to use rustc_deprecated here, just rebase your PR and we should be good to go.

@RalfJung
Copy link
Member

Sure, that also works. No idea how widely used this function is.

(What happened last time was not about tools not breaking due to beta; it was that this one got rolled up with an "update miri" PR. Changing a tool and breaking it in the same PR leads to CI failure.)

@rust-highfive
Copy link
Collaborator

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:01c88a3b:start=1555335979079856581,finish=1555335979880535696,duration=800679115
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:06:47] .................................................................................................... 2500/5543
[01:06:51] .................................................................................................... 2600/5543
[01:06:55] .................................................................................................... 2700/5543
[01:06:59] .................................................................................................... 2800/5543
[01:07:03] ...................................................................................F....FFFF.FF..... 2900/5543
[01:07:11] .................................................................................................... 3100/5543
[01:07:14] .................................................................................................... 3200/5543
[01:07:18] .................................................................................................... 3300/5543
[01:07:22] .......................................i............................................................ 3400/5543
---
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/option-as_deref.rs:4:29
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &Some(42).as_deref();
[01:08:43] -    |                             ^^^^^^^^ help: did you mean: `as_ref`
[01:08:43] 6    |
[01:08:43] 7    = note: the method `as_deref` exists but the following trait bounds were not satisfied:
[01:08:43] 7    = note: the method `as_deref` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::Deref`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref/option-as_deref.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/option-as_deref.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref` found for type `std::option::Option<{integer}>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs","byte_start":66,"byte_end":74,"line_start":4,"line_end":4,"column_start":29,"column_end":37,"is_primary":true,"text":[{"text":"    let _result = &Some(42).as_deref();","highlight_start":29,"highlight_end":37}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::Deref`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs","byte_start":66,"byte_end":74,"line_start":4,"line_end":4,"column_start":29,"column_end":37,"is_primary":true,"text":[{"text":"    let _result = &Some(42).as_deref();","highlight_start":29,"highlight_end":37}],"label":null,"suggested_replacement":"as_ref","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref` found for type `std::option::Option<{integer}>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs:4:29\n   |\nLL |     let _result = &Some(42).as_deref();\n   |                             ^^^^^^^^ help: there is a method with a similar name: `as_ref`\n   |\n   = note: the method `as_deref` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::Deref`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
---
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref_err.rs:4:28
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &Err(41).as_deref_err();
[01:08:43] -    |                            ^^^^^^^^^^^^ help: did you mean: `as_deref_ok`
[01:08:43] +    |                            ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_ok`
[01:08:43] 7    = note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
[01:08:43] 7    = note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::Deref`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err/result-as_deref_err.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref_err.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref_err` found for type `std::result::Result<_, {integer}>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs","byte_start":65,"byte_end":77,"line_start":4,"line_end":4,"column_start":28,"column_end":40,"is_primary":true,"text":[{"text":"    let _result = &Err(41).as_deref_err();","highlight_start":28,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref_err` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::Deref`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs","byte_start":65,"byte_end":77,"line_start":4,"line_end":4,"column_start":28,"column_end":40,"is_primary":true,"text":[{"text":"    let _result = &Err(41).as_deref_err();","highlight_start":28,"highlight_end":40}],"label":null,"suggested_replacement":"as_deref_ok","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref_err` found for type `std::result::Result<_, {integer}>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs:4:28\n   |\nLL |     let _result = &Err(41).as_deref_err();\n   |                            ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_ok`\n   |\n   = note: the method `as_deref_err` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::Deref`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] 
[01:08:43] ---- [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs stdout ----
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref.rs:4:27
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &Ok(42).as_deref();
[01:08:43] -    |                           ^^^^^^^^ help: did you mean: `as_ref`
[01:08:43] 6    |
[01:08:43] 7    = note: the method `as_deref` exists but the following trait bounds were not satisfied:
[01:08:43] 7    = note: the method `as_deref` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::Deref`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref/result-as_deref.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref` found for type `std::result::Result<{integer}, _>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs","byte_start":64,"byte_end":72,"line_start":4,"line_end":4,"column_start":27,"column_end":35,"is_primary":true,"text":[{"text":"    let _result = &Ok(42).as_deref();","highlight_start":27,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::Deref`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs","byte_start":64,"byte_end":72,"line_start":4,"line_end":4,"column_start":27,"column_end":35,"is_primary":true,"text":[{"text":"    let _result = &Ok(42).as_deref();","highlight_start":27,"highlight_end":35}],"label":null,"suggested_replacement":"as_ref","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref` found for type `std::result::Result<{integer}, _>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs:4:27\n   |\nLL |     let _result = &Ok(42).as_deref();\n   |                           ^^^^^^^^ help: there is a method with a similar name: `as_ref`\n   |\n   = note: the method `as_deref` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::Deref`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] 
[01:08:43] ---- [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs stdout ----
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref_mut.rs:4:31
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &mut Ok(42).as_deref_mut();
[01:08:43] -    |                               ^^^^^^^^^^^^ help: did you mean: `as_deref_err`
[01:08:43] +    |                               ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
[01:08:43] 7    = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
[01:08:43] 7    = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::DerefMut`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut/result-as_deref_mut.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref_mut` found for type `std::result::Result<{integer}, _>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs","byte_start":68,"byte_end":80,"line_start":4,"line_end":4,"column_start":31,"column_end":43,"is_primary":true,"text":[{"text":"    let _result = &mut Ok(42).as_deref_mut();","highlight_start":31,"highlight_end":43}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref_mut` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::DerefMut`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs","byte_start":68,"byte_end":80,"line_start":4,"line_end":4,"column_start":31,"column_end":43,"is_primary":true,"text":[{"text":"    let _result = &mut Ok(42).as_deref_mut();","highlight_start":31,"highlight_end":43}],"label":null,"suggested_replacement":"as_deref_err","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref_mut` found for type `std::result::Result<{integer}, _>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs:4:31\n   |\nLL |     let _result = &mut Ok(42).as_deref_mut();\n   |                               ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`\n   |\n   = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::DerefMut`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] 
[01:08:43] ---- [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs stdout ----
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref_mut_err.rs:4:32
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &mut Err(41).as_deref_mut_err();
[01:08:43] -    |                                ^^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_ok`
[01:08:43] +    |                                ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_ok`
[01:08:43] 7    = note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
[01:08:43] 7    = note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::DerefMut`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err/result-as_deref_mut_err.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref_mut_err` found for type `std::result::Result<_, {integer}>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs","byte_start":69,"byte_end":85,"line_start":4,"line_end":4,"column_start":32,"column_end":48,"is_primary":true,"text":[{"text":"    let _result = &mut Err(41).as_deref_mut_err();","highlight_start":32,"highlight_end":48}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::DerefMut`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs","byte_start":69,"byte_end":85,"line_start":4,"line_end":4,"column_start":32,"column_end":48,"is_primary":true,"text":[{"text":"    let _result = &mut Err(41).as_deref_mut_err();","highlight_start":32,"highlight_end":48}],"label":null,"suggested_replacement":"as_deref_mut_ok","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref_mut_err` found for type `std::result::Result<_, {integer}>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs:4:32\n   |\nLL |     let _result = &mut Err(41).as_deref_mut_err();\n   |                                ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_ok`\n   |\n   = note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::DerefMut`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] 
[01:08:43] ---- [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs stdout ----
[01:08:43] 
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref_mut_ok.rs:4:31
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &mut Ok(42).as_deref_mut_ok();
[01:08:43] -    |                               ^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_err`
[01:08:43] +    |                               ^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_err`
[01:08:43] 6    |
[01:08:43] 7    = note: the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::DerefMut`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok/result-as_deref_mut_ok.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref_mut_ok` found for type `std::result::Result<{integer}, _>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs","byte_start":68,"byte_end":83,"line_start":4,"line_end":4,"column_start":31,"column_end":46,"is_primary":true,"text":[{"text":"    let _result = &mut Ok(42).as_deref_mut_ok();","highlight_start":31,"highlight_end":46}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::DerefMut`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs","byte_start":68,"byte_end":83,"line_start":4,"line_end":4,"column_start":31,"column_end":46,"is_primary":true,"text":[{"text":"    let _result = &mut Ok(42).as_deref_mut_ok();","highlight_start":31,"highlight_end":46}],"label":null,"suggested_replacement":"as_deref_mut_err","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref_mut_ok` found for type `std::result::Result<{integer}, _>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs:4:31\n   |\nLL |     let _result = &mut Ok(42).as_deref_mut_ok();\n   |                               ^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_err`\n   |\n   = note: the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::DerefMut`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] ---- [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs stdout ----
[01:08:43] diff of stderr:
[01:08:43] 
[01:08:43] 2   --> $DIR/result-as_deref_ok.rs:4:27
[01:08:43] 2   --> $DIR/result-as_deref_ok.rs:4:27
[01:08:43] 3    |
[01:08:43] 4 LL |     let _result = &Ok(42).as_deref_ok();
[01:08:43] -    |                           ^^^^^^^^^^^ help: did you mean: `as_deref_err`
[01:08:43] +    |                           ^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
[01:08:43] 6    |
[01:08:43] 7    = note: the method `as_deref_ok` exists but the following trait bounds were not satisfied:
[01:08:43] 8            `{integer} : std::ops::Deref`
[01:08:43] 
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] The actual stderr differed from the expected stderr.
[01:08:43] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok/result-as_deref_ok.stderr
[01:08:43] To update references, rerun the tests and pass the `--bless` flag
[01:08:43] To only update this specific test, also pass `--test-args issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs`
[01:08:43] error: 1 errors occurred comparing output.
[01:08:43] status: exit code: 1
[01:08:43] status: exit code: 1
[01:08:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok/auxiliary" "-A" "unused"
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] stderr:
[01:08:43] stderr:
[01:08:43] ------------------------------------------
[01:08:43] {"message":"no method named `as_deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs","byte_start":64,"byte_end":75,"line_start":4,"line_end":4,"column_start":27,"column_end":38,"is_primary":true,"text":[{"text":"    let _result = &Ok(42).as_deref_ok();","highlight_start":27,"highlight_end":38}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `as_deref_ok` exists but the following trait bounds were not satisfied:\n`{integer} : std::ops::Deref`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"there is a method with a similar name","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs","byte_start":64,"byte_end":75,"line_start":4,"line_end":4,"column_start":27,"column_end":38,"is_primary":true,"text":[{"text":"    let _result = &Ok(42).as_deref_ok();","highlight_start":27,"highlight_end":38}],"label":null,"suggested_replacement":"as_deref_err","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `as_deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs:4:27\n   |\nLL |     let _result = &Ok(42).as_deref_ok();\n   |                           ^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`\n   |\n   = note: the method `as_deref_ok` exists but the following trait bounds were not satisfied:\n           `{integer} : std::ops::Deref`\n\n"}
[01:08:43] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:08:43] 
[01:08:43] ------------------------------------------
[01:08:43] 
[01:08:43] 
[01:08:43] thread '[ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3469:9
[01:08:43] 
[01:08:43] 
[01:08:43] failures:
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.rs
[01:08:43]     [ui] ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.rs
[01:08:43] test result: FAILED. 5515 passed; 7 failed; 21 ignored; 0 measured; 0 filtered out
[01:08:43] 
[01:08:43] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:517:22
[01:08:43] 
[01:08:43] 
[01:08:43] 
[01:08:43] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:08:43] 
[01:08:43] 
[01:08:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:08:43] Build completed unsuccessfully in 0:04:24
[01:08:43] Build completed unsuccessfully in 0:04:24
[01:08:43] Makefile:48: recipe for target 'check' failed
[01:08:43] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00e3d19f
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Apr 15 14:55:14 UTC 2019
---
travis_time:end:00231b85:start=1555340115897262991,finish=1555340115902042764,duration=4779773
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:07cb7f86
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:114c6e8e
travis_time:start:114c6e8e
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0279b23b
$ dmesg | grep -i kill

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)

@bors
Copy link
Contributor

bors commented Apr 18, 2019

☔ The latest upstream changes (presumably #58702) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC-zz
Copy link

ping from triage @U007D any updates?

@jonas-schievink
Copy link
Contributor

Triage ping @U007D, this needs a few merge conflicts to be resolved

@Dylan-DPC-zz
Copy link

ping from triage @U007D
Unfortunately we haven't heard from you on this in a while, so I'm closing the PR to keep things tidy. Don't worry though, if you'll have time again in the future please reopen this PR, we'll be happy to review it again!

@jonas-schievink jonas-schievink added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 24, 2019
Centril added a commit to Centril/rust that referenced this pull request Jul 25, 2019
Introduce `as_deref` to Option

This is re-submission for rust-lang#59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC rust-lang#50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
Centril added a commit to Centril/rust that referenced this pull request Jul 26, 2019
Introduce `as_deref` to Option

This is re-submission for rust-lang#59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC rust-lang#50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
Centril added a commit to Centril/rust that referenced this pull request Jul 26, 2019
Introduce `as_deref` to Option

This is re-submission for rust-lang#59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC rust-lang#50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
Centril added a commit to Centril/rust that referenced this pull request Jul 26, 2019
Introduce `as_deref` to Option

This is re-submission for rust-lang#59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC rust-lang#50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants