mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
rustup: update to nightly-2021-08-27.
This commit is contained in:
parent
92dc64bd06
commit
75f81814ec
@ -144,7 +144,7 @@ impl AggregatedSpirvAttributes {
|
||||
|
||||
// NOTE(eddyb) `delay_span_bug` ensures that if attribute checking fails
|
||||
// to see an attribute error, it will cause an ICE instead.
|
||||
for (_, parse_attr_result) in crate::symbols::parse_attrs_for_checking(&cx.sym, attrs) {
|
||||
for parse_attr_result in crate::symbols::parse_attrs_for_checking(&cx.sym, attrs) {
|
||||
let (span, parsed_attr) = match parse_attr_result {
|
||||
Ok(span_and_parsed_attr) => span_and_parsed_attr,
|
||||
Err((span, msg)) => {
|
||||
@ -263,11 +263,7 @@ impl CheckSpirvAttrVisitor<'_> {
|
||||
let parse_attrs = |attrs| crate::symbols::parse_attrs_for_checking(&self.sym, attrs);
|
||||
|
||||
let attrs = self.tcx.hir().attrs(hir_id);
|
||||
for (attr, parse_attr_result) in parse_attrs(attrs) {
|
||||
// Make sure to mark the whole `#[spirv(...)]` attribute as used,
|
||||
// to avoid warnings about unused attributes.
|
||||
self.tcx.sess.mark_attr_used(attr);
|
||||
|
||||
for parse_attr_result in parse_attrs(attrs) {
|
||||
let (span, parsed_attr) = match parse_attr_result {
|
||||
Ok(span_and_parsed_attr) => span_and_parsed_attr,
|
||||
Err((span, msg)) => {
|
||||
@ -312,7 +308,7 @@ impl CheckSpirvAttrVisitor<'_> {
|
||||
let parent_hir_id = self.tcx.hir().get_parent_node(hir_id);
|
||||
let parent_is_entry_point =
|
||||
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
|
||||
.filter_map(|(_, r)| r.ok())
|
||||
.filter_map(|r| r.ok())
|
||||
.any(|(_, attr)| matches!(attr, SpirvAttribute::Entry(_)));
|
||||
if !parent_is_entry_point {
|
||||
self.tcx.sess.span_err(
|
||||
@ -494,7 +490,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
|
||||
fn check_invalid_macro_level_spirv_attr(tcx: TyCtxt<'_>, sym: &Symbols, attrs: &[Attribute]) {
|
||||
for attr in attrs {
|
||||
if tcx.sess.check_name(attr, sym.spirv) {
|
||||
if attr.has_name(sym.spirv) {
|
||||
tcx.sess
|
||||
.span_err(attr.span, "#[spirv(..)] cannot be applied to a macro");
|
||||
}
|
||||
|
@ -341,14 +341,17 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> CodegenCx<'tcx> {
|
||||
// This function comes from https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/layout.rs.html,
|
||||
// and is a lambda in the `layout_raw_uncached` function in Version 1.50.0-nightly (eb4fc71dc 2020-12-17)
|
||||
// This function comes from `ty::layout`'s `layout_of_uncached`,
|
||||
// where it's named `scalar_unit`.
|
||||
pub fn primitive_to_scalar(&self, value: Primitive) -> abi::Scalar {
|
||||
let bits = value.size(self.data_layout()).bits();
|
||||
assert!(bits <= 128);
|
||||
abi::Scalar {
|
||||
value,
|
||||
valid_range: 0..=(!0 >> (128 - bits)),
|
||||
valid_range: abi::WrappingRange {
|
||||
start: 0,
|
||||
end: (!0 >> (128 - bits)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,12 +294,17 @@ impl<'tcx> StaticMethods for CodegenCx<'tcx> {
|
||||
.set_global_initializer(g.def_cx(self), v.def_cx(self));
|
||||
}
|
||||
|
||||
/// Mark the given global value as "used", to prevent a backend from potentially removing a
|
||||
/// static variable that may otherwise appear unused.
|
||||
///
|
||||
/// Static variables in Rust can be annotated with the `#[used]` attribute to direct the `rustc`
|
||||
/// compiler to mark the variable as a "used global".
|
||||
/// Mark the given global value as "used", to prevent the compiler and linker from potentially
|
||||
/// removing a static variable that may otherwise appear unused.
|
||||
fn add_used_global(&self, _global: Self::Value) {
|
||||
// TODO: Ignore for now.
|
||||
}
|
||||
|
||||
/// Same as `add_used_global`, but only prevent the compiler from potentially removing an
|
||||
/// otherwise unused symbol. The linker is still permitted to drop it.
|
||||
///
|
||||
/// This corresponds to the semantics of the `#[used]` attribute.
|
||||
fn add_compiler_used_global(&self, _global: Self::Value) {
|
||||
// TODO: Ignore for now.
|
||||
}
|
||||
}
|
||||
|
@ -562,6 +562,10 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn compiler_used_statics(&self) -> &RefCell<Vec<Self::Value>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set_frame_pointer_type(&self, _llfn: Self::Function) {
|
||||
todo!()
|
||||
}
|
||||
@ -574,6 +578,10 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn create_compiler_used_variable(&self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn declare_c_main(&self, _fn_type: Self::Type) -> Option<Self::Function> {
|
||||
todo!()
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::attr::{Entry, ExecutionModeExtra, IntrinsicType, SpirvAttribute};
|
||||
use crate::builder::libm_intrinsics;
|
||||
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
|
||||
use rustc_ast::ast::{AttrKind, Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
|
||||
use rustc_ast::ast::{Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
@ -409,22 +409,9 @@ type ParseAttrError = (Span, String);
|
||||
pub(crate) fn parse_attrs_for_checking<'a>(
|
||||
sym: &'a Symbols,
|
||||
attrs: &'a [Attribute],
|
||||
) -> impl Iterator<
|
||||
Item = (
|
||||
&'a Attribute,
|
||||
Result<(Span, SpirvAttribute), ParseAttrError>,
|
||||
),
|
||||
> + 'a {
|
||||
) -> impl Iterator<Item = Result<(Span, SpirvAttribute), ParseAttrError>> + 'a {
|
||||
attrs.iter().flat_map(move |attr| {
|
||||
let is_spirv = match attr.kind {
|
||||
AttrKind::Normal(ref item, _) => {
|
||||
// TODO: We ignore the rest of the path. Is this right?
|
||||
let last = item.path.segments.last();
|
||||
last.map_or(false, |seg| seg.ident.name == sym.spirv)
|
||||
}
|
||||
AttrKind::DocComment(..) => false,
|
||||
};
|
||||
let (whole_attr_error, args) = if !is_spirv {
|
||||
let (whole_attr_error, args) = if !attr.has_name(sym.spirv) {
|
||||
// Use an empty vec here to return empty
|
||||
(None, Vec::new())
|
||||
} else if let Some(args) = attr.meta_item_list() {
|
||||
@ -475,7 +462,6 @@ pub(crate) fn parse_attrs_for_checking<'a>(
|
||||
};
|
||||
Ok((span, parsed_attr))
|
||||
}))
|
||||
.map(move |parse_attr_result| (attr, parse_attr_result))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,5 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "nightly-2021-08-10"
|
||||
channel = "nightly-2021-08-27"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: Cannot memcpy dynamically sized data
|
||||
--> $CORE_SRC/intrinsics.rs:2132:14
|
||||
--> $CORE_SRC/intrinsics.rs:2138:14
|
||||
|
|
||||
2132 | unsafe { copy(src, dst, count) }
|
||||
2138 | unsafe { copy(src, dst, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user