Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 71f4e0c

Browse files
committedJun 4, 2024
Bless tests and handle tests/crashes
1 parent 2b5ee09 commit 71f4e0c

34 files changed

+386
-275
lines changed
 

‎tests/crashes/119830.rs

-11
This file was deleted.

‎tests/crashes/122908.rs

-4
This file was deleted.

‎tests/crashes/125556.rs

-14
This file was deleted.

‎tests/debuginfo/function-names.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// Const generic parameter
3838
// gdb-command:info functions -q function_names::const_generic_fn.*
3939
// gdb-check:[...]static fn function_names::const_generic_fn_bool<false>();
40-
// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#ad91263f6d2dd96e}>();
40+
// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#[...]}>();
4141
// gdb-check:[...]static fn function_names::const_generic_fn_signed_int<-7>();
4242
// gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int<14>();
4343

@@ -76,7 +76,7 @@
7676
// Const generic parameter
7777
// cdb-command:x a!function_names::const_generic_fn*
7878
// cdb-check:[...] a!function_names::const_generic_fn_bool<false> (void)
79-
// cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST$ad91263f6d2dd96e> (void)
79+
// cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST#[...]> (void)
8080
// cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void)
8181
// cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void)
8282

‎tests/mir-opt/issue_99325.main.built.after.32bit.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| User Type Annotations
44
| 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">}
5-
| 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">}
5+
| 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">}
66
|
77
fn main() -> () {
88
let mut _0: ();

‎tests/mir-opt/issue_99325.main.built.after.64bit.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| User Type Annotations
44
| 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">}
5-
| 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">}
5+
| 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">}
66
|
77
fn main() -> () {
88
let mut _0: ();
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
//@ edition:2021
2+
//@ check-pass
23
// issues rust-lang/rust#111911
34
// test for ICE opaque type with non-universal region substs
45

56
#![feature(adt_const_params)]
67
#![allow(incomplete_features)]
78

89
pub async fn foo<const X: &'static str>() {}
9-
//~^ ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
10-
//~| ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias
1110
fn bar<const N: &'static u8>() -> impl Sized {}
1211

1312
pub fn main() {}

‎tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.stderr

-16
This file was deleted.

‎tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ LL | pub struct Dependent<T, const X: T>([(); X]);
66
|
77
= note: type parameters may not be used in the type of const parameters
88

9-
error: aborting due to 1 previous error
9+
error[E0392]: type parameter `T` is never used
10+
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
11+
|
12+
LL | pub struct Dependent<T, const X: T>([(); X]);
13+
| ^ unused type parameter
14+
|
15+
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
16+
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
17+
18+
error: aborting due to 2 previous errors
1019

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

‎tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ LL | pub struct Dependent<T, const X: T>([(); X]);
66
|
77
= note: type parameters may not be used in the type of const parameters
88

9-
error: aborting due to 1 previous error
9+
error[E0392]: type parameter `T` is never used
10+
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
11+
|
12+
LL | pub struct Dependent<T, const X: T>([(); X]);
13+
| ^ unused type parameter
14+
|
15+
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
16+
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
17+
18+
error: aborting due to 2 previous errors
1019

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

‎tests/ui/const-generics/const-param-type-depends-on-type-param.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010

1111
pub struct Dependent<T, const X: T>([(); X]);
1212
//~^ ERROR: the type of const parameters must not depend on other generic parameters
13+
//~| ERROR: type parameter `T` is never used
1314

1415
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ compile-flags: -Znext-solver=coherence
2+
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
pub struct A<const z: [usize; x]> {}
7+
//~^ ERROR: cannot find value `x` in this scope
8+
//~| ERROR: `[usize; x]` is forbidden as the type of a const generic parameter
9+
10+
impl A<2> {
11+
//~^ ERROR: mismatched types
12+
pub const fn B() {}
13+
//~^ ERROR: duplicate definitions
14+
}
15+
16+
impl A<2> {
17+
//~^ ERROR: mismatched types
18+
pub const fn B() {}
19+
}
20+
21+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
error[E0425]: cannot find value `x` in this scope
2+
--> $DIR/error_in_ty.rs:6:31
3+
|
4+
LL | pub struct A<const z: [usize; x]> {}
5+
| - ^ help: a const parameter with a similar name exists: `z`
6+
| |
7+
| similarly named const parameter `z` defined here
8+
9+
error: `[usize; x]` is forbidden as the type of a const generic parameter
10+
--> $DIR/error_in_ty.rs:6:23
11+
|
12+
LL | pub struct A<const z: [usize; x]> {}
13+
| ^^^^^^^^^^
14+
|
15+
= note: the only supported types are integers, `bool` and `char`
16+
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
17+
|
18+
LL + #![feature(adt_const_params)]
19+
|
20+
21+
error[E0308]: mismatched types
22+
--> $DIR/error_in_ty.rs:10:8
23+
|
24+
LL | impl A<2> {
25+
| ^ expected `[usize; x]`, found integer
26+
27+
error[E0308]: mismatched types
28+
--> $DIR/error_in_ty.rs:16:8
29+
|
30+
LL | impl A<2> {
31+
| ^ expected `[usize; x]`, found integer
32+
33+
error[E0592]: duplicate definitions with name `B`
34+
--> $DIR/error_in_ty.rs:12:5
35+
|
36+
LL | pub const fn B() {}
37+
| ^^^^^^^^^^^^^^^^ duplicate definitions for `B`
38+
...
39+
LL | pub const fn B() {}
40+
| ---------------- other definition for `B`
41+
42+
error: aborting due to 5 previous errors
43+
44+
Some errors have detailed explanations: E0308, E0425, E0592.
45+
For more information about an error, try `rustc --explain E0308`.

‎tests/ui/const-generics/generic_const_exprs/eval-privacy.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ pub trait Trait {
99
fn assoc_fn() -> Self::AssocTy;
1010
}
1111

12-
impl<const U: u8> Trait for Const<U> // OK, trait impl predicates
12+
impl<const U: u8> Trait for Const<U>
1313
where
14-
Const<{ my_const_fn(U) }>: ,
14+
// OK, trait impl predicates
15+
Const<{ my_const_fn(U) }>:,
1516
{
1617
type AssocTy = Const<{ my_const_fn(U) }>;
1718
//~^ ERROR private type
19+
//~| ERROR private type
1820
fn assoc_fn() -> Self::AssocTy {
1921
Const
2022
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
2-
--> $DIR/eval-privacy.rs:16:5
2+
--> $DIR/eval-privacy.rs:17:5
33
|
44
LL | type AssocTy = Const<{ my_const_fn(U) }>;
55
| ^^^^^^^^^^^^ can't leak private type
66
...
77
LL | const fn my_const_fn(val: u8) -> u8 {
88
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
99

10-
error: aborting due to 1 previous error
10+
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
11+
--> $DIR/eval-privacy.rs:17:5
12+
|
13+
LL | type AssocTy = Const<{ my_const_fn(U) }>;
14+
| ^^^^^^^^^^^^ can't leak private type
15+
...
16+
LL | const fn my_const_fn(val: u8) -> u8 {
17+
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
18+
|
19+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20+
21+
error: aborting due to 2 previous errors
1122

1223
For more information about this error, try `rustc --explain E0446`.

‎tests/ui/const-generics/issues/issue-71381.full.stderr

+15-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,25 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
77
= note: type parameters may not be used in the type of const parameters
88

99
error[E0770]: the type of const parameters must not depend on other generic parameters
10-
--> $DIR/issue-71381.rs:22:40
10+
--> $DIR/issue-71381.rs:23:40
1111
|
1212
LL | const FN: unsafe extern "C" fn(Args),
1313
| ^^^^ the type must not depend on the parameter `Args`
1414
|
1515
= note: type parameters may not be used in the type of const parameters
1616

17-
error: aborting due to 2 previous errors
17+
error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
18+
--> $DIR/issue-71381.rs:16:9
19+
|
20+
LL | self.0 = Self::trampiline::<Args, IDX, FN> as _
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
22+
|
23+
help: consider changing this to be a mutable reference
24+
|
25+
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
26+
| ~~~~~~~~~
27+
28+
error: aborting due to 3 previous errors
1829

19-
For more information about this error, try `rustc --explain E0770`.
30+
Some errors have detailed explanations: E0594, E0770.
31+
For more information about an error, try `rustc --explain E0594`.

‎tests/ui/const-generics/issues/issue-71381.min.stderr

+15-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,25 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
77
= note: type parameters may not be used in the type of const parameters
88

99
error[E0770]: the type of const parameters must not depend on other generic parameters
10-
--> $DIR/issue-71381.rs:22:40
10+
--> $DIR/issue-71381.rs:23:40
1111
|
1212
LL | const FN: unsafe extern "C" fn(Args),
1313
| ^^^^ the type must not depend on the parameter `Args`
1414
|
1515
= note: type parameters may not be used in the type of const parameters
1616

17-
error: aborting due to 2 previous errors
17+
error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
18+
--> $DIR/issue-71381.rs:16:9
19+
|
20+
LL | self.0 = Self::trampiline::<Args, IDX, FN> as _
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
22+
|
23+
help: consider changing this to be a mutable reference
24+
|
25+
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
26+
| ~~~~~~~~~
27+
28+
error: aborting due to 3 previous errors
1829

19-
For more information about this error, try `rustc --explain E0770`.
30+
Some errors have detailed explanations: E0594, E0770.
31+
For more information about an error, try `rustc --explain E0594`.

‎tests/ui/const-generics/issues/issue-71381.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ impl Test {
1414
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
1515
//~^ ERROR: the type of const parameters must not depend on other generic parameters
1616
self.0 = Self::trampiline::<Args, IDX, FN> as _
17+
//~^ ERROR: cannot assign to `self.0`
1718
}
1819

1920
unsafe extern "C" fn trampiline<
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ edition:2021
2+
3+
trait Trait<const N: Trait = bar> {
4+
//~^ ERROR: cannot find value `bar` in this scope
5+
//~| ERROR: cycle detected when computing type of `Trait::N`
6+
//~| ERROR: the trait `Trait` cannot be made into an object
7+
//~| ERROR: the trait `Trait` cannot be made into an object
8+
//~| ERROR: the trait `Trait` cannot be made into an object
9+
//~| ERROR: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
10+
//~| ERROR: trait objects must include the `dyn` keyword
11+
async fn a() {}
12+
}
13+
14+
fn main() {}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.