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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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 19:40:21 +00:00
struct Lexer<R: Read>
2014-10-16 19:40:21 +00:00
{
reader: BufReader<R>,
2014-10-16 19:40:21 +00:00
}
impl<R: Read> Lexer<R>
2014-10-16 19:40:21 +00:00
{
pub fn new_from_reader(r: R) -> Lexer<R>
{
Lexer{reader: BufReader::new(r)}
2014-10-16 19:40:21 +00:00
}
pub fn new_from_file(p: &str) -> io::Result<Lexer<File>>
2014-10-16 19:40:21 +00:00
{
Ok(Lexer::new_from_reader(File::open(p)?))
2014-10-16 19:40:21 +00:00
}
pub fn new_from_str<'a>(s: &'a str) -> Lexer<&'a [u8]>
2014-10-16 19:40:21 +00:00
{
Lexer::new_from_reader(s.as_bytes())
2014-10-16 19:40:21 +00:00
}
}
fn main() {}