-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
tests/ui/const-generics/adt_const_params/const_param_ty_object_safety.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(adt_const_params, unsized_const_parameters)] | ||
#![allow(incomplete_features)] | ||
|
||
use std::marker::ConstParamTy_; | ||
|
||
fn foo(a: &dyn ConstParamTy_) {} | ||
//~^ ERROR: the trait `ConstParamTy_` | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
tests/ui/const-generics/adt_const_params/const_param_ty_object_safety.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0038]: the trait `ConstParamTy_` cannot be made into an object | ||
--> $DIR/const_param_ty_object_safety.rs:6:12 | ||
| | ||
LL | fn foo(a: &dyn ConstParamTy_) {} | ||
| ^^^^^^^^^^^^^^^^^ `ConstParamTy_` cannot be made into an object | ||
| | ||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $SRC_DIR/core/src/cmp.rs:LL:COL | ||
| | ||
= note: the trait cannot be made into an object because it uses `Self` as a type parameter | ||
help: consider using an opaque type instead | ||
| | ||
LL | fn foo(a: &impl ConstParamTy_) {} | ||
| ~~~~ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0038`. |
11 changes: 11 additions & 0 deletions
11
tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-1.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(adt_const_params, unsized_const_parameters)] | ||
#![allow(incomplete_features)] | ||
|
||
use std::marker::ConstParamTy_; | ||
|
||
struct Foo; | ||
|
||
impl ConstParamTy_ for &'static Foo {} | ||
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type | ||
--> $DIR/reference_pointee_is_const_param-1.rs:8:24 | ||
| | ||
LL | impl ConstParamTy_ for &'static Foo {} | ||
| ^^^^^^^^^^^^ this field does not implement `ConstParamTy_` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0204`. |
6 changes: 4 additions & 2 deletions
6
tests/crashes/119299.rs → ...ams/reference_pointee_is_const_param-2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type | ||
--> $DIR/reference_pointee_is_const_param-2.rs:11:24 | ||
| | ||
LL | impl ConstParamTy_ for &'static ConstStrU {} | ||
| ^^^^^^^^^^^^^^^^^^ this field does not implement `ConstParamTy_` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0204`. |