Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1a97162

Browse files
committedJun 8, 2022
Auto merge of #94732 - nnethercote:infallible-encoder, r=bjorn3
Make `Encodable` and `Encoder` infallible. A follow-up to #93066. r? `@ghost`
2 parents e45d997 + b983e42 commit 1a97162

File tree

48 files changed

+705
-855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+705
-855
lines changed
 

‎compiler/rustc_ast/src/ast.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
3131
use rustc_data_structures::sync::Lrc;
3232
use rustc_data_structures::thin_vec::ThinVec;
3333
use rustc_macros::HashStable_Generic;
34-
use rustc_serialize::{self, Decoder, Encoder};
34+
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
3535
use rustc_span::source_map::{respan, Spanned};
3636
use rustc_span::symbol::{kw, sym, Ident, Symbol};
3737
use rustc_span::{Span, DUMMY_SP};
@@ -2472,13 +2472,11 @@ rustc_index::newtype_index! {
24722472
}
24732473
}
24742474

2475-
impl<S: Encoder> rustc_serialize::Encodable<S> for AttrId {
2476-
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
2477-
Ok(())
2478-
}
2475+
impl<S: Encoder> Encodable<S> for AttrId {
2476+
fn encode(&self, _s: &mut S) {}
24792477
}
24802478

2481-
impl<D: Decoder> rustc_serialize::Decodable<D> for AttrId {
2479+
impl<D: Decoder> Decodable<D> for AttrId {
24822480
fn decode(_: &mut D) -> AttrId {
24832481
crate::attr::mk_attr_id()
24842482
}

‎compiler/rustc_ast/src/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ impl<D: Decoder, T: 'static + Decodable<D>> Decodable<D> for P<T> {
121121
}
122122

123123
impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<T> {
124-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
125-
(**self).encode(s)
124+
fn encode(&self, s: &mut S) {
125+
(**self).encode(s);
126126
}
127127
}
128128

@@ -191,8 +191,8 @@ impl<'a, T> IntoIterator for &'a P<[T]> {
191191
}
192192

193193
impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<[T]> {
194-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
195-
Encodable::encode(&**self, s)
194+
fn encode(&self, s: &mut S) {
195+
Encodable::encode(&**self, s);
196196
}
197197
}
198198

0 commit comments

Comments
 (0)
Please sign in to comment.