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

MIR sanity check: validate types on assignment #72796

Merged
merged 12 commits into from
Jun 28, 2020

Conversation

RalfJung
Copy link
Member

This expands the MIR validation added by @jonas-schievink in #72093 to also check that on an assignment, the types of both sides match.

Cc @eddyb @oli-obk

@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 30, 2020
@RalfJung
Copy link
Member Author

RalfJung commented May 30, 2020

However, something is wrong: this ICEs.

error: internal compiler error: broken MIR in DefId(0:39 ~ rustc_demangle[8d08]::v0[0]::{{impl}}[1]::try_small_punycode_decode[0]) (end of phase Optimized): encountered `Assign` statement with incompatible types:
left-hand side has type: [char; 128]
right-hand side has type: [char; _]
  --> /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.16/src/v0.rs:98:23
   |
98 |         let mut out = ['\0'; SMALL_PUNYCODE_LEN];
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks like something with consts does not work right here?

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@RalfJung
Copy link
Member Author

Cc @lcnr (as const generics seem to be involved)

@lcnr
Copy link
Contributor

lcnr commented May 31, 2020

Does this happen while building mir, if so, we probably didn't normalize the rhs yet.
Don't have a lot of time rn, but you may try to either use tcx.const_eval_resolve if either rhs or lhs is unevaluated or add another ConstEquate obligation here 🤔

edit: you can also try running this with --verbose, which prints the actual debug repr instead of _.

@RalfJung
Copy link
Member Author

I am seeing this after all optimizations have run, so it's not during MIR building.

@eddyb
Copy link
Member

eddyb commented May 31, 2020

@RalfJung You don't see this in miri because the way you do monomorphization also normalizes.

The MIR type-checker that runs as part of borrow-checking has to normalize types in a few places in order to work, but what it does involves capturing all of the constraints on lifetimes resulting from normalizing and equating types.

I guess you can probably just use tcx.normalize_erasing_regions(...) (you need to erase regions anyway). Oh, right, you have that custom folder, let me leave a comment there instead.

