Skip to content

Rustup #2673

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

Closed
wants to merge 39 commits into from
Closed

Rustup #2673

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
218f60e
Merge from rustc
RalfJung Nov 5, 2022
b8baf4d
Auto merge of #2650 - RalfJung:rustup, r=RalfJung
bors Nov 5, 2022
32c90ff
Auto merge of #2638 - DrMeepster:windows-condvars, r=RalfJung
bors Nov 6, 2022
6140874
remove a stray stderr file
RalfJung Nov 6, 2022
661ad8d
Auto merge of #2653 - RalfJung:stderr, r=RalfJung
bors Nov 6, 2022
b20a030
README: Add macos cache deletion command
mkroening Nov 6, 2022
0fee883
Auto merge of #2654 - mkroening:macos-cache, r=RalfJung
bors Nov 6, 2022
d463404
bump rustc-build-sysroot
RalfJung Nov 6, 2022
0004a4f
Auto merge of #2655 - RalfJung:rustc-build-sysroot, r=RalfJung
bors Nov 6, 2022
d042a5c
Add miri_alloc, miri_dealloc
mkroening Nov 7, 2022
d52586d
Bump ui test
oli-obk Nov 8, 2022
b42f468
Auto merge of #2659 - oli-obk:ui_test_bump, r=RalfJung
bors Nov 8, 2022
4b33088
Merge from rustc
RalfJung Nov 10, 2022
4392b27
Auto merge of #2662 - RalfJung:rustup, r=RalfJung
bors Nov 10, 2022
40520b0
pthread: slight refactoring of how we access the sync object fields
RalfJung Nov 13, 2022
e16b362
Auto merge of #2663 - RalfJung:sync, r=RalfJung
bors Nov 13, 2022
162e6a5
final tweaks
RalfJung Nov 13, 2022
1e8e0bd
Auto merge of #2657 - mkroening:miri-alloc, r=RalfJung
bors Nov 13, 2022
a0f6506
Merge from rustc
RalfJung Nov 15, 2022
15e7b5a
Auto merge of #2665 - RalfJung:rustup, r=RalfJung
bors Nov 15, 2022
8f872f8
update josh instructions
RalfJung Nov 15, 2022
e814547
Auto merge of #2666 - RalfJung:josh, r=RalfJung
bors Nov 15, 2022
892f76a
adjust josh pushing and remove ./miri toolchain updating the toolchai…
RalfJung Nov 15, 2022
981afc3
Auto merge of #2667 - RalfJung:josh, r=RalfJung
bors Nov 15, 2022
e48ec37
Merge from rustc
RalfJung Nov 16, 2022
8a84ebb
Auto merge of #2668 - RalfJung:rustup, r=RalfJung
bors Nov 16, 2022
0dada97
use josh feature to fetch a specific commit
RalfJung Nov 16, 2022
ee0e990
Auto merge of #2669 - RalfJung:josh, r=RalfJung
bors Nov 16, 2022
9259552
clean up retagging recursive traversal a bit
RalfJung Nov 16, 2022
22cf3fc
Auto merge of #2670 - RalfJung:retag, r=RalfJung
bors Nov 16, 2022
5ed0f14
remove unused shell_escape dep
klensy Nov 16, 2022
4ca3e27
Auto merge of #2671 - klensy:shell_escape, r=RalfJung
bors Nov 16, 2022
2fc547c
fix handling of rust-version file in rustc-pull
RalfJung Nov 17, 2022
e7fd09c
Preparing for merge from rustc
RalfJung Nov 17, 2022
50c524c
Merge from rustc
RalfJung Nov 17, 2022
8e61ed4
change handling of rust-version file in rustc-pull, and add a sanity …
RalfJung Nov 17, 2022
8466d2f
Auto merge of #2674 - RalfJung:josh, r=RalfJung
bors Nov 17, 2022
7c85b95
Merge remote-tracking branch 'origin/master' into rustup
RalfJung Nov 17, 2022
f08415d
sync with reset branch
RalfJung Nov 17, 2022
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
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ doctest = false # and no doc tests
getrandom = { version = "0.2", features = ["std"] }
env_logger = "0.9"
log = "0.4"
shell-escape = "0.1.4"
rand = "0.8"
smallvec = "1.7"

