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

Move pointee_info_at from rustc_codegen_llvm to rustc_target. #60237

Merged

Conversation

saleemjaffer
Copy link
Contributor

@saleemjaffer saleemjaffer commented Apr 24, 2019

Makes progress towards #56166.

This is a continuation of #57150.

@oli-obk Should I close the older PR?

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

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned matthewjasper Apr 24, 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:16ea328d:start=1556118243011137315,finish=1556118367342870921,duration=124331733606
$ 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:03:45] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:45] tidy error: /checkout/src/librustc_target/abi/mod.rs:961: line longer than 100 chars
[00:03:45] tidy error: /checkout/src/librustc_target/abi/mod.rs:961: trailing whitespace
[00:03:47] some tidy checks failed
[00:03:47] 
[00:03:47] 
[00:03:47] 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:03:47] 
[00:03:47] 
[00:03:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:47] Build completed unsuccessfully in 0:00:42
[00:03:47] Build completed unsuccessfully in 0:00:42
[00:03:47] make: *** [tidy] Error 1
[00:03:47] Makefile:67: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0782dccc
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Apr 24 15:10:04 UTC 2019
---
travis_time:end:0147239e:start=1556118605034713655,finish=1556118605039181324,duration=4467669
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:21d25584
$ 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:02aa37fd
travis_time:start:02aa37fd
$ 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:0754baa6
$ 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

Creating a new PR as I do not have push rights to @wildarch 's repo

@oli-obk
Copy link
Contributor

oli-obk commented Apr 24, 2019 via email

@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented Apr 24, 2019

@oli-obk Yeah, I have not yet fixed any issues. I just rebased on top of master.

Will start fixing them.

@saleemjaffer saleemjaffer changed the title Issue 56166 miri fntype arg passing [WIP] Issue 56166 miri fntype arg passing Apr 24, 2019
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:095a77c0:start=1556196840215455735,finish=1556196928156953855,duration=87941498120
$ 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:06:27]    Compiling rustc_macros v0.1.0 (/checkout/src/librustc_macros)
[00:06:34]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:06:38]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:07:40]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:07:51] error[E0207]: the type parameter `E` is not constrained by the impl trait, self type, or predicates
[00:07:51]      |
[00:07:51]      |
[00:07:51] 1614 | impl<'a, 'tcx, C, E> TyLayoutMethods<'tcx, C> for Ty<'tcx>
[00:07:51]      |                   ^ unconstrained type parameter
[00:07:51] error: aborting due to previous error
[00:07:51] 
[00:07:51] For more information about this error, try `rustc --explain E0207`.
[00:07:51] error: Could not compile `rustc`.
---
travis_time:end:1902fb06:start=1556197423866236068,finish=1556197423871700808,duration=5464740
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:16f3020d
$ 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:3dae5ba6
travis_time:start:3dae5ba6
$ 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:0eabe6f8
$ 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 saleemjaffer force-pushed the issue-56166-miri-fntype-arg-passing branch from 76fa80d to f2935a3 Compare April 26, 2019 07:50
@saleemjaffer
Copy link
Contributor Author

@oli-obk This is the fallout:

error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
    --> src/librustc/ty/layout.rs:1245:30
     |
