rust/src/test
Geoffry Song 9d42549df4
Implement the loop_break_value feature.
This implements RFC 1624, tracking issue #37339.

- `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the
  currently deduced type of that loop, the desired type, and a list of
  break expressions currently seen. `loop` loops get a fresh type
  variable as their initial type (this logic is stolen from that for
  arrays). `while` loops get `()`.
- `break {expr}` looks up the broken loop, and unifies the type of
  `expr` with the type of the loop.
- `break` with no expr unifies the loop's type with `()`.
- When building MIR, `loop` loops no longer construct a `()` value at
  termination of the loop; rather, the `break` expression assigns the
  result of the loop. `while` loops are unchanged.
- `break` respects contexts in which expressions may not end with braced
  blocks. That is, `while break { break-value } { while-body }` is
  illegal; this preserves backwards compatibility.
- The RFC did not make it clear, but I chose to make `break ()` inside
  of a `while` loop illegal, just in case we wanted to do anything with
  that design space in the future.

This is my first time dealing with this part of rustc so I'm sure
there's plenty of problems to pick on here ^_^
2016-11-21 20:20:42 -08:00
..
codegen Fix codegen test after change of llvm type naming scheme 2016-11-13 19:49:56 -05:00
codegen-units Fix fallout in tests. 2016-09-27 06:43:51 +00:00
compile-fail Implement the loop_break_value feature. 2016-11-21 20:20:42 -08:00
compile-fail-fulldeps Fix fallout in rustdoc and tests. 2016-11-21 12:16:46 +00:00
debuginfo Move all Linux/OSX CI infastructure to Travis 2016-11-11 07:36:40 -08:00
incremental Rollup merge of #37841 - michaelwoerister:ich-loop-tests, r=nikomatsakis 2016-11-20 15:00:04 +01:00
mir-opt update tests 2016-10-04 20:43:43 +03:00
parse-fail Fix fallout in rustdoc and tests. 2016-11-21 12:16:46 +00:00
pretty tests: fix fallout in pretty-printing output exact-match tests. 2016-11-10 01:44:53 +02:00
run-fail Warn when a #[should_panic] test has an unexpected message 2016-11-18 21:01:19 +10:30
run-fail-fulldeps Fix fallout in rustdoc and tests. 2016-11-21 12:16:46 +00:00
run-make Auto merge of #37824 - jseyfried:symbols, r=eddyb 2016-11-21 08:08:47 -06:00
run-pass Implement the loop_break_value feature. 2016-11-21 20:20:42 -08:00
run-pass-fulldeps Auto merge of #37824 - jseyfried:symbols, r=eddyb 2016-11-21 08:08:47 -06:00
run-pass-valgrind Fix some pretty printing tests 2016-10-18 23:23:40 +03:00
rustdoc Auto merge of #37773 - ollie27:rustdoc_inline_glob, r=brson 2016-11-16 01:17:53 -08:00
ui Auto merge of #37771 - alexcrichton:fix-nightlies, r=brson 2016-11-14 14:04:54 -08:00