Skip to content

Commit

Permalink
Removed rust-analyzer change and rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeWort committed Feb 15, 2024
1 parent 9d7f9d0 commit 66d3179
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
15 changes: 10 additions & 5 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,11 +1628,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if index >= args.len() as u128 {
span_mirbug!(self, term, "index out of bounds");
} else {
if !matches!(args[index as usize], Operand::Constant(_)) {
self.tcx().sess.emit_err(IntrinsicConstVectorArgNonConst {
span: term.source_info.span,
index,
});
if !matches!(
args[index.get() as usize],
Spanned { node: Operand::Constant(_), .. }
) {
self.tcx().dcx().emit_err(
IntrinsicConstVectorArgNonConst {
span: term.source_info.span,
index: index.get(),
},
);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
if let mir::Operand::Constant(constant) = &arg.node {
let (llval, ty) = self.early_evaluate_const_vector(bx, constant);
let llval = llval.unwrap_or_else(|| {
bx.tcx().sess.emit_err(errors::ShuffleIndicesEvaluation {
bx.tcx().dcx().emit_err(errors::ShuffleIndicesEvaluation {
span: constant.span,
});
// We've errored, so we don't have to produce working code.
Expand Down Expand Up @@ -928,7 +928,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
.map(|item: &NestedMetaItem| match item {
NestedMetaItem::Lit(MetaItemLit {
kind: LitKind::Int(index, _), ..
}) => *index as usize,
}) => index.get() as usize,
_ => span_bug!(item.span(), "attribute argument must be an integer"),
})
.collect()
Expand All @@ -947,7 +947,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let (llval, ty) = self.early_evaluate_const_vector(bx, &constant);
let llval = llval.unwrap_or_else(|| {
bx.tcx()
.sess
.dcx()
.emit_err(errors::ConstVectorEvaluation { span: constant.span });
// We've errored, so we don't have to produce working code.
let llty = bx.backend_type(bx.layout_of(ty));
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2125,10 +2125,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
for meta in list {
if let Some(LitKind::Int(val, _)) = meta.lit().map(|lit| &lit.kind) {
if *val >= arg_count {
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
attr_span: attr.span,
span: span,
index: *val,
index: val.get(),
arg_count: decl.inputs.len(),
});
return false;
Expand Down Expand Up @@ -2170,7 +2170,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
None
}

let param_ty = decl.inputs[*val as usize];
let param_ty = decl.inputs[val.get() as usize];
let type_id = get_type_def(self.tcx, param_ty);
let is_simd = if let Some(type_id) = type_id {
self.tcx
Expand All @@ -2182,23 +2182,23 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
false
};
if !is_simd {
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
attr_span: attr.span,
param_span: param_ty.span,
index: *val,
index: val.get(),
});
return false;
}
} else {
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
span: meta.span(),
});
return false;
}
}
} else {
self.tcx
.sess
.dcx()
.emit_err(errors::RustcIntrinsicConstVectorArg { attr_span: attr.span, span });
return false;
}
Expand Down
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
rustc_attr!(
rustc_const_panic_str, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
),
rustc_attr!(rustc_intrinsic_const_vector_arg, Normal, template!(List: "arg_index1, arg_index2, ..."), ErrorFollowing, INTERNAL_UNSTABLE),

// ==========================================================================
// Internal attributes, Layout related:
Expand Down

0 comments on commit 66d3179

Please sign in to comment.