Make some std::io functions const

Includes:
- io::Cursor::new
- io::Cursor::get_ref
- io::Cursor::position
- io::empty
- io::repeat
- io::sink
This commit is contained in:
Benoît du Garreau
2020-11-06 17:46:56 +01:00
parent dc06a36074
commit ae059b532f
5 changed files with 28 additions and 7 deletions

View File

@@ -514,3 +514,10 @@ fn test_eq() {
let _: AssertEq<Cursor<Vec<u8>>> = AssertEq(Cursor::new(Vec::new()));
}
#[allow(dead_code)]
fn const_cursor() {
const CURSOR: Cursor<&[u8]> = Cursor::new(&[0]);
const _: &&[u8] = CURSOR.get_ref();
const _: u64 = CURSOR.position();
}