mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Remove Ty::is_region_ptr
This commit is contained in:
parent
da7c50c089
commit
20dc532085
@ -120,9 +120,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
&& !self.upvars.is_empty()
|
||||
{
|
||||
item_msg = access_place_desc;
|
||||
debug_assert!(
|
||||
self.body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty.is_region_ptr()
|
||||
);
|
||||
debug_assert!(self.body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty.is_ref());
|
||||
debug_assert!(is_closure_or_generator(
|
||||
Place::ty_from(
|
||||
the_place_err.local,
|
||||
@ -470,11 +468,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
{
|
||||
let local_decl = &self.body.local_decls[local];
|
||||
|
||||
let (pointer_sigil, pointer_desc) = if local_decl.ty.is_region_ptr() {
|
||||
("&", "reference")
|
||||
} else {
|
||||
("*const", "pointer")
|
||||
};
|
||||
let (pointer_sigil, pointer_desc) =
|
||||
if local_decl.ty.is_ref() { ("&", "reference") } else { ("*const", "pointer") };
|
||||
|
||||
match self.local_names[local] {
|
||||
Some(name) if !local_decl.from_compiler_desugaring() => {
|
||||
@ -1258,7 +1253,7 @@ fn suggest_ampmut<'tcx>(
|
||||
(
|
||||
suggestability,
|
||||
highlight_span,
|
||||
if local_decl.ty.is_region_ptr() {
|
||||
if local_decl.ty.is_ref() {
|
||||
format!("&mut {}", ty_mut.ty)
|
||||
} else {
|
||||
format!("*mut {}", ty_mut.ty)
|
||||
|
@ -48,9 +48,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
|
||||
) -> (Pointer, Value) {
|
||||
let (ptr, vtable) = 'block: {
|
||||
if let Abi::Scalar(_) = arg.layout().abi {
|
||||
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr()
|
||||
&& !arg.layout().ty.is_region_ptr()
|
||||
{
|
||||
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr() && !arg.layout().ty.is_ref() {
|
||||
for i in 0..arg.layout().fields.count() {
|
||||
let field = arg.value_field(fx, mir::Field::new(i));
|
||||
if !field.layout().is_zst() {
|
||||
|
@ -917,7 +917,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
//
|
||||
// This is also relevant for `Pin<&mut Self>`, where we need to peel the `Pin`.
|
||||
'descend_newtypes: while !op.layout.ty.is_unsafe_ptr()
|
||||
&& !op.layout.ty.is_region_ptr()
|
||||
&& !op.layout.ty.is_ref()
|
||||
{
|
||||
for i in 0..op.layout.fields.count() {
|
||||
let field = op.extract_field(bx, i);
|
||||
@ -959,7 +959,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
Immediate(_) => {
|
||||
// See comment above explaining why we peel these newtypes
|
||||
'descend_newtypes: while !op.layout.ty.is_unsafe_ptr()
|
||||
&& !op.layout.ty.is_region_ptr()
|
||||
&& !op.layout.ty.is_ref()
|
||||
{
|
||||
for i in 0..op.layout.fields.count() {
|
||||
let field = op.extract_field(bx, i);
|
||||
|
@ -1487,7 +1487,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
{
|
||||
let deref_kind = if checked_ty.is_box() {
|
||||
"unboxing the value"
|
||||
} else if checked_ty.is_region_ptr() {
|
||||
} else if checked_ty.is_ref() {
|
||||
"dereferencing the borrow"
|
||||
} else {
|
||||
"dereferencing the type"
|
||||
|
@ -1182,7 +1182,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.inputs()
|
||||
.skip_binder()
|
||||
.get(0)
|
||||
.filter(|ty| ty.is_region_ptr() && !rcvr_ty.is_region_ptr())
|
||||
.filter(|ty| ty.is_ref() && !rcvr_ty.is_ref())
|
||||
.copied()
|
||||
.unwrap_or(rcvr_ty),
|
||||
};
|
||||
|
@ -1913,11 +1913,6 @@ impl<'tcx> Ty<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_region_ptr(self) -> bool {
|
||||
matches!(self.kind(), Ref(..))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_mutable_ptr(self) -> bool {
|
||||
matches!(
|
||||
@ -1944,7 +1939,7 @@ impl<'tcx> Ty<'tcx> {
|
||||
/// Tests if this is any kind of primitive pointer type (reference, raw pointer, fn pointer).
|
||||
#[inline]
|
||||
pub fn is_any_ptr(self) -> bool {
|
||||
self.is_region_ptr() || self.is_unsafe_ptr() || self.is_fn_ptr()
|
||||
self.is_ref() || self.is_unsafe_ptr() || self.is_fn_ptr()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -185,7 +185,7 @@ impl<'tcx> Cx<'tcx> {
|
||||
if self.typeck_results().is_coercion_cast(source.hir_id) {
|
||||
// Convert the lexpr to a vexpr.
|
||||
ExprKind::Use { source: self.mirror_expr(source) }
|
||||
} else if self.typeck_results().expr_ty(source).is_region_ptr() {
|
||||
} else if self.typeck_results().expr_ty(source).is_ref() {
|
||||
// Special cased so that we can type check that the element
|
||||
// type of the source matches the pointed to type of the
|
||||
// destination.
|
||||
|
@ -539,7 +539,7 @@ fn make_thin_self_ptr<'tcx>(
|
||||
// get a built-in pointer type
|
||||
let mut fat_pointer_layout = layout;
|
||||
'descend_newtypes: while !fat_pointer_layout.ty.is_unsafe_ptr()
|
||||
&& !fat_pointer_layout.ty.is_region_ptr()
|
||||
&& !fat_pointer_layout.ty.is_ref()
|
||||
{
|
||||
for i in 0..fat_pointer_layout.fields.count() {
|
||||
let field_layout = fat_pointer_layout.field(cx, i);
|
||||
|
Loading…
Reference in New Issue
Block a user