Skip to content

Commit 920d95e

Browse files
committed
Auto merge of rust-lang#139085 - matthiaskrgr:rollup-3q2peol, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#138976 (Explain one-past-the-end pointer in std library) - rust-lang#139052 (Put pin!() tests in the right file.) - rust-lang#139058 (Fix formatting nit in process.rs) - rust-lang#139063 (Fix TAIT & ATPIT feature gating in the presence of anon consts) - rust-lang#139065 (Miri subtree update) - rust-lang#139069 (`io::Take`: avoid new `BorrowedBuf` creation in some case) - rust-lang#139075 (Do not treat lifetimes from parent items as influencing child items) - rust-lang#139079 (tracking autodiff files via triagebot.toml) Failed merges: - rust-lang#139044 (bootstrap: Avoid cloning `change-id` list) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 19f42cb + 20f2655 commit 920d95e

Some content is hidden

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

41 files changed

+501
-128
lines changed

Cargo.lock

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ dependencies = [
535535
"termize",
536536
"tokio",
537537
"toml 0.7.8",
538-
"ui_test 0.29.2",
538+
"ui_test",
539539
"walkdir",
540540
]
541541

@@ -2262,7 +2262,7 @@ dependencies = [
22622262
"smallvec",
22632263
"tempfile",
22642264
"tikv-jemalloc-sys",
2265-
"ui_test 0.28.0",
2265+
"ui_test",
22662266
"windows-sys 0.52.0",
22672267
]
22682268

@@ -5508,32 +5508,6 @@ version = "0.1.7"
55085508
source = "registry+https://github.com/rust-lang/crates.io-index"
55095509
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
55105510

5511-
[[package]]
5512-
name = "ui_test"
5513-
version = "0.28.0"
5514-
source = "registry+https://github.com/rust-lang/crates.io-index"
5515-
checksum = "7484683d60d50ca1d1b6433c3dbf6c5ad71d20387acdcfb16fe79573f3fba576"
5516-
dependencies = [
5517-
"annotate-snippets 0.11.5",
5518-
"anyhow",
5519-
"bstr",
5520-
"cargo-platform",
5521-
"cargo_metadata 0.18.1",
5522-
"color-eyre",
5523-
"colored",
5524-
"comma",
5525-
"crossbeam-channel",
5526-
"indicatif",
5527-
"levenshtein",
5528-
"prettydiff",
5529-
"regex",
5530-
"rustc_version",
5531-
"rustfix",
5532-
"serde",
5533-
"serde_json",
5534-
"spanned",
5535-
]
5536-
55375511
[[package]]
55385512
name = "ui_test"
55395513
version = "0.29.2"

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ impl<'a> PostExpansionVisitor<'a> {
9999
}
100100
visit::walk_ty(self, ty);
101101
}
102+
103+
fn visit_anon_const(&mut self, _: &ast::AnonConst) -> Self::Result {
104+
// We don't walk the anon const because it crosses a conceptual boundary: We're no
105+
// longer "inside" the original type.
106+
// Brittle: We assume that the callers of `check_impl_trait` will later recurse into
107+
// the items found in the AnonConst to look for nested TyAliases.
108+
}
102109
}
103110
ImplTraitVisitor { vis: self, in_associated_ty }.visit_ty(ty);
104111
}

