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

fixes rust-lang#52482 #58670

Merged
merged 1 commit into from
Mar 9, 2019

Conversation

saleemjaffer
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(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 Feb 23, 2019
@saleemjaffer
Copy link
Contributor Author

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned eddyb Feb 23, 2019
@saleemjaffer
Copy link
Contributor Author

@oli-obk This is the backtrace I get:

thread 'rustc' panicked at 'bad input type for cast', src/libcore/option.rs:1038:5d                                                                                         
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: <rustc_mir::transform::qualify_consts::IsNotConst as rustc_mir::transform::qualify_consts::Qualif>::in_rvalue
  11: rustc_mir::transform::qualify_consts::Checker::assign
  12: rustc::mir::visit::Visitor::super_statement
  13: <rustc_mir::transform::qualify_consts::QualifyAndPromoteConstants as rustc_mir::transform::MirPass>::run_pass
  14: rustc_mir::transform::run_passes::{{closure}}
  15: rustc_mir::transform::run_passes
  16: rustc_mir::transform::mir_validated
  17: rustc::ty::query::__query_compute::mir_validated
  18: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_validated<'tcx>>::compute
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  21: rustc_mir::borrow_check::mir_borrowck
  22: rustc::ty::query::__query_compute::mir_borrowck
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  26: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::par_body_owners
  27: rustc::util::common::time
  28: <std::thread::local::LocalKey<T>>::with
  29: rustc::ty::context::TyCtxt::create_and_enter
  30: rustc_driver::driver::phase_3_run_analysis_passes
  31: rustc_driver::driver::compile_input
  32: rustc_driver::run_compiler_with_pool
  33: <scoped_tls::ScopedKey<T>>::set
  34: rustc_driver::run_compiler
  35: <scoped_tls::ScopedKey<T>>::set
  36: syntax::with_globals
  37: __rust_maybe_catch_panic
  38: <F as alloc::boxed::FnBox<A>>::call_box
  39: std::sys_common::thread::start_thread
  40: std::sys::unix::thread::Thread::new::thread_start
  41: _pthread_body
  42: _pthread_start
query stack during panic:
#0 [mir_validated] processing `<panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::box_me_up`
#1 [mir_borrowck] processing `<panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::box_me_up`
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.34.0-dev running on x86_64-apple-darwin

note: compiler flags: -Z osx-rpath-install-name -Z force-unstable-if-unmarked -C prefer-dynamic -C opt-level=2 -C incremental -C prefer-dynamic -C debug-assertions=n -C link-args=-Wl,-rpath,@loader_path/../lib --crate-type dylib --crate-type rlib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `std`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/Users/acko034/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-j" "4" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/Users/acko034/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
failed to run: /Users/acko034/rust/build/bootstrap/debug/bootstrap build -i --stage 1 src/libstd
Build completed unsuccessfully in 0:04:24

@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:14ead65a:start=1550918608983031110,finish=1550918696581639428,duration=87598608318
$ 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:05:16]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:06:25]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:11:56]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:11:56]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:11:59] error: unused import: `rustc::ty::cast::CastKind as TyCastKind`
[00:11:59]   --> src/librustc_mir/hair/cx/expr.rs:11:5
[00:11:59] 11 | use rustc::ty::cast::CastKind as TyCastKind;
[00:11:59]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:11:59]    |
[00:11:59]    = note: `-D unused-imports` implied by `-D warnings`

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)

@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:08c98872:start=1550919838047717566,finish=1550919933563927792,duration=95516210226
$ 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:24:40] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:24:40] 
[00:24:40] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[00:24:40] 
[00:24:40] note: compiler flags: -Z force-unstable-if-unmarked -C prefer-dynamic -C opt-level=2 -C prefer-dynamic -C debug-assertions=y -C codegen-units=1 -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type dylib --crate-type rlib
[00:24:40] note: some of the compiler flags provided by cargo are hidden
[00:24:40] 
[00:24:40] error: Could not compile `std`.
[00:24:40] 
---
175796 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc
156160 ./src/llvm-project/clang
155960 ./obj/build/bootstrap/debug/incremental
141180 ./obj/build/bootstrap/debug/incremental/bootstrap-3i6jt5nchoxcn
141176 ./obj/build/bootstrap/debug/incremental/bootstrap-3i6jt5nchoxcn/s-f9r6u681w5-sewl9m-1wm2zcqodn409
138684 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release
135904 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
123516 ./src/llvm-project/llvm/test/CodeGen
108528 ./src/llvm-project/lldb
---
travis_time:end:1d7c2c10:start=1550921423902911470,finish=1550921423907610487,duration=4699017
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1187a373
$ 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:0201d80e
travis_time:start:0201d80e
$ 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:01356a9e
$ 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)

