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

Enable comparing fat pointers #58301

Merged
merged 4 commits into from Feb 14, 2019

Conversation

Projects
None yet
4 participants
@RalfJung
Copy link
Member

RalfJung commented Feb 8, 2019

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk


// Handle operations that support pointer values
if left.is_ptr() || right.is_ptr() || bin_op == mir::BinOp::Offset {
return M::ptr_op(self, bin_op, left, left_layout, right, right_layout);
if left.to_scalar_ptr()?.is_ptr() ||

This comment has been minimized.

@oli-obk

oli-obk Feb 8, 2019

Contributor

isn't this problematic for miri? a fat pointer will cause an error here, will it not?

This comment has been minimized.

@RalfJung

RalfJung Feb 8, 2019

Author Member

to_scalar_ptr returns the first component of a scalar pair.

let n = *self.frame().locals[local].access()?;
let n_layout = self.layout_of(self.tcx.types.usize)?;
let n = self.read_scalar(OpTy { op: n, layout: n_layout })?;
let layout = self.layout_of(self.tcx.types.usize)?;

This comment has been minimized.

@oli-obk

oli-obk Feb 8, 2019

Contributor
Suggested change Beta
let layout = self.layout_of(self.tcx.types.usize)?;
let layout = self.layout_of(self.tcx.types.usize)?;
@RalfJung

This comment has been minimized.

Copy link
Member Author

RalfJung commented Feb 8, 2019

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 8, 2019

📌 Commit fd14129 has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 9, 2019

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

@RalfJung RalfJung force-pushed the RalfJung:fat-ptr-eq branch from fd14129 to a873d18 Feb 9, 2019

@RalfJung

This comment has been minimized.

Copy link
Member Author

RalfJung commented Feb 9, 2019

Rebased.

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 9, 2019

📌 Commit a873d18 has been approved by oli-obk

@RalfJung RalfJung force-pushed the RalfJung:fat-ptr-eq branch from a873d18 to 1a5304a Feb 13, 2019

@RalfJung

This comment has been minimized.

Copy link
Member Author

RalfJung commented Feb 13, 2019

Rebased, to integrate with other Miri-related changes (for easier testing).

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2019

📌 Commit 1a5304a has been approved by oli-obk

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Feb 13, 2019

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:046cf26b:start=1550049436063082300,finish=1550049436987767363,duration=924685063
$ 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:57]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:07:06]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:12:38]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:12:38]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:12:53] error[E0599]: no method named `binary_op_imm` found for type `&mut interpret::eval_context::EvalContext<'a, 'mir, 'tcx, M>` in the current scope
[00:12:53]    --> src/librustc_mir/interpret/intrinsics.rs:129:46
[00:12:53]     |
[00:12:53] 129 |                 let (val, overflowed) = self.binary_op_imm(if is_add {
[00:12:53]     |
[00:12:53]     |
[00:12:53]     = help: did you mean `binary_op`?
[00:12:54] error: aborting due to previous error
[00:12:54] 
[00:12:54] For more information about this error, try `rustc --explain E0599`.
[00:12:54] error: Could not compile `rustc_mir`.
[00:12:54] error: Could not compile `rustc_mir`.
[00:12:54] warning: build failed, waiting for other jobs to finish...
[00:15:45] error: build failed
[00:15:45] 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:15:45] expected success, got: exit code: 101
[00:15:45] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:15:45] Build completed unsuccessfully in 0:11:57
[00:15:45] make: *** [all] Error 1
[00:15:45] Makefile:18: recipe for target 'all' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1d076d7a
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Feb 13 09:33:12 UTC 2019
---
travis_time:end:146153e1:start=1550050393251264169,finish=1550050393257523245,duration=6259076
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2cb8ae64
$ 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:1b4b1cd9
travis_time:start:1b4b1cd9
$ 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:0dfaec06
$ 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)

@RalfJung

This comment has been minimized.

Copy link
Member Author

RalfJung commented Feb 13, 2019

Fixed rebase fallout.

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2019

📌 Commit 22d5e6a has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019

Rollup merge of rust-lang#58301 - RalfJung:fat-ptr-eq, r=oli-obk
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk

Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019

Rollup merge of rust-lang#58301 - RalfJung:fat-ptr-eq, r=oli-obk
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk

bors added a commit that referenced this pull request Feb 14, 2019

Auto merge of #58446 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #57451 (suggestion-diagnostics: as_ref improve snippet)
 - #57856 (Convert old first edition links to current edition one)
 - #57992 (Update the future/task API)
 - #58258 (Reduce the size of `hir::Expr`.)
 - #58267 (Tweak "incompatible match arms" error)
 - #58296 (Hidden suggestion support)
 - #58301 (Enable comparing fat pointers)
 - #58308 (Extract block to insert an intrinsic into its own function)

Failed merges:

r? @ghost

@bors bors merged commit 22d5e6a into rust-lang:master Feb 14, 2019

@RalfJung RalfJung deleted the RalfJung:fat-ptr-eq branch Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment