diff options
| author | bors <bors@rust-lang.org> | 2024-03-09 20:51:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-09 20:51:26 +0000 |
| commit | 2d24fe591f30386d6d5fc2bb941c78d7266bf10f (patch) | |
| tree | 4d4014d245653353b1d590f532ec7eb0290a778f /tests | |
| parent | 25ee3c6a2f429a97ff4ad239e3f42409cd71fe0a (diff) | |
| parent | 13ca978f914a2ffb212698e7fd69aaf10611fb8e (diff) | |
| download | rust-2d24fe591f30386d6d5fc2bb941c78d7266bf10f.tar.gz rust-2d24fe591f30386d6d5fc2bb941c78d7266bf10f.zip | |
Auto merge of #122256 - Nadrieril:rollup-rc232xh, r=Nadrieril
Rollup of 8 pull requests
Successful merges:
- #99153 (Add Read Impl for &Stdin)
- #114655 (Make `impl<Fd: AsFd>` impl take `?Sized`)
- #120504 (Vec::try_with_capacity)
- #121280 (Implement MaybeUninit::fill{,_with,_from})
- #121403 (impl From<TryReserveError> for io::Error)
- #121526 (on the fly type casting for `build.rustc` and `build.cargo`)
- #121584 (bump itertools to 0.12)
- #121711 (Implement junction_point)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/codegen/vec-with-capacity.rs | 35 | ||||
| -rw-r--r-- | tests/ui/hygiene/panic-location.run.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/suggestions/deref-path-method.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/ufcs/bad-builder.stderr | 4 |
4 files changed, 40 insertions, 5 deletions
diff --git a/tests/codegen/vec-with-capacity.rs b/tests/codegen/vec-with-capacity.rs new file mode 100644 index 00000000000..47051f2eef8 --- /dev/null +++ b/tests/codegen/vec-with-capacity.rs @@ -0,0 +1,35 @@ +//@ compile-flags: -O +//@ ignore-debug +// (with debug assertions turned on, `assert_unchecked` generates a real assertion) + +#![crate_type = "lib"] +#![feature(try_with_capacity)] + +// CHECK-LABEL: @with_capacity_does_not_grow1 +#[no_mangle] +pub fn with_capacity_does_not_grow1() -> Vec<u32> { + let v = Vec::with_capacity(1234); + // CHECK: call {{.*}}__rust_alloc( + // CHECK-NOT: call {{.*}}__rust_realloc + // CHECK-NOT: call {{.*}}capacity_overflow + // CHECK-NOT: call {{.*}}finish_grow + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: memcpy + // CHECK-NOT: memset + v +} + +// CHECK-LABEL: @try_with_capacity_does_not_grow2 +#[no_mangle] +pub fn try_with_capacity_does_not_grow2() -> Option<Vec<Vec<u8>>> { + let v = Vec::try_with_capacity(1234).ok()?; + // CHECK: call {{.*}}__rust_alloc( + // CHECK-NOT: call {{.*}}__rust_realloc + // CHECK-NOT: call {{.*}}capacity_overflow + // CHECK-NOT: call {{.*}}finish_grow + // CHECK-NOT: call {{.*}}handle_alloc_error + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: memcpy + // CHECK-NOT: memset + Some(v) +} diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index 5c552411da7..ec0ce18c3df 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,3 +1,3 @@ -thread 'main' panicked at library/alloc/src/raw_vec.rs:571:5: +thread 'main' panicked at library/alloc/src/raw_vec.rs:26:5: capacity overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr index a2b68fa966f..b27d9aef066 100644 --- a/tests/ui/suggestions/deref-path-method.stderr +++ b/tests/ui/suggestions/deref-path-method.stderr @@ -7,9 +7,9 @@ LL | Vec::contains(&vec, &0); note: if you're trying to build a new `Vec<_, _>` consider using one of the following associated functions: Vec::<T>::new Vec::<T>::with_capacity + Vec::<T>::try_with_capacity Vec::<T>::from_raw_parts - Vec::<T, A>::new_in - and 2 others + and 4 others --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: the function `contains` is implemented on `[_]` | diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index e1c5e45b3eb..9cfeb7a5d09 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -7,9 +7,9 @@ LL | Vec::<Q>::mew() note: if you're trying to build a new `Vec<Q>` consider using one of the following associated functions: Vec::<T>::new Vec::<T>::with_capacity + Vec::<T>::try_with_capacity Vec::<T>::from_raw_parts - Vec::<T, A>::new_in - and 2 others + and 4 others --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: there is an associated function `new` with a similar name | |