@oli-obk
Copy link
Contributor

oli-obk commented Feb 26, 2019

There was a comment, but it disappeared. Did you resolve your problem?

@bors
Copy link
Contributor

bors commented Feb 27, 2019

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

@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:05973ba0:start=1551242581652494535,finish=1551242702335874422,duration=120683379887
$ 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
---
##############################################################            86.3%
######################################################################## 100.0%
[00:01:24] extracting /checkout/obj/build/cache/2019-02-17/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:24]     Updating crates.io index
[00:01:36] error: the lock file /checkout/Cargo.lock needs to be updated but --locked was passed to prevent this
[00:01:36] Build completed unsuccessfully in 0:00:25
[00:01:36] Makefile:70: recipe for target 'prepare' failed
[00:01:36] make: *** [prepare] Error 1
[00:01:37] Command failed. Attempt 2/5:
[00:01:37] Command failed. Attempt 2/5:
[00:01:37] error: the lock file /checkout/Cargo.lock needs to be updated but --locked was passed to prevent this
[00:01:37] Build completed unsuccessfully in 0:00:00
[00:01:37] Makefile:70: recipe for target 'prepare' failed
[00:01:37] make: *** [prepare] Error 1
[00:01:39] Command failed. Attempt 3/5:
[00:01:39] Command failed. Attempt 3/5:
[00:01:40] error: the lock file /checkout/Cargo.lock needs to be updated but --locked was passed to prevent this
[00:01:40] Build completed unsuccessfully in 0:00:00
[00:01:40] make: *** [prepare] Error 1
[00:01:40] Makefile:70: recipe for target 'prepare' failed
[00:01:43] Command failed. Attempt 4/5:
[00:01:43] Command failed. Attempt 4/5:
[00:01:43] error: the lock file /checkout/Cargo.lock needs to be updated but --locked was passed to prevent this
[00:01:43] Build completed unsuccessfully in 0:00:00
[00:01:43] make: *** [prepare] Error 1
[00:01:43] Makefile:70: recipe for target 'prepare' failed
[00:01:47] Command failed. Attempt 5/5:
[00:01:47] Command failed. Attempt 5/5:
[00:01:48] error: the lock file /checkout/Cargo.lock needs to be updated but --locked was passed to prevent this
[00:01:48] Build completed unsuccessfully in 0:00:00
[00:01:48] Makefile:70: recipe for target 'prepare' failed
[00:01:48] make: *** [prepare] Error 1
[00:01:48] The command has failed after 5 attempts.

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)

@saleemjaffer
Copy link
Contributor Author

@oli-obk Made some changes to fix 1. Can you please have a look at it?

@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:378fa340:start=1551245576874767151,finish=1551245656961692865,duration=80086925714
$ 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:17:59]    Compiling rustc_privacy v0.0.0 (/checkout/src/librustc_privacy)
[00:18:56]    Compiling rustc_codegen_utils v0.0.0 (/checkout/src/librustc_codegen_utils)
[00:18:57]    Compiling rustc_borrowck v0.0.0 (/checkout/src/librustc_borrowck)
[00:18:57]    Compiling rustc_passes v0.0.0 (/checkout/src/librustc_passes)
[00:18:58] error[E0599]: no method named `cast_kinds` found for type `&'a rustc::ty::TypeckTables<'tcx>` in the current scope
[00:18:58]    --> src/librustc_passes/rvalue_promotion.rs:322:28
[00:18:58]     |
[00:18:58] 322 |             match v.tables.cast_kinds().get(from.hir_id) {
[00:18:58] 
[00:18:58] error: aborting due to previous error
[00:18:58] 
[00:18:58] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:07c1a6d1:start=1551246848260647672,finish=1551246848265470789,duration=4823117
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1ca0d52b
$ 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:0a696959
travis_time:start:0a696959
$ 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:263c7d3c
$ 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)

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have still some more fallout to address. I think the failing code just needs to use your new function.

src/librustc/ty/context.rs Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
src/librustc_mir/hair/cx/expr.rs Outdated Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented Feb 27, 2019

@oli-obk The failing code is because of part 2 of #52482. I'll fix that in a bit. Resolved the other issues for part 1 though. Anything more?

