-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
99 additions
and
2 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 |
---|---|---|
|
@@ -126,6 +126,7 @@ pub enum WellKnownTrait { | |
FnMut, | ||
Fn, | ||
Unsize, | ||
Unpin, | ||
} | ||
|
||
#[derive(Clone, PartialEq, Eq, Debug)] | ||
|
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 |
---|---|---|
|
@@ -269,6 +269,7 @@ pub enum WellKnownTrait { | |
FnMut, | ||
Fn, | ||
Unsize, | ||
Unpin, | ||
} | ||
|
||
chalk_ir::const_visit!(WellKnownTrait); | ||
|
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 |
---|---|---|
|
@@ -346,5 +346,6 @@ mod slices; | |
mod string; | ||
mod tuples; | ||
mod unify; | ||
mod unpin; | ||
mod unsize; | ||
mod wf_goals; |
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,86 @@ | ||
//! Tests targeting the Unpin trait | ||
use super::*; | ||
|
||
#[test] | ||
fn unpin_lowering() { | ||
lowering_success! { | ||
program { | ||
#[auto] #[lang(unpin)] trait Unpin { } | ||
enum A { Variant } | ||
struct B { } | ||
impl !Unpin for A {} | ||
impl Unpin for B {} | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn unpin_auto_trait() { | ||
test! { | ||
program { | ||
#[auto] #[lang(unpin)] trait Unpin { } | ||
struct A { } | ||
} | ||
|
||
goal { | ||
A: Unpin | ||
} yields { | ||
"Unique" | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn unpin_negative() { | ||
test! { | ||
program { | ||
#[auto] #[lang(unpin)] trait Unpin { } | ||
struct A { } | ||
impl !Unpin for A {} | ||
} | ||
|
||
goal { | ||
A: Unpin | ||
} yields { | ||
"No possible solution" | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn unpin_inherit_negative() { | ||
test! { | ||
program { | ||
#[auto] #[lang(unpin)] trait Unpin { } | ||
struct A { } | ||
impl !Unpin for A {} | ||
struct B { a: A } | ||
} | ||
|
||
goal { | ||
B: Unpin | ||
} yields { | ||
"No possible solution" | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn unpin_overwrite() { | ||
test! { | ||
program { | ||
#[auto] #[lang(unpin)] trait Unpin { } | ||
struct A { } | ||
impl !Unpin for A {} | ||
struct B { a: A } | ||
impl Unpin for B {} | ||
} | ||
|
||
goal { | ||
B: Unpin | ||
} yields { | ||
"Unique" | ||
} | ||
} | ||
} |