forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#93714 - compiler-errors:can-type-impl-copy-…
…error-span, r=jackh726 better ObligationCause for normalization errors in `can_type_implement_copy` Some logic is needed so we can point to the field when given totally nonsense types like `struct Foo(<u32 as Iterator>::Item);` Fixes rust-lang#93687
- Loading branch information
Showing
6 changed files
with
65 additions
and
5 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
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,25 @@ | ||
trait TraitFoo { | ||
type Bar; | ||
} | ||
|
||
struct Foo<T> | ||
where | ||
T: TraitFoo, | ||
{ | ||
inner: T::Bar, | ||
} | ||
|
||
impl<T> Clone for Foo<T> | ||
where | ||
T: TraitFoo, | ||
T::Bar: Clone, | ||
{ | ||
fn clone(&self) -> Self { | ||
Self { inner: self.inner.clone() } | ||
} | ||
} | ||
|
||
impl<T> Copy for Foo<T> {} | ||
//~^ ERROR the trait bound `T: TraitFoo` is not satisfied | ||
|
||
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,14 @@ | ||
error[E0277]: the trait bound `T: TraitFoo` is not satisfied | ||
--> $DIR/copy-impl-cannot-normalize.rs:22:1 | ||
| | ||
LL | impl<T> Copy for Foo<T> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitFoo` is not implemented for `T` | ||
| | ||
help: consider restricting type parameter `T` | ||
| | ||
LL | impl<T: TraitFoo> Copy for Foo<T> {} | ||
| ++++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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