mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Bless tests and handle tests/crashes
This commit is contained in:
parent
7fa98d0c01
commit
f74119a2e4
@ -1,4 +0,0 @@
|
||||
//@ known-bug: #122908
|
||||
trait Trait<const module_path: Trait = bar> {
|
||||
async fn handle<F>(slf: &F) {}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
//@ known-bug: rust-lang/rust#125556
|
||||
//@ compile-flags: -Znext-solver=coherence
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
pub struct A<const z: [usize; x]> {}
|
||||
|
||||
impl A<2> {
|
||||
pub const fn B() {}
|
||||
}
|
||||
|
||||
impl A<2> {
|
||||
pub const fn B() {}
|
||||
}
|
@ -37,7 +37,7 @@
|
||||
// Const generic parameter
|
||||
// gdb-command:info functions -q function_names::const_generic_fn.*
|
||||
// gdb-check:[...]static fn function_names::const_generic_fn_bool<false>();
|
||||
// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#ad91263f6d2dd96e}>();
|
||||
// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#[...]}>();
|
||||
// gdb-check:[...]static fn function_names::const_generic_fn_signed_int<-7>();
|
||||
// gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int<14>();
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
// Const generic parameter
|
||||
// cdb-command:x a!function_names::const_generic_fn*
|
||||
// cdb-check:[...] a!function_names::const_generic_fn_bool<false> (void)
|
||||
// cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST$ad91263f6d2dd96e> (void)
|
||||
// cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST#[...]> (void)
|
||||
// cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void)
|
||||
// cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
| User Type Annotations
|
||||
| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[d56d]::main::{constant#1}), args: [] }: &'static [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[d56d]::main::{constant#1}), args: [] }], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
|
|
||||
fn main() -> () {
|
||||
let mut _0: ();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
| User Type Annotations
|
||||
| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[d56d]::main::{constant#1}), args: [] }: &'static [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[d56d]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[d56d]::main::{constant#1}), args: [] }], user_self_ty: None }), max_universe: U0, variables: [], defining_opaque_types: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
||||
|
|
||||
fn main() -> () {
|
||||
let mut _0: ();
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ edition:2021
|
||||
//@ check-pass
|
||||
// issues rust-lang/rust#111911
|
||||
// test for ICE opaque type with non-universal region substs
|
||||
|
||||
@ -6,8 +7,6 @@
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub async fn foo<const X: &'static str>() {}
|
||||
//~^ ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
//~| ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
fn bar<const N: &'static u8>() -> impl Sized {}
|
||||
|
||||
pub fn main() {}
|
||||
|
@ -1,16 +0,0 @@
|
||||
error: const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/opaque_type_with_non-universal_region_substs_ice-111911.rs:8:43
|
||||
|
|
||||
LL | pub async fn foo<const X: &'static str>() {}
|
||||
| ^^
|
||||
|
||||
error: const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/opaque_type_with_non-universal_region_substs_ice-111911.rs:8:43
|
||||
|
|
||||
LL | pub async fn foo<const X: &'static str>() {}
|
||||
| ^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -6,6 +6,16 @@ LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0770.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
|
@ -6,6 +6,16 @@ LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0770.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
|
@ -10,5 +10,6 @@
|
||||
|
||||
pub struct Dependent<T, const X: T>([(); X]);
|
||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||
//~| ERROR: type parameter `T` is never used
|
||||
|
||||
fn main() {}
|
||||
|
21
tests/ui/const-generics/generic_const_exprs/error_in_ty.rs
Normal file
21
tests/ui/const-generics/generic_const_exprs/error_in_ty.rs
Normal file
@ -0,0 +1,21 @@
|
||||
//@ compile-flags: -Znext-solver=coherence
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub struct A<const z: [usize; x]> {}
|
||||
//~^ ERROR: cannot find value `x` in this scope
|
||||
//~| ERROR: `[usize; x]` is forbidden as the type of a const generic parameter
|
||||
|
||||
impl A<2> {
|
||||
//~^ ERROR: mismatched types
|
||||
pub const fn B() {}
|
||||
//~^ ERROR: duplicate definitions
|
||||
}
|
||||
|
||||
impl A<2> {
|
||||
//~^ ERROR: mismatched types
|
||||
pub const fn B() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,45 @@
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/error_in_ty.rs:6:31
|
||||
|
|
||||
LL | pub struct A<const z: [usize; x]> {}
|
||||
| - ^ help: a const parameter with a similar name exists: `z`
|
||||
| |
|
||||
| similarly named const parameter `z` defined here
|
||||
|
||||
error: `[usize; x]` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/error_in_ty.rs:6:23
|
||||
|
|
||||
LL | pub struct A<const z: [usize; x]> {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||
|
|
||||
LL + #![feature(adt_const_params)]
|
||||
|
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/error_in_ty.rs:10:8
|
||||
|
|
||||
LL | impl A<2> {
|
||||
| ^ expected `[usize; x]`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/error_in_ty.rs:16:8
|
||||
|
|
||||
LL | impl A<2> {
|
||||
| ^ expected `[usize; x]`, found integer
|
||||
|
||||
error[E0592]: duplicate definitions with name `B`
|
||||
--> $DIR/error_in_ty.rs:12:5
|
||||
|
|
||||
LL | pub const fn B() {}
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definitions for `B`
|
||||
...
|
||||
LL | pub const fn B() {}
|
||||
| ---------------- other definition for `B`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0425, E0592.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
@ -9,9 +9,10 @@ pub trait Trait {
|
||||
fn assoc_fn() -> Self::AssocTy;
|
||||
}
|
||||
|
||||
impl<const U: u8> Trait for Const<U> // OK, trait impl predicates
|
||||
impl<const U: u8> Trait for Const<U>
|
||||
where
|
||||
Const<{ my_const_fn(U) }>: ,
|
||||
// OK, trait impl predicates
|
||||
Const<{ my_const_fn(U) }>:,
|
||||
{
|
||||
type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
//~^ ERROR private type
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/eval-privacy.rs:16:5
|
||||
--> $DIR/eval-privacy.rs:17:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
@ -8,7 +8,7 @@ LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/eval-privacy.rs:16:5
|
||||
--> $DIR/eval-privacy.rs:17:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
|
@ -7,13 +7,25 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-71381.rs:23:40
|
||||
--> $DIR/issue-71381.rs:24:40
|
||||
|
|
||||
LL | const FN: unsafe extern "C" fn(Args),
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
|
||||
--> $DIR/issue-71381.rs:17:9
|
||||
|
|
||||
LL | self.0 = Self::trampiline::<Args, IDX, FN> as _
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
|
||||
|
|
||||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
|
||||
| ~~~~~~~~~
|
||||
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0594, E0770.
|
||||
For more information about an error, try `rustc --explain E0594`.
|
||||
|
@ -7,7 +7,7 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-71381.rs:23:40
|
||||
--> $DIR/issue-71381.rs:24:40
|
||||
|
|
||||
LL | const FN: unsafe extern "C" fn(Args),
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
@ -23,13 +23,25 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: using function pointers as const generic parameters is forbidden
|
||||
--> $DIR/issue-71381.rs:23:19
|
||||
--> $DIR/issue-71381.rs:24:19
|
||||
|
|
||||
LL | const FN: unsafe extern "C" fn(Args),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
|
||||
--> $DIR/issue-71381.rs:17:9
|
||||
|
|
||||
LL | self.0 = Self::trampiline::<Args, IDX, FN> as _
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
|
||||
|
|
||||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
|
||||
| ~~~~~~~~~
|
||||
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0594, E0770.
|
||||
For more information about an error, try `rustc --explain E0594`.
|
||||
|
@ -15,6 +15,7 @@ impl Test {
|
||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||
//[min]~^^ ERROR: using function pointers as const generic parameters is forbidden
|
||||
self.0 = Self::trampiline::<Args, IDX, FN> as _
|
||||
//~^ ERROR: cannot assign to `self.0`
|
||||
}
|
||||
|
||||
unsafe extern "C" fn trampiline<
|
||||
|
14
tests/ui/const-generics/not_wf_param_in_rpitit.rs
Normal file
14
tests/ui/const-generics/not_wf_param_in_rpitit.rs
Normal file
@ -0,0 +1,14 @@
|
||||
//@ edition:2021
|
||||
|
||||
trait Trait<const N: Trait = bar> {
|
||||
//~^ ERROR: cannot find value `bar` in this scope
|
||||
//~| ERROR: cycle detected when computing type of `Trait::N`
|
||||
//~| ERROR: the trait `Trait` cannot be made into an object
|
||||
//~| ERROR: the trait `Trait` cannot be made into an object
|
||||
//~| ERROR: the trait `Trait` cannot be made into an object
|
||||
//~| ERROR: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
//~| ERROR: trait objects must include the `dyn` keyword
|
||||
async fn a() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
113
tests/ui/const-generics/not_wf_param_in_rpitit.stderr
Normal file
113
tests/ui/const-generics/not_wf_param_in_rpitit.stderr
Normal file
@ -0,0 +1,113 @@
|
||||
error[E0425]: cannot find value `bar` in this scope
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:30
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Trait::N`
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `Trait::N` again
|
||||
note: cycle used when computing explicit predicates of trait `Trait`
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:1
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^ `Trait` 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>
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | async fn a() {}
|
||||
| ^ ...because associated function `a` has no `self` parameter
|
||||
help: consider turning `a` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | async fn a(&self) {}
|
||||
| +++++
|
||||
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
||||
|
|
||||
LL | async fn a() where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:13
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `Trait` 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>
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | async fn a() {}
|
||||
| ^ ...because associated function `a` has no `self` parameter
|
||||
help: consider turning `a` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | async fn a(&self) {}
|
||||
| +++++
|
||||
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
||||
|
|
||||
LL | async fn a() where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
|
||||
error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:13
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `Trait` 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>
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | async fn a() {}
|
||||
| ^ ...because associated function `a` has no `self` parameter
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: consider turning `a` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | async fn a(&self) {}
|
||||
| +++++
|
||||
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
||||
|
|
||||
LL | async fn a() where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | trait Trait<const N: dyn Trait = bar> {
|
||||
| +++
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0391, E0425, E0782.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
@ -13,7 +13,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
|
||||
LL | std::mem::transmute(v)
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: source type: `[[u32; H]; W]` (this type does not have a fixed size)
|
||||
= note: source type: `[[u32; H]; W]` (size can vary because of [u32; H])
|
||||
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])
|
||||
|
||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||
|
@ -5,6 +5,7 @@ impl X {
|
||||
}
|
||||
}
|
||||
fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
//~^ ERROR expected type, found built-in attribute `cfg_attr`
|
||||
//~^ ERROR: expected type, found built-in attribute `cfg_attr`
|
||||
//~| ERROR: mismatched types
|
||||
|
||||
fn main() {}
|
||||
|
@ -10,7 +10,15 @@ error[E0573]: expected type, found built-in attribute `cfg_attr`
|
||||
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
| ^^^^^^^^ not a type
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_not_in_scope.rs:7:33
|
||||
|
|
||||
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
| ---- ^^^^^^^ expected `[u8; N]`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
Some errors have detailed explanations: E0412, E0573.
|
||||
For more information about an error, try `rustc --explain E0412`.
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0412, E0573.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
@ -5,7 +5,7 @@ struct S<const S: (), const S: S = { S }>;
|
||||
//~^ ERROR the name `S` is already used for a generic parameter in this item's generic parameters
|
||||
//~| ERROR missing generics for struct `S`
|
||||
//~| ERROR cycle detected when computing type of `S::S`
|
||||
//~| ERROR cycle detected when computing type of `S`
|
||||
//~| ERROR `()` is forbidden as the type of a const generic parameter
|
||||
//~| ERROR `S<{const error}, {const error}>` is forbidden as the type of a const generic parameter
|
||||
|
||||
fn main() {}
|
||||
|
@ -29,26 +29,7 @@ LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `S::S` again
|
||||
note: cycle used when computing type of `S`
|
||||
--> $DIR/issue-103790.rs:4:1
|
||||
|
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error[E0391]: cycle detected when computing type of `S`
|
||||
--> $DIR/issue-103790.rs:4:1
|
||||
|
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires computing type of `S::S`...
|
||||
--> $DIR/issue-103790.rs:4:32
|
||||
|
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^
|
||||
= note: ...which again requires computing type of `S`, completing the cycle
|
||||
note: cycle used when checking that `S` is well-formed
|
||||
note: cycle used when computing explicit predicates of `S`
|
||||
--> $DIR/issue-103790.rs:4:1
|
||||
|
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
@ -67,6 +48,18 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
|
||||
LL + #![feature(adt_const_params)]
|
||||
|
|
||||
|
||||
error: `S<{const error}, {const error}>` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/issue-103790.rs:4:32
|
||||
|
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||
|
|
||||
LL + #![feature(adt_const_params)]
|
||||
|
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0391, E0403.
|
||||
|
@ -11,55 +11,46 @@ pub struct PubTy;
|
||||
pub struct PubTyGeneric<T>(T);
|
||||
pub trait PubTr {}
|
||||
impl PubTr for PrivTy {}
|
||||
pub trait PubTrWithAssocTy { type AssocTy; }
|
||||
impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
|
||||
|
||||
pub trait PubTrWithAssocTy {
|
||||
type AssocTy;
|
||||
}
|
||||
impl PubTrWithAssocTy for PrivTy {
|
||||
type AssocTy = PrivTy;
|
||||
}
|
||||
|
||||
pub struct S
|
||||
//~^ WARNING type `PrivTy` is more private than the item `S`
|
||||
where
|
||||
PrivTy:
|
||||
{}
|
||||
|
||||
PrivTy:, {}
|
||||
|
||||
pub enum E
|
||||
//~^ WARNING type `PrivTy` is more private than the item `E`
|
||||
where
|
||||
PrivTy:
|
||||
{}
|
||||
|
||||
PrivTy:, {}
|
||||
|
||||
pub fn f()
|
||||
//~^ WARNING type `PrivTy` is more private than the item `f`
|
||||
where
|
||||
PrivTy:
|
||||
{}
|
||||
|
||||
PrivTy:,
|
||||
{
|
||||
}
|
||||
|
||||
impl S
|
||||
//~^ WARNING type `PrivTy` is more private than the item `S`
|
||||
where
|
||||
PrivTy:
|
||||
PrivTy:,
|
||||
{
|
||||
pub fn f()
|
||||
//~^ WARNING type `PrivTy` is more private than the item `S::f`
|
||||
where
|
||||
PrivTy:
|
||||
{}
|
||||
PrivTy:,
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
impl PubTr for PubTy where PrivTy: {}
|
||||
|
||||
impl PubTr for PubTy
|
||||
where
|
||||
PrivTy:
|
||||
{}
|
||||
|
||||
|
||||
impl<T> PubTr for PubTyGeneric<T>
|
||||
where
|
||||
T: PubTrWithAssocTy<AssocTy=PrivTy>
|
||||
{}
|
||||
|
||||
impl<T> PubTr for PubTyGeneric<T> where T: PubTrWithAssocTy<AssocTy = PrivTy> {}
|
||||
|
||||
pub struct Const<const U: u8>;
|
||||
|
||||
@ -70,7 +61,7 @@ pub trait Trait {
|
||||
|
||||
impl<const U: u8> Trait for Const<U>
|
||||
where
|
||||
Const<{ my_const_fn(U) }>: ,
|
||||
Const<{ my_const_fn(U) }>:,
|
||||
{
|
||||
type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
//~^ ERROR private type
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: type `PrivTy` is more private than the item `S`
|
||||
--> $DIR/where-priv-type.rs:18:1
|
||||
--> $DIR/where-priv-type.rs:21:1
|
||||
|
|
||||
LL | pub struct S
|
||||
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
||||
@ -12,7 +12,7 @@ LL | struct PrivTy;
|
||||
= note: `#[warn(private_bounds)]` on by default
|
||||
|
||||
warning: type `PrivTy` is more private than the item `E`
|
||||
--> $DIR/where-priv-type.rs:25:1
|
||||
--> $DIR/where-priv-type.rs:26:1
|
||||
|
|
||||
LL | pub enum E
|
||||
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
||||
@ -24,13 +24,13 @@ LL | struct PrivTy;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
warning: type `PrivTy` is more private than the item `f`
|
||||
--> $DIR/where-priv-type.rs:32:1
|
||||
--> $DIR/where-priv-type.rs:31:1
|
||||
|
|
||||
LL | / pub fn f()
|
||||
LL | |
|
||||
LL | | where
|
||||
LL | | PrivTy:
|
||||
| |___________^ function `f` is reachable at visibility `pub`
|
||||
LL | | PrivTy:,
|
||||
| |____________^ function `f` is reachable at visibility `pub`
|
||||
|
|
||||
note: but type `PrivTy` is only usable at visibility `pub(crate)`
|
||||
--> $DIR/where-priv-type.rs:8:1
|
||||
@ -39,13 +39,13 @@ LL | struct PrivTy;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
warning: type `PrivTy` is more private than the item `S`
|
||||
--> $DIR/where-priv-type.rs:39:1
|
||||
--> $DIR/where-priv-type.rs:38:1
|
||||
|
|
||||
LL | / impl S
|
||||
LL | |
|
||||
LL | | where
|
||||
LL | | PrivTy:
|
||||
| |___________^ implementation `S` is reachable at visibility `pub`
|
||||
LL | | PrivTy:,
|
||||
| |____________^ implementation `S` is reachable at visibility `pub`
|
||||
|
|
||||
note: but type `PrivTy` is only usable at visibility `pub(crate)`
|
||||
--> $DIR/where-priv-type.rs:8:1
|
||||
@ -54,13 +54,13 @@ LL | struct PrivTy;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
warning: type `PrivTy` is more private than the item `S::f`
|
||||
--> $DIR/where-priv-type.rs:44:5
|
||||
--> $DIR/where-priv-type.rs:43:5
|
||||
|
|
||||
LL | / pub fn f()
|
||||
LL | |
|
||||
LL | | where
|
||||
LL | | PrivTy:
|
||||
| |_______________^ associated function `S::f` is reachable at visibility `pub`
|
||||
LL | | PrivTy:,
|
||||
| |________________^ associated function `S::f` is reachable at visibility `pub`
|
||||
|
|
||||
note: but type `PrivTy` is only usable at visibility `pub(crate)`
|
||||
--> $DIR/where-priv-type.rs:8:1
|
||||
@ -69,7 +69,7 @@ LL | struct PrivTy;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/where-priv-type.rs:75:5
|
||||
--> $DIR/where-priv-type.rs:66:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
@ -78,7 +78,7 @@ LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/where-priv-type.rs:75:5
|
||||
--> $DIR/where-priv-type.rs:66:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
|
@ -17,8 +17,6 @@ impl<T> const Foo for T where T: const Specialize {}
|
||||
//~^ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
|
||||
//~| error: `const` can only be applied to `#[const_trait]` traits
|
||||
//~| error: the const parameter `host` is not constrained by the impl trait, self type, or predicates [E0207]
|
||||
//~| error: specialization impl does not specialize any associated items
|
||||
//~| error: could not resolve generic parameters on overridden impl
|
||||
//~| error: conflicting implementations of trait `Foo`
|
||||
|
||||
fn main() {
|
||||
}
|
||||
fn main() {}
|
||||
|
@ -37,6 +37,15 @@ LL | impl<T> const Foo for T {}
|
||||
= note: expressions using a const parameter must map each value to a distinct output value
|
||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Foo`
|
||||
--> $DIR/spec-effectvar-ice.rs:16:1
|
||||
|
|
||||
LL | impl<T> const Foo for T {}
|
||||
| ----------------------- first implementation here
|
||||
...
|
||||
LL | impl<T> const Foo for T where T: const Specialize {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/spec-effectvar-ice.rs:16:9
|
||||
|
|
||||
@ -46,24 +55,7 @@ LL | impl<T> const Foo for T where T: const Specialize {}
|
||||
= note: expressions using a const parameter must map each value to a distinct output value
|
||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||
|
||||
error: specialization impl does not specialize any associated items
|
||||
--> $DIR/spec-effectvar-ice.rs:16:1
|
||||
|
|
||||
LL | impl<T> const Foo for T where T: const Specialize {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: impl is a specialization of this impl
|
||||
--> $DIR/spec-effectvar-ice.rs:12:1
|
||||
|
|
||||
LL | impl<T> const Foo for T {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
error: could not resolve generic parameters on overridden impl
|
||||
--> $DIR/spec-effectvar-ice.rs:16:1
|
||||
|
|
||||
LL | impl<T> const Foo for T where T: const Specialize {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0207`.
|
||||
Some errors have detailed explanations: E0119, E0207.
|
||||
For more information about an error, try `rustc --explain E0119`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: `Bar` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/const_generic_type.rs:7:24
|
||||
--> $DIR/const_generic_type.rs:8:24
|
||||
|
|
||||
LL | async fn test<const N: crate::Bar>() {
|
||||
| ^^^^^^^^^^
|
||||
|
@ -1,13 +1,13 @@
|
||||
error[E0283]: type annotations needed
|
||||
--> $DIR/const_generic_type.rs:7:1
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/const_generic_type.rs:5:12
|
||||
|
|
||||
LL | async fn test<const N: crate::Bar>() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
LL | type Bar = impl std::fmt::Display;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: cannot satisfy `_: std::fmt::Display`
|
||||
= note: `Bar` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: `Bar` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/const_generic_type.rs:7:24
|
||||
--> $DIR/const_generic_type.rs:8:24
|
||||
|
|
||||
LL | async fn test<const N: crate::Bar>() {
|
||||
| ^^^^^^^^^^
|
||||
@ -16,4 +16,3 @@ LL | async fn test<const N: crate::Bar>() {
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0283`.
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
type Bar = impl std::fmt::Display;
|
||||
//[no_infer]~^ ERROR: unconstrained opaque type
|
||||
|
||||
async fn test<const N: crate::Bar>() {
|
||||
//[no_infer]~^ ERROR: type annotations needed
|
||||
//~^^ ERROR: `Bar` is forbidden as the type of a const generic parameter
|
||||
//~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
|
||||
#[cfg(infer)]
|
||||
let x: u32 = N;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
trait Trait<const N: Trait = bar> {
|
||||
//~^ ERROR cannot find value `bar` in this scope
|
||||
//~| ERROR cycle detected when computing type of `Trait::N`
|
||||
//~| ERROR cycle detected when computing type of `Trait::N`
|
||||
//~| ERROR the trait `Trait` cannot be made into an object
|
||||
//~| ERROR the trait `Trait` cannot be made into an object
|
||||
//~| ERROR the trait `Trait` cannot be made into an object
|
||||
@ -11,20 +10,20 @@ trait Trait<const N: Trait = bar> {
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
//~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
|
||||
//~| ERROR expected value, found builtin type `u32`
|
||||
//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
//~| ERROR associated item referring to unboxed trait object for its own trait
|
||||
//~| ERROR the trait `Trait` cannot be made into an object
|
||||
//~| ERROR `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
|
||||
//~| ERROR expected value, found builtin type `u32`
|
||||
//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
//~| ERROR associated item referring to unboxed trait object for its own trait
|
||||
//~| ERROR the trait `Trait` cannot be made into an object
|
||||
//~| ERROR `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
bar
|
||||
//~^ ERROR cannot find value `bar` in this scope
|
||||
//~^ ERROR cannot find value `bar` in this scope
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0403]: the name `N` is already used for a generic parameter in this item's generic parameters
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:18
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:18
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| - first use of `N`
|
||||
@ -14,13 +14,13 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0423]: expected value, found builtin type `u32`
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:29
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:29
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^ not a value
|
||||
|
||||
error[E0425]: cannot find value `bar` in this scope
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:26:9
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:25:9
|
||||
|
|
||||
LL | bar
|
||||
| ^^^ not found in this scope
|
||||
@ -53,28 +53,14 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Trait::N`
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `Trait::N` again
|
||||
note: cycle used when computing explicit predicates of trait `Trait`
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:12
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:12
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
@ -87,7 +73,7 @@ LL | fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:44
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
@ -120,7 +106,7 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^ `Trait` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
@ -136,7 +122,7 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `Trait` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
@ -154,7 +140,7 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:44
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- in this trait
|
||||
@ -168,7 +154,7 @@ LL | fn fnc<const N: Trait = u32>(&self) -> Self {
|
||||
| ~~~~
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
@ -182,13 +168,13 @@ LL | fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
|
||||
| +++
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^ `Trait` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
@ -204,7 +190,7 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `Trait` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
@ -215,14 +201,14 @@ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: aborting due to 14 previous errors; 5 warnings emitted
|
||||
error: aborting due to 13 previous errors; 5 warnings emitted
|
||||
|
||||
Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
||||
|
@ -1,15 +1,11 @@
|
||||
// Regression test for ICE #122989
|
||||
trait Foo<const N: Bar<2>> {
|
||||
//~^ WARN trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| ERROR cycle detected when computing type of `Foo::N`
|
||||
//~| ERROR cycle detected when computing type of `Foo::N`
|
||||
//~| ERROR the trait `Foo` cannot be made into an object
|
||||
//~| ERROR the trait `Foo` cannot be made into an object
|
||||
//~| ERROR the trait `Foo` cannot be made into an object
|
||||
//~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
|
||||
fn func() {
|
||||
}
|
||||
//~^ WARN trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
//~| ERROR cycle detected when computing type of `Foo::N`
|
||||
//~| ERROR the trait `Foo` cannot be made into an object
|
||||
//~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
|
||||
fn func() {}
|
||||
}
|
||||
|
||||
trait Bar<const M: Foo<2>> {}
|
||||
|
@ -13,7 +13,7 @@ LL | trait Foo<const N: dyn Bar<2>> {
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20
|
||||
|
|
||||
LL | trait Bar<const M: Foo<2>> {}
|
||||
| ^^^^^^
|
||||
@ -32,7 +32,7 @@ LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires computing type of `Bar::M`...
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11
|
||||
|
|
||||
LL | trait Bar<const M: Foo<2>> {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -44,26 +44,6 @@ LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Foo::N`
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires computing type of `Bar::M`...
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
|
||||
|
|
||||
LL | trait Bar<const M: Foo<2>> {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing type of `Foo::N`, completing the cycle
|
||||
note: cycle used when computing explicit predicates of trait `Foo`
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:24
|
||||
|
|
||||
@ -71,43 +51,20 @@ LL | trait Foo<const N: Bar<2>> {
|
||||
| ^ `Foo` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:8:8
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| --- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn func() {
|
||||
LL | fn func() {}
|
||||
| ^^^^ ...because associated function `func` has no `self` parameter
|
||||
help: consider turning `func` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | fn func(&self) {
|
||||
LL | fn func(&self) {}
|
||||
| +++++
|
||||
help: alternatively, consider constraining `func` so it does not apply to trait objects
|
||||
|
|
||||
LL | fn func() where Self: Sized {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^ `Foo` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| --- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn func() {
|
||||
| ^^^^ ...because associated function `func` has no `self` parameter
|
||||
help: consider turning `func` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | fn func(&self) {
|
||||
| +++++
|
||||
help: alternatively, consider constraining `func` so it does not apply to trait objects
|
||||
|
|
||||
LL | fn func() where Self: Sized {
|
||||
LL | fn func() where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
|
||||
error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
|
||||
@ -119,61 +76,37 @@ LL | trait Foo<const N: Bar<2>> {
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11
|
||||
|
|
||||
LL | trait Bar<const M: Foo<2>> {}
|
||||
| ^^^^^^^^^^^^^^^ `Foo` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:8:8
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| --- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn func() {
|
||||
LL | fn func() {}
|
||||
| ^^^^ ...because associated function `func` has no `self` parameter
|
||||
help: consider turning `func` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | fn func(&self) {
|
||||
LL | fn func(&self) {}
|
||||
| +++++
|
||||
help: alternatively, consider constraining `func` so it does not apply to trait objects
|
||||
|
|
||||
LL | fn func() where Self: Sized {
|
||||
LL | fn func() where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
|
||||
error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20
|
||||
|
|
||||
LL | trait Bar<const M: Foo<2>> {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| ^^^^^^^^^^^^^^^ `Foo` 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>
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
|
||||
|
|
||||
LL | trait Foo<const N: Bar<2>> {
|
||||
| --- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn func() {
|
||||
| ^^^^ ...because associated function `func` has no `self` parameter
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: consider turning `func` into a method by giving it a `&self` argument
|
||||
|
|
||||
LL | fn func(&self) {
|
||||
| +++++
|
||||
help: alternatively, consider constraining `func` so it does not apply to trait objects
|
||||
|
|
||||
LL | fn func() where Self: Sized {
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 8 previous errors; 2 warnings emitted
|
||||
error: aborting due to 5 previous errors; 2 warnings emitted
|
||||
|
||||
Some errors have detailed explanations: E0038, E0391.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
||||
|
Loading…
Reference in New Issue
Block a user