Skip to content

Commit f769045

Browse files
committed
Auto merge of #2935 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 5f81d83 + 6ea5035 commit f769045

File tree

100 files changed

+1654
-1288
lines changed

Some content is hidden

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

100 files changed

+1654
-1288
lines changed

.github/workflows/dependencies.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Automatically run `cargo update` periodically
2+
3+
---
4+
name: Bump dependencies in Cargo.lock
5+
on:
6+
schedule:
7+
# Run weekly
8+
- cron: '0 0 * * Sun'
9+
workflow_dispatch:
10+
# Needed so we can run it manually
11+
permissions:
12+
contents: read
13+
defaults:
14+
run:
15+
shell: bash
16+
env:
17+
# So cargo doesn't complain about unstable features
18+
RUSTC_BOOTSTRAP: 1
19+
PR_TITLE: Weekly `cargo update`
20+
PR_MESSAGE: |
21+
Automation to keep dependencies in `Cargo.lock` current.
22+
23+
The following is the output from `cargo update`:
24+
COMMIT_MESSAGE: "cargo update \n\n"
25+
26+
jobs:
27+
not-waiting-on-bors:
28+
name: skip if S-waiting-on-bors
29+
runs-on: ubuntu-latest
30+
steps:
31+
- env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
# Fetch state and labels of PR
35+
# Or exit successfully if PR does not exist
36+
JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
37+
STATE=$(echo "$JSON" | jq -r '.state')
38+
WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')
39+
40+
# Exit with error if open and S-waiting-on-bors
41+
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
42+
exit 1
43+
fi
44+
45+
update:
46+
name: update dependencies
47+
needs: not-waiting-on-bors
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: checkout the source code
51+
uses: actions/checkout@v3
52+
with:
53+
submodules: recursive
54+
- name: install the bootstrap toolchain
55+
run: |
56+
# Extract the stage0 version
57+
TOOLCHAIN=$(jq -r '.compiler | {version,date} | join("-")' -- src/stage0.json)
58+
# Install and set as default
59+
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
60+
rustup default $TOOLCHAIN
61+
62+
- name: cargo update
63+
# Remove first line that always just says "Updating crates.io index"
64+
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
65+
- name: upload Cargo.lock artifact for use in PR
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: Cargo-lock
69+
path: Cargo.lock
70+
retention-days: 1
71+
- name: upload cargo-update log artifact for use in PR
72+
uses: actions/upload-artifact@v3
73+
with:
74+
name: cargo-updates
75+
path: cargo_update.log
76+
retention-days: 1
77+
78+
pr:
79+
name: amend PR
80+
needs: update
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: write
84+
pull-requests: write
85+
steps:
86+
- name: checkout the source code
87+
uses: actions/checkout@v3
88+
89+
- name: download Cargo.lock from update job
90+
uses: actions/download-artifact@v3
91+
with:
92+
name: Cargo-lock
93+
- name: download cargo-update log from update job
94+
uses: actions/download-artifact@v3
95+
with:
96+
name: cargo-updates
97+
98+
- name: craft PR body and commit message
99+
run: |
100+
echo "${COMMIT_MESSAGE}" > commit.txt
101+
cat cargo_update.log >> commit.txt
102+
103+
echo "${PR_MESSAGE}" > body.md
104+
echo '```txt' >> body.md
105+
cat cargo_update.log >> body.md
106+
echo '```' >> body.md
107+
108+
- name: commit
109+
run: |
110+
git config user.name github-actions
111+
git config user.email github-actions@github.com
112+
git switch --force-create cargo_update
113+
git add ./Cargo.lock
114+
git commit --no-verify --file=commit.txt
115+
116+
- name: push
117+
run: git push --no-verify --force --set-upstream origin cargo_update
118+
119+
- name: edit existing open pull request
120+
id: edit
121+
# Don't fail job if we need to open new PR
122+
continue-on-error: true
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
run: |
126+
# Exit with error if PR is closed
127+
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
128+
if [[ "$STATE" != "OPEN" ]]; then
129+
exit 1
130+
fi
131+
132+
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
133+
134+
- name: open new pull request
135+
# Only run if there wasn't an existing PR
136+
if: steps.edit.outcome != 'success'
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ fn check_opaque_type_well_formed<'tcx>(
330330
// Require the hidden type to be well-formed with only the generics of the opaque type.
331331
// Defining use functions may have more bounds than the opaque type, which is ok, as long as the
332332
// hidden type is well formed even without those bounds.
333-
let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
333+
let predicate =
334+
ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::WellFormed(definition_ty.into())));
334335
ocx.register_obligation(Obligation::misc(tcx, definition_span, def_id, param_env, predicate));
335336

336337
// Check that all obligations are satisfied by the implementation's

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,9 +1419,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14191419
//
14201420
// See #91068 for an example.
14211421
self.prove_predicates(
1422-
sig.inputs_and_output
1423-
.iter()
1424-
.map(|ty| ty::Binder::dummy(ty::PredicateKind::WellFormed(ty.into()))),
1422+
sig.inputs_and_output.iter().map(|ty| {
1423+
ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::WellFormed(
1424+
ty.into(),
1425+
)))
1426+
}),
14251427
term_location.to_locations(),
14261428
ConstraintCategory::Boring,
14271429
);
@@ -1850,7 +1852,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18501852