compiler/rustc_resolve/src/late.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1833,14 +1833,17 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18331833
}
18341834
LifetimeRibKind::StaticIfNoLifetimeInScope { lint_id: node_id, emit_lint } => {
18351835
let mut lifetimes_in_scope = vec![];
1836-
for rib in &self.lifetime_ribs[..i] {
1836+
for rib in self.lifetime_ribs[..i].iter().rev() {
18371837
lifetimes_in_scope.extend(rib.bindings.iter().map(|(ident, _)| ident.span));
18381838
// Consider any anonymous lifetimes, too
18391839
if let LifetimeRibKind::AnonymousCreateParameter { binder, .. } = rib.kind
18401840
&& let Some(extra) = self.r.extra_lifetime_params_map.get(&binder)
18411841
{
18421842
lifetimes_in_scope.extend(extra.iter().map(|(ident, _, _)| ident.span));
18431843
}
1844+
if let LifetimeRibKind::Item = rib.kind {
1845+
break;
1846+
}
18441847
}
18451848
if lifetimes_in_scope.is_empty() {
18461849
self.record_lifetime_res(

library/core/src/ptr/const_ptr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ impl<T: ?Sized> *const T {
386386
/// * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
387387
/// [allocated object], and the entire memory range between `self` and the result must be in
388388
/// bounds of that allocated object. In particular, this range must not "wrap around" the edge
389-
/// of the address space.
389+
/// of the address space. Note that "range" here refers to a half-open range as usual in Rust,
390+
/// i.e., `self..result` for non-negative offsets and `result..self` for negative offsets.
390391
///
391392
/// Allocated objects can never be larger than `isize::MAX` bytes, so if the computed offset
392393
/// stays in bounds of the allocated object, it is guaranteed to satisfy the first requirement.

library/coretests/tests/pin.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ fn pin_const() {
3434
}
3535

3636
pin_mut_const();
37-
38-
// Check that we accept a Rust 2024 $expr.
39-
std::pin::pin!(const { 1 });
4037
}
4138

4239
#[allow(unused)]
@@ -84,14 +81,3 @@ mod pin_coerce_unsized {
8481
arg
8582
}
8683
}
87-
88-
#[test]
89-
#[cfg(not(bootstrap))]
90-
fn temp_lifetime() {
91-
// Check that temporary lifetimes work as in Rust 2021.
92-
// Regression test for https://github.com/rust-lang/rust/issues/138596
93-
match std::pin::pin!(foo(&mut 0)) {
94-
_ => {}
95-
}
96-
async fn foo(_: &mut usize) {}
97-
}

library/coretests/tests/pin_macro.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@ fn unsize_coercion() {
3030
let dyn_obj: Pin<&mut dyn Send> = pin!([PhantomPinned; 2]);
3131
stuff(dyn_obj);
3232
}
33+
34+
#[test]
35+
fn rust_2024_expr() {
36+
// Check that we accept a Rust 2024 $expr.
37+
std::pin::pin!(const { 1 });
38+
}
39+
40+
#[test]
41+
#[cfg(not(bootstrap))]
42+
fn temp_lifetime() {
43+
// Check that temporary lifetimes work as in Rust 2021.
44+
// Regression test for https://github.com/rust-lang/rust/issues/138596
45+
match std::pin::pin!(foo(&mut 0)) {
46+
_ => {}
47+
}
48+
async fn foo(_: &mut usize) {}
49+
}

library/std/src/io/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,11 +2989,11 @@ impl<T: Read> Read for Take<T> {
29892989
return Ok(());
29902990
}
29912991

2992-
if self.limit <= buf.capacity() as u64 {
2993-
// if we just use an as cast to convert, limit may wrap around on a 32 bit target
2994-
let limit = cmp::min(self.limit, usize::MAX as u64) as usize;
2992+
if self.limit < buf.capacity() as u64 {
2993+
// The condition above guarantees that `self.limit` fits in `usize`.
2994+
let limit = self.limit as usize;
29952995

2996-
let extra_init = cmp::min(limit as usize, buf.init_ref().len());
2996+
let extra_init = cmp::min(limit, buf.init_ref().len());
29972997

29982998
// SAFETY: no uninit data is written to ibuf
29992999
let ibuf = unsafe { &mut buf.as_mut()[..limit] };

library/std/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ impl crate::sealed::Sealed for ExitStatusError {}
18361836
/// # if cfg!(unix) {
18371837
/// use std::process::{Command, ExitStatusError};
18381838
///
1839-
/// fn run(cmd: &str) -> Result<(),ExitStatusError> {
1839+
/// fn run(cmd: &str) -> Result<(), ExitStatusError> {
18401840
/// Command::new(cmd).status().unwrap().exit_ok()?;
18411841
/// Ok(())
18421842
/// }

src/tools/miri/.github/workflows/sysroots.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- name: Build the sysroots
1818
run: |
19+
rustup toolchain install nightly
1920
cargo install -f rustup-toolchain-install-master
2021
./miri toolchain -c rust-docs # Docs are the only place targets are separated by tier
2122
./miri install

src/tools/miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
10791079

10801080
[[package]]
10811081
name = "ui_test"
1082-
version = "0.28.0"
1082+
version = "0.29.1"
10831083
source = "registry+https://github.com/rust-lang/crates.io-index"
1084-
checksum = "7484683d60d50ca1d1b6433c3dbf6c5ad71d20387acdcfb16fe79573f3fba576"
1084+
checksum = "14bf63f2931a28a04af0bd24c5f850223d29f3a40afae49ed6ce442a65eb8652"
10851085
dependencies = [
10861086
"annotate-snippets",
10871087
"anyhow",

0 commit comments

Comments
 (0)