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

refactor some FnType stuff to rustc::ty::layout #60693

Merged
merged 4 commits into from
May 16, 2019

Conversation

saleemjaffer
Copy link
Contributor

@saleemjaffer saleemjaffer commented May 10, 2019

Does work in the direction of #56166.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

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

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned matthewjasper May 10, 2019
@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented May 10, 2019

@eddyb Should I make adjust_for_abi an inherent method on FnType in librustc_target/abi/call/mod.rs?

@saleemjaffer saleemjaffer changed the title refactor some FnType stuff to rustc::ty::layout [WIP] refactor some FnType stuff to rustc::ty::layout May 10, 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:05bf0e76:start=1557476120354153745,finish=1557476206910210498,duration=86556056753
$ 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:25:39]    Compiling rustc-demangle v0.1.10
[00:25:42]    Compiling num_cpus v1.8.0
[00:25:44]    Compiling memmap v0.6.2
[00:25:47]    Compiling rustc_llvm v0.0.0 (/checkout/src/librustc_llvm)
[00:25:51] error: unused imports: `Abi as LayoutAbi`, `Size`, `TyLayout`
[00:25:51]   --> src/librustc_codegen_llvm/abi.rs:14:50
[00:25:51]    |
[00:25:51] 14 | use rustc_target::abi::{HasDataLayout, LayoutOf, Size, TyLayout, Abi as LayoutAbi};
[00:25:51]    |
[00:25:51]    = note: `-D unused-imports` implied by `-D warnings`
[00:25:51] 
[00:25:51] error: unused import: `PointerKind`
[00:25:51] error: unused import: `PointerKind`
[00:25:51]   --> src/librustc_codegen_llvm/abi.rs:16:31
[00:25:51]    |
[00:25:51] 16 | use rustc::ty::layout::{self, PointerKind};
[00:25:51]    |                               ^^^^^^^^^^^
[00:25:51] 
[00:25:51] error[E0599]: no function or associated item named `new` found for type `rustc_target::abi::call::FnType<'_, _>` in the current scope
[00:25:51]    --> src/librustc_codegen_llvm/abi.rs:550:17
[00:25:51]     |
[00:25:51] 550 |         FnType::new(&self, sig, extra_args)
[00:25:51]     |                 ^^^ function or associated item not found in `rustc_target::abi::call::FnType<'_, _>`
[00:25:51]     = help: items from traits can only be used if the trait is in scope
[00:25:51]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:25:51]             `use crate::rustc::ty::layout::FnTypeExt;`
[00:25:51] 
[00:25:51] 
[00:25:51] error[E0599]: no function or associated item named `new_vtable` found for type `rustc_target::abi::call::FnType<'_, _>` in the current scope
[00:25:51]    --> src/librustc_codegen_llvm/abi.rs:557:17
[00:25:51]     |
[00:25:51] 557 |         FnType::new_vtable(&self, sig, extra_args)
[00:25:51]     |                 ^^^^^^^^^^ function or associated item not found in `rustc_target::abi::call::FnType<'_, _>`
[00:25:51]     = help: items from traits can only be used if the trait is in scope
[00:25:51]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:25:51]             `use crate::rustc::ty::layout::FnTypeExt;`
[00:25:51] 
[00:25:51] 
[00:25:51] error[E0599]: no function or associated item named `of_instance` found for type `rustc_target::abi::call::FnType<'_, _>` in the current scope
[00:25:51]    --> src/librustc_codegen_llvm/abi.rs:560:17
[00:25:51]     |
[00:25:51] 560 |         FnType::of_instance(&self, instance)
[00:25:51]     |                 ^^^^^^^^^^^ function or associated item not found in `rustc_target::abi::call::FnType<'_, _>`
[00:25:51]     = help: items from traits can only be used if the trait is in scope
[00:25:51]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:25:51]             `use crate::rustc::ty::layout::FnTypeExt;`
[00:25:51] 
[00:25:51] 
[00:25:52] error[E0599]: no function or associated item named `new` found for type `rustc_target::abi::call::FnType<'_, _>` in the current scope
[00:25:52]     |
[00:25:52]     |
[00:25:52] 103 |         let fty = FnType::new(self, sig, &[]);
[00:25:52]     |                           ^^^ function or associated item not found in `rustc_target::abi::call::FnType<'_, _>`
[00:25:52]     = help: items from traits can only be used if the trait is in scope
[00:25:52]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:25:52]             `use crate::rustc::ty::layout::FnTypeExt;`
[00:25:52] 
[00:25:52] 
[00:25:53] error[E0599]: no function or associated item named `new` found for type `rustc_target::abi::call::FnType<'_, _>` in the current scope
[00:25:53]    --> src/librustc_codegen_llvm/type_of.rs:242:53
[00:25:53]     |
[00:25:53] 242 |                     cx.fn_ptr_backend_type(&FnType::new(cx, sig, &[]))
[00:25:53]     |                                                     ^^^ function or associated item not found in `rustc_target::abi::call::FnType<'_, _>`
[00:25:53]     = help: items from traits can only be used if the trait is in scope
[00:25:53]     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
[00:25:53]             `use crate::rustc::ty::layout::FnTypeExt;`
[00:25:53] 
[00:25:53] 
[00:25:53] error: unused import: `FnTypeExt`
[00:25:53]   --> src/librustc_codegen_llvm/declare.rs:16:26
[00:25:53]    |
[00:25:53] 16 | use crate::abi::{FnType, FnTypeExt};
[00:25:53] 
[00:25:53] error: unused import: `FnTypeExt`
[00:25:53]  --> src/librustc_codegen_llvm/type_of.rs:1:26
[00:25:53]   |
[00:25:53]   |
[00:25:53] 1 | use crate::abi::{FnType, FnTypeExt};
[00:25:53] 
[00:25:53] error: aborting due to 9 previous errors
[00:25:53] 
[00:25:53] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:005af32d:start=1557477770108556458,finish=1557477770113085927,duration=4529469
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0ec68c6e
$ 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:06c5e068
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib

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

