Rollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk
add more `rustc_pass_by_value` r? ```@oli-obk``` cc #98766
This commit is contained in:
commit
cb2d3bb198
4 changed files with 15 additions and 14 deletions
|
@ -149,7 +149,7 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||||
fn visit_ascribe_user_ty(
|
fn visit_ascribe_user_ty(
|
||||||
&mut self,
|
&mut self,
|
||||||
_place: &Place<'tcx>,
|
_place: &Place<'tcx>,
|
||||||
_variance: &ty::Variance,
|
_variance: ty::Variance,
|
||||||
_user_ty: &UserTypeProjection,
|
_user_ty: &UserTypeProjection,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -311,6 +311,7 @@ pub enum StatementKind<'tcx> {
|
||||||
|
|
||||||
/// Describes what kind of retag is to be performed.
|
/// Describes what kind of retag is to be performed.
|
||||||
#[derive(Copy, Clone, TyEncodable, TyDecodable, Debug, PartialEq, Eq, Hash, HashStable)]
|
#[derive(Copy, Clone, TyEncodable, TyDecodable, Debug, PartialEq, Eq, Hash, HashStable)]
|
||||||
|
#[rustc_pass_by_value]
|
||||||
pub enum RetagKind {
|
pub enum RetagKind {
|
||||||
/// The initial retag when entering a function.
|
/// The initial retag when entering a function.
|
||||||
FnEntry,
|
FnEntry,
|
||||||
|
|
|
@ -147,7 +147,7 @@ macro_rules! make_mir_visitor {
|
||||||
fn visit_ascribe_user_ty(
|
fn visit_ascribe_user_ty(
|
||||||
&mut self,
|
&mut self,
|
||||||
place: & $($mutability)? Place<'tcx>,
|
place: & $($mutability)? Place<'tcx>,
|
||||||
variance: & $($mutability)? ty::Variance,
|
variance: $(& $mutability)? ty::Variance,
|
||||||
user_ty: & $($mutability)? UserTypeProjection,
|
user_ty: & $($mutability)? UserTypeProjection,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -164,7 +164,7 @@ macro_rules! make_mir_visitor {
|
||||||
|
|
||||||
fn visit_retag(
|
fn visit_retag(
|
||||||
&mut self,
|
&mut self,
|
||||||
kind: & $($mutability)? RetagKind,
|
kind: $(& $mutability)? RetagKind,
|
||||||
place: & $($mutability)? Place<'tcx>,
|
place: & $($mutability)? Place<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -425,7 +425,7 @@ macro_rules! make_mir_visitor {
|
||||||
self.visit_source_info(source_info);
|
self.visit_source_info(source_info);
|
||||||
match kind {
|
match kind {
|
||||||
StatementKind::Assign(
|
StatementKind::Assign(
|
||||||
box(ref $($mutability)? place, ref $($mutability)? rvalue)
|
box (place, rvalue)
|
||||||
) => {
|
) => {
|
||||||
self.visit_assign(place, rvalue, location);
|
self.visit_assign(place, rvalue, location);
|
||||||
}
|
}
|
||||||
|
@ -465,13 +465,13 @@ macro_rules! make_mir_visitor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
StatementKind::Retag(kind, place) => {
|
StatementKind::Retag(kind, place) => {
|
||||||
self.visit_retag(kind, place, location);
|
self.visit_retag($(& $mutability)? *kind, place, location);
|
||||||
}
|
}
|
||||||
StatementKind::AscribeUserType(
|
StatementKind::AscribeUserType(
|
||||||
box(ref $($mutability)? place, ref $($mutability)? user_ty),
|
box (place, user_ty),
|
||||||
variance
|
variance
|
||||||
) => {
|
) => {
|
||||||
self.visit_ascribe_user_ty(place, variance, user_ty, location);
|
self.visit_ascribe_user_ty(place, $(& $mutability)? *variance, user_ty, location);
|
||||||
}
|
}
|
||||||
StatementKind::Coverage(coverage) => {
|
StatementKind::Coverage(coverage) => {
|
||||||
self.visit_coverage(
|
self.visit_coverage(
|
||||||
|
@ -480,9 +480,9 @@ macro_rules! make_mir_visitor {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
StatementKind::CopyNonOverlapping(box crate::mir::CopyNonOverlapping{
|
StatementKind::CopyNonOverlapping(box crate::mir::CopyNonOverlapping{
|
||||||
ref $($mutability)? src,
|
src,
|
||||||
ref $($mutability)? dst,
|
dst,
|
||||||
ref $($mutability)? count,
|
count,
|
||||||
}) => {
|
}) => {
|
||||||
self.visit_operand(src, location);
|
self.visit_operand(src, location);
|
||||||
self.visit_operand(dst, location);
|
self.visit_operand(dst, location);
|
||||||
|
@ -517,8 +517,7 @@ macro_rules! make_mir_visitor {
|
||||||
TerminatorKind::GeneratorDrop |
|
TerminatorKind::GeneratorDrop |
|
||||||
TerminatorKind::Unreachable |
|
TerminatorKind::Unreachable |
|
||||||
TerminatorKind::FalseEdge { .. } |
|
TerminatorKind::FalseEdge { .. } |
|
||||||
TerminatorKind::FalseUnwind { .. } => {
|
TerminatorKind::FalseUnwind { .. } => {}
|
||||||
}
|
|
||||||
|
|
||||||
TerminatorKind::Return => {
|
TerminatorKind::Return => {
|
||||||
// `return` logically moves from the return place `_0`. Note that the place
|
// `return` logically moves from the return place `_0`. Note that the place
|
||||||
|
@ -830,7 +829,7 @@ macro_rules! make_mir_visitor {
|
||||||
|
|
||||||
fn super_ascribe_user_ty(&mut self,
|
fn super_ascribe_user_ty(&mut self,
|
||||||
place: & $($mutability)? Place<'tcx>,
|
place: & $($mutability)? Place<'tcx>,
|
||||||
_variance: & $($mutability)? ty::Variance,
|
_variance: $(& $mutability)? ty::Variance,
|
||||||
user_ty: & $($mutability)? UserTypeProjection,
|
user_ty: & $($mutability)? UserTypeProjection,
|
||||||
location: Location) {
|
location: Location) {
|
||||||
self.visit_place(
|
self.visit_place(
|
||||||
|
@ -847,7 +846,7 @@ macro_rules! make_mir_visitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn super_retag(&mut self,
|
fn super_retag(&mut self,
|
||||||
_kind: & $($mutability)? RetagKind,
|
_kind: $(& $mutability)? RetagKind,
|
||||||
place: & $($mutability)? Place<'tcx>,
|
place: & $($mutability)? Place<'tcx>,
|
||||||
location: Location) {
|
location: Location) {
|
||||||
self.visit_place(
|
self.visit_place(
|
||||||
|
|
|
@ -599,6 +599,7 @@ impl UnifyKey for FloatVid {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash)]
|
#[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash)]
|
||||||
|
#[rustc_pass_by_value]
|
||||||
pub enum Variance {
|
pub enum Variance {
|
||||||
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
|
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
|
||||||
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
|
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue