Skip to content

Commit 75f8181

Browse files
committed
rustup: update to nightly-2021-08-27.
1 parent 92dc64b commit 75f8181

File tree

7 files changed

+34
-36
lines changed

7 files changed

+34
-36
lines changed

crates/rustc_codegen_spirv/src/attr.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl AggregatedSpirvAttributes {
144144

145145
// NOTE(eddyb) `delay_span_bug` ensures that if attribute checking fails
146146
// to see an attribute error, it will cause an ICE instead.
147-
for (_, parse_attr_result) in crate::symbols::parse_attrs_for_checking(&cx.sym, attrs) {
147+
for parse_attr_result in crate::symbols::parse_attrs_for_checking(&cx.sym, attrs) {
148148
let (span, parsed_attr) = match parse_attr_result {
149149
Ok(span_and_parsed_attr) => span_and_parsed_attr,
150150
Err((span, msg)) => {
@@ -263,11 +263,7 @@ impl CheckSpirvAttrVisitor<'_> {
263263
let parse_attrs = |attrs| crate::symbols::parse_attrs_for_checking(&self.sym, attrs);
264264

265265
let attrs = self.tcx.hir().attrs(hir_id);
266-
for (attr, parse_attr_result) in parse_attrs(attrs) {
267-
// Make sure to mark the whole `#[spirv(...)]` attribute as used,
268-
// to avoid warnings about unused attributes.
269-
self.tcx.sess.mark_attr_used(attr);
270-
266+
for parse_attr_result in parse_attrs(attrs) {
271267
let (span, parsed_attr) = match parse_attr_result {
272268
Ok(span_and_parsed_attr) => span_and_parsed_attr,
273269
Err((span, msg)) => {
@@ -312,7 +308,7 @@ impl CheckSpirvAttrVisitor<'_> {
312308
let parent_hir_id = self.tcx.hir().get_parent_node(hir_id);
313309
let parent_is_entry_point =
314310
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
315-
.filter_map(|(_, r)| r.ok())
311+
.filter_map(|r| r.ok())
316312
.any(|(_, attr)| matches!(attr, SpirvAttribute::Entry(_)));
317313
if !parent_is_entry_point {
318314
self.tcx.sess.span_err(
@@ -494,7 +490,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
494490

495491
fn check_invalid_macro_level_spirv_attr(tcx: TyCtxt<'_>, sym: &Symbols, attrs: &[Attribute]) {
496492
for attr in attrs {
497-
if tcx.sess.check_name(attr, sym.spirv) {
493+
if attr.has_name(sym.spirv) {
498494
tcx.sess
499495
.span_err(attr.span, "#[spirv(..)] cannot be applied to a macro");
500496
}

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,17 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
341341
}
342342

343343
impl<'tcx> CodegenCx<'tcx> {
344-
// This function comes from https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/layout.rs.html,
345-
// and is a lambda in the `layout_raw_uncached` function in Version 1.50.0-nightly (eb4fc71dc 2020-12-17)
344+
// This function comes from `ty::layout`'s `layout_of_uncached`,
345+
// where it's named `scalar_unit`.
346346
pub fn primitive_to_scalar(&self, value: Primitive) -> abi::Scalar {
347347
let bits = value.size(self.data_layout()).bits();
348348
assert!(bits <= 128);
349349
abi::Scalar {
350350
value,
351-
valid_range: 0..=(!0 >> (128 - bits)),
351+
valid_range: abi::WrappingRange {
352+
start: 0,
353+
end: (!0 >> (128 - bits)),
354+
},
352355
}
353356
}
354357

crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,17 @@ impl<'tcx> StaticMethods for CodegenCx<'tcx> {
294294
.set_global_initializer(g.def_cx(self), v.def_cx(self));
295295
}
296296

297-
/// Mark the given global value as "used", to prevent a backend from potentially removing a
298-
/// static variable that may otherwise appear unused.
299-
///
300-
/// Static variables in Rust can be annotated with the `#[used]` attribute to direct the `rustc`
301-
/// compiler to mark the variable as a "used global".
297+
/// Mark the given global value as "used", to prevent the compiler and linker from potentially
298+
/// removing a static variable that may otherwise appear unused.
302299
fn add_used_global(&self, _global: Self::Value) {
303300
// TODO: Ignore for now.
304301
}
302+
303+
/// Same as `add_used_global`, but only prevent the compiler from potentially removing an
304+
/// otherwise unused symbol. The linker is still permitted to drop it.
305+
///
306+
/// This corresponds to the semantics of the `#[used]` attribute.
307+
fn add_compiler_used_global(&self, _global: Self::Value) {
308+
// TODO: Ignore for now.
309+
}
305310
}

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> {
562562
todo!()
563563
}
564564

565+
fn compiler_used_statics(&self) -> &RefCell<Vec<Self::Value>> {
566+
todo!()
567+
}
568+
565569
fn set_frame_pointer_type(&self, _llfn: Self::Function) {
566570
todo!()
567571
}
@@ -574,6 +578,10 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> {
574578
todo!()
575579
}
576580

581+
fn create_compiler_used_variable(&self) {
582+
todo!()
583+
}
584+
577585
fn declare_c_main(&self, _fn_type: Self::Type) -> Option<Self::Function> {
578586
todo!()
579587
}

crates/rustc_codegen_spirv/src/symbols.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::attr::{Entry, ExecutionModeExtra, IntrinsicType, SpirvAttribute};
22
use crate::builder::libm_intrinsics;
33
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
4-
use rustc_ast::ast::{AttrKind, Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
4+
use rustc_ast::ast::{Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
55
use rustc_data_structures::fx::FxHashMap;
66
use rustc_span::symbol::{Ident, Symbol};
77
use rustc_span::Span;
@@ -409,22 +409,9 @@ type ParseAttrError = (Span, String);
409409
pub(crate) fn parse_attrs_for_checking<'a>(
410410
sym: &'a Symbols,
411411
attrs: &'a [Attribute],
412-
) -> impl Iterator<
413-
Item = (
414-
&'a Attribute,
415-
Result<(Span, SpirvAttribute), ParseAttrError>,
416-
),
417-
> + 'a {
412+
) -> impl Iterator<Item = Result<(Span, SpirvAttribute), ParseAttrError>> + 'a {
418413
attrs.iter().flat_map(move |attr| {
419-
let is_spirv = match attr.kind {
420-
AttrKind::Normal(ref item, _) => {
421-
// TODO: We ignore the rest of the path. Is this right?
422-
let last = item.path.segments.last();
423-
last.map_or(false, |seg| seg.ident.name == sym.spirv)
424-
}
425-
AttrKind::DocComment(..) => false,
426-
};
427-
let (whole_attr_error, args) = if !is_spirv {
414+
let (whole_attr_error, args) = if !attr.has_name(sym.spirv) {
428415
// Use an empty vec here to return empty
429416
(None, Vec::new())
430417
} else if let Some(args) = attr.meta_item_list() {
@@ -475,7 +462,6 @@ pub(crate) fn parse_attrs_for_checking<'a>(
475462
};
476463
Ok((span, parsed_attr))
477464
}))
478-
.map(move |parse_attr_result| (attr, parse_attr_result))
479465
})
480466
}
481467

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-08-10"
8+
channel = "nightly-2021-08-27"
99
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

tests/ui/dis/ptr_copy.normal.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: Cannot memcpy dynamically sized data
2-
--> $CORE_SRC/intrinsics.rs:2132:14
2+
--> $CORE_SRC/intrinsics.rs:2138:14
33
|
4-
2132 | unsafe { copy(src, dst, count) }
4+
2138 | unsafe { copy(src, dst, count) }
55
| ^^^^^^^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error

0 commit comments

Comments
 (0)