mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-25 06:32:04 +00:00
Opting-out of `Sized` with `?Sized` is now equivalent to adding a `MetaSized` bound, and adding a `MetaSized` or `PointeeSized` bound is equivalent to removing the default `Sized` bound - this commit implements this change in `rustc_hir_analysis::hir_ty_lowering`. `MetaSized` is also added as a supertrait of all traits, as this is necessary to preserve backwards compatibility. Unfortunately, non-global where clauses being preferred over item bounds (where `PointeeSized` bounds would be proven) - which can result in errors when a `PointeeSized` supertrait/bound/predicate is added to some items. Rather than `PointeeSized` being a bound on everything, it can be the absence of a bound on everything, as `?Sized` was.
126 lines
5.0 KiB
Plaintext
126 lines
5.0 KiB
Plaintext
error[E0658]: `?Trait` is not permitted in supertraits
|
|
--> $DIR/default-supertrait.rs:8:17
|
|
|
|
|
LL | trait NegSized: ?Sized { }
|
|
| ^^^^^^
|
|
|
|
|
= note: traits are `?Sized` by default
|
|
= help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
|
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
|
|
error[E0658]: `?Trait` is not permitted in supertraits
|
|
--> $DIR/default-supertrait.rs:13:21
|
|
|
|
|
LL | trait NegMetaSized: ?MetaSized { }
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: traits are `?MetaSized` by default
|
|
= help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
|
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
|
|
error[E0658]: `?Trait` is not permitted in supertraits
|
|
--> $DIR/default-supertrait.rs:19:24
|
|
|
|
|
LL | trait NegPointeeSized: ?PointeeSized { }
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: traits are `?PointeeSized` by default
|
|
= help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
|
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known
|
|
--> $DIR/default-supertrait.rs:52:38
|
|
|
|
|
LL | fn with_bare_trait<T: PointeeSized + Bare>() {
|
|
| ^^^^ doesn't have a known size
|
|
|
|
|
note: required by a bound in `Bare`
|
|
--> $DIR/default-supertrait.rs:22:1
|
|
|
|
|
LL | trait Bare {}
|
|
| ^^^^^^^^^^^^^ required by this bound in `Bare`
|
|
help: consider further restricting type parameter `T` with unstable trait `MetaSized`
|
|
|
|
|
LL | fn with_bare_trait<T: PointeeSized + Bare + std::marker::MetaSized>() {
|
|
| ++++++++++++++++++++++++
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
|
--> $DIR/default-supertrait.rs:35:22
|
|
|
|
|
LL | fn with_metasized_supertrait<T: PointeeSized + MetaSized_>() {
|
|
| - this type parameter needs to be `Sized`
|
|
LL | requires_sized::<T>();
|
|
| ^ doesn't have a size known at compile-time
|
|
|
|
|
note: required by a bound in `requires_sized`
|
|
--> $DIR/default-supertrait.rs:24:22
|
|
|
|
|
LL | fn requires_sized<T: Sized>() {}
|
|
| ^^^^^ required by this bound in `requires_sized`
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
|
--> $DIR/default-supertrait.rs:43:22
|
|
|
|
|
LL | fn with_pointeesized_supertrait<T: PointeeSized + PointeeSized_>() {
|
|
| - this type parameter needs to be `Sized`
|
|
LL | requires_sized::<T>();
|
|
| ^ doesn't have a size known at compile-time
|
|
|
|
|
note: required by a bound in `requires_sized`
|
|
--> $DIR/default-supertrait.rs:24:22
|
|
|
|
|
LL | fn requires_sized<T: Sized>() {}
|
|
| ^^^^^ required by this bound in `requires_sized`
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known
|
|
--> $DIR/default-supertrait.rs:45:26
|
|
|
|
|
LL | requires_metasized::<T>();
|
|
| ^ doesn't have a known size
|
|
|
|
|
note: required by a bound in `requires_metasized`
|
|
--> $DIR/default-supertrait.rs:25:26
|
|
|
|
|
LL | fn requires_metasized<T: MetaSized>() {}
|
|
| ^^^^^^^^^ required by this bound in `requires_metasized`
|
|
help: consider further restricting type parameter `T` with unstable trait `MetaSized`
|
|
|
|
|
LL | fn with_pointeesized_supertrait<T: PointeeSized + PointeeSized_ + std::marker::MetaSized>() {
|
|
| ++++++++++++++++++++++++
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
|
--> $DIR/default-supertrait.rs:54:22
|
|
|
|
|
LL | fn with_bare_trait<T: PointeeSized + Bare>() {
|
|
| - this type parameter needs to be `Sized`
|
|
LL |
|
|
LL | requires_sized::<T>();
|
|
| ^ doesn't have a size known at compile-time
|
|
|
|
|
note: required by a bound in `requires_sized`
|
|
--> $DIR/default-supertrait.rs:24:22
|
|
|
|
|
LL | fn requires_sized<T: Sized>() {}
|
|
| ^^^^^ required by this bound in `requires_sized`
|
|
|
|
error[E0277]: the size for values of type `T` cannot be known
|
|
--> $DIR/default-supertrait.rs:56:26
|
|
|
|
|
LL | requires_metasized::<T>();
|
|
| ^ doesn't have a known size
|
|
|
|
|
note: required by a bound in `requires_metasized`
|
|
--> $DIR/default-supertrait.rs:25:26
|
|
|
|
|
LL | fn requires_metasized<T: MetaSized>() {}
|
|
| ^^^^^^^^^ required by this bound in `requires_metasized`
|
|
help: consider further restricting type parameter `T` with unstable trait `MetaSized`
|
|
|
|
|
LL | fn with_bare_trait<T: PointeeSized + Bare + std::marker::MetaSized>() {
|
|
| ++++++++++++++++++++++++
|
|
|
|
error: aborting due to 9 previous errors
|
|
|
|
Some errors have detailed explanations: E0277, E0658.
|
|
For more information about an error, try `rustc --explain E0277`.
|