rust/tests/ui/issues/issue-17121.rs

32 lines
560 B
Rust
Raw Normal View History

// check-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616
use std::fs::File;
use std::io::{self, BufReader, Read};
2014-10-16 14:40:21 -05:00
struct Lexer<R: Read>
2014-10-16 14:40:21 -05:00
{
reader: BufReader<R>,
2014-10-16 14:40:21 -05:00
}
impl<R: Read> Lexer<R>
2014-10-16 14:40:21 -05:00
{
pub fn new_from_reader(r: R) -> Lexer<R>
{
Lexer{reader: BufReader::new(r)}
2014-10-16 14:40:21 -05:00
}
pub fn new_from_file(p: &str) -> io::Result<Lexer<File>>
2014-10-16 14:40:21 -05:00
{
Ok(Lexer::new_from_reader(File::open(p)?))
2014-10-16 14:40:21 -05:00
}
pub fn new_from_str<'a>(s: &'a str) -> Lexer<&'a [u8]>
2014-10-16 14:40:21 -05:00
{
Lexer::new_from_reader(s.as_bytes())
2014-10-16 14:40:21 -05:00
}
}
fn main() {}