Skip to content

Commit be51f99

Browse files
committed
library: add {Pointee,Meta}Sized to next prelude
Its strange to have to import sizedness traits, so add them to the prelude in the next edition.
1 parent 0ca9566 commit be51f99

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

library/core/src/prelude/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,8 @@ pub mod rust_future {
9292
#[stable(feature = "prelude_2024", since = "1.85.0")]
9393
#[doc(no_inline)]
9494
pub use crate::future::{Future, IntoFuture};
95+
96+
#[unstable(feature = "prelude_next", issue = "none")]
97+
#[doc(no_inline)]
98+
pub use crate::marker::{MetaSized, PointeeSized};
9599
}

tests/ui/sized-hierarchy/extern-type-behind-ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ check-pass
22
#![feature(extern_types, sized_hierarchy)]
33

4-
use std::marker::{MetaSized, PointeeSized};
4+
use std::marker::PointeeSized;
55

66
pub fn hash<T: PointeeSized>(_: *const T) {
77
unimplemented!();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0405]: cannot find trait `MetaSized` in this scope
2+
--> $DIR/prelude.rs:10:21
3+
|
4+
LL | pub fn metasized<T: MetaSized>() {}
5+
| ^^^^^^^^^ not found in this scope
6+
|
7+
help: consider importing this trait
8+
|
9+
LL + use std::marker::MetaSized;
10+
|
11+
12+
error[E0405]: cannot find trait `PointeeSized` in this scope
13+
--> $DIR/prelude.rs:12:24
14+
|
15+
LL | pub fn pointeesized<T: PointeeSized>() {}
16+
| ^^^^^^^^^^^^ not found in this scope
17+
|
18+
help: consider importing this trait
19+
|
20+
LL + use std::marker::PointeeSized;
21+
|
22+
23+
error: aborting due to 2 previous errors
24+
25+
For more information about this error, try `rustc --explain E0405`.

tests/ui/sized-hierarchy/prelude.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ compile-flags: --crate-type=lib
2+
//@ revisions: e2024 future
3+
//@[e2024] edition: 2024
4+
//@[e2024] check-fail
5+
//@[future] compile-flags: -Zunstable-options
6+
//@[future] edition: future
7+
//@[future] check-pass
8+
#![feature(sized_hierarchy)]
9+
10+
pub fn metasized<T: MetaSized>() {}
11+
//[e2024]~^ ERROR cannot find trait `MetaSized` in this scope
12+
pub fn pointeesized<T: PointeeSized>() {}
13+
//[e2024]~^ ERROR cannot find trait `PointeeSized` in this scope

0 commit comments

Comments
 (0)