// Normalize both of them away.
// FIXME: Share this code with `interpret/eval_context.rs`.
let normalize = |ty: Ty<'tcx>| {
ty.fold_with(&mut BottomUpFolder {
Copy link
Member

Choose a reason for hiding this comment

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

Btw you can make this cheaper by implementing TypeFolder instead, which is only a few lines longer, and doing early returns in the type-visiting method based on flags (which are precomputed so they're basically free) that tell you if there are any erasable lifetimes or normalizable consts (for example, you could choose more things to do/look for).

Although you still have that reference "normalization" aspect, hmpf.

Copy link
Member Author

Choose a reason for hiding this comment

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

I understood maybe half of that so I think I'll leave this to someone else...

@RalfJung RalfJung changed the title WIP: MIR sanity check: validate types on assignment MIR sanity check: validate types on assignment May 31, 2020
@RalfJung
Copy link
Member Author

RalfJung commented May 31, 2020

Now we get a different failure:

error: internal compiler error: broken MIR in DefId(0:493 ~ rustc_expand[1d72]::base[0]::{{impl}}[9]::new[0]) (end of phase Optimized): encountered `Assign` statement with incompatible types:
left-hand side has type: [closure@src/librustc_expand/base.rs:805:18: 805:69]
right-hand side has type: [closure@src/librustc_expand/base.rs:805:18: 805:69]
   --> src/librustc_expand/base.rs:805:18
    |
805 |             .map(|features| features.collect::<Vec<Symbol>>().into());
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The confusing part is that this looks like it's the same type on both sides.^^

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, 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.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 11'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/bd7dcac1-d565-4207-8d23-6e215c9af92c.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72796/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72796/merge:refs/remotes/pull/72796/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
   Compiling rustc_ast_passes v0.0.0 (/checkout/src/librustc_ast_passes)
   Compiling rustc_expand v0.0.0 (/checkout/src/librustc_expand)
error: internal compiler error: broken MIR in DefId(0:493 ~ rustc_expand[1d72]::base[0]::{{impl}}[9]::new[0]) (end of phase Optimized): encountered `Assign` statement with incompatible types:
left-hand side has type: [closure@src/librustc_expand/base.rs:805:18: 805:69]
right-hand side has type: [closure@src/librustc_expand/base.rs:805:18: 805:69]
   --> src/librustc_expand/base.rs:805:18
    |
805 |             .map(|features| features.collect::<Vec<Symbol>>().into());


thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:366:17

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: ***/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.45.0-nightly (f81b2f8b6 2020-05-31) running on x86_64-unknown-linux-gnu


note: compiler flags: -Z macro-backtrace -Z unstable-options -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -C link-args=-Wl,-rpath,$ORIGIN/../lib -C prefer-dynamic -C llvm-args=-import-instr-limit=10 -C debug-assertions=n --crate-type lib
note: some of the compiler flags provided by cargo are hidden

error: could not compile `rustc_expand`.

---
  local time: Sun May 31 13:42:58 UTC 2020
  network time: Sun, 31 May 2020 13:42:59 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72796/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72796/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3613) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@matthewjasper
Copy link
Contributor

matthewjasper commented May 31, 2020

running with -Z verbose -Z span-free-formats should show all of the substs for the closure.

@RalfJung
Copy link
Member Author

RalfJung commented Jun 1, 2020

@matthewjasper unfortunately, bootstrap fails to even build with those flags...

RUSTFLAGS="-Zverbose -Z span-free-formats" ./x.py build --stage 1 src/librustc_middle

gives

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.10zr3dovsc3k7qof.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.1klxh0psn8ai248.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.1ndvq33fni5b2mze.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.1o158abaida0ly3s.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.204oa9x8qiwqzjbt.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.258zwkalod298faj.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.35m0ppugyfw98kl8.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.3bqkd1c0gnw4mlpv.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.3y1z6ddqoke57hhz.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.4nhn2ijlmd3h6k6x.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.b39awh7cziau9xa.rcgu.o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.m1lqlk456o85uiv.rcgu.o" "-o" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/bootstrap-1a4fde2dce462fdf.tuotebtedb0wgd8.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps" "-L" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libbootstrap-1f25c1b05a63006f.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libcmake-b371d0c0e8028669.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libopener-5f86d9b2496828ba.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libnum_cpus-02f9d03aeacf562e.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libtoml-a49da21858403f0e.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libserde_json-30a9685ccb57b414.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libryu-094e416b0942ccd2.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libitoa-68e7edcfcb2b8af2.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libcc-0b79ffa90b10f90d.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libignore-1b9a24dc82d81e59.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libwalkdir-f32985706856b358.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libsame_file-c3e8bb93ae0ac68d.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libglobset-18a8d9981db22600.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libregex-4dc0f5d6d45fe2de.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libthread_local-a31887d10a9af727.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libregex_syntax-849cb126a939c247.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/liblog-284331e7fe4d65f8.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libfnv-450fc55cb5500796.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libbstr-b26a302be18e0f65.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libaho_corasick-7c52168583e8db63.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libmemchr-3c428c8e89af1d0f.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libcrossbeam_channel-64a6cf33b4f10d8f.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libcrossbeam_utils-650132fbe772b3f5.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libgetopts-c882dac192939cca.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libunicode_width-5da8c79f2fe59832.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libtime-5be05113adc34c3a.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libserde-0ecf01ebd3543ba6.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/liblazy_static-abe7f1a16a4c5390.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libfiletime-19c9e79c43601bb8.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/liblibc-8286724a7ed2e1e9.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libcfg_if-fe6c3e9edf294d39.rlib" "/home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libbuild_helper-f19e0904496459ae.rlib" "-Wl,--start-group" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ddd4722641488d4f.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-b0321cf154c65d00.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-587f790a7d18db12.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-f2b1b65a9a030a2b.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-6dcccc11022bade0.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-ed3e7438919073ed.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fd9dfec412f544e1.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-387d131cc9c78231.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d657514a5cfa7a51.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-136d3bca4f5e32fc.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-7c47857811f7327b.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-ba3ee5d1f092210a.rlib" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0dd9a7843287a221.rlib" "-Wl,--end-group" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1884370e56dedb14.rlib" "-Wl,-Bdynamic" "-lutil" "-ldl" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: /home/r/src/rust/rustc.2/build/bootstrap/debug/deps/libbootstrap-1f25c1b05a63006f.rlib(bootstrap-1f25c1b05a63006f.47exclbhc2bwcb1n.rcgu.o): in function `bootstrap::native::supported_sanitizers':
          /home/r/src/rust/rustc.2/src/bootstrap/native.rs:714: undefined reference to `core::array::<impl core::iter::traits::collect::IntoIterator for &[T; _]>::into_iter'
          /usr/bin/ld: /home/r/src/rust/rustc.2/src/bootstrap/native.rs:723: undefined reference to `core::array::<impl core::iter::traits::collect::IntoIterator for &[T; _]>::into_iter'
          collect2: error: ld returned 1 exit status

@RalfJung
Copy link
Member Author

RalfJung commented Jun 1, 2020

I passed the flags by modifying bootstrap/bin/rustc.rs instead.

error: internal compiler error: broken MIR in DefId(0:1325 ~ rustc_metadata[9b46]::locator[0]::{{impl}}[2]::new[0]) (end of phase Optimized): encountered `Assign` statement with incompatible types:
left-hand side has type: [closure@locator::CrateLocator::new::{{closure}}#0 closure_kind_ty=i16 closure_sig_as_fn_ptr_ty=extern "rust-call" fn((&ReErased rustc_session::config::ExternEntry,)) -> std::option::Option<Opaque(DefId(71:283 ~ rustc_session[890f]::config[0]::{{impl}}[8]::files[0]::{{opaque}}[0]), [ReErased])>]
right-hand side has type: [closure@locator::CrateLocator::new::{{closure}}#0 closure_kind_ty=i16 closure_sig_as_fn_ptr_ty=extern "rust-call" fn((&ReErased rustc_session::config::ExternEntry,)) -> std::option::Option<std::collections::btree_set::Iter<std::string::String>>]

Looks like closure_sig_as_fn_ptr_ty has a different return type?

std::option::Option<Opaque(DefId(71:283 ~ rustc_session[890f]::config[0]::{{impl}}[8]::files[0]::{{opaque}}[0]), [ReErased])>

vs

std::option::Option<std::collections::btree_set::Iter<std::string::String>>

@rust-highfive

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 22, 2020

☀️ Try build successful - checks-azure
Build commit: 5e7db3c429dc362ffac291de89f7b045b674bfc9 (5e7db3c429dc362ffac291de89f7b045b674bfc9)

@rust-timer
Copy link
Collaborator

Queued 5e7db3c429dc362ffac291de89f7b045b674bfc9 with parent 1a4e2b6, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (5e7db3c429dc362ffac291de89f7b045b674bfc9): comparison url.

@RalfJung
Copy link
Member Author

Ah lol, the extra check of layouts are really equal if the types are equal actually is measurable for the CTFE stress test.

@RalfJung
Copy link
Member Author

Okay @matthewjasper I think this is finally ready for review.

"encountered `Assign` statement with overlapping memory",
);
match &statement.kind {
StatementKind::Assign(box (dest, rvalue)) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

As a follow up we should also check function calls and DropAndReplace

Copy link
Contributor

Choose a reason for hiding this comment

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

SetDiscriminant can also get checked as to whether the type has the mentioned discriminant id and whether the local's type is actually an enum

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's collect these ideas in #73832

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 27, 2020

📌 Commit 35911ee has been approved by matthewjasper

@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 Jun 27, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jun 28, 2020
…ewjasper

MIR sanity check: validate types on assignment

This expands the MIR validation added by @jonas-schievink in rust-lang#72093 to also check that on an assignment, the types of both sides match.

Cc @eddyb @oli-obk
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 28, 2020
…ewjasper

MIR sanity check: validate types on assignment

This expands the MIR validation added by @jonas-schievink in rust-lang#72093 to also check that on an assignment, the types of both sides match.

Cc @eddyb @oli-obk
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 28, 2020
…arth

Rollup of 10 pull requests

Successful merges:

 - rust-lang#72796 (MIR sanity check: validate types on assignment)
 - rust-lang#73243 (Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility)
 - rust-lang#73525 (Prepare for LLVM 11)
 - rust-lang#73672 (Adds a clearer message for when the async keyword is missing from a f…)
 - rust-lang#73708 (Explain move errors that occur due to method calls involving `self` (take two))
 - rust-lang#73758 (improper_ctypes: fix remaining `Reveal:All`)
 - rust-lang#73763 (errors: use `-Z terminal-width` in JSON emitter)
 - rust-lang#73796 (replace more `DefId`s with `LocalDefId`)
 - rust-lang#73797 (fix typo in self-profile.md)
 - rust-lang#73809 (Add links to fs::DirEntry::metadata)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented Jun 28, 2020

⌛ Testing commit 35911ee with merge 25687ca...

@bors bors merged commit 385d85c into rust-lang:master Jun 28, 2020
@jonas-schievink
Copy link
Contributor

This has broken the bootstrap with -Zvalidate-mir again (#73860), please run that when making changes to the validation pass

@RalfJung
Copy link
Member Author

@jonas-schievink what exactly is the command for that again?

Might be worth adding a comment in the file explaining this.

@RalfJung RalfJung deleted the mir-assign-sanity branch June 30, 2020 06:43
@jonas-schievink
Copy link
Contributor

I think it's RUSTFLAGS_NOT_BOOTSTRAP="-Zvalidate-mir"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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.