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

error: remove StringError from Debug output #60897

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

seanmonstar
Copy link
Contributor

Seeing StringError("something something") in debug output can cause
someone to think there was an error dealing with Strings, not that the
error type is just a string. So, remove that noise.

For example:

io error: Custom { kind: InvalidData, error: StringError("corrupt data") }

With this change:

io error: Custom { kind: InvalidData, error: "corrupt data" }

@rust-highfive
Copy link
Collaborator

r? @aidanhs

(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 May 17, 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:015255c9:start=1558051979768053862,finish=1558051980565078828,duration=797024966
$ 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:56] tidy error: /checkout/src/libstd/error.rs:314: trailing whitespace
[00:05:01] some tidy checks failed
[00:05:01] 
[00:05:01] 
[00:05:01] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:05:01] 
[00:05:01] 
[00:05:01] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:05:01] Build completed unsuccessfully in 0:01:17
[00:05:01] Build completed unsuccessfully in 0:01:17
[00:05:01] make: *** [tidy] Error 1
[00:05:01] Makefile:67: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:11f5dd36
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri May 17 00:18:13 UTC 2019
---
travis_time:end:068d263d:start=1558052294108971769,finish=1558052294114038516,duration=5066747
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:20543706
$ 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:12c2c73a
travis_time:start:12c2c73a
$ 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:315e9a21
$ 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)

Seeing `StringError("something something")` in debug output can cause
 someone to think there was an error dealing with `String`s, not that the
error type is just a string. So, remove that noise.
@seanmonstar
Copy link
Contributor Author

Ping?

@tesuji
Copy link
Contributor

tesuji commented May 30, 2019

r? @Centril

@Centril
Copy link
Contributor

Centril commented May 30, 2019

r? @sfackler

@rust-highfive rust-highfive assigned sfackler and unassigned aidanhs May 30, 2019
@sfackler
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 30, 2019

📌 Commit d2d89b1 has been approved by sfackler

@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 30, 2019
Centril added a commit to Centril/rust that referenced this pull request May 30, 2019
error: remove StringError from Debug output

Seeing `StringError("something something")` in debug output can cause
 someone to think there was an error dealing with `String`s, not that the
error type is just a string. So, remove that noise.

For example:

```
io error: Custom { kind: InvalidData, error: StringError("corrupt data") }
```

With this change:

```
io error: Custom { kind: InvalidData, error: "corrupt data" }
```
bors added a commit that referenced this pull request May 31, 2019
Rollup of 10 pull requests

Successful merges:

 - #60897 (error: remove StringError from Debug output)
 - #61278 (Miri: give machine the chance to tag all allocations)
 - #61304 (Speed up Azure CI installing Windows dependencies)
 - #61342 (Set ellipsis_inclusive_range_patterns lint to warn)
 - #61344 (Add regression test for const generics ICE)
 - #61359 (Fix links in Deref documentation)
 - #61363 (Stabilize iter_nth_back feature)
 - #61369 (Fixed lifetime misspelling)
 - #61372 (Migrate some books to mdbook version 0.2)
 - #61374 (Explicitly suggest 'type_ascription' feature)

Failed merges:

r? @ghost
pietroalbini added a commit to pietroalbini/rust that referenced this pull request May 31, 2019
error: remove StringError from Debug output

Seeing `StringError("something something")` in debug output can cause
 someone to think there was an error dealing with `String`s, not that the
error type is just a string. So, remove that noise.

For example:

```
io error: Custom { kind: InvalidData, error: StringError("corrupt data") }
```

With this change:

```
io error: Custom { kind: InvalidData, error: "corrupt data" }
```
bors added a commit that referenced this pull request Jun 1, 2019
Rollup of 11 pull requests

Successful merges:

 - #60897 (error: remove StringError from Debug output)
 - #61304 (Speed up Azure CI installing Windows dependencies)
 - #61319 (Swap order of `unsafe async fn` to `async unsafe fn`)
 - #61342 (Set ellipsis_inclusive_range_patterns lint to warn)
 - #61344 (Add regression test for const generics ICE)
 - #61359 (Fix links in Deref documentation)
 - #61363 (Stabilize iter_nth_back feature)
 - #61369 (Fixed lifetime misspelling)
 - #61372 (Migrate some books to mdbook version 0.2)
 - #61374 (Explicitly suggest 'type_ascription' feature)
 - #61382 (Fixed a typo in core::convert::AsMut)

Failed merges:

r? @ghost
@bors bors merged commit d2d89b1 into rust-lang:master Jun 1, 2019
thomwiggers added a commit to thomwiggers/rustls that referenced this pull request Jun 11, 2019
Rust change rust-lang/rust#60897 changed the output, making this test fail on nightly
ctz pushed a commit to rustls/rustls that referenced this pull request Jun 12, 2019
Rust change rust-lang/rust#60897 changed the output, making this test fail on nightly
@LukasKalbertodt
Copy link
Member

I know this PR was already merged, but while we're at it, can we just Display::fmt(&self.0, f) instead so that the string does not get escaped? The string in a StringError is made for humans to read, so I'd say escaping is useless in that case. Any counter arguments? If not, I'd open a PR.

@seanmonstar seanmonstar deleted the patch-4 branch July 24, 2019 21:43
@seanmonstar
Copy link
Contributor Author

I'd typically expect the Debug format to escape strings. I wouldn't want newlines or whatever to be rendered, for instance.

@LukasKalbertodt
Copy link
Member

@seanmonstar I agree in the general case. But in this case we are talking about an error description and not any String debug output. I can still understand your reasoning, but I think in this case escaping isn't doing any good. Suppose the string error contains the output of a GLSL compiler or something: in that case, I want the newlines.

@seanmonstar
Copy link
Contributor Author

Couldn't formatting the error with Display get you the output you want?

@LukasKalbertodt
Copy link
Member

True, but in many real life situations, errors are just formatted as Debug sadly :/

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.

None yet

8 participants