1245 |                 match layout.field(self, i) {
     |                              ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
     |
     = help: the following implementations were found:
               <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
     = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`

error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
    --> src/librustc/ty/layout.rs:1312:51
     |
1312 |                                            layout.for_variant(self, i))
     |                                                   ^^^^^^^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
     |
     = help: the following implementations were found:
               <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
     = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`

error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
    --> src/librustc/ty/layout.rs:1998:47
     |
1998 |                 return self.find_niche(layout.field(self, 0)?);
     |                                               ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
     |
     = help: the following implementations were found:
               <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
     = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`

error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
    --> src/librustc/ty/layout.rs:2006:57
     |
2006 |             if let Some(mut c) = self.find_niche(layout.field(self, i)?)? {
     |                                                         ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
     |
     = help: the following implementations were found:
               <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
     = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`

@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:132611ec:start=1556532561205224736,finish=1556532645711079738,duration=84505855002
$ 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:06:32]    Compiling rustc_macros v0.1.0 (/checkout/src/librustc_macros)
[00:06:44]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:06:48]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:07:55]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:08:28] error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
[00:08:28]      |
[00:08:28]      |
[00:08:28] 1246 |                 match layout.field(self, i) {
[00:08:28]      |                              ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
[00:08:28]      = help: the following implementations were found:
[00:08:28]      = help: the following implementations were found:
[00:08:28]                <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
[00:08:28]      = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`
[00:08:28] 
[00:08:28] error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
[00:08:28]      |
[00:08:28]      |
[00:08:28] 1313 |                                            layout.for_variant(self, i))
[00:08:28]      |                                                   ^^^^^^^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
[00:08:28]      = help: the following implementations were found:
[00:08:28]      = help: the following implementations were found:
[00:08:28]                <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
[00:08:28]      = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`
[00:08:28] 
[00:08:28] error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
[00:08:28]      |
[00:08:28]      |
[00:08:28] 1999 |                 return self.find_niche(layout.field(self, 0)?);
[00:08:28]      |                                               ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
[00:08:28]      = help: the following implementations were found:
[00:08:28]      = help: the following implementations were found:
[00:08:28]                <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
[00:08:28]      = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`
[00:08:28] 
[00:08:28] error[E0277]: the trait bound `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>: ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not satisfied
[00:08:28]      |
[00:08:28]      |
[00:08:28] 2007 |             if let Some(mut c) = self.find_niche(layout.field(self, i)?)? {
[00:08:28]      |                                                         ^^^^^ the trait `ty::layout::MaybeResult<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, !>` is not implemented for `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, ty::layout::LayoutError<'_>>`
[00:08:28]      = help: the following implementations were found:
[00:08:28]      = help: the following implementations were found:
[00:08:28]                <std::result::Result<T, E> as ty::layout::MaybeResult<T, E>>
[00:08:28]      = note: required because of the requirements on the impl of `rustc_target::abi::TyLayoutMethods<'_, ty::layout::LayoutCx<'_, ty::context::TyCtxt<'_, 'tcx, 'tcx>>>` for `&ty::TyS<'_>`
[00:08:32] error: aborting due to 4 previous errors
[00:08:32] 
[00:08:32] For more information about this error, try `rustc --explain E0277`.
[00:08:32] error: Could not compile `rustc`.
---
travis_time:end:0134fd90:start=1556533168379644068,finish=1556533168383790814,duration=4146746
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0b8940e0
$ 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:3cbd0073
travis_time:start:3cbd0073
$ 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-i

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)

@@ -1490,27 +1492,40 @@ impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> {
}
}

