Skip to content

Commit 86e5a72

Browse files
committed
fix ui test fallout
1 parent 873962f commit 86e5a72

File tree

19 files changed

+86
-209
lines changed

19 files changed

+86
-209
lines changed

library/alloc/src/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ unsafe fn box_new_uninit(size: usize, align: usize) -> *mut u8 {
248248
}
249249
}
250250

251-
/// Writes `x` into `b`, then returns `b` at its new type`.
251+
/// Writes `x` into `b`, then returns `b` at its new type.
252252
///
253253
/// This is needed for `vec!`, which can't afford any extra copies of the argument (or else debug
254254
/// builds regress), has to be written fully as a call chain without `let` (or else the temporary
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fn foo(a: i32) -> Vec<i32> {
22
vec![1, 2, 3]
3-
//~^ ERROR allocations are not allowed
4-
//~| ERROR cannot call non-const method
3+
//~^ ERROR cannot call non-const
4+
//~| ERROR cannot call non-const
55
}
66

77
fn main() {}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
error[E0010]: allocations are not allowed in constant functions
1+
error[E0015]: cannot call non-const associated function `Box::<[i32; 3]>::new_uninit` in constant functions
22
--> $DIR/bad_const_fn_body_ice.rs:2:5
33
|
44
LL | vec![1, 2, 3]
5-
| ^^^^^^^^^^^^^ allocation not allowed in constant functions
5+
| ^^^^^^^^^^^^^
66
|
7+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
78
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
89

9-
error[E0015]: cannot call non-const method `slice::<impl [i32]>::into_vec::<std::alloc::Global>` in constant functions
10+
error[E0015]: cannot call non-const function `box_array_into_vec::<i32, 3>` in constant functions
1011
--> $DIR/bad_const_fn_body_ice.rs:2:5
1112
|
1213
LL | vec![1, 2, 3]
@@ -17,5 +18,4 @@ LL | vec![1, 2, 3]
1718

1819
error: aborting due to 2 previous errors
1920

20-
Some errors have detailed explanations: E0010, E0015.
21-
For more information about an error, try `rustc --explain E0010`.
21+
For more information about this error, try `rustc --explain E0015`.

tests/ui/coroutine/issue-105084.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ fn copy<T: Copy>(x: T) -> T {
1414
fn main() {
1515
let mut g = #[coroutine]
1616
|| {
17-
// This is desuraged as 4 stages:
18-
// - allocate a `*mut u8` with `exchange_malloc`;
19-
// - create a Box that is ignored for trait computations;
17+
// This is desuraged as 3 stages:
18+
// - `init_box_via_move`
2019
// - compute fields (and yields);
2120
// - assign to `t`.
22-
let t = std::boxed::box_new((5, yield));
21+
let t = Box::new_uninit();
22+
let t = std::boxed::init_box_via_move(t, (5, yield));
2323
drop(t);
2424
};
2525

@@ -30,7 +30,7 @@ fn main() {
3030
// As it is not taken into account for trait computation,
3131
// the coroutine is `Copy`.
3232
let mut h = copy(g);
33-
//~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
33+
//~^ ERROR the trait bound `Box<MaybeUninit<(i32, ())>>: Copy` is not satisfied in
3434

3535
// We now have 2 boxes with the same backing allocation:
3636
// one inside `g` and one inside `h`.

tests/ui/coroutine/issue-105084.stderr

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,22 @@ help: consider cloning the value if the performance cost is acceptable
2222
LL | let mut h = copy(g.clone());
2323
| ++++++++
2424

25-
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
25+
error[E0277]: the trait bound `Box<MaybeUninit<(i32, ())>>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
2626
--> $DIR/issue-105084.rs:32:17
2727
|
2828
LL | || {
2929
| -- within this `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
3030
...
3131
LL | let mut h = copy(g);
32-
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
32+
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<MaybeUninit<(i32, ())>>`
3333
|
3434
note: coroutine does not implement `Copy` as this value is used across a yield
35-
--> $DIR/issue-105084.rs:22:41
35+
--> $DIR/issue-105084.rs:22:54
3636
|
37-
LL | let t = std::boxed::box_new((5, yield));
38-
| ------------------------^^^^^--
39-
| | |
40-
| | yield occurs here, with `std::boxed::box_new((5, yield))` maybe used later
41-
| has type `Box<(i32, ())>` which does not implement `Copy`
37+
LL | let t = std::boxed::init_box_via_move(t, (5, yield));
38+
| - ^^^^^ yield occurs here, with `t` maybe used later
39+
| |
40+
| has type `Box<MaybeUninit<(i32, ())>>` which does not implement `Copy`
4241
note: required by a bound in `copy`
4342
--> $DIR/issue-105084.rs:10:12
4443
|

tests/ui/error-codes/E0010-teach.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/error-codes/E0010-teach.stderr

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/ui/error-codes/E0010.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ui/error-codes/E0010.stderr

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/ui/impl-trait/where-allowed.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,6 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
390390
- impl<F, Args> Fn<Args> for Exclusive<F>
391391
where F: Sync, F: Fn<Args>, Args: Tuple;
392392

393-
error[E0118]: no nominal type found for inherent implementation
394-
--> $DIR/where-allowed.rs:240:1
395-
|
396-
LL | impl<T = impl Debug> T {}
397-
| ^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
398-
|
399-
= note: either implement a trait on it or create a newtype to wrap it instead
400-
401393
error: unconstrained opaque type
402394
--> $DIR/where-allowed.rs:121:16
403395
|
@@ -414,6 +406,14 @@ LL | type InTypeAlias<R> = impl Debug;
414406
|
415407
= note: `InTypeAlias` must be used in combination with a concrete type within the same crate
416408

409+
error[E0118]: no nominal type found for inherent implementation
410+
--> $DIR/where-allowed.rs:240:1
411+
|
412+
LL | impl<T = impl Debug> T {}
413+
| ^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
414+
|
415+
= note: either implement a trait on it or create a newtype to wrap it instead
416+
417417
error: aborting due to 48 previous errors
418418

419419
Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666.

0 commit comments

Comments
 (0)