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

Update to nightly-2023-01-21 #991

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed 🛠
- [PR#991](https://github.com/EmbarkStudios/rust-gpu/pull/991) Updated toolchain to `nightly-2023-01-21`.
- [PR#990](https://github.com/EmbarkStudios/rust-gpu/pull/990) Removed return type inference from `Image` API and made `glam` usage mandatory.

## [0.5.0]
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2022-12-18"
channel = "nightly-2023-01-21"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 0468a00ae3fd6ef1a6a0f9eaf637d7aa9e604acc"#;
# commit_hash = 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ impl CheckSpirvAttrVisitor<'_> {
| SpirvAttribute::Invariant
| SpirvAttribute::InputAttachmentIndex(_) => match target {
Target::Param => {
let parent_hir_id = self.tcx.hir().get_parent_node(hir_id);
let parent_hir_id = self.tcx.hir().parent_id(hir_id);
let parent_is_entry_point =
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
.filter_map(|r| r.ok())
Expand Down
3 changes: 2 additions & 1 deletion crates/rustc_codegen_spirv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ fn is_blocklisted_fn<'tcx>(
Some(assoc) if assoc.ident(tcx).name == sym::fmt => match assoc.container {
ty::ImplContainer => {
let impl_def_id = assoc.container_id(tcx);
tcx.impl_trait_ref(impl_def_id).map(|tr| tr.def_id)
tcx.impl_trait_ref(impl_def_id)
.map(|tr| tr.skip_binder().def_id)
== Some(debug_trait_def_id)
}
ty::TraitContainer => false,
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/linker/spirt_passes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const _: () = {
// HACK(eddyb) this works around the accidental lack of `spirt::Value: Hash`.
#[derive(Copy, Clone, PartialEq, Eq)]
struct HashableValue(Value);
#[allow(clippy::derive_hash_xor_eq)]
#[allow(clippy::derived_hash_with_manual_eq)]
impl Hash for HashableValue {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
use spirt::*;
Expand Down
12 changes: 11 additions & 1 deletion crates/rustc_codegen_spirv/src/linker/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use super::{link, LinkResult};
use pipe::pipe;
use rspirv::dr::{Loader, Module};
use rustc_errors::registry::Registry;
use rustc_session::{config::Input, CompilerIO};
use rustc_span::FileName;
use std::io::Read;

// https://github.com/colin-kiegel/rust-pretty-assertions/issues/24
Expand Down Expand Up @@ -130,7 +132,15 @@ fn link_with_linker_opts(
rustc_span::create_session_globals_then(sopts.edition, || {
let mut sess = rustc_session::build_session(
sopts,
None,
CompilerIO {
input: Input::Str {
name: FileName::Custom(String::new()),
input: String::new(),
},
output_dir: None,
output_file: None,
temps_dir: None,
},
None,
Registry::new(&[]),
Default::default(),
Expand Down
5 changes: 2 additions & 3 deletions rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "nightly-2022-12-18"
channel = "nightly-2023-01-21"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 0468a00ae3fd6ef1a6a0f9eaf637d7aa9e604acc
# commit_hash = 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14

# Whenever changing the nightly channel, update the commit hash above, and make
# sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also.

24 changes: 24 additions & 0 deletions tests/ui/arch/debug_printf_type_checking.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,19 @@ error[E0308]: mismatched types
| | expected `f32`, found `u32`
| arguments to this function are incorrect
|
help: the return type of this call is `u32` due to the type of the argument passed
--> $DIR/debug_printf_type_checking.rs:21:9
|
21 | debug_printf!("%f", 11_u32);
| ^^^^^^^^^^^^^^^^^^^^------^
| |
| this argument influences the return type of `spirv_std`
note: function defined here
--> $SPIRV_STD_SRC/lib.rs:144:8
|
144 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
help: change the type of the numeric literal from `u32` to `f32`
|
21 | debug_printf!("%f", 11_f32);
Expand All @@ -86,11 +94,19 @@ error[E0308]: mismatched types
| | expected `u32`, found `f32`
| arguments to this function are incorrect
|
help: the return type of this call is `f32` due to the type of the argument passed
--> $DIR/debug_printf_type_checking.rs:22:9
|
22 | debug_printf!("%u", 11.0_f32);
| ^^^^^^^^^^^^^^^^^^^^--------^
| |
| this argument influences the return type of `spirv_std`
note: function defined here
--> $SPIRV_STD_SRC/lib.rs:144:8
|
144 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
help: change the type of the numeric literal from `f32` to `u32`
|
22 | debug_printf!("%u", 11u32);
Expand Down Expand Up @@ -130,11 +146,19 @@ error[E0308]: mismatched types
| | expected `f32`, found struct `Vec2`
| arguments to this function are incorrect
|
help: the return type of this call is `Vec2` due to the type of the argument passed
--> $DIR/debug_printf_type_checking.rs:24:9
|
24 | debug_printf!("%f", Vec2::splat(33.3));
| ^^^^^^^^^^^^^^^^^^^^-----------------^
| |
| this argument influences the return type of `spirv_std`
note: function defined here
--> $SPIRV_STD_SRC/lib.rs:144:8
|
144 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 14 previous errors

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dis/ptr_copy.normal.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: Cannot memcpy dynamically sized data
--> $CORE_SRC/intrinsics.rs:2519:9
--> $CORE_SRC/intrinsics.rs:2458:9
|
2519 | copy(src, dst, count)
2458 | copy(src, dst, count)
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: Stack:
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_read.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5
%7 = OpLabel
OpLine %8 1135 8
OpLine %8 1157 8
%9 = OpLoad %10 %4
OpLine %11 9 13
OpStore %6 %9
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_read_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5
%7 = OpLabel
OpLine %8 1135 8
OpLine %8 1157 8
%9 = OpLoad %10 %4
OpLine %11 9 13
OpStore %6 %9
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%7 = OpLabel
OpLine %8 9 35
%9 = OpLoad %10 %4
OpLine %11 1332 8
OpLine %11 1354 8
OpStore %6 %9
OpNoLine
OpReturn
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%7 = OpLabel
OpLine %8 9 37
%9 = OpLoad %10 %4
OpLine %11 1332 8
OpLine %11 1354 8
OpStore %6 %9
OpNoLine
OpReturn
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/image/gather_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ error[E0277]: the trait bound `Image<f32, 0, 2, 0, 0, 1, 0>: HasGather` is not s
Image<SampledType, 1, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::gather`
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
--> $SPIRV_STD_SRC/image.rs:163:15
|
163 | Self: HasGather,
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::gather`
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`

error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0>: HasGather` is not satisfied
--> $DIR/gather_err.rs:16:34
Expand All @@ -24,11 +24,11 @@ error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0>: HasGather` is not s
Image<SampledType, 1, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::gather`
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`
--> $SPIRV_STD_SRC/image.rs:163:15
|
163 | Self: HasGather,
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::gather`
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT>::gather`

error: aborting due to 2 previous errors

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/image/query/query_size_lod_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0>: HasQuerySizeLod` is
Image<SampledType, 1, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 2, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::query_size_lod`
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT>::query_size_lod`
--> $SPIRV_STD_SRC/image.rs:903:15
|
903 | Self: HasQuerySizeLod,
| ^^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, _, SAMPLED, FORMAT>::query_size_lod`
| ^^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT>::query_size_lod`

error: aborting due to previous error

Expand Down