Skip to content

Commit b71f4ab

Browse files
committed
Removed rust-analyzer change and rebased
1 parent 9d7f9d0 commit b71f4ab

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1628,11 +1628,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
16281628
if index >= args.len() as u128 {
16291629
span_mirbug!(self, term, "index out of bounds");
16301630
} else {
1631-
if !matches!(args[index as usize], Operand::Constant(_)) {
1632-
self.tcx().sess.emit_err(IntrinsicConstVectorArgNonConst {
1633-
span: term.source_info.span,
1634-
index,
1635-
});
1631+
if !matches!(
1632+
args[index.get() as usize],
1633+
Spanned { node: Operand::Constant(_), .. }
1634+
) {
1635+
self.tcx().dcx().emit_err(
1636+
IntrinsicConstVectorArgNonConst {
1637+
span: term.source_info.span,
1638+
index: index.get(),
1639+
},
1640+
);
16361641
}
16371642
}
16381643
}

compiler/rustc_codegen_ssa/src/mir/block.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
867867
if let mir::Operand::Constant(constant) = &arg.node {
868868
let (llval, ty) = self.early_evaluate_const_vector(bx, constant);
869869
let llval = llval.unwrap_or_else(|| {
870-
bx.tcx().sess.emit_err(errors::ShuffleIndicesEvaluation {
870+
bx.tcx().dcx().emit_err(errors::ShuffleIndicesEvaluation {
871871
span: constant.span,
872872
});
873873
// We've errored, so we don't have to produce working code.
@@ -928,7 +928,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
928928
.map(|item: &NestedMetaItem| match item {
929929
NestedMetaItem::Lit(MetaItemLit {
930930
kind: LitKind::Int(index, _), ..
931-
}) => *index as usize,
931+
}) => index.get() as usize,
932932
_ => span_bug!(item.span(), "attribute argument must be an integer"),
933933
})
934934
.collect()
@@ -947,7 +947,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
947947
let (llval, ty) = self.early_evaluate_const_vector(bx, &constant);
948948
let llval = llval.unwrap_or_else(|| {
949949
bx.tcx()
950-
.sess
950+
.dcx()
951951
.emit_err(errors::ConstVectorEvaluation { span: constant.span });
952952
// We've errored, so we don't have to produce working code.
953953
let llty = bx.backend_type(bx.layout_of(ty));

compiler/rustc_passes/src/check_attr.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2125,10 +2125,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21252125
for meta in list {
21262126
if let Some(LitKind::Int(val, _)) = meta.lit().map(|lit| &lit.kind) {
21272127
if *val >= arg_count {
2128-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
2128+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
21292129
attr_span: attr.span,
21302130
span: span,
2131-
index: *val,
2131+
index: val.get(),
21322132
arg_count: decl.inputs.len(),
21332133
});
21342134
return false;
@@ -2170,7 +2170,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21702170
None
21712171
}
21722172

2173-
let param_ty = decl.inputs[*val as usize];
2173+
let param_ty = decl.inputs[val.get() as usize];
21742174
let type_id = get_type_def(self.tcx, param_ty);
21752175
let is_simd = if let Some(type_id) = type_id {
21762176
self.tcx
@@ -2182,23 +2182,23 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21822182
false
21832183
};
21842184
if !is_simd {
2185-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
2185+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
21862186
attr_span: attr.span,
21872187
param_span: param_ty.span,
2188-
index: *val,
2188+
index: val.get(),
21892189
});
21902190
return false;
21912191
}
21922192
} else {
2193-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
2193+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
21942194
span: meta.span(),
21952195
});
21962196
return false;
21972197
}
21982198
}
21992199
} else {
22002200
self.tcx
2201-
.sess
2201+
.dcx()
22022202
.emit_err(errors::RustcIntrinsicConstVectorArg { attr_span: attr.span, span });
22032203
return false;
22042204
}

library/stdarch

src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
497497
rustc_attr!(
498498
rustc_const_panic_str, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
499499
),
500-
rustc_attr!(rustc_intrinsic_const_vector_arg, Normal, template!(List: "arg_index1, arg_index2, ..."), ErrorFollowing, INTERNAL_UNSTABLE),
501500

502501
// ==========================================================================
503502
// Internal attributes, Layout related:

0 commit comments

Comments
 (0)