18511853
let array_ty = rvalue.ty(body.local_decls(), tcx);
18521854
self.prove_predicate(
1853-
ty::PredicateKind::WellFormed(array_ty.into()),
1855+
ty::PredicateKind::Clause(ty::Clause::WellFormed(array_ty.into())),
18541856
Locations::Single(location),
18551857
ConstraintCategory::Boring,
18561858
);

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,16 +379,12 @@ fn parse_clobber_abi<'a>(p: &mut Parser<'a>, args: &mut AsmArgs) -> PResult<'a,
379379
}
380380

381381
let mut new_abis = Vec::new();
382-
loop {
382+
while !p.eat(&token::CloseDelim(Delimiter::Parenthesis)) {
383383
match p.parse_str_lit() {
384384
Ok(str_lit) => {
385385
new_abis.push((str_lit.symbol_unescaped, str_lit.span));
386386
}
387387
Err(opt_lit) => {
388-
// If the non-string literal is a closing paren then it's the end of the list and is fine
389-
if p.eat(&token::CloseDelim(Delimiter::Parenthesis)) {
390-
break;
391-
}
392388
let span = opt_lit.map_or(p.token.span, |lit| lit.span);
393389
let mut err =
394390
p.sess.span_diagnostic.struct_span_err(span, "expected string literal");

compiler/rustc_codegen_cranelift/example/mini_core.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ impl<T> Box<T> {
546546

547547
impl<T: ?Sized, A> Drop for Box<T, A> {
548548
fn drop(&mut self) {
549-
// drop is currently performed by compiler.
549+
// inner value is dropped by compiler
550+
libc::free(self.0.pointer.0 as *mut u8);
550551
}
551552
}
552553

@@ -563,11 +564,6 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
563564
libc::malloc(size)
564565
}
565566

566-
#[lang = "box_free"]
567-
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
568-
libc::free(ptr.pointer.0 as *mut u8);
569-
}
570-
571567
#[lang = "drop"]
572568
pub trait Drop {
573569
fn drop(&mut self);

compiler/rustc_codegen_gcc/example/mini_core.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> fo
490490

491491
impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
492492
fn drop(&mut self) {
493-
// drop is currently performed by compiler.
493+
// inner value is dropped by compiler
494+
libc::free(self.pointer.0 as *mut u8);
494495
}
495496
}
496497

@@ -507,11 +508,6 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
507508
libc::malloc(size)
508509
}
509510

510-
#[lang = "box_free"]
511-
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
512-
libc::free(ptr.pointer.0 as *mut u8);
513-
}
514-
515511
#[lang = "drop"]
516512
pub trait Drop {
517513
fn drop(&mut self);

compiler/rustc_const_eval/src/transform/promote_consts.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
1515
use rustc_hir as hir;
1616
use rustc_middle::mir;
17-
use rustc_middle::mir::traversal::ReversePostorderIter;
1817
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
1918
use rustc_middle::mir::*;
2019
use rustc_middle::ty::subst::InternalSubsts;
@@ -53,9 +52,8 @@ impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx> {
5352
return;
5453
}
5554

56-
let mut rpo = traversal::reverse_postorder(body);
5755
let ccx = ConstCx::new(tcx, body);
58-
let (mut temps, all_candidates) = collect_temps_and_candidates(&ccx, &mut rpo);
56+
let (mut temps, all_candidates) = collect_temps_and_candidates(&ccx);
5957

6058
let promotable_candidates = validate_candidates(&ccx, &mut temps, &all_candidates);
6159

@@ -166,14 +164,13 @@ impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> {
166164

167165
pub fn collect_temps_and_candidates<'tcx>(
168166
ccx: &ConstCx<'_, 'tcx>,
169-
rpo: &mut ReversePostorderIter<'_, 'tcx>,
170167
) -> (IndexVec<Local, TempState>, Vec<Candidate>) {
171168
let mut collector = Collector {
172169
temps: IndexVec::from_elem(TempState::Undefined, &ccx.body.local_decls),
173170
candidates: vec![],
174171
ccx,
175172
};
176-
for (bb, data) in rpo {
173+
for (bb, data) in traversal::reverse_postorder(ccx.body) {
177174
collector.visit_basic_block_data(bb, data);
178175
}
179176
(collector.temps, collector.candidates)

compiler/rustc_hir/src/lang_items.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ language_item_table! {
250250
FormatUnsafeArg, sym::format_unsafe_arg, format_unsafe_arg, Target::Struct, GenericRequirement::None;
251251

252252
ExchangeMalloc, sym::exchange_malloc, exchange_malloc_fn, Target::Fn, GenericRequirement::None;
253-
BoxFree, sym::box_free, box_free_fn, Target::Fn, GenericRequirement::Minimum(1);
254253
DropInPlace, sym::drop_in_place, drop_in_place_fn, Target::Fn, GenericRequirement::Minimum(1);
255254
AllocLayout, sym::alloc_layout, alloc_layout, Target::Struct, GenericRequirement::None;
256255

0 commit comments

Comments
 (0)