8000 Rollup of 4 pull requests by Centril · Pull Request #64951 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 4 pull requests #64951

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1d704e7
fix typo
ztlpn Sep 16, 2019
3f85ff4
fix spurious unreachable_code lints for try{} block ok-wrapping
ztlpn Sep 18, 2019
c60c0cb
add tests
ztlpn Sep 18, 2019
65251ea
address review comments
ztlpn Sep 18, 2019
58eacaa
fix test after rebase
ztlpn Sep 22, 2019
d2c0d10
[const-prop] Handle MIR Rvalue::Repeat
wesleywiser Sep 14, 2019
f290467
syntax: cleanup method parsing.
Centril Sep 29, 2019
378cc98
syntax: `is_named_argument` -> `is_named_param`.
Centril Sep 29, 2019
4fa9c3b
syntax refactor `parse_fn_params`
Centril Sep 29, 2019
40dc9da
syntax refactor `parse_self_param` (1)
Centril Sep 29, 2019
f688f8a
syntax refactor `parse_self_param` (2)
Centril Sep 29, 2019
ac454e9
syntax refactor `parse_self_param` (3)
Centril Sep 30, 2019
4306d00
syntax refactor `parse_self_param` (4)
Centril Sep 30, 2019
0492302
syntax refactor `parse_self_param` (5)
Centril Sep 30, 2019
347deac
syntax: reorder param parsing to make more sense.
Centril Sep 30, 2019
d9d0e5d
syntax: cleanup `parse_fn_decl`.
Centril Sep 30, 2019
5b80ead
syntax: misc cleanup
Centril Sep 30, 2019
66bf323
syntax: cleanup `parse_visibility`.
Centril Sep 30, 2019
573a8d8
syntax: extract `error_on_invalid_abi`.
Centril Sep 30, 2019
258e86a
syntax: fuse more code paths together.
Centril Sep 30, 2019
bea404f
syntax: stylistic cleanup in item parsing.
Centril Sep 30, 2019
151ce96
syntax: reduce repetition in fn parsing.
Centril Sep 30, 2019
85f2945
[const-prop] Handle MIR Rvalue::Aggregates
wesleywiser Sep 14, 2019
ea78010
[const-prop] Handle MIR Rvalue::Discriminant
wesleywiser Sep 15, 2019
b3234a3
[const-prop] Handle MIR Rvalue::Box
wesleywiser Sep 15, 2019
5804c3b
Cleanup const_prop() some
wesleywiser Sep 15, 2019
7062164
Added interpreter mode to compiler interface, interpreter parsing fun…
alexreg Sep 20, 2019
df298b4
syntax: document some methods.
Centril Oct 1, 2019
30647d1
syntax: put helpers of `parse_self_param` in the method.
Centril Oct 1, 2019
49780d2
syntax: merge things back into `parse_visibility`.
Centril Oct 1, 2019
e046904
syntax: de-closure-ify `check_or_expected`.
Centril Oct 1, 2019
5c5dd80
syntax: reformat passing of `FnHeader` to `parse_item_fn`.
Centril Oct 1, 2019
e463a22
Rollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=Ce…
Centril Oct 1, 2019
031d968
Rollup merge of #64648 - alexreg:rush-parsing, r=Mark-Simulacrum
Centril Oct 1, 2019
8436080
Rollup merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk
Centril Oct 1, 2019
c0e0a32
Rollup merge of #64910 - Centril:params-cleanup, r=petrochenkov
Centril Oct 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
Prev Previous commit
Next Next commit
[const-prop] Handle MIR Rvalue::Repeat
  • Loading branch information
wesleywiser committed Sep 29, 2019
commit d2c0d1022d39d357273c90d5f2b68dd52955eddd
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {

// if this isn't a supported operation, then return None
match rvalue {
Rvalue::Repeat(..) |
Rvalue::Aggregate(..) |
Rvalue::NullaryOp(NullOp::Box, _) |
Rvalue::Discriminant(..) => return None,

Rvalue::Use(_) |
Rvalue::Len(_) |
Rvalue::Repeat(..) |
Rvalue::Cast(..) |
Rvalue::NullaryOp(..) |
Rvalue::CheckedBinaryOp(..) |
Expand Down
37 changes: 37 additions & 0 deletions src/test/mir-opt/const_prop/repeat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// compile-flags: -O

fn main() {
let x: u32 = [42; 8][2] + 0;
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
// bb0: {
// ...
// _3 = [const 42u32; 8];
// ...
// _4 = const 2usize;
// _5 = const 8usize;
// _6 = Lt(_4, _5);
// assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
// }
// bb1: {
// _2 = _3[_4];
// _1 = Add(move _2, const 0u32);
// ...
// return;
// }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
// bb0: {
// ...
// _6 = const true;
// assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
// }
// bb1: {
// _2 = const 42u32;
// _1 = Add(move _2, const 0u32);
// ...
// return;
// }
// END rustc.main.ConstProp.after.mir
1 change: 1 addition & 0 deletions src/test/ui/consts/const-prop-ice.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fn main() {
[0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3
//~| ERROR this expression will panic at runtime
}
8 changes: 7 additions & 1 deletion src/test/ui/consts/const-prop-ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ LL | [0; 3][3u64 as usize];
|
= note: `#[deny(const_err)]` on by default

error: aborting due to previous error
error: this expression will panic at runtime
--> $DIR/const-prop-ice.rs:2:5
|
LL | [0; 3][3u64 as usize];
| ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 3

error: aborting due to 2 previous errors

0