Expand Down
40 changes: 25 additions & 15 deletions miri
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ Update and activate the rustup toolchain 'miri' to the commit given in the
`rustup-toolchain-install-master` must be installed for this to work. Any extra
flags are passed to `rustup-toolchain-install-master`.

./miri rustc-pull:
Pull and merge Miri changes from the rustc repo. The fetched commit is stored in
the `rust-version` file, so the next `./miri toolchain` will install the rustc
we just pulled.
./miri rustc-pull <commit>:
Pull and merge Miri changes from the rustc repo. Defaults to fetching the latest
rustc commit. The fetched commit is stored in the `rust-version` file, so the
next `./miri toolchain` will install the rustc that just got pulled.

./miri rustc-push <github user> <branch>:
Push Miri changes back to the rustc repo. This will pull a copy of the rustc
Expand Down Expand Up @@ -113,18 +113,17 @@ toolchain)
;;
rustc-pull)
cd "$MIRIDIR"
FETCH_COMMIT=$(git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
# We can't pull from a commit with josh
# (https://github.com/josh-project/josh/issues/1034), so we just hope that
# nothing gets merged into rustc *during* this pull.
git fetch http://localhost:8000/rust-lang/rust.git$JOSH_FILTER.git master
# Just verify that `master` didn't move.
if [[ $FETCH_COMMIT != $(git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1) ]]; then
echo "Looks like something got merged into Rust *while we were pulling*. Aborting. Please try again."
FETCH_COMMIT="$1"
if [ -z "$FETCH_COMMIT" ]; then
FETCH_COMMIT=$(git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
fi
echo "$FETCH_COMMIT" > rust-version # do this *before* merging as merging will fail in case of conflicts
# Update rust-version file. As a separate commit, since making it part of
# the merge has confused the heck out of josh in the past.
echo "$FETCH_COMMIT" > rust-version
git commit rust-version -m "Preparing for merge from rustc"
# Fetch given rustc commit and note down which one that was
git fetch http://localhost:8000/rust-lang/rust.git@$FETCH_COMMIT$JOSH_FILTER.git
git merge FETCH_HEAD --no-ff -m "Merge from rustc"
git commit rust-version --amend -m "Merge from rustc"
exit 0
;;
rustc-push)
Expand Down Expand Up @@ -157,11 +156,22 @@ rustc-push)
fi
git fetch https://github.com/rust-lang/rust $BASE
git push https://github.com/$USER/rust $BASE:refs/heads/$BRANCH -f
echo
# Do the actual push.
cd "$MIRIDIR"
echo "Pushing Miri changes..."
git push http://localhost:8000/$USER/rust.git$JOSH_FILTER.git HEAD:$BRANCH
exit 0
# Do a round-trip check to make sure the push worked as expected.
echo
git fetch http://localhost:8000/$USER/rust.git@$JOSH_FILTER.git $BRANCH &>/dev/null
if [[ $(git rev-parse HEAD) != $(git rev-parse FETCH_HEAD) ]]; then
echo "ERROR: Josh created a non-roundtrip push! Do NOT merge this into rustc!"
exit 1
else
echo "Confirmed that the push round-trips back to Miri properly. Please create a rustc PR:"
echo " https://github.com/$USER/rust/pull/new/$BRANCH"
exit 0
fi
;;
many-seeds)
for SEED in $({ echo obase=16; seq 0 255; } | bc); do
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
101e1822c3e54e63996c8aaa014d55716f3937eb
9340e5c1b9dee53fd32a18f7bfb54faabfe00b7b
97 changes: 49 additions & 48 deletions src/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use rustc_middle::mir::RetagKind;
use rustc_middle::ty::{
self,
layout::{HasParamEnv, LayoutOf},
Ty,
};
use rustc_target::abi::Abi;
use rustc_target::abi::Size;
Expand Down Expand Up @@ -983,28 +982,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
let mut visitor = RetagVisitor { ecx: this, kind, retag_cause, retag_fields };
return visitor.visit_value(place);

