forked from rust-lang/rust
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a regression test for issue-74244
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
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,20 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
trait Allocator { | ||
type Buffer; | ||
} | ||
|
||
struct DefaultAllocator; | ||
|
||
impl<T> Allocator for DefaultAllocator { | ||
//~^ ERROR: the type parameter `T` is not constrained | ||
type Buffer = (); | ||
} | ||
|
||
type A = impl Fn(<DefaultAllocator as Allocator>::Buffer); | ||
|
||
fn foo() -> A { | ||
|_| () | ||
} | ||
|
||
fn main() {} |
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[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/issue-74244.rs:9:6 | ||
| | ||
LL | impl<T> Allocator for DefaultAllocator { | ||
| ^ unconstrained type parameter | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0207`. |