Why is the diff so big? Did you change line ending or whitespaces (tabs to spaces or vice versa)?

@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented May 10, 2019

Well, this is basically a refactor. I have moved some code from one file to another file. That's why the diff is big. No other reason.

@hellow554
Copy link
Contributor

D'oh. I didn't see that they are two different files. Stupid me, sorry.

src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
@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:0331ef0f:start=1557722405009871566,finish=1557722492595699672,duration=87585828106
$ 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:38:24]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:38:25] error: Could not compile `syntax_pos`.
[00:38:25] 
[00:38:25] Caused by:
[00:38:25]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --edition=2018 --crate-name syntax_pos src/libsyntax_pos/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=d46843837a41024c -C extra-filename=-d46843837a41024c --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-14b5fc1195912829.so --extern cfg_if=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libcfg_if-25f7973b49aaf9c0.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-3b12615f7748fb48.so --extern rustc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps/librustc_macros-ad4581548d76fa48.so --extern scoped_tls=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libscoped_tls-fee9662c14477a45.rlib --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-65c4157205da4e40.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-65c4157205da4e40.rlib --extern unicode_width=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libunicode_width-ec3a485b818c54ba.rlib` (signal: 11, SIGSEGV: invalid memory reference)
[00:39:46] error: build failed
[00:39:46] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:39:46] expected success, got: exit code: 101
[00:39:46] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
---
travis_time:end:12096cec:start=1557724889925403017,finish=1557724889932235852,duration=6832835
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0711a934
$ 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:start:crashlog
obj/cores/core.10397.!checkout!obj!build!x86_64-unknown-linux-gnu!stage1!bin!rustc
[New LWP 10398]
[New LWP 10397]
warning: Could not load shared library symbols for 14 libraries, e.g. /lib/x86_64-linux-gnu/libc.so.6.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
ustc_interface..interface..Compiler$GT$::expansion::h3c4e5511d7b6c0fa () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_interface-d40570b20b31e1f6.so
#16 0x00007fd51837264b in rustc_interface::queries::_$LT$impl$u20$rustc_interface..interface..Compiler$GT$::lower_to_hir::h9dfdda6305d8b8b4 () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_interface-d40570b20b31e1f6.so
#17 0x00007fd518372cc9 in rustc_interface::queries::_$LT$impl$u20$rustc_interface..interface..Compiler$GT$::prepare_outputs::hf555e74849db2284 () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_interface-d40570b20b31e1f6.so
#18 0x00007fd518f52918 in rustc_interface::interface::run_compiler_in_existing_thread_pool::h8c6409a23c1fa7a7 () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc_driver-60a1cd996b8c2db5.so
#19 0x00007fd518fc4366 in std::thread::local::LocalKey$LT$T$GT$::with::ha46e068d86419b52 () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc_driver-60a1cd996b8c2db5.so
#20 0x00007fd518f69765 in scoped_tls::ScopedKey$LT$T$GT$::set::h0f66fae6d7ca732c () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc_driver-60a1cd996b8c2db5.so
#21 0x00007fd518fa15c2 in syntax::with_globals::h25baa84e87b093e6 () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc_driver-60a1cd996b8c2db5.so
#22 0x00007fd518ede115 in std::sys_common::backtrace::__rust_begin_short_backtrace::h06fb4440f32b393c () from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage

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 Any idea about this error?

error: Could not compile `syntax_pos`.

Caused by:
  process didn't exit successfully: `/Users/acko034/rust/build/bootstrap/debug/rustc --edition=2018 --crate-name syntax_pos src/libsyntax_pos/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=4cf44357de86c90a -C extra-filename=-4cf44357de86c90a --out-dir /Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -C incremental=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/incremental -L dependency=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps -L dependency=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/release/deps --extern arena=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libarena-9113d823ad0fac3a.dylib --extern cfg_if=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libcfg_if-817962401f6d45f3.rlib --extern rustc_data_structures=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/librustc_data_structures-535ff1b0c2fb6169.dylib --extern rustc_macros=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/release/deps/librustc_macros-e21c299017fe644b.dylib --extern scoped_tls=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libscoped_tls-4ca8af8a9a53aa58.rlib --extern serialize=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libserialize-c636480d8730f10f.dylib --extern serialize=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libserialize-c636480d8730f10f.rlib --extern unicode_width=/Users/acko034/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/deps/libunicode_width-4198939c88977c7e.rlib` (signal: 10, SIGBUS: access to undefined memory)
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" "" "--manifest-path" "/Users/acko034/rust/src/rustc/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/librustc_codegen_llvm
Build completed unsuccessfully in 0:00:17

@RalfJung
Copy link
Member

RalfJung commented May 13, 2019

fixes #56166.

This doesn't "fix" that issue -- we still have to wire up the new code with Miri. But it works towards that issue. So please reword the original comment to avoid closing #56166.

@saleemjaffer saleemjaffer changed the title [WIP] refactor some FnType stuff to rustc::ty::layout refactor some FnType stuff to rustc::ty::layout May 14, 2019
@eddyb
Copy link
Member

eddyb commented May 14, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 14, 2019

📌 Commit 44eb607 has been approved by eddyb

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2019
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 14, 2019
Centril added a commit to Centril/rust that referenced this pull request May 15, 2019
… r=eddyb

refactor some `FnType` stuff to `rustc::ty::layout`

Does work in the direction of rust-lang#56166.
@bors
Copy link
Contributor

bors commented May 16, 2019

⌛ Testing commit 44eb607 with merge 49d139c...

bors added a commit that referenced this pull request May 16, 2019
refactor some `FnType` stuff to `rustc::ty::layout`

Does work in the direction of #56166.
@bors
Copy link
Contributor

bors commented May 16, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: eddyb
Pushing 49d139c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 16, 2019
@bors bors merged commit 44eb607 into rust-lang:master May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants