From 8a6154b8cf1fb00f016c94e594314045bfc555a4 Mon Sep 17 00:00:00 2001 From: sope Date: Wed, 26 Jan 2022 20:20:28 +0800 Subject: [PATCH] Update too-long1.md --- book/contents/fight-with-compiler/lifetime/too-long1.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/book/contents/fight-with-compiler/lifetime/too-long1.md b/book/contents/fight-with-compiler/lifetime/too-long1.md index e30f2a5b..14bd96df 100644 --- a/book/contents/fight-with-compiler/lifetime/too-long1.md +++ b/book/contents/fight-with-compiler/lifetime/too-long1.md @@ -141,7 +141,8 @@ struct List<'text> { } impl<'text> List<'text> { - pub fn get_interface<'manager>(&'manager mut self) -> Interface<'text, 'manager> { + pub fn get_interface<'manager>(&'manager mut self) -> Interface<'text, 'manager> + where 'text: 'manager { Interface { manager: &mut self.manager } @@ -167,4 +168,4 @@ fn main() { fn use_list(list: &List) { println!("{}", list.manager.text); } -``` \ No newline at end of file +```