Skip to content

Commit eae6c99

Browse files
bors[bot]Dirbaio
andauthored
Merge #263
263: extend core::fmt impl to cover all lifetimes r=eldruin a=Dirbaio Without this, code like this doesn't build: ```rust fn what<'a, E>(tx: &'a mut dyn hal::serial::Write<u8, Error=E>) { tx.write_char('a'); } ``` ``` error[E0308]: mismatched types --> src/main.rs:136:8 | 136 | tx.write_char('a'); | ^^^^^^^^^^ lifetime mismatch | = note: expected trait `core::fmt::Write` found trait `core::fmt::Write` note: the lifetime `'a` as defined on the function body at 135:9... --> src/main.rs:135:9 | 135 | fn what<'a, E>(tx: &'a mut dyn hal::serial::Write<u8, Error=E>) { | ^^ = note: ...does not necessarily outlive the static lifetime ``` Co-authored-by: Dario Nieuwenhuis <[email protected]>
2 parents d45af5f + 3bda303 commit eae6c99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! TODO write example of usage
44
use core::fmt::{Result, Write};
55

6-
impl<Word, Error> Write for dyn (crate::serial::Write<Word, Error = Error>)
6+
impl<Word, Error> Write for dyn crate::serial::Write<Word, Error = Error> + '_
77
where
88
Word: From<u8>,
99
{

0 commit comments

Comments
 (0)