-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate associated type bounds on ?
- Loading branch information
1 parent
e356279
commit 06a49b6
Showing
3 changed files
with
58 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
trait HasAssoc { | ||
type Assoc; | ||
} | ||
fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} | ||
//~^ WARN relaxing a default bound | ||
|
||
trait NoAssoc {} | ||
fn noassoc<T: ?NoAssoc<Missing = ()>>() {} | ||
//~^ WARN relaxing a default bound | ||
//~| ERROR associated type `Missing` not found for `NoAssoc` | ||
|
||
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,21 @@ | ||
warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default | ||
--> $DIR/maybe-bound-with-assoc.rs:4:16 | ||
| | ||
LL | fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default | ||
--> $DIR/maybe-bound-with-assoc.rs:8:15 | ||
| | ||
LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0220]: associated type `Missing` not found for `NoAssoc` | ||
--> $DIR/maybe-bound-with-assoc.rs:8:24 | ||
| | ||
LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} | ||
| ^^^^^^^ associated type `Missing` not found | ||
|
||
error: aborting due to 1 previous error; 2 warnings emitted | ||
|
||
For more information about this error, try `rustc --explain E0220`. |