Skip to content

Commit b688d53

Browse files
committed
Auto merge of rust-lang#123396 - jhpratt:rollup-oa54mh1, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#122865 (Split hir ty lowerer's error reporting code in check functions to mod errors.) - rust-lang#122935 (rename ptr::from_exposed_addr -> ptr::with_exposed_provenance) - rust-lang#123182 (Avoid expanding to unstable internal method) - rust-lang#123203 (Add `Context::ext`) - rust-lang#123380 (Improve bootstrap comments) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 40f743d + f756095 commit b688d53

File tree

67 files changed

+752
-485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+752
-485
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22792279
}
22802280
}
22812281

2282-
CastKind::PointerFromExposedAddress => {
2282+
CastKind::PointerWithExposedProvenance => {
22832283
let ty_from = op.ty(body, tcx);
22842284
let cast_ty_from = CastTy::from_ty(ty_from);
22852285
let cast_ty_to = CastTy::from_ty(*ty);
@@ -2289,7 +2289,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22892289
span_mirbug!(
22902290
self,
22912291
rvalue,
2292-
"Invalid PointerFromExposedAddress cast {:?} -> {:?}",
2292+
"Invalid PointerWithExposedProvenance cast {:?} -> {:?}",
22932293
ty_from,
22942294
ty
22952295
)

compiler/rustc_codegen_cranelift/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ fn codegen_stmt<'tcx>(
650650
| CastKind::FnPtrToPtr
651651
| CastKind::PtrToPtr
652652
| CastKind::PointerExposeAddress
653-
| CastKind::PointerFromExposedAddress,
653+
| CastKind::PointerWithExposedProvenance,
654654
ref operand,
655655
to_ty,
656656
) => {

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
965965
});
966966
}
967967