@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:00a5e24d:start=1551267111386773922,finish=1551267184468501139,duration=73081727217
$ 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:20:08]    Compiling rustc_borrowck v0.0.0 (/checkout/src/librustc_borrowck)
[00:20:27]    Compiling rustc_passes v0.0.0 (/checkout/src/librustc_passes)
[00:20:28]    Compiling rustc_save_analysis v0.0.0 (/checkout/src/librustc_save_analysis)
[00:20:28]    Compiling rustc_codegen_ssa v0.0.0 (/checkout/src/librustc_codegen_ssa)
[00:20:28] error[E0599]: no method named `cast_kinds` found for type `&'a rustc::ty::TypeckTables<'tcx>` in the current scope
[00:20:28]    --> src/librustc_passes/rvalue_promotion.rs:322:28
[00:20:28]     |
[00:20:28] 322 |             match v.tables.cast_kinds().get(from.hir_id) {
[00:20:28] 
[00:20:29] error: aborting due to previous error
[00:20:29] 
[00:20:29] For more information about this error, try `rustc --explain E0599`.
---
171884 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc
156148 ./src/llvm-project/clang
155940 ./obj/build/bootstrap/debug/incremental
141172 ./obj/build/bootstrap/debug/incremental/bootstrap-3i6jt5nchoxcn
141168 ./obj/build/bootstrap/debug/incremental/bootstrap-3i6jt5nchoxcn/s-f9vmddzezf-1n8wqd1-okq6jwyp562e
132280 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release
129564 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
123516 ./src/llvm-project/llvm/test/CodeGen
108528 ./src/llvm-project/lldb
---
travis_time:end:0e6cbf17:start=1551268503253337975,finish=1551268503258833897,duration=5495922
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1ddfaf74
$ 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:05162d60
travis_time:start:05162d60
$ 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: N

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)

@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:02863380:start=1551327919421466430,finish=1551328006850479333,duration=87429012903
$ 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:18:31]    Compiling rustc_privacy v0.0.0 (/checkout/src/librustc_privacy)
[00:18:31]    Compiling rustc_codegen_utils v0.0.0 (/checkout/src/librustc_codegen_utils)
[00:19:32]    Compiling rustc_passes v0.0.0 (/checkout/src/librustc_passes)
[00:19:32]    Compiling rustc_borrowck v0.0.0 (/checkout/src/librustc_borrowck)
[00:19:33] error[E0599]: no method named `cast_kinds` found for type `&'a rustc::ty::TypeckTables<'tcx>` in the current scope
[00:19:33]    --> src/librustc_passes/rvalue_promotion.rs:322:28
[00:19:33]     |
[00:19:33] 322 |             match v.tables.cast_kinds().get(from.hir_id) {
[00:19:33] 
[00:19:34] error: aborting due to previous error
[00:19:34] 
[00:19:34] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:2c1f1ec0:start=1551329207577928757,finish=1551329207583123096,duration=5194339
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0bf32635
$ 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:0026290b
travis_time:start:0026290b
$ 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: N

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)

@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:00319e6c:start=1551339418924095380,finish=1551339493679741545,duration=74755646165
$ 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:24:37] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:24:37] 
[00:24:37] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[00:24:37] 
[00:24:37] note: compiler flags: -Z force-unstable-if-unmarked -C opt-level=2 -C prefer-dynamic -C debug-assertions=y -C codegen-units=1 -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type lib
[00:24:37] note: some of the compiler flags provided by cargo are hidden
[00:24:37] 
[00:24:37] error: Could not compile `core`.
[00:24:37] 
---
travis_time:end:16209b97:start=1551340981697752827,finish=1551340981704182712,duration=6429885
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:236eef0c
$ 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:04663f5e
travis_time:start:04663f5e
$ 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:3bff05ce
$ 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)

@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented Feb 28, 2019

@oli-obk When trying to fix 2 of #52482 I am getting a panic. This is what i tried:

let expr_promotability = v.check_expr(from);
debug!("Checking const cast(id={})", from.hir_id);
let cast_in = CastTy::from_ty(v.tables.expr_ty(from)).expect("bad input type for cast");
match cast_in {
CastTy::FnPtr | CastTy::Ptr(_) => {
NotPromotable
}
_ => expr_promotability
}

This is the backtrace:

