Skip to content

Commit f0baf78

Browse files
committed
rustup: update to nightly-2022-03-01.
1 parent 57eed83 commit f0baf78

File tree

17 files changed

+83
-89
lines changed

17 files changed

+83
-89
lines changed

crates/rustc_codegen_spirv/src/abi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ fn trans_intrinsic_type<'tcx>(
792792

793793
// fn type_from_variant_discriminant<'tcx, P: FromPrimitive>(
794794
// cx: &CodegenCx<'tcx>,
795-
// const_: &'tcx Const<'tcx>,
795+
// const_: Const<'tcx>,
796796
// ) -> P {
797797
// let adt_def = const_.ty.ty_adt_def().unwrap();
798798
// assert!(adt_def.is_enum());
@@ -845,10 +845,10 @@ fn trans_intrinsic_type<'tcx>(
845845

846846
fn const_int_value<'tcx, P: FromPrimitive>(
847847
cx: &CodegenCx<'tcx>,
848-
const_: &'tcx Const<'tcx>,
848+
const_: Const<'tcx>,
849849
) -> Result<P, ErrorReported> {
850-
assert!(const_.ty.is_integral());
851-
let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty);
850+
assert!(const_.ty().is_integral());
851+
let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty());
852852
match P::from_u128(value) {
853853
Some(v) => Ok(v),
854854
None => {

crates/rustc_codegen_spirv/src/attr.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,19 @@ impl CheckSpirvAttrVisitor<'_> {
375375
Err(MultipleAttrs {
376376
prev_span,
377377
category,
378-
}) => self
379-
.tcx
380-
.sess
381-
.struct_span_err(
382-
span,
383-
&format!("only one {} attribute is allowed on a {}", category, target),
384-
)
385-
.span_note(prev_span, &format!("previous {} attribute", category))
386-
.emit(),
378+
}) => {
379+
self.tcx
380+
.sess
381+
.struct_span_err(
382+
span,
383+
&format!(
384+
"only one {} attribute is allowed on a {}",
385+
category, target
386+
),
387+
)
388+
.span_note(prev_span, &format!("previous {} attribute", category))
389+
.emit();
390+
}
387391
},
388392
}
389393
}

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -330,26 +330,28 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
330330
let one = self.constant_int(size_bytes.ty, 1);
331331
let zero_align = Align::from_bytes(0).unwrap();
332332

333-
let mut header = self.build_sibling_block("memset_header");
334-
let mut body = self.build_sibling_block("memset_body");
335-
let exit = self.build_sibling_block("memset_exit");
333+
let header_bb = self.append_sibling_block("memset_header");
334+
let body_bb = self.append_sibling_block("memset_body");
335+
let exit_bb = self.append_sibling_block("memset_exit");
336336

337337
let count = self.udiv(size_bytes, size_elem_const);
338338
let index = self.alloca(count.ty, zero_align);
339339
self.store(zero, index, zero_align);
340-
self.br(header.llbb());
340+
self.br(header_bb);
341341

342-
let current_index = header.load(count.ty, index, zero_align);
343-
let cond = header.icmp(IntPredicate::IntULT, current_index, count);
344-
header.cond_br(cond, body.llbb(), exit.llbb());
342+
self.switch_to_block(header_bb);
343+
let current_index = self.load(count.ty, index, zero_align);
344+
let cond = self.icmp(IntPredicate::IntULT, current_index, count);
345+
self.cond_br(cond, body_bb, exit_bb);
345346

346-
let gep_ptr = body.gep(pat.ty, ptr, &[current_index]);
347-
body.store(pat, gep_ptr, zero_align);
348-
let current_index_plus_1 = body.add(current_index, one);
349-
body.store(current_index_plus_1, index, zero_align);
350-
body.br(header.llbb());
347+
self.switch_to_block(body_bb);
348+
let gep_ptr = self.gep(pat.ty, ptr, &[current_index]);
349+
self.store(pat, gep_ptr, zero_align);
350+
let current_index_plus_1 = self.add(current_index, one);
351+
self.store(current_index_plus_1, index, zero_align);
352+
self.br(header_bb);
351353

352-
*self = exit;
354+
self.switch_to_block(exit_bb);
353355
}
354356

355357
fn zombie_convert_ptr_to_u(&self, def: Word) {
@@ -503,23 +505,10 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
503505
.unwrap()
504506
}
505507

506-
fn build_sibling_block(&mut self, _name: &str) -> Self {
507-
let mut builder = self.emit_with_cursor(BuilderCursor {
508-
function: self.cursor.function,
509-
block: None,
510-
});
511-
let new_bb = builder.begin_block(None).unwrap();
512-
let new_cursor = BuilderCursor {
513-
function: self.cursor.function,
514-
block: builder.selected_block(),
515-
};
516-
Self {
517-
cx: self.cx,
518-
cursor: new_cursor,
519-
current_fn: self.current_fn,
520-
basic_block: new_bb,
521-
current_span: Default::default(),
522-
}
508+
fn switch_to_block(&mut self, llbb: Self::BasicBlock) {
509+
// FIXME(eddyb) this could be more efficient by having an index in
510+
// `Self::BasicBlock`, not just a SPIR-V ID.
511+
*self = Self::build(self.cx, llbb);
523512
}
524513

525514
fn ret_void(&mut self) {

crates/rustc_codegen_spirv/src/builder/intrinsics.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,14 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
335335
// HACK(eddyb) there is no `abort` or `trap` instruction in SPIR-V,
336336
// so the best thing we can do is inject an infinite loop.
337337
// (While there is `OpKill`, it doesn't really have the right semantics)
338-
let mut abort_loop_bx = self.build_sibling_block("abort_loop");
339-
abort_loop_bx.br(abort_loop_bx.llbb());
340-
self.br(abort_loop_bx.llbb());
341-
*self = self.build_sibling_block("abort_continue");
338+
let abort_loop_bb = self.append_sibling_block("abort_loop");
339+
let abort_continue_bb = self.append_sibling_block("abort_continue");
340+
self.br(abort_loop_bb);
341+
342+
self.switch_to_block(abort_loop_bb);
343+
self.br(abort_loop_bb);
344+
345+
self.switch_to_block(abort_continue_bb);
342346
}
343347

344348
fn assume(&mut self, _val: Self::Value) {

crates/rustc_codegen_spirv/src/builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_codegen_ssa::traits::{
2020
AbiBuilderMethods, ArgAbiMethods, BackendTypes, BuilderMethods, CoverageInfoBuilderMethods,
2121
DebugInfoBuilderMethods, HasCodegen, StaticBuilderMethods,
2222
};
23-
use rustc_errors::DiagnosticBuilder;
23+
use rustc_errors::{DiagnosticBuilder, ErrorReported};
2424
use rustc_middle::mir::coverage::{
2525
CodeRegion, CounterValueReference, ExpressionOperandId, InjectedExpressionId, Op,
2626
};
@@ -70,7 +70,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7070
}
7171
}
7272

