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-2022-10-01 #935

Merged
merged 8 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added ⭐

- Added check for env var `RUSTGPU_SKIP_TOOLCHAIN_CHECK` to prevent toolchain check
oisyn marked this conversation as resolved.
Show resolved Hide resolved

### Changed 🛠️

- 🚨BREAKING🚨 Migrated from `register_attr` to `register_tool`. [More information](docs/src/migration-to-register-tool.md).
- Updated toolchain to `nightly-2022-09-06`
- Updated toolchain to `nightly-2022-10-01`
- Updated `glam` to `0.22`
- Removed `glam::BVec` support (they are no longer `#[repl(simd)]` in `glam`, as Rust doesn't support SIMD vectors with `bool` elements)

Expand Down
8 changes: 5 additions & 3 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-09-06"
channel = "nightly-2022-10-01"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = b44197abb0b3ffe4908892e1e08ab1cd721ff3b9"#;
# commit_hash = 8ce3204af9463db3192ea1eb31c45c2f6d4b5ae6"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down Expand Up @@ -45,7 +45,9 @@ fn check_toolchain_version() -> Result<(), Box<dyn Error>> {
}
}

if !cfg!(feature = "skip-toolchain-check") {
if !cfg!(feature = "skip-toolchain-check")
&& !std::env::var("RUSTGPU_SKIP_TOOLCHAIN_CHECK").is_ok()
oisyn marked this conversation as resolved.
Show resolved Hide resolved
{
// check if our current rustc's commit hash matches with what we expect it to be
let current_hash = get_rustc_commit_hash()?;
let required_hash = get_required_commit_hash()?;
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ pub(crate) fn provide(providers: &mut Providers) {
tag_encoding: match *tag_encoding {
TagEncoding::Direct => TagEncoding::Direct,
TagEncoding::Niche {
dataful_variant,
untagged_variant,
ref niche_variants,
niche_start,
} => TagEncoding::Niche {
dataful_variant,
untagged_variant,
niche_variants: niche_variants.clone(),
niche_start,
},
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>)
match impl_item.kind {
hir::ImplItemKind::Const(..) => Target::AssocConst,
hir::ImplItemKind::Fn(..) => {
let parent_local_def_id = tcx.hir().get_parent_item(impl_item.hir_id());
let containing_item = tcx.hir().expect_item(parent_local_def_id);
let parent_owner_id = tcx.hir().get_parent_item(impl_item.hir_id());
let containing_item = tcx.hir().expect_item(parent_owner_id.def_id);
let containing_impl_is_for_trait = match &containing_item.kind {
hir::ItemKind::Impl(hir::Impl { of_trait, .. }) => of_trait.is_some(),
_ => unreachable!("parent of an ImplItem must be an Impl"),
Expand Down
15 changes: 15 additions & 0 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,21 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
ty
)),
};

// HACK(eddyb) https://github.com/rust-lang/rust/pull/101483 accidentally
// abused the fact that an `i1` LLVM value will be automatically `zext`'d
// to `i8` by `from_immediate`, and so you can pretend that, from the
// Rust perspective, a `bool` value has the type `u8`, as long as it will
// be stored to memory (which intrinsics all do, for historical reasons)
// - but we don't do that in `from_immediate`, so it's emulated here.
let val = match (self.lookup_type(val.ty), self.lookup_type(ptr_elem_ty)) {
(SpirvType::Bool, SpirvType::Integer(8, false)) => {
self.zext(val, ptr_elem_ty)
}

_ => val
};

assert_ty_eq!(self, ptr_elem_ty, val.ty);
self.emit()
.store(ptr.def(self), val.def(self), None, empty())
Expand Down
4 changes: 0 additions & 4 deletions crates/rustc_codegen_spirv/src/codegen_cx/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
}
}

fn zst_to_backend(&self, _llty: Self::Type) -> Self::Value {
unreachable!();
}

// FIXME(eddyb) this shouldn't exist, and is only used by vtable creation,
// see https://github.com/rust-lang/rust/pull/86475#discussion_r680792727.
fn const_data_from_alloc(&self, _alloc: ConstAllocation<'tcx>) -> Self::Value {
Expand Down
4 changes: 2 additions & 2 deletions rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "nightly-2022-09-06"
channel = "nightly-2022-10-01"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = b44197abb0b3ffe4908892e1e08ab1cd721ff3b9
# commit_hash = 8ce3204af9463db3192ea1eb31c45c2f6d4b5ae6

# 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.
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:2403:9
--> $CORE_SRC/intrinsics.rs:2431:9
|
2403 | copy(src, dst, count)
2431 | copy(src, dst, count)
| ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error
Expand Down