pub trait MaybeResult<T> {
pub trait MaybeResult<T, E>: From<Result<T, E>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

So... apparently doing it this way is blocked on lazy normalization: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e6956340922d4df0087baa36b02b1ce3

Let's go with your original suggestion and add a from(r: Result<T, Self::item>) method to MaybeResult

@saleemjaffer saleemjaffer force-pushed the issue-56166-miri-fntype-arg-passing branch from 5298959 to 738f9c3 Compare April 30, 2019 06:50
@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:1f330945:start=1556607076633602957,finish=1556607162008355166,duration=85374752209
$ 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:07:12]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:07:42] error[E0308]: mismatched types
[00:07:42]     --> src/librustc/ty/layout.rs:1634:21
[00:07:42]      |
[00:07:42] 1634 | /                     cx.layout_of(this.ty).to_result().map(|layout| {
[00:07:42] 1635 | |                         assert_eq!(layout.variants, Variants::Single { index });layout
[00:07:42]      | |______________________^ expected enum `std::result::Result`, found struct `rustc_target::abi::TyLayout`
[00:07:42]      |
[00:07:42]      |
[00:07:42]      = note: expected type `std::result::Result<std::result::Result<rustc_target::abi::TyLayout<'tcx, &'tcx ty::TyS<'tcx>>, !>, !>`
[00:07:42]                 found type `std::result::Result<rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>, <<C as rustc_target::abi::LayoutOf>::TyLayout as ty::layout::MaybeResult<rustc_target::abi::TyLayout<'tcx, &'tcx ty::TyS<'tcx>>>>::Item>`
[00:07:46] error: aborting due to previous error
[00:07:46] 
[00:07:46] For more information about this error, try `rustc --explain E0308`.
Tue, 30 Apr 2019 07:00:37 GMT
---
travis_time:end:068ed6c0:start=1556607638200813248,finish=1556607638205254819,duration=4441571
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:08f903f7
$ 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:28dc8c50
travis_time:start:28dc8c50
$ 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-i3

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 saleemjaffer force-pushed the issue-56166-miri-fntype-arg-passing branch from 738f9c3 to bafa063 Compare May 2, 2019 08:40
@@ -1694,10 +1686,11 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
} else {
tcx.mk_mut_ref(tcx.types.re_static, nil)
};
return cx.layout_of(ptr_ty).map_same(|mut ptr_layout| {
let ptr_layout: C::TyLayout = cx.layout_of(ptr_ty);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oli-obk I get this error here:

error[E0308]: mismatched types==============================>        ] 118/137: rustc                                                                                       
    --> src/librustc/ty/layout.rs:1692:32
     |
1656 |     fn field(this: TyLayout<'tcx>, cx: &C, i: usize) -> C::TyLayout {
     |                                                         ----------- expected `<C as rustc_target::abi::LayoutOf>::TyLayout` because of return type
...
1692 |                         return ptr_layout;
     |                                ^^^^^^^^^^ expected associated type, found struct `rustc_target::abi::TyLayout`
     |
     = note: expected type `<C as rustc_target::abi::LayoutOf>::TyLayout`
                found type `rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>`

Why is to_result changing the type here?

Copy link
Contributor

Choose a reason for hiding this comment

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

The error is sadly not telling you what the actual issue is. What you want here is to convert the result back to a MaybeResult after mapping it

return MaybeResult::from(cx.layout_of(ptr_ty).to_result().map(|mut ptr_layout| {
    ptr_layout.ty = this.ty;
    ptr_layout 
}));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oli-obk Should this be raised as an issue? :o

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we used to have some more aggressive suggestions around that. If you can create a small example, then a diagnostics issue would be great, yes.

@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:0b19f870:start=1556786471469241895,finish=1556786562520184786,duration=91050942891
$ 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:07:48]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:08:19] error[E0308]: mismatched types
[00:08:19]     --> src/librustc/ty/layout.rs:1693:32
[00:08:19]      |
[00:08:19] 1657 |     fn field(this: TyLayout<'tcx>, cx: &C, i: usize) -> C::TyLayout {
[00:08:19]      |                                                         ----------- expected `<C as rustc_target::abi::LayoutOf>::TyLayout` because of return type
[00:08:19] ...
[00:08:19] 1693 |                         return ptr_layout;
[00:08:19]      |                                ^^^^^^^^^^ expected associated type, found struct `rustc_target::abi::TyLayout`
[00:08:19]      |
[00:08:19]      = note: expected type `<C as rustc_target::abi::LayoutOf>::TyLayout`
[00:08:19]                 found type `rustc_target::abi::TyLayout<'_, &ty::TyS<'_>>`
[00:08:23] error: aborting due to previous error
[00:08:23] 
[00:08:23] For more information about this error, try `rustc --explain E0308`.
[00:08:23] error: Could not compile `rustc`.
---
travis_time:end:204b235a:start=1556787076116641990,finish=1556787076121473966,duration=4831976
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:04ec3c8a
$ 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:1577ead9
travis_time:start:1577ead9
$ 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:082fdfca
$ 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)

src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
@@ -1694,10 +1686,11 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
} else {
tcx.mk_mut_ref(tcx.types.re_static, nil)
};
return cx.layout_of(ptr_ty).map_same(|mut ptr_layout| {
let ptr_layout: C::TyLayout = cx.layout_of(ptr_ty);
Copy link
Contributor

Choose a reason for hiding this comment

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

The error is sadly not telling you what the actual issue is. What you want here is to convert the result back to a MaybeResult after mapping it

return MaybeResult::from(cx.layout_of(ptr_ty).to_result().map(|mut ptr_layout| {
    ptr_layout.ty = this.ty;
    ptr_layout 
}));

@saleemjaffer saleemjaffer force-pushed the issue-56166-miri-fntype-arg-passing branch from bafa063 to e983574 Compare May 2, 2019 12:41
@saleemjaffer
Copy link
Contributor Author

saleemjaffer commented May 3, 2019

#57150 (comment)

@oli-obk @eddyb I have added the is_freeze. Not sure if this is right as you guys were mentioning about not passing ParamEnv separately, but I am still passing ParamEnv as a parameter.

cx: &C,
param_env: Self::ParamEnv,
)-> bool {
this.ty.is_freeze(cx.tcx(), param_env, DUMMY_SP)
Copy link
Contributor

Choose a reason for hiding this comment

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

@eddyb what do you think about making is_freeze take TyCtxtAt and make HasTyCtxt::tcx return a TyCtxtAt?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should bother, for now.
If you want, you can just make it not a method of Ty.

fn is_freeze(
this: TyLayout<'a, Self>,
cx: &C,
param_env: Self::ParamEnv,
Copy link
Member

Choose a reason for hiding this comment

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

You can remove this, it's always part of cx, because all implementors need it in order to implement layout_of anyway!

@saleemjaffer saleemjaffer force-pushed the issue-56166-miri-fntype-arg-passing branch from 11d3504 to 94a4892 Compare May 4, 2019 10:57
@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:002c507c:start=1556967571444332310,finish=1556967573515335533,duration=2071003223
$ 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:44] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:45] tidy error: /checkout/src/librustc_codegen_llvm/context.rs:18: line longer than 100 chars
[00:04:49] some tidy checks failed
[00:04:49] 
[00:04:49] 
[00:04:49] 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:04:49] 
[00:04:49] 
[00:04:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:49] Build completed unsuccessfully in 0:01:08
[00:04:49] Build completed unsuccessfully in 0:01:08
[00:04:49] make: *** [tidy] Error 1
[00:04:49] Makefile:67: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:06400260
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sat May  4 11:04:33 UTC 2019
---
travis_time:end:31c9fee1:start=1556967874777764550,finish=1556967874782790410,duration=5025860
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0e75de70
$ 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:23d7e1f0
travis_time:start:23d7e1f0
$ 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:09734417
$ 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)