73-
pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> {
73+
pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorReported> {
7474
if let Some(current_span) = self.current_span {
7575
self.tcx.sess.struct_span_err(current_span, msg)
7676
} else {

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,26 +239,27 @@ impl<'tcx> CodegenCx<'tcx> {
239239
storage_class_attr.span,
240240
"redundant storage class specifier, storage class is inferred from type",
241241
),
242-
Some(inferred) => self
243-
.tcx
244-
.sess
245-
.struct_span_err(hir_param.span, "storage class mismatch")
246-
.span_label(
247-
storage_class_attr.span,
248-
format!("{:?} specified in attribute", storage_class),
249-
)
250-
.span_label(
251-
hir_param.ty_span,
252-
format!("{:?} inferred from type", inferred),
253-
)
254-
.span_help(
255-
storage_class_attr.span,
256-
&format!(
257-
"remove storage class attribute to use {:?} as storage class",
258-
inferred
259-
),
260-
)
261-
.emit(),
242+
Some(inferred) => {
243+
self.tcx
244+
.sess
245+
.struct_span_err(hir_param.span, "storage class mismatch")
246+
.span_label(
247+
storage_class_attr.span,
248+
format!("{:?} specified in attribute", storage_class),
249+
)
250+
.span_label(
251+
hir_param.ty_span,
252+
format!("{:?} inferred from type", inferred),
253+
)
254+
.span_help(
255+
storage_class_attr.span,
256+
&format!(
257+
"remove storage class attribute to use {:?} as storage class",
258+
inferred
259+
),
260+
)
261+
.emit();
262+
}
262263
None => (),
263264
}
264265

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2424
use rustc_middle::mir::mono::CodegenUnit;
2525
use rustc_middle::mir::Body;
2626
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt};
27-
use rustc_middle::ty::{Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt, TyS};
27+
use rustc_middle::ty::{Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
2828
use rustc_session::Session;
2929
use rustc_span::def_id::{DefId, LOCAL_CRATE};
3030
use rustc_span::symbol::{sym, Symbol};
@@ -614,7 +614,7 @@ impl<'tcx> DebugInfoMethods<'tcx> for CodegenCx<'tcx> {
614614
fn dbg_scope_fn(
615615
&self,
616616
_: rustc_middle::ty::Instance<'tcx>,
617-
_: &FnAbi<'tcx, &'tcx TyS<'tcx>>,
617+
_: &FnAbi<'tcx, Ty<'tcx>>,
618618
_: Option<Self::Function>,
619619
) -> Self::DIScope {
620620
todo!()

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
509509
};
510510
if let Ok(ref path) = env::var("DUMP_MODULE_ON_PANIC") {
511511
let module_dumper = DumpModuleOnPanic { cx: &cx, path };
512-
with_no_trimmed_paths(do_codegen);
512+
with_no_trimmed_paths!(do_codegen());
513513
drop(module_dumper);
514514
} else {
515-
with_no_trimmed_paths(do_codegen);
515+
with_no_trimmed_paths!(do_codegen());
516516
}
517517
let spirv_module = cx.finalize_module().assemble();
518518

crates/rustc_codegen_spirv/src/link.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ fn do_spirv_opt(
297297
// TODO: Adds spans here? Not sure how useful with binary, but maybe?
298298

299299
let mut err = match msg.level {
300-
Level::Fatal | Level::InternalError => sess.struct_fatal(&msg.message),
301-
Level::Error => sess.struct_err(&msg.message),
300+
Level::Fatal | Level::InternalError => {
301+
sess.struct_fatal(&msg.message).forget_guarantee()
302+
}
303+
Level::Error => sess.struct_err(&msg.message).forget_guarantee(),
302304
Level::Warning => sess.struct_warn(&msg.message),
303305
Level::Info | Level::Debug => sess.struct_note_without_error(&msg.message),
304306
};

crates/rustc_codegen_spirv/src/linker/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ fn assemble_and_link(binaries: &[&[u8]]) -> Result<Module, String> {
7171
let config = rustc_interface::Config {
7272
opts: sopts,
7373
crate_cfg: Default::default(),
74+
crate_check_cfg: Default::default(),
7475
input: Input::File(PathBuf::new()),
7576
input_path: None,
7677
output_file: None,
7778
output_dir: None,
7879
file_loader: None,
7980
diagnostic_output: DiagnosticOutput::Raw(Box::new(write_diags)),
80-
stderr: None,
8181
lint_caps: Default::default(),
8282
parse_sess_created: None,
8383
register_lints: None,

0 commit comments

Comments
 (0)