Skip to content

Rollup of 11 pull requests #134201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d442cf5
control libunwind linkage mode via `crt-static` on gnullvm targets
mati865 Sep 28, 2024
b440ef8
Move some alloc tests to the alloctests crate
bjorn3 Dec 4, 2024
67df7cb
Simplify `rustc_mir_dataflow::abs_domain`.
nnethercote Dec 8, 2024
f7ca820
Forbid unsafe_op_in_unsafe_fn in hurd-specific os and sys files
sthibaul Dec 10, 2024
014363e
Don't emit "field expressions may not have generic arguments" if it's…
Dec 10, 2024
c04b52a
Add regression tests
oli-obk Dec 9, 2024
f11edf7
allow `symbol_intern_string_literal` lint in test modules
onur-ozkan Dec 11, 2024
1268445
remove `Kind` check for `symbol_intern_string_literal`
onur-ozkan Dec 11, 2024
6a8bc4b
Remove consteval note from <*mut T>::align_offset docs.
zachs18 Dec 11, 2024
6d3d61f
Evaluate constants in SIMD vec lengths before rejecting them
oli-obk Dec 9, 2024
98edb8f
Clarify why a type is rejected for asm!
oli-obk Dec 9, 2024
1bc5897
Stabilize the Rust 2024 prelude
ehuss Dec 11, 2024
40c9645
Remove `PErr`.
nnethercote Dec 12, 2024
2caada1
Properly consider APITs for never type fallback ascription fix
compiler-errors Dec 10, 2024
a4cf1f8
Rollup merge of #122003 - mati865:gnullvm-build-libunwind, r=petroche…
matthiaskrgr Dec 12, 2024
909a3e2
Rollup merge of #133859 - bjorn3:move_tests_to_alloctests, r=tgross35
matthiaskrgr Dec 12, 2024
fed24af
Rollup merge of #134070 - oli-obk:push-nquzymupzlsq, r=jieyouxu
matthiaskrgr Dec 12, 2024
296e0ba
Rollup merge of #134144 - compiler-errors:fallback-apit, r=WaffleLapkin
matthiaskrgr Dec 12, 2024
d71576d
Rollup merge of #134152 - nnethercote:simplify-rustc_mir_dataflow-abs…
matthiaskrgr Dec 12, 2024
1d78422
Rollup merge of #134154 - dev-ardi:field-expr-generics, r=compiler-er…
matthiaskrgr Dec 12, 2024
454ed9b
Rollup merge of #134155 - sthibaul:unsafe_op_in_unsafe_fn, r=tgross35
matthiaskrgr Dec 12, 2024
958fc08
Rollup merge of #134173 - onur-ozkan:allow-symbol-intern-string-liter…
matthiaskrgr Dec 12, 2024
90f6b27
Rollup merge of #134178 - ehuss:stabilize-2024-prelude, r=amanieu,tra…
matthiaskrgr Dec 12, 2024
1055659
Rollup merge of #134179 - zachs18:align_offset_mut_ptr_doc, r=working…
matthiaskrgr Dec 12, 2024
2ced8b3
Rollup merge of #134187 - nnethercote:rm-PErr, r=jieyouxu
matthiaskrgr Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 9 additions & 35 deletions compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,34 @@
//! field-deref on a local variable, `x.field`, has the same meaning
//! in both domains). Indexed projections are the exception: `a[x]`
//! needs to be treated as mapping to the same move path as `a[y]` as
//! well as `a[13]`, etc.
//! well as `a[13]`, etc. So we map these `x`/`y` values to `()`.
//!
//! (In theory, the analysis could be extended to work with sets of
//! paths, so that `a[0]` and `a[13]` could be kept distinct, while
//! `a[x]` would still overlap them both. But that is not this
//! representation does today.)

use rustc_middle::mir::{Local, Operand, PlaceElem, ProjectionElem};
use rustc_middle::ty::Ty;

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub(crate) struct AbstractOperand;
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub(crate) struct AbstractType;
pub(crate) type AbstractElem = ProjectionElem<AbstractOperand, AbstractType>;
use rustc_middle::mir::{PlaceElem, ProjectionElem, ProjectionKind};

pub(crate) trait Lift {
type Abstract;
fn lift(&self) -> Self::Abstract;
}
impl<'tcx> Lift for Operand<'tcx> {
type Abstract = AbstractOperand;
fn lift(&self) -> Self::Abstract {
AbstractOperand
}
}
impl Lift for Local {
type Abstract = AbstractOperand;
fn lift(&self) -> Self::Abstract {
AbstractOperand
}
}
impl<'tcx> Lift for Ty<'tcx> {
type Abstract = AbstractType;
fn lift(&self) -> Self::Abstract {
AbstractType
}
fn lift(&self) -> ProjectionKind;
}

impl<'tcx> Lift for PlaceElem<'tcx> {
type Abstract = AbstractElem;
fn lift(&self) -> Self::Abstract {
fn lift(&self) -> ProjectionKind {
match *self {
ProjectionElem::Deref => ProjectionElem::Deref,
ProjectionElem::Field(f, ty) => ProjectionElem::Field(f, ty.lift()),
ProjectionElem::OpaqueCast(ty) => ProjectionElem::OpaqueCast(ty.lift()),
ProjectionElem::Index(ref i) => ProjectionElem::Index(i.lift()),
ProjectionElem::Field(f, _ty) => ProjectionElem::Field(f, ()),
ProjectionElem::OpaqueCast(_ty) => ProjectionElem::OpaqueCast(()),
ProjectionElem::Index(_i) => ProjectionElem::Index(()),
ProjectionElem::Subslice { from, to, from_end } => {
ProjectionElem::Subslice { from, to, from_end }
}
ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
ProjectionElem::ConstantIndex { offset, min_length, from_end }
}
ProjectionElem::Downcast(a, u) => ProjectionElem::Downcast(a, u),
ProjectionElem::Subtype(ty) => ProjectionElem::Subtype(ty.lift()),
ProjectionElem::Subtype(_ty) => ProjectionElem::Subtype(()),
}
}
}
4 changes: 2 additions & 2 deletions compiler/rustc_mir_dataflow/src/move_paths/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_middle::ty::{Ty, TyCtxt};
use rustc_span::Span;
use smallvec::SmallVec;

use self::abs_domain::{AbstractElem, Lift};
use self::abs_domain::Lift;
use crate::un_derefer::UnDerefer;

mod abs_domain;
Expand Down Expand Up @@ -300,7 +300,7 @@ pub struct MovePathLookup<'tcx> {
/// subsequent search so that it is solely relative to that
/// base-place). For the remaining lookup, we map the projection
/// elem to the associated MovePathIndex.
projections: FxHashMap<(MovePathIndex, AbstractElem), MovePathIndex>,
projections: FxHashMap<(MovePathIndex, ProjectionKind), MovePathIndex>,

un_derefer: UnDerefer<'tcx>,
}
Expand Down