forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#123182 - jhpratt:fix-decodable-derive, r=da…
…vidtwco Avoid expanding to unstable internal method Fixes rust-lang#123156 Rather than expanding to `std::rt::begin_panic`, the expansion is now to `unreachable!()`. The resulting behavior is identical. A test that previously triggered the same error as rust-lang#123156 has been added to ensure it does not regress. r? compiler
- Loading branch information
Showing
4 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![crate_type = "lib"] | ||
|
||
pub trait Decoder { | ||
type Error; | ||
|
||
fn read_enum<T, F>(&mut self, name: &str, f: F) -> Result<T, Self::Error> | ||
where F: FnOnce(&mut Self) -> Result<T, Self::Error>; | ||
fn read_enum_variant<T, F>(&mut self, names: &[&str], f: F) | ||
-> Result<T, Self::Error> | ||
where F: FnMut(&mut Self, usize) -> Result<T, Self::Error>; | ||
|
||
} | ||
|
||
pub trait Decodable: Sized { | ||
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@ check-pass | ||
//@ edition:2021 | ||
//@ aux-build:rustc-serialize.rs | ||
|
||
#![crate_type = "lib"] | ||
#![allow(deprecated, soft_unstable)] | ||
|
||
extern crate rustc_serialize; | ||
|
||
#[derive(RustcDecodable)] | ||
pub enum Foo {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Future incompatibility report: Future breakage diagnostic: | ||
warning: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code | ||
--> $DIR/rustc-decodable-issue-123156.rs:10:10 | ||
| | ||
LL | #[derive(RustcDecodable)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> | ||
|