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-12-18 #982

Merged
merged 8 commits into from
Jan 5, 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
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv-types/src/compile_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'a> Trie<'a> {
let full_child_name = if full_name.is_empty() {
(*child_name).to_string()
} else {
format!("{}::{}", full_name, child_name)
format!("{full_name}::{child_name}")
};
if child.present {
assert!(child.children.is_empty());
Expand Down
6 changes: 3 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-10-29"
channel = "nightly-2022-12-18"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 9565dfeb4e6225177bbe78f18cd48a7982f34401"#;
# commit_hash = 0468a00ae3fd6ef1a6a0f9eaf637d7aa9e604acc"#;

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 @@ -78,7 +78,7 @@ fn main() -> ExitCode {
match check_toolchain_version() {
Ok(_) => ExitCode::SUCCESS,
Err(e) => {
eprint!("{}", e);
eprint!("{e}");
ExitCode::FAILURE
}
}
Expand Down
13 changes: 6 additions & 7 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub(crate) fn provide(providers: &mut Providers) {

// FIXME(eddyb) remove this by deriving `Clone` for `LayoutS` upstream.
// FIXME(eddyb) the `S` suffix is a naming antipattern, rename upstream.
fn clone_layout<'a>(layout: &LayoutS<'a>) -> LayoutS<'a> {
fn clone_layout<V: Idx>(layout: &LayoutS<V>) -> LayoutS<V> {
let LayoutS {
ref fields,
ref variants,
Expand Down Expand Up @@ -270,7 +270,7 @@ impl fmt::Display for PointeeTy<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PointeeTy::Ty(ty) => write!(f, "{}", ty.ty),
PointeeTy::Fn(ty) => write!(f, "{}", ty),
PointeeTy::Fn(ty) => write!(f, "{ty}"),
}
}
}
Expand Down Expand Up @@ -577,8 +577,7 @@ fn dig_scalar_pointee<'tcx>(
Some(old_pointee) if old_pointee != new_pointee => {
cx.tcx.sess.fatal(format!(
"dig_scalar_pointee: unsupported Pointer with different \
pointee types ({:?} vs {:?}) at offset {:?} in {:#?}",
old_pointee, new_pointee, offset, layout
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
));
}
_ => pointee = Some(new_pointee),
Expand Down Expand Up @@ -662,8 +661,8 @@ fn trans_aggregate<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>
}

// returns (field_offsets, size, align)
pub fn auto_struct_layout<'tcx>(
cx: &CodegenCx<'tcx>,
pub fn auto_struct_layout(
cx: &CodegenCx<'_>,
field_types: &[Word],
) -> (Vec<Size>, Option<Size>, Align) {
// FIXME(eddyb) use `AccumulateVec`s just like `rustc` itself does.
Expand Down Expand Up @@ -860,7 +859,7 @@ fn trans_intrinsic_type<'tcx>(
None => Err(cx
.tcx
.sess
.err(format!("Invalid value for Image const generic: {}", value))),
.err(format!("Invalid value for Image const generic: {value}"))),
}
}

Expand Down
18 changes: 7 additions & 11 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl AggregatedSpirvAttributes {
}) => {
cx.tcx
.sess
.delay_span_bug(span, format!("multiple {} attributes", category));
.delay_span_bug(span, format!("multiple {category} attributes"));
}
}
}
Expand Down Expand Up @@ -228,7 +228,7 @@ impl AggregatedSpirvAttributes {
}

// FIXME(eddyb) make this reusable from somewhere in `rustc`.
fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>) -> Target {
fn target_from_impl_item(tcx: TyCtxt<'_>, impl_item: &hir::ImplItem<'_>) -> Target {
match impl_item.kind {
hir::ImplItemKind::Const(..) => Target::AssocConst,
hir::ImplItemKind::Fn(..) => {
Expand Down Expand Up @@ -333,7 +333,7 @@ impl CheckSpirvAttrVisitor<'_> {
if let Err(msg) = valid {
self.tcx.sess.span_err(
span,
format!("`{:?}` storage class {}", storage_class, msg),
format!("`{storage_class:?}` storage class {msg}"),
);
}
}
Expand All @@ -355,8 +355,7 @@ impl CheckSpirvAttrVisitor<'_> {
self.tcx.sess.span_err(
span,
format!(
"attribute is only valid on a {}, not on a {}",
expected_target, target
"attribute is only valid on a {expected_target}, not on a {target}"
),
);
}
Expand All @@ -370,12 +369,9 @@ impl CheckSpirvAttrVisitor<'_> {
.sess
.struct_span_err(
span,
&format!(
"only one {} attribute is allowed on a {}",
category, target
),
&format!("only one {category} attribute is allowed on a {target}"),
)
.span_note(prev_span, &format!("previous {} attribute", category))
.span_note(prev_span, &format!("previous {category} attribute"))
.emit();
}
},
Expand Down Expand Up @@ -461,7 +457,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
}

fn visit_variant(&mut self, variant: &'tcx hir::Variant<'tcx>) {
self.check_spirv_attributes(variant.id, Target::Variant);
self.check_spirv_attributes(variant.hir_id, Target::Variant);
intravisit::walk_variant(self, variant);
}

Expand Down
Loading