Skip to content

Commit 1fcf41f

Browse files
committed
Removed rust-analyzer change and rebased
1 parent 4ccfa40 commit 1fcf41f

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

Diff for: compiler/rustc_borrowck/src/type_check/mod.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1692,11 +1692,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
16921692
if index >= args.len() as u128 {
16931693
span_mirbug!(self, term, "index out of bounds");
16941694
} else {
1695-
if !matches!(args[index as usize], Operand::Constant(_)) {
1696-
self.tcx().sess.emit_err(IntrinsicConstVectorArgNonConst {
1697-
span: term.source_info.span,
1698-
index,
1699-
});
1695+
if !matches!(
1696+
args[index.get() as usize],
1697+
Spanned { node: Operand::Constant(_), .. }
1698+
) {
1699+
self.tcx().dcx().emit_err(
1700+
IntrinsicConstVectorArgNonConst {
1701+
span: term.source_info.span,
1702+
index: index.get(),
1703+
},
1704+
);
17001705
}
17011706
}
17021707
}

Diff for: 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));

Diff for: compiler/rustc_passes/src/check_attr.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -2094,14 +2094,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
20942094
span: Span,
20952095
target: Target,
20962096
) -> bool {
2097-
let hir = self.tcx.hir();
2098-
20992097
if let Target::ForeignFn = target
2100-
&& let Some(parent) = hir.opt_parent_id(hir_id)
21012098
&& let hir::Node::Item(Item {
21022099
kind: ItemKind::ForeignMod { abi: Abi::Unadjusted, .. },
21032100
..
2104-
}) = self.tcx.hir_node(parent)
2101+
}) = self.tcx.parent_hir_node(hir_id)
21052102
{
21062103
let Some(list) = attr.meta_item_list() else {
21072104
// The attribute form is validated on AST.
@@ -2116,10 +2113,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21162113
for meta in list {
21172114
if let Some(LitKind::Int(val, _)) = meta.lit().map(|lit| &lit.kind) {
21182115
if *val >= arg_count {
2119-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
2116+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgOutOfBounds {
21202117
attr_span: attr.span,
21212118
span: span,
2122-
index: *val,
2119+
index: val.get(),
21232120
arg_count: decl.inputs.len(),
21242121
});
21252122
return false;
@@ -2161,7 +2158,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21612158
None
21622159
}
21632160

2164-
let param_ty = decl.inputs[*val as usize];
2161+
let param_ty = decl.inputs[val.get() as usize];
21652162
let type_id = get_type_def(self.tcx, param_ty);
21662163
let is_simd = if let Some(type_id) = type_id {
21672164
self.tcx
@@ -2173,23 +2170,23 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
21732170
false
21742171
};
21752172
if !is_simd {
2176-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
2173+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgNonVector {
21772174
attr_span: attr.span,
21782175
param_span: param_ty.span,
2179-
index: *val,
2176+
index: val.get(),
21802177
});
21812178
return false;
21822179
}
21832180
} else {
2184-
self.tcx.sess.emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
2181+
self.tcx.dcx().emit_err(errors::RustcIntrinsicConstVectorArgInvalid {
21852182
span: meta.span(),
21862183
});
21872184
return false;
21882185
}
21892186
}
21902187
} else {
21912188
self.tcx
2192-
.sess
2189+
.dcx()
21932190
.emit_err(errors::RustcIntrinsicConstVectorArg { attr_span: attr.span, span });
21942191
return false;
21952192
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
494494
rustc_attr!(
495495
rustc_const_panic_str, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
496496
),
497-
rustc_attr!(rustc_intrinsic_const_vector_arg, Normal, template!(List: "arg_index1, arg_index2, ..."), ErrorFollowing, INTERNAL_UNSTABLE),
498497

499498
// ==========================================================================
500499
// Internal attributes, Layout related:

0 commit comments

Comments
 (0)