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

Avoid panic when matching function call #55742

Merged
merged 1 commit into from
Nov 9, 2018
Merged

Conversation

F001
Copy link
Contributor

@F001 F001 commented Nov 7, 2018

Fix #55718

This bug is introduced by #53751. The original code checked Def::AssociatedConst(..) | Def::Method(..) before pat_ty.no_bound_vars().expect("expected fn type"). But somehow I exchanged the sequence carelessly. Sorry about that.

r? @petrochenkov

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

The job x86_64-gnu-llvm-5.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:0825434e:start=1541584237071019649,finish=1541584238040638110,duration=969618461
$ 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-5.0
---
[00:50:11] diff of stderr:
[00:50:11] 
[00:50:11] 5    |         ^^^^^^^^^^^^^^^^ not a tuple variant or struct
[00:50:11] 6 
[00:50:11] 7 error[E0164]: expected tuple struct/variant, found method `<Path>::new`
[00:50:11] -   --> $DIR/match-fn-call.rs:7:9
[00:50:11] +   --> $DIR/match-fn-call.rs:8:9
[00:50:11] 9    |
[00:50:11] 10 LL |         Path::new("bar"ch foo {\n        Foo::B(i) => i, // error E0164\n    }\n}\n```\n\nTry using `{}` instead:\n\n```\nenum Foo { B { i: u32 } }\n\nfn bar(foo: Foo) -> u32 {\n    match foo {\n        Foo::B{i} => i,\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/match/match-fn-call.rs","byte_start":92,"byte_end":108,"line_start":6,"line_end":6,"column_start":9,"column_end":25,"is_primary":true,"text":[{"text":"        Path::new(\"foo\") => println!(\"foo\"),","highlight_start":9,"highlight_end":25}],"label":"not a tuple variant or struct","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0164]: expected tuple struct/variant, found method `<Path>::new`\n  --> /checkout/src/test/ui/match/match-fn-call.rs:6:9\n   |\nLL |         Path::new(\"foo\") => println!(\"foo\"),\n   |         ^^^^^^^^^^^^^^^^ not a tuple variant or struct\n\n"}
[00:50:11] {"message":"expected tuple struct/variant, found method `<Path>::new`","code":{"code":"E0164","explanation":"\nThis error means that an attempt was made to match a struct type enum\nvariant as a non-struct type:\n\n```compile_fail,E0164\nenum Foo { B { i: u32 } }\n\nfn bar(foo: Foo) -> u32 {\n    match foo {\n        Foo::B(i) => i, // error E0164\n    }\n}\n```\n\nTry using `{}` instead:\n\n```\nenum Foo { B { i: u32 } }\n\nfn bar(foo: Foo) -> u32 {\n    match foo {\n        Foo::B{i} => i,\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/match/match-fn-call.rs","byte_start":186,"byte_end":202,"line_start":8,"line_end":8,"column_start":9,"column_end":25,"is_primary":true,"text":[{"text":"        Path::new(\"bar\") => println!(\"bar\"),","highlight_start":9,"highlight_end":25}],"label":"not a tuple variant or struct","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0164]: expected tuple struct/variant, found method `<Path>::new`\n  --> /checkout/src/test/ui/match/match-fn-call.rs:8:9\n   |\nLL |         Path::new(\"bar\") => println!(\"bar\"),\n   |         ^^^^^^^^^^^^^^^^ not a tuple variant or struct\n\n"}
[00:50:11] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:50:11] {"message":"For more information about this error, try `rustc --explain E0164`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0164`.\n"}
[00:50:11] ------------------------------------------
[00:50:11] 
[00:50:11] thread '[ui] ui/match/match-fn-call.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[00:50:11] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:50:11] 
[00:50:11] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:50:11] 
[00:50:11] 
[00:50:11] 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-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--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" "5.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"
[00:50:11] 
[00:50:11] 
[00:50:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:11] Build completed unsuccessfully in 0:03:36
[00:50:11] Build completed unsuccessfully in 0:03:36
[00:50:11] Makefile:58: recipe for target 'check' failed
[00:50:11] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0ae85410
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date4193592 .
---
travis_time:end:1e838182:start=1541587260227360118,finish=1541587260232668775,duration=5308657
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:213653b4
$ 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:2740f640
travis_time:start:2740f640
$ 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:1cad264c
$ 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)

@petrochenkov
Copy link
Contributor

@bors r+
Thanks!

@bors
Copy link
Contributor

bors commented Nov 7, 2018

📌 Commit f63c2f8 has been approved by petrochenkov

@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 Nov 7, 2018
@Mark-Simulacrum
Copy link
Member

@bors rollup

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Nov 9, 2018
Avoid panic when matching function call

Fix rust-lang#55718

This bug is introduced by rust-lang#53751. The original code checked `Def::AssociatedConst(..) | Def::Method(..)` before `pat_ty.no_bound_vars().expect("expected fn type")`. But somehow I exchanged the sequence carelessly. Sorry about that.

r? @petrochenkov
bors added a commit that referenced this pull request Nov 9, 2018
Rollup of 17 pull requests

Successful merges:

 - #55576 (Clarify error message for -C opt-level)
 - #55633 (Support memcpy/memmove with differing src/dst alignment)
 - #55638 (Fix ICE in msg_span_from_free_region on ReEmpty)
 - #55659 (rustc: Delete grouping logic from the musl target)
 - #55719 (Sidestep link error from rustfix'ed code by using a *defined* static.)
 - #55736 (Elide anon lifetimes in conflicting impl note)
 - #55739 (Consume optimization fuel from the MIR inliner)
 - #55742 (Avoid panic when matching function call)
 - #55753 (borrow_set: remove a helper function and a clone it uses)
 - #55755 (Improve creation of 3 IndexVecs)
 - #55758 ([regression - rust2018]: unused_mut lint false positives on nightly)
 - #55760 (Remove intermediate font specs)
 - #55761 (mir: remove a hacky recursive helper function)
 - #55774 (wasm32-unknown-emscripten expects the rust_eh_personality symbol)
 - #55777 (Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.)
 - #55783 (Deprecate mpsc channel selection)
 - #55788 (rustc: Request ansi colors if stderr isn't a tty)

Failed merges:

r? @ghost
@bors bors merged commit f63c2f8 into rust-lang:master Nov 9, 2018
@oli-obk oli-obk added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 26, 2018
@nikomatsakis
Copy link
Contributor

Approving for beta because (a) small patch and (b) tight timeline for beta.

cc @rust-lang/community

@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 26, 2018
@nikomatsakis nikomatsakis mentioned this pull request Nov 26, 2018
2 tasks
@pietroalbini
Copy link
Member

Did you mean to cc @rust-lang/compiler?

@pietroalbini pietroalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 26, 2018
bors added a commit that referenced this pull request Nov 26, 2018
beta backports

Backported PRs:

- [x]  Avoid panic when matching function call #55742
- [x]  [beta] resolve: Implement edition hygiene for imports and absolute paths #56053

r? @ghost
cc @rust-lang/release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

9 participants