968-
sym::simd_expose_addr | sym::simd_from_exposed_addr | sym::simd_cast_ptr => {
968+
sym::simd_expose_addr | sym::simd_with_exposed_provenance | sym::simd_cast_ptr => {
969969
intrinsic_args!(fx, args => (arg); intrinsic);
970970
ret.write_cvalue_transmute(fx, arg);
971971
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21392139
return Ok(bx.ptrtoint(args[0].immediate(), llret_ty));
21402140
}
21412141

2142-
if name == sym::simd_from_exposed_addr {
2142+
if name == sym::simd_with_exposed_provenance {
21432143
let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
21442144
require!(
21452145
in_len == out_len,

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
509509
// Since int2ptr can have arbitrary integer types as input (so we have to do
510510
// sign extension and all that), it is currently best handled in the same code
511511
// path as the other integer-to-X casts.
512-
| mir::CastKind::PointerFromExposedAddress => {
512+
| mir::CastKind::PointerWithExposedProvenance => {
513513
assert!(bx.cx().is_backend_immediate(cast));
514514
let ll_t_out = bx.cx().immediate_backend_type(cast);
515515
if operand.layout.abi.is_uninhabited() {

compiler/rustc_const_eval/src/interpret/cast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
4040
self.write_immediate(*res, dest)?;
4141
}
4242

43-
CastKind::PointerFromExposedAddress => {
43+
CastKind::PointerWithExposedProvenance => {
4444
let src = self.read_immediate(src)?;
45-
let res = self.pointer_from_exposed_address_cast(&src, cast_layout)?;
45+
let res = self.pointer_with_exposed_provenance_cast(&src, cast_layout)?;
4646
self.write_immediate(*res, dest)?;
4747
}
4848

@@ -242,7 +242,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
242242
Ok(ImmTy::from_scalar(self.cast_from_int_like(scalar, src.layout, cast_to.ty)?, cast_to))
243243
}
244244

245-
pub fn pointer_from_exposed_address_cast(
245+
pub fn pointer_with_exposed_provenance_cast(
246246
&self,
247247
src: &ImmTy<'tcx, M::Provenance>,
248248
cast_to: TyAndLayout<'tcx>,

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
547547
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => {
548548
self.check_op(ops::RawPtrToIntCast);
549549
}
550-
Rvalue::Cast(CastKind::PointerFromExposedAddress, _, _) => {
550+
Rvalue::Cast(CastKind::PointerWithExposedProvenance, _, _) => {
551551
// Since no pointer can ever get exposed (rejected above), this is easy to support.
552552
}
553553

compiler/rustc_const_eval/src/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
10761076
// FIXME(dyn-star): make sure nothing needs to be done here.
10771077
}
10781078
// FIXME: Add Checks for these
1079-
CastKind::PointerFromExposedAddress
1079+
CastKind::PointerWithExposedProvenance
10801080
| CastKind::PointerExposeAddress
10811081
| CastKind::PointerCoercion(_) => {}
10821082
CastKind::IntToInt | CastKind::IntToFloat => {

compiler/rustc_expand/src/build.rs

+32-8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ impl<'a> ExtCtxt<'a> {
4848
ast::Path { span, segments, tokens: None }
4949
}
5050

51+
pub fn macro_call(
52+
&self,
53+
span: Span,
54+
path: ast::Path,
55+
delim: ast::token::Delimiter,
56+
tokens: ast::tokenstream::TokenStream,
57+
) -> P<ast::MacCall> {
58+
P(ast::MacCall {
59+
path,
60+
args: P(ast::DelimArgs {
61+
dspan: ast::tokenstream::DelimSpan { open: span, close: span },
62+
delim,
63+
tokens,
64+
}),
65+
})
66+
}
67+
5168
pub fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
5269
ast::MutTy { ty, mutbl }
5370
}
@@ -265,6 +282,10 @@ impl<'a> ExtCtxt<'a> {
265282
self.expr(span, ast::ExprKind::Field(expr, field))
266283
}
267284

285+
pub fn expr_macro_call(&self, span: Span, call: P<ast::MacCall>) -> P<ast::Expr> {
286+
self.expr(span, ast::ExprKind::MacCall(call))
287+
}
288+
268289
pub fn expr_binary(
269290
&self,
270291
sp: Span,
@@ -410,18 +431,21 @@ impl<'a> ExtCtxt<'a> {
410431
self.expr(sp, ast::ExprKind::Tup(exprs))
411432
}
412433

413-
pub fn expr_fail(&self, span: Span, msg: Symbol) -> P<ast::Expr> {
414-
self.expr_call_global(
434+
pub fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
435+
self.expr_macro_call(
415436
span,
416-
[sym::std, sym::rt, sym::begin_panic].iter().map(|s| Ident::new(*s, span)).collect(),
417-
thin_vec![self.expr_str(span, msg)],
437+
self.macro_call(
438+
span,
439+
self.path_global(
440+
span,
441+
[sym::std, sym::unreachable].map(|s| Ident::new(s, span)).to_vec(),
442+
),
443+
ast::token::Delimiter::Parenthesis,
444+
ast::tokenstream::TokenStream::default(),
445+
),
418446
)
419447
}
420448

421-
pub fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
422-
self.expr_fail(span, Symbol::intern("internal error: entered unreachable code"))
423-
}
424-
425449
pub fn expr_ok(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
426450
let ok = self.std_path(&[sym::result, sym::Result, sym::Ok]);
427451
self.expr_call_global(sp, ok, thin_vec![expr])

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ pub fn check_intrinsic_type(
628628
| sym::simd_as
629629
| sym::simd_cast_ptr
630630
| sym::simd_expose_addr
631-
| sym::simd_from_exposed_addr => (2, 0, vec![param(0)], param(1)),
631+
| sym::simd_with_exposed_provenance => (2, 0, vec![param(0)], param(1)),
632632
sym::simd_bitmask => (2, 0, vec![param(0)], param(1)),
633633
sym::simd_select | sym::simd_select_bitmask => {
634634
(2, 0, vec![param(0), param(1), param(1)], param(1))

0 commit comments

Comments
 (0)