mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Add test for the issue
This commit is contained in:
parent
42c4f1024a
commit
44616e11d0
20
tests/ui/proc-macro/auxiliary/issue-118809.rs
Normal file
20
tests/ui/proc-macro/auxiliary/issue-118809.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// force-host
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_type = "proc-macro"]
|
||||
|
||||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro_derive(Deserialize)]
|
||||
pub fn deserialize_derive(input: TokenStream) -> TokenStream {
|
||||
"impl Build {
|
||||
fn deserialize() -> Option<u64> {
|
||||
let x: Option<u32> = Some(0);
|
||||
Some(x? + 1)
|
||||
}
|
||||
}
|
||||
"
|
||||
.parse()
|
||||
.unwrap()
|
||||
}
|
10
tests/ui/proc-macro/issue-118809.rs
Normal file
10
tests/ui/proc-macro/issue-118809.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// aux-build: issue-118809.rs
|
||||
|
||||
#[macro_use]
|
||||
extern crate issue_118809;
|
||||
|
||||
#[derive(Deserialize)] //~ ERROR mismatched types [E0308]
|
||||
pub struct Build {
|
||||
}
|
||||
|
||||
fn main() {}
|
21
tests/ui/proc-macro/issue-118809.stderr
Normal file
21
tests/ui/proc-macro/issue-118809.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-118809.rs:6:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
| |
|
||||
| expected `u64`, found `u32`
|
||||
| arguments to this enum variant are incorrect
|
||||
|
|
||||
help: the type constructed contains `u32` due to the type of the argument passed
|
||||
--> $DIR/issue-118809.rs:6:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^ this argument influences the type of `Some`
|
||||
note: tuple variant defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user