src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
src/librustc/ty/layout.rs Outdated Show resolved Hide resolved
ptr_layout
});
return MaybeResult::from(
cx.layout_of(ptr_ty).to_result().map(|mut ptr_layout| {
Copy link
Member

Choose a reason for hiding this comment

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

Even with this much indentation, rustfmt will keep return MaybeResult::from(cx.layout_of(ptr_ty).to_result().map( on one line and just have the closure expression indented by itself, e.g.:

                    return MaybeResult::from(cx.layout_of(ptr_ty).to_result().map(
                        |mut ptr_layout| {
                            ptr_layout.ty = this.ty;
                            ptr_layout
                        },
                    ));

Copy link
Contributor Author

@saleemjaffer saleemjaffer May 5, 2019

Choose a reason for hiding this comment

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

@eddyb actually rustfmt does this

    return MaybeResult::from(cx.layout_of(ptr_ty).to_result().map(|mut ptr_layout| {
        ptr_layout.ty = this.ty;
        ptr_layout
    }));

Copy link
Member

Choose a reason for hiding this comment

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

Only if you have less indentation than you actually do here.

@@ -969,10 +964,6 @@ impl<'a, Ty> TyLayout<'a, Ty> {
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
Ty::pointee_info_at(self, cx, offset, param_env)
}
pub fn is_freeze<C>(self, cx: &C, param_env: Ty::ParamEnv) -> bool
Copy link
Member

Choose a reason for hiding this comment

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

Huh, was this actually not needed? Only pointee_info_at?
Or was my original plan to implement pointee_info_at in rustc_target instead?
I guess I had forgotten about the special-cases in it? A bit surprising, still, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eddyb You did suggest this first, and that's what i tried to do, but then you said this

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to the param_env argument, not is_freeze.
But I think in your first link, I did forget that you can't implement pointee_info_at in rustc_target anyway.

@eddyb eddyb changed the title [WIP] Issue 56166 miri fntype arg passing Move pointee_info_at from rustc_codegen_llvm to rustc_target. May 5, 2019
@eddyb
Copy link
Member

eddyb commented May 5, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 5, 2019

📌 Commit 968eb7f has been approved by eddyb

@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 5, 2019
@bors
Copy link
Contributor

bors commented May 5, 2019

⌛ Testing commit 968eb7f with merge d628c2e...

bors added a commit that referenced this pull request May 5, 2019
…ng, r=eddyb

Move pointee_info_at from rustc_codegen_llvm to rustc_target.

Makes progress towards #56166.

This is a continuation of #57150.

@oli-obk Should I close the older PR?
@bors
Copy link
Contributor

bors commented May 5, 2019

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 5, 2019
@bors bors merged commit 968eb7f into rust-lang:master May 5, 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.

7 participants