thread 'rustc' panicked at 'bad input type for cast', src/libcore/option.rs:1038:5re                                                                                        
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_expr
  11: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_expr
  12: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_expr
  13: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_block
  14: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_expr
  15: rustc_passes::rvalue_promotion::CheckCrateVisitor::check_nested_body
  16: rustc_passes::rvalue_promotion::rvalue_promotable_map
  17: rustc::ty::query::__query_compute::rvalue_promotable_map
  18: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::rvalue_promotable_map<'tcx>>::compute
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  21: rustc_passes::rvalue_promotion::const_is_rvalue_promotable_to_static
  22: rustc::ty::query::__query_compute::const_is_rvalue_promotable_to_static
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::const_is_rvalue_promotable_to_static<'tcx>>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  26: rustc_passes::rvalue_promotion::check_crate
  27: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::{{closure}}
  28: rustc::util::common::time
  29: <std::thread::local::LocalKey<T>>::with
  30: rustc::ty::context::TyCtxt::create_and_enter
  31: rustc_driver::driver::phase_3_run_analysis_passes
  32: rustc_driver::driver::compile_input
  33: rustc_driver::run_compiler_with_pool
  34: <scoped_tls::ScopedKey<T>>::set
  35: rustc_driver::run_compiler
  36: <scoped_tls::ScopedKey<T>>::set
  37: syntax::with_globals
  38: __rust_maybe_catch_panic
  39: <F as alloc::boxed::FnBox<A>>::call_box
  40: std::sys_common::thread::start_thread
  41: std::sys::unix::thread::Thread::new::thread_start
  42: _pthread_body
  43: _pthread_start
query stack during panic:
#0 [rvalue_promotable_map] checking which parts of `fmt::ArgumentV1::as_usize` are promotable to static
#1 [const_is_rvalue_promotable_to_static] const checking if rvalue is promotable to static `fmt::ArgumentV1::as_usize`
end of query stack

error: internal compiler error: unexpected panic

