-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove "approx env bounds" if we already know from trait
- Loading branch information
1 parent
485397e
commit a5b4cb2
Showing
2 changed files
with
60 additions
and
7 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,37 @@ | ||
// Regression test for #55756. | ||
// | ||
// In this test, the result of `self.callee` is a projection `<D as | ||
// Database<'?0>>::Guard`. As it may contain a destructor, the dropck | ||
// rules require that this type outlivess the scope of `state`. Unfortunately, | ||
// our region inference is not smart enough to figure out how to | ||
// translate a requirement like | ||
// | ||
// <D as Database<'0>>::guard: 'r | ||
// | ||
// into a requirement that `'0: 'r` -- in particular, it fails to do | ||
// so because it *also* knows that `<D as Database<'a>>::Guard: 'a` | ||
// from the trait definition. Faced with so many choices, the current | ||
// solver opts to do nothing. | ||
// | ||
// Fixed by tweaking the solver to recognize that the constraint from | ||
// the environment duplicates one from the trait. | ||
// | ||
// compile-pass | ||
|
||
#![crate_type="lib"] | ||
|
||
pub trait Database<'a> { | ||
type Guard: 'a; | ||
} | ||
|
||
pub struct Stateful<'a, D: 'a>(&'a D); | ||
|
||
impl<'b, D: for <'a> Database<'a>> Stateful<'b, D> { | ||
pub fn callee<'a>(&'a self) -> <D as Database<'a>>::Guard { | ||
unimplemented!() | ||
} | ||
pub fn caller<'a>(&'a self) -> <D as Database<'a>>::Guard { | ||
let state = self.callee(); | ||
unimplemented!() | ||
} | ||
} |