Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use constraint span when lowering associated types
- Loading branch information
Showing
9 changed files
with
354 additions
and
189 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
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
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
22 changes: 22 additions & 0 deletions
22
src/test/ui/associated-item/associated-item-type-issue-63594.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,22 @@ | ||
#![feature(associated_type_bounds)] | ||
|
||
fn main() {} | ||
|
||
trait Bar { type Assoc; } | ||
|
||
trait Thing { | ||
type Out; | ||
fn func() -> Self::Out; | ||
} | ||
|
||
struct AssocNoCopy; | ||
impl Bar for AssocNoCopy { type Assoc = String; } | ||
|
||
impl Thing for AssocNoCopy { | ||
type Out = Box<dyn Bar<Assoc: Copy>>; | ||
//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied | ||
|
||
fn func() -> Self::Out { | ||
Box::new(AssocNoCopy) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/associated-item/associated-item-type-issue-63594.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,11 @@ | ||
error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied | ||
--> $DIR/associated-item-type-issue-63594.rs:16:28 | ||
| | ||
LL | type Out = Box<dyn Bar<Assoc: Copy>>; | ||
| ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | ||
| | ||
= note: the return type of a function must have a statically known size | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
Oops, something went wrong.