rustup update, and edition = 2021 (#775)

This commit is contained in:
Ashley Hauck 2021-10-26 12:24:44 +02:00 committed by GitHub
parent 4831789bbb
commit f58c6f20af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 46 additions and 21 deletions

View File

@ -717,8 +717,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
// FIXME(eddyb) try multiple signatures until one fits.
let mut sig = match instruction_signatures(instruction.class.opcode)? {
[sig
@ InstSig {
[sig @ InstSig {
output_type: Some(_),
..
}] => *sig,

View File

@ -588,7 +588,12 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> {
}
impl<'tcx> DebugInfoMethods<'tcx> for CodegenCx<'tcx> {
fn create_vtable_metadata(&self, _ty: Ty<'tcx>, _vtable: Self::Value) {
fn create_vtable_metadata(
&self,
_ty: Ty<'tcx>,
_trait_ref: Option<PolyExistentialTraitRef<'tcx>>,
_vtable: Self::Value,
) {
// Ignore.
}

View File

@ -117,6 +117,7 @@ extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_index;
extern crate rustc_interface;
extern crate rustc_metadata;
extern crate rustc_middle;
extern crate rustc_session;
extern crate rustc_span;
@ -167,8 +168,8 @@ use rustc_codegen_ssa::traits::{
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen, ModuleKind};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{ErrorReported, FatalError, Handler};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::cstore::EncodedMetadata;
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
use rustc_middle::mir::pretty::write_mir_pretty;
use rustc_middle::ty::print::with_no_trimmed_paths;
@ -211,7 +212,7 @@ fn is_blocklisted_fn<'tcx>(
) -> bool {
// TODO: These sometimes have a constant value of an enum variant with a hole
if let InstanceDef::Item(def) = instance.def {
if let Some(debug_trait_def_id) = tcx.get_diagnostic_item(sym::debug_trait) {
if let Some(debug_trait_def_id) = tcx.get_diagnostic_item(sym::Debug) {
// Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
let is_debug_fmt_method = |def_id| match tcx.opt_associated_item(def_id) {
Some(assoc) if assoc.ident.name == sym::fmt => match assoc.container {

View File

@ -102,7 +102,11 @@ fn link_rlib(sess: &Session, codegen_results: &CodegenResults, out_filename: &Pa
}
}
create_archive(&file_list, &codegen_results.metadata.raw_data, out_filename);
create_archive(
&file_list,
codegen_results.metadata.raw_data(),
out_filename,
);
}
fn link_exe(

View File

@ -53,7 +53,7 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
})
});
let mut inliner = Inliner {
header: &mut module.header.as_mut().unwrap(),
header: module.header.as_mut().unwrap(),
types_global_values: &mut module.types_global_values,
void,
functions: &functions,

View File

@ -37,7 +37,7 @@ pub struct Options {
}
pub enum LinkResult {
SingleModule(Module),
SingleModule(Box<Module>),
MultipleModules(FxHashMap<String, Module>),
}
@ -107,8 +107,8 @@ pub fn link(sess: &Session, mut inputs: Vec<Module>, opts: &Options) -> Result<L
let mut bound = inputs[0].header.as_ref().unwrap().bound - 1;
let version = inputs[0].header.as_ref().unwrap().version();
for mut module in inputs.iter_mut().skip(1) {
simple_passes::shift_ids(&mut module, bound);
for module in inputs.iter_mut().skip(1) {
simple_passes::shift_ids(module, bound);
bound += module.header.as_ref().unwrap().bound - 1;
let this_version = module.header.as_ref().unwrap().version();
if version != this_version {
@ -293,11 +293,11 @@ pub fn link(sess: &Session, mut inputs: Vec<Module>, opts: &Options) -> Result<L
.collect();
LinkResult::MultipleModules(modules)
} else {
LinkResult::SingleModule(output)
LinkResult::SingleModule(Box::new(output))
};
let output_module_iter: Box<dyn Iterator<Item = &mut Module>> = match output {
LinkResult::SingleModule(ref mut m) => Box::new(std::iter::once(m)),
LinkResult::SingleModule(ref mut m) => Box::new(std::iter::once(&mut *m as &mut Module)),
LinkResult::MultipleModules(ref mut m) => Box::new(m.values_mut()),
};
for (i, output) in output_module_iter.enumerate() {

View File

@ -99,7 +99,7 @@ fn assemble_and_link(binaries: &[&[u8]]) -> Result<Module, String> {
);
assert_eq!(compiler.session().has_errors(), res.is_err());
res.map(|res| match res {
LinkResult::SingleModule(m) => m,
LinkResult::SingleModule(m) => *m,
LinkResult::MultipleModules(_) => unreachable!(),
})
})

View File

@ -36,7 +36,7 @@ pub fn read_deps_file_from(
loop {
line.clear();
if file.read_until(b'\n', &mut line.as_mut_bytes())? == 0 {
if file.read_until(b'\n', line.as_mut_bytes())? == 0 {
break;
}

View File

@ -1,6 +1,10 @@
use crate::vector::Vector;
/// Abstract trait representing a SPIR-V floating point type.
///
/// # Safety
/// Implementing this trait on non-primitive-float types breaks assumptions of other unsafe code,
/// and should not be done.
pub unsafe trait Float: num_traits::Float + crate::scalar::Scalar + Default {
const WIDTH: usize;
}

View File

@ -1,4 +1,8 @@
/// Abstract trait representing any SPIR-V integer type.
///
/// # Safety
/// Implementing this trait on non-primitive-integer types breaks assumptions of other unsafe code,
/// and should not be done.
pub unsafe trait Integer: num_traits::PrimInt + crate::scalar::Scalar {
const WIDTH: usize;
const SIGNED: bool;

View File

@ -1,4 +1,8 @@
/// Abstract trait representing a SPIR-V scalar type.
///
/// # Safety
/// Implementing this trait on non-scalar types breaks assumptions of other unsafe code, and should
/// not be done.
pub unsafe trait Scalar: Copy + Default + crate::sealed::Sealed {}
unsafe impl Scalar for bool {}

View File

@ -1,4 +1,8 @@
/// Abstract trait representing a SPIR-V vector type.
///
/// # Safety
/// Implementing this trait on non-simd-vector types breaks assumptions of other unsafe code, and
/// should not be done.
pub unsafe trait Vector<T: crate::scalar::Scalar, const N: usize>: Default {}
#[cfg(feature = "glam")]

View File

@ -5,5 +5,5 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain]
channel = "nightly-2021-09-29"
channel = "nightly-2021-10-26"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View File

@ -84,7 +84,7 @@ error[E0277]: the trait bound `{float}: Vector<f32, 2_usize>` is not satisfied
--> $DIR/debug_printf_type_checking.rs:22:31
|
22 | debug_printf!("%v2f", 11.0);
| ----------------------^^^^--
| ----------------------^^^^-
| | |
| | the trait `Vector<f32, 2_usize>` is not implemented for `{float}`
| required by a bound introduced by this call

View File

@ -12,7 +12,7 @@ pub fn main(
output: &mut glam::Vec4,
) {
let v3 = glam::Vec3::new(0.0, 1.0, 0.5);
let r1: glam::Vec4 = image1d.gather(*sampler, 0.0, 0);
let r1: glam::Vec4 = image1d.gather(*sampler, 0.0f32, 0);
let r2: glam::Vec4 = image3d.gather(*sampler, v3, 0);
*output = r1 + r2;
}

View File

@ -1,7 +1,7 @@
error[E0277]: the trait bound `Image<f32, 0_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>: HasGather` is not satisfied
--> $DIR/gather_err.rs:15:34
|
15 | let r1: glam::Vec4 = image1d.gather(*sampler, 0.0, 0);
15 | let r1: glam::Vec4 = image1d.gather(*sampler, 0.0f32, 0);
| ^^^^^^ the trait `HasGather` is not implemented for `Image<f32, 0_u32, 2_u32, 0_u32, 0_u32, 1_u32, 0_u32>`
|
= help: the following implementations were found:

View File

@ -2,7 +2,7 @@ error: `noreturn` requires a terminator at the end
--> $DIR/block_tracking_fail.rs:10:9
|
10 | asm!("", options(noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trailing terminator Unreachable requires `options(noreturn)`
--> $DIR/block_tracking_fail.rs:17:9
@ -10,7 +10,7 @@ error: trailing terminator Unreachable requires `options(noreturn)`
17 | / asm!(
18 | | "OpUnreachable",
19 | | );
| |__________^
| |_________^
error: expected OpLabel after terminator Kill
--> $DIR/block_tracking_fail.rs:26:9
@ -20,7 +20,7 @@ error: expected OpLabel after terminator Kill
28 | | "%sum = OpFAdd _ {x} {x}",
29 | | x = in(reg) x,
30 | | );
| |__________^
| |_________^
error: aborting due to 3 previous errors