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

convert custom try macro to ? #60581

Merged
merged 2 commits into from
May 22, 2019
Merged

convert custom try macro to ? #60581

merged 2 commits into from
May 22, 2019

Conversation

hellow554
Copy link
Contributor

resolves #60580

r? @frewsxcv

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 6, 2019
@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:04b28fb9:start=1557147506185357089,finish=1557147593944804622,duration=87759447533
$ 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
---
[00:04:52]    Compiling rustc-demangle v0.1.10
[00:04:57]    Compiling rustc-std-workspace-alloc v1.0.0 (/checkout/src/tools/rustc-std-workspace-alloc)
[00:04:57]    Compiling panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
[00:04:57]    Compiling hashbrown v0.3.0
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:171:13
[00:05:01]     |
[00:05:01] 171 |             cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO))?;
[00:05:01]     |             |
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:174:13
[00:05:01]     |
[00:05:01] 174 |             cvt_r(|| libc::dup2(fd, libc::STDOUT_FILENO))?;
[00:05:01]     |             |
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:177:13
[00:05:01]     |
[00:05:01] 177 |             cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO))?;
[00:05:01]     |             |
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:182:17
[00:05:01]     |
[00:05:01] 182 |                 cvt(libc::setgid(u as gid_t))?;
[00:05:01]     |                 |
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:194:17
[00:05:01]     |
[00:05:01] 194 |                 cvt(libc::setuid(u as uid_t))?;
[00:05:01]     |                 |
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:198:13
[00:05:01]     |
[00:05:01] 198 |             cvt(libc::chdir(cwd.as_ptr()))?;
[00:05:01]     |             |
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:221:17
[00:05:01]     |
[00:05:01] 221 |                 cvt(libc::sigemptyset(&mut set))?;
[00:05:01]     |                 |
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |                 in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:223:13
[00:05:01]     |
[00:05:01] 223 | /             cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
[00:05:01] 224 | |                                          ptr::null_mut()))?;
[00:05:01]     | |                                                           |
[00:05:01]     | |                                                           cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     | |                                                           cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     | |___________________________________________________________in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
[00:05:01] 
[00:05:01] error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `core::ops::Try`)
[00:05:01]    --> src/libstd/sys/unix/process/process_unix.rs:232:13
[00:05:01] 232 |             callback()?;
[00:05:01]     |             ^^^^^^^^^^^
[00:05:01]     |             |
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             cannot use the `?` operator in a function that returns `io::error::Error`
[00:05:01]     |             in this expansion of `desugaring of `?``
[00:05:01]     |
[00:05:01]     = help: the trait `core::ops::Try` is not implemented for `io::error::Error`
[00:05:01]     = note: required by `core::ops::Try::from_error`
[00:05:01] 
---
travis_time:end:08ba5560:start=1557147905190159569,finish=1557147905194530753,duration=4371184
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1c9ccf55
$ 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:14b5dff4
travis_time:start:14b5dff4
$ 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 

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)

@hellow554
Copy link
Contributor Author

Quick question: is the AWS_ACCESS_KEY_ID supposed to be visible? @Centril

@mati865
Copy link
Contributor

mati865 commented May 6, 2019

It might be not worth just now: #37939

@hellow554
Copy link
Contributor Author

hellow554 commented May 6, 2019

@mati865 I'm sadly aware of that issue, but a quick test showed that since 1.32.0 they produce the same asm at least on godbolt

forget that, sorry :)

@Centril
Copy link
Contributor

Centril commented May 6, 2019

Quick question: is the AWS_ACCESS_KEY_ID supposed to be visible? @Centril

@pietroalbini ^--

@pietroalbini
Copy link
Member

Quick question: is the AWS_ACCESS_KEY_ID supposed to be visible?

Yep, the access key id can be public. The actual sensitive part is AWS_SECRET_ACCESS_KEY which is not visible, and also not included in PR builds. We could make AWS_ACCESS_KEY_ID secret, but it would be annoying for us when we need to track down where a key is used.

@hellow554 hellow554 closed this May 10, 2019
@hellow554 hellow554 deleted the fix_60580 branch May 10, 2019 10:29
@hellow554 hellow554 restored the fix_60580 branch May 14, 2019 08:51
@hellow554
Copy link
Contributor Author

Oh boy.. what happened here? AFAIk I haven't closed this PR.

@hellow554 hellow554 reopened this May 14, 2019
@hellow554
Copy link
Contributor Author

Concern by @mati865

#37939 probably should be fixed first

@hellow554
Copy link
Contributor Author

ping @frewsxcv

@hellow554
Copy link
Contributor Author

@jonas-schievink can you reassign this PR please? @frewsxcv seems to be not available.

@Centril
Copy link
Contributor

Centril commented May 21, 2019

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented May 21, 2019

📌 Commit 5458b65 has been approved by alexcrichton

@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 May 21, 2019
Centril added a commit to Centril/rust that referenced this pull request May 21, 2019
Centril added a commit to Centril/rust that referenced this pull request May 21, 2019
Centril added a commit to Centril/rust that referenced this pull request May 21, 2019
Centril added a commit to Centril/rust that referenced this pull request May 22, 2019
bors added a commit that referenced this pull request May 22, 2019
Rollup of 10 pull requests

Successful merges:

 - #59742 (Move `edition` outside the hygiene lock and avoid accessing it)
 - #60581 (convert custom try macro to `?`)
 - #60963 (Update boxed::Box docs on memory layout)
 - #60973 (Avoid symbol interning in `file_metadata`.)
 - #60982 (Do not fail on child without DefId)
 - #60991 (LocalDecl push returns Local len)
 - #60995 (Add stream_to_parser_with_base_dir)
 - #60998 (static_assert: make use of anonymous constants)
 - #61003 (Remove impls for `InternedString`/string equality.)
 - #61006 (adjust deprecation date of mem::uninitialized)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented May 22, 2019

⌛ Testing commit 5458b65 with merge dbfe70d...

@bors bors merged commit 5458b65 into rust-lang:master May 22, 2019
@hellow554 hellow554 deleted the fix_60580 branch May 22, 2019 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

t! macro can be replaced by '?' operator
8 participants