Spent some time on this but could not figure it out :(.

Specifically, how does this issue occur at compile time? It should be a runtime issue right?

@saleemjaffer saleemjaffer changed the title partially fixes rust-lang#52482 fixes rust-lang#52482 Feb 28, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Mar 1, 2019

The issue is that CastTy returns None for casts from e.g. a function name to a function pointer. We don't really care about these casts here, all we want is to forbid pointer to int and function pointer to int casts. You can create a check like in

let cast_in = CastTy::from_ty(operand_ty).expect("bad input type for cast");
let cast_out = CastTy::from_ty(cast_ty).expect("bad output type for cast");
match (cast_in, cast_out) {
(CastTy::Ptr(_), CastTy::Int(_)) |
(CastTy::FnPtr, CastTy::Int(_)) => {

except that you don't unwrap the CastTy::from result, but match on it. If the result is None, then you can just allow the cast to get promoted.

@saleemjaffer
Copy link
Contributor Author

@oli-obk

hir::ExprKind::Cast(ref from, _) => {
let expr_promotability = v.check_expr(from);
debug!("Checking const cast(id={})", from.hir_id);
let cast_in = CastTy::from_ty(v.tables.expr_ty(from));
let cast_out = CastTy::from_ty(v.tables.expr_ty(e));
match (cast_in, cast_out) {
(Some(CastTy::FnPtr), Some(CastTy::Int(_))) |
(Some(CastTy::Ptr(_)), Some(CastTy::Int(_))) => NotPromotable,
(None, _) => {
//v.tcx.sess.delay_span_bug(e.span, "no kind for cast");
Promotable
},
(_, _) => expr_promotability
}

If I do this I get a panic

thread 'rustc' panicked at 'bad input type for cast', src/libcore/option.rs:1038:5mpiler_builtins
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: <rustc_mir::transform::qualify_consts::IsNotConst as rustc_mir::transform::qualify_consts::Qualif>::in_rvalue
  11: rustc_mir::transform::qualify_consts::Checker::assign
  12: rustc::mir::visit::Visitor::super_statement
  13: <rustc_mir::transform::qualify_consts::QualifyAndPromoteConstants as rustc_mir::transform::MirPass>::run_pass
  14: rustc_mir::transform::run_passes::{{closure}}
  15: rustc_mir::transform::run_passes
  16: rustc_mir::transform::mir_validated
  17: rustc::ty::query::__query_compute::mir_validated
  18: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_validated<'tcx>>::compute
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  21: rustc_borrowck::borrowck::borrowck
  22: rustc::ty::query::__query_compute::borrowck
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::borrowck<'tcx>>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  26: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::par_body_owners
  27: rustc_borrowck::borrowck::check_crate
  28: rustc::util::common::time
  29: <std::thread::local::LocalKey<T>>::with
  30: rustc::ty::context::TyCtxt::create_and_enter
  31: rustc_driver::driver::phase_3_run_analysis_passes
  32: rustc_driver::driver::compile_input
  33: rustc_driver::run_compiler_with_pool
  34: <scoped_tls::ScopedKey<T>>::set
  35: rustc_driver::run_compiler
  36: <scoped_tls::ScopedKey<T>>::set
  37: syntax::with_globals
  38: __rust_maybe_catch_panic
  39: <F as alloc::boxed::FnBox<A>>::call_box
  40: std::sys_common::thread::start_thread
  41: std::sys::unix::thread::Thread::new::thread_start
  42: _pthread_body
  43: _pthread_start
query stack during panic:
#0 [mir_validated] processing `float::cmp::cmp`
#1 [borrowck] processing `float::cmp::cmp`

This panic arises arises in the code snippet you have mentioned(from qualify_consts).

This seems confusing. So I changed the code in qualify_consts to not use the expect. I ended up getting panics from some other file. Am I doing the right thing?

@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:1066a020:start=1551522415120692013,finish=1551522498370369137,duration=83249677124
$ 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:24:11] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:24:11] 
[00:24:11] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[00:24:11] 
[00:24:11] note: compiler flags: -Z external-macro-backtrace -Z force-unstable-if-unmarked -C opt-level=2 -C prefer-dynamic -C panic=abort -C debug-assertions=no -C codegen-units=1 -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type lib
[00:24:11] note: some of the compiler flags provided by cargo are hidden
[00:24:11] 
[00:24:11] error: Could not compile `compiler_builtins`.
[00:24:11] warning: build failed, waiting for other jobs to finish...
---
19956 ./src/llvm-project/llgo/third_party/gofrontend/libgo/go
19596 ./src/tools/rls/rls-analysis
travis_time:end:024f2f28:start=1551523958860694843,finish=1551523959478273171,duration=617578328
travis_fold:end:after_failure.1
travis_folib/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:23fa4226
$ 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)

@oli-obk
Copy link
Contributor

oli-obk commented Mar 2, 2019

I have a general request. If it's not too much trouble, please include a commit message that says something about the content of the commit. It makes tracking the changes easier during review. There's no need to produce a high quality commit message for these commits, just anything related to why or what is changed.

@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented Mar 2, 2019

Totally agree. My plan was to squash all commits to a single commit once everything works fine. I did not anticipate that having meaningful commit messages helps during the review. Will keep this in mind. Sorry if this made the review process harder :(

@saleemjaffer saleemjaffer force-pushed the refactor_typecast_check_kinds branch from b1f3629 to c9edcab Compare March 3, 2019 04:48
@saleemjaffer
Copy link
Contributor Author

@oli-obk Everything seems to be fine now.

@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented Mar 5, 2019

Fixed. The only remaining question is

Also an interesting question is "why are we copying fcx.tables fields manually to self.tables and don't just move the entire tables over?"

I am looking at this. Should we move this discussion to a different PR? Also, I am really eager to get this one merged :P

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two more nits, then this is ready to merge

src/librustc/ty/context.rs Outdated Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2019

Should we move this discussion to a different PR?

Yes that makes sense

@saleemjaffer
Copy link
Contributor Author

Done with the changes. Squash all commits?

@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2019

Squash all commits?

yes

@saleemjaffer saleemjaffer force-pushed the refactor_typecast_check_kinds branch from 4e5bc4f to 9902f8c Compare March 5, 2019 10:44
@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Mar 5, 2019

📌 Commit 9902f8c has been approved by oli-obk

@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 Mar 5, 2019
@saleemjaffer
Copy link
Contributor Author

#58670 (comment)

Shall I go ahead and create a separate PR for this?

@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2019

Shall I go ahead and create a separate PR for this?

I haven't looked at the code in detail, so there might be a good reason the code is written the way it is. I don't think there is, so I'd be glad if you tried to improve it, but please be aware that you might end up doing some work and then realize it can't be done at all.

Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
bors added a commit that referenced this pull request Mar 9, 2019
Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)
 - #59045 (Expose new_sub_parser_from_file)

Failed merges:

r? @ghost
@bors bors merged commit 9902f8c into rust-lang:master Mar 9, 2019
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.

5 participants