diff options
| author | bors <bors@rust-lang.org> | 2022-02-07 15:32:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-07 15:32:19 +0000 |
| commit | f52c31840df7ec9c9350baff51a8964b20b5e1ba (patch) | |
| tree | a7ea66705f0f42dc17756f1a63b91f3faa2a5139 /compiler/rustc_serialize/src/json.rs | |
| parent | c5e414843ebfe25674d8e18a5369d6249fdee741 (diff) | |
| parent | a6c48108ad2a5bbfb161818a047e4497dde0afea (diff) | |
| download | rust-f52c31840df7ec9c9350baff51a8964b20b5e1ba.tar.gz rust-f52c31840df7ec9c9350baff51a8964b20b5e1ba.zip | |
Auto merge of #93738 - m-ou-se:rollup-zjyd2et, r=m-ou-se
Rollup of 13 pull requests
Successful merges:
- #88313 (Make the pre-commit script pre-push instead)
- #91530 (Suggest 1-tuple parentheses on exprs without existing parens)
- #92724 (Cleanup c_str.rs)
- #93208 (Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0)
- #93394 (Don't allow {} to refer to implicit captures in format_args.)
- #93416 (remove `allow_fail` test flag)
- #93487 (Fix linking stage1 toolchain in `./x.py setup`)
- #93673 (Linkify sidebar headings for sibling items)
- #93680 (Drop json::from_reader)
- #93682 (Update tracking issue for `const_fn_trait_bound`)
- #93722 (Use shallow clones for submodules managed by rustbuild, not just bootstrap.py)
- #93723 (Rerun bootstrap's build script when RUSTC changes)
- #93737 (bootstrap: prefer using '--config' over 'RUST_BOOTSTRAP_CONFIG')
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_serialize/src/json.rs')
| -rw-r--r-- | compiler/rustc_serialize/src/json.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/compiler/rustc_serialize/src/json.rs b/compiler/rustc_serialize/src/json.rs index 044de8e4e24..6a398549241 100644 --- a/compiler/rustc_serialize/src/json.rs +++ b/compiler/rustc_serialize/src/json.rs @@ -185,8 +185,6 @@ use self::ParserState::*; use std::borrow::Cow; use std::collections::{BTreeMap, HashMap}; -use std::io; -use std::io::prelude::*; use std::mem::swap; use std::num::FpCategory as Fp; use std::ops::Index; @@ -250,7 +248,6 @@ pub enum ErrorCode { pub enum ParserError { /// msg, line, col SyntaxError(ErrorCode, usize, usize), - IoError(io::ErrorKind, String), } // Builder and Parser have the same errors. @@ -329,10 +326,6 @@ impl fmt::Display for ErrorCode { } } -fn io_error_to_error(io: io::Error) -> ParserError { - IoError(io.kind(), io.to_string()) -} - impl fmt::Display for ParserError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // FIXME this should be a nicer error @@ -2163,21 +2156,6 @@ impl<T: Iterator<Item = char>> Builder<T> { } } -/// Decodes a json value from an `&mut io::Read` -pub fn from_reader(rdr: &mut dyn Read) -> Result<Json, BuilderError> { - let mut contents = Vec::new(); - match rdr.read_to_end(&mut contents) { - Ok(c) => c, - Err(e) => return Err(io_error_to_error(e)), - }; - let s = match str::from_utf8(&contents).ok() { - Some(s) => s, - _ => return Err(SyntaxError(NotUtf8, 0, 0)), - }; - let mut builder = Builder::new(s.chars()); - builder.build() -} - /// Decodes a json value from a string pub fn from_str(s: &str) -> Result<Json, BuilderError> { let mut builder = Builder::new(s.chars()); |