// Determine mutability and whether to add a protector.
// Cannot use `builtin_deref` because that reports *immutable* for `Box`,
// making it useless.
fn qualify(ty: Ty<'_>, kind: RetagKind) -> Option<(RefKind, bool)> {
match ty.kind() {
// References are simple.
ty::Ref(_, _, Mutability::Mut) =>
Some((
RefKind::Unique { two_phase: kind == RetagKind::TwoPhase },
kind == RetagKind::FnEntry,
)),
ty::Ref(_, _, Mutability::Not) =>
Some((RefKind::Shared, kind == RetagKind::FnEntry)),
// Raw pointers need to be enabled.
ty::RawPtr(tym) if kind == RetagKind::Raw =>
Some((RefKind::Raw { mutable: tym.mutbl == Mutability::Mut }, false)),
// Boxes are handled separately due to that allocator situation,
// see the visitor below.
_ => None,
}
}

// The actual visitor.
struct RetagVisitor<'ecx, 'mir, 'tcx> {
ecx: &'ecx mut MiriInterpCx<'mir, 'tcx>,
Expand Down Expand Up @@ -1057,34 +1034,58 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
return Ok(());
}

let recurse_for_fields = || {
match self.retag_fields {
RetagFields::No => false,
RetagFields::Yes => true,
RetagFields::OnlyScalar => {
// Matching `ArgAbi::new` at the time of writing, only fields of
// `Scalar` and `ScalarPair` ABI are considered.
matches!(place.layout.abi, Abi::Scalar(..) | Abi::ScalarPair(..))
// Check the type of this value to see what to do with it (retag, or recurse).
match place.layout.ty.kind() {
ty::Ref(_, _, mutbl) => {
let ref_kind = match mutbl {
Mutability::Mut =>
RefKind::Unique { two_phase: self.kind == RetagKind::TwoPhase },
Mutability::Not => RefKind::Shared,
};
self.retag_place(
place,
ref_kind,
self.retag_cause,
/*protector*/ self.kind == RetagKind::FnEntry,
)?;
}
ty::RawPtr(tym) => {
// We definitely do *not* want to recurse into raw pointers -- wide raw
// pointers have fields, and for dyn Trait pointees those can have reference
// type!
if self.kind == RetagKind::Raw {
// Raw pointers need to be enabled.
self.retag_place(
place,
RefKind::Raw { mutable: tym.mutbl == Mutability::Mut },
self.retag_cause,
/*protector*/ false,
)?;
}
}
_ if place.layout.ty.ty_adt_def().is_some_and(|adt| adt.is_box()) => {
// Recurse for boxes, they require some tricky handling and will end up in `visit_box` above.
// (Yes this means we technically also recursively retag the allocator itself
// even if field retagging is not enabled. *shrug*)
self.walk_value(place)?;
}
_ => {
// Not a reference/pointer/box. Only recurse if configured appropriately.
let recurse = match self.retag_fields {
RetagFields::No => false,
RetagFields::Yes => true,
RetagFields::OnlyScalar => {
// Matching `ArgAbi::new` at the time of writing, only fields of
// `Scalar` and `ScalarPair` ABI are considered.
matches!(place.layout.abi, Abi::Scalar(..) | Abi::ScalarPair(..))
}
};
if recurse {
self.walk_value(place)?;
}
}
};

if let Some((ref_kind, protector)) = qualify(place.layout.ty, self.kind) {
self.retag_place(place, ref_kind, self.retag_cause, protector)?;
} else if matches!(place.layout.ty.kind(), ty::RawPtr(..)) {
// Wide raw pointers *do* have fields and their types are strange.
// vtables have a type like `&[*const (); 3]` or so!
// Do *not* recurse into them.
// (No need to worry about wide references, those always "qualify". And Boxes
// are handles specially by the visitor anyway.)
} else if recurse_for_fields()
|| place.layout.ty.ty_adt_def().is_some_and(|adt| adt.is_box())
{
// Recurse deeper. Need to always recurse for `Box` to even hit `visit_box`.
// (Yes this means we technically also recursively retag the allocator itself
// even if field retagging is not enabled. *shrug*)
self.walk_value(place)?;
}

Ok(())
}
}
Expand Down