mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
IAT: Add a few regression tests
This commit is contained in:
parent
e8139dfd5a
commit
46ec348611
12
tests/ui/associated-inherent-types/issue-109768.rs
Normal file
12
tests/ui/associated-inherent-types/issue-109768.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// incremental
|
||||
|
||||
struct Wrapper<T>(T);
|
||||
|
||||
struct Local<T, U>(T, U);
|
||||
|
||||
impl<T> Local { //~ ERROR missing generics for struct `Local`
|
||||
type AssocType3 = T; //~ ERROR inherent associated types are unstable
|
||||
|
||||
const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper();
|
||||
}
|
||||
//~^ ERROR `main` function not found
|
35
tests/ui/associated-inherent-types/issue-109768.stderr
Normal file
35
tests/ui/associated-inherent-types/issue-109768.stderr
Normal file
@ -0,0 +1,35 @@
|
||||
error[E0601]: `main` function not found in crate `issue_109768`
|
||||
--> $DIR/issue-109768.rs:11:2
|
||||
|
|
||||
LL | }
|
||||
| ^ consider adding a `main` function to `$DIR/issue-109768.rs`
|
||||
|
||||
error[E0107]: missing generics for struct `Local`
|
||||
--> $DIR/issue-109768.rs:7:9
|
||||
|
|
||||
LL | impl<T> Local {
|
||||
| ^^^^^ expected 2 generic arguments
|
||||
|
|
||||
note: struct defined here, with 2 generic parameters: `T`, `U`
|
||||
--> $DIR/issue-109768.rs:5:8
|
||||
|
|
||||
LL | struct Local<T, U>(T, U);
|
||||
| ^^^^^ - -
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | impl<T> Local<T, U> {
|
||||
| ++++++
|
||||
|
||||
error[E0658]: inherent associated types are unstable
|
||||
--> $DIR/issue-109768.rs:8:5
|
||||
|
|
||||
LL | type AssocType3 = T;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
|
||||
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0601, E0658.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
22
tests/ui/associated-inherent-types/issue-109789.rs
Normal file
22
tests/ui/associated-inherent-types/issue-109789.rs
Normal file
@ -0,0 +1,22 @@
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl Foo<fn(&'static ())> {
|
||||
type Assoc = u32;
|
||||
}
|
||||
|
||||
trait Other {}
|
||||
impl Other for u32 {}
|
||||
|
||||
// FIXME(inherent_associated_types): Avoid emitting two diagnostics (they only differ in span).
|
||||
// FIXME(inherent_associated_types): Enhancement: Spruce up the diagnostic by saying something like
|
||||
// "implementation is not general enough" as is done for traits via
|
||||
// `try_report_trait_placeholder_mismatch`.
|
||||
|
||||
fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
||||
//~^ ERROR mismatched types
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {}
|
21
tests/ui/associated-inherent-types/issue-109789.stderr
Normal file
21
tests/ui/associated-inherent-types/issue-109789.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-109789.rs:18:1
|
||||
|
|
||||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected struct `Foo<fn(&'static ())>`
|
||||
found struct `Foo<for<'a> fn(&'a ())>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-109789.rs:18:11
|
||||
|
|
||||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected struct `Foo<fn(&'static ())>`
|
||||
found struct `Foo<for<'a> fn(&'a ())>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
17
tests/ui/associated-inherent-types/issue-109790.rs
Normal file
17
tests/ui/associated-inherent-types/issue-109790.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl<'a> Foo<fn(&'a ())> {
|
||||
type Assoc = &'a ();
|
||||
}
|
||||
|
||||
trait Other {}
|
||||
impl Other for u32 {}
|
||||
|
||||
fn bar(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user