Skip to content

Commit a0b4de4

Browse files
committed
Bump rust-toolchain to nightly-2021-03-17, unlocking for i in 0..n loops!
1 parent 17f4f37 commit a0b4de4

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

crates/rustc_codegen_spirv/src/linker/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fn assemble_and_link(binaries: &[&[u8]]) -> Result<Module, String> {
7878
diagnostic_output: DiagnosticOutput::Raw(Box::new(write_diags)),
7979
stderr: None,
8080
lint_caps: Default::default(),
81+
parse_sess_created: None,
8182
register_lints: None,
8283
override_queries: None,
8384
make_codegen_backend: None,

crates/spirv-builder/src/test/control_flow.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,11 @@ pub fn main() {
377377
}"#);
378378
}
379379

380-
// HACK(eddyb) test that `for` loop desugaring (with its call to `Iterator::next`
381-
// and matching on the resulting `Option`) works, without a working `Range`
382-
// iterator (due to the use of `mem::swap` and its block-wise implementation).
380+
// NOTE(eddyb) this tests `for` loop desugaring (with its call to `Iterator::next`
381+
// and matching on the resulting `Option`), without relying on a `Range` iterator.
382+
// More precisely, `Range` used to not compile, due to it using `mem::replace`,
383+
// which, before https://github.com/rust-lang/rust/pull/83022, used to just call
384+
// `mem::swap` (which has a block-wise optimization that can't work on SPIR-V).
383385
#[test]
384386
fn cf_for_with_custom_range_iter() {
385387
val(r#"
@@ -408,3 +410,14 @@ pub fn main(i: Input<i32>) {
408410
}
409411
"#);
410412
}
413+
414+
#[test]
415+
fn cf_for_range() {
416+
val(r#"
417+
#[spirv(fragment)]
418+
pub fn main(i: Input<i32>) {
419+
for _ in 0..*i {
420+
}
421+
}
422+
"#);
423+
}

examples/runners/ash/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,15 +1217,15 @@ impl PipelineDescriptor {
12171217
.build();
12181218

12191219
Self {
1220+
color_blend_attachments,
1221+
dynamic_state,
12201222
shader_stages,
12211223
vertex_input,
12221224
input_assembly,
12231225
rasterization,
12241226
multisample,
12251227
depth_stencil,
1226-
color_blend_attachments,
12271228
color_blend,
1228-
dynamic_state,
12291229
dynamic_state_info,
12301230
}
12311231
}

examples/shaders/mouse-shader/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ pub fn main_fs(
223223
.intersect(mouse_circle)
224224
};
225225

226-
// FIXME(eddyb) use a `for i in 0..3` loop when that works.
227-
let mut i = 0;
228-
while i < 3 {
226+
for i in 0..3 {
229227
painter.fill(
230228
mouse_button(i),
231229
RED.lerp(
@@ -239,7 +237,6 @@ pub fn main_fs(
239237
),
240238
),
241239
);
242-
i += 1;
243240
}
244241

245242
painter.fill_with_contrast_border(

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
66

77
[toolchain]
8-
channel = "nightly-2021-03-11"
8+
channel = "nightly-2021-03-17"
99
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

0 commit comments

Comments
 (0)