]> git.proxmox.com Git - rustc.git/blame - src/test/ui/never_type/defaulted-never-note.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / ui / never_type / defaulted-never-note.rs
CommitLineData
60c5eb7d
XL
1// We need to opt into the `never_type_fallback` feature
2// to trigger the requirement that this is testing.
3#![feature(never_type, never_type_fallback)]
0531ce1d 4
041b39d2 5#![allow(unused)]
8bb4bdeb
XL
6
7trait Deserialize: Sized {
8 fn deserialize() -> Result<Self, String>;
9}
10
11impl Deserialize for () {
12 fn deserialize() -> Result<(), String> {
13 Ok(())
14 }
15}
16
8bb4bdeb
XL
17trait ImplementedForUnitButNotNever {}
18
19impl ImplementedForUnitButNotNever for () {}
20
21fn foo<T: ImplementedForUnitButNotNever>(_t: T) {}
e1599b0c 22//~^ NOTE required by this bound in `foo`
8bb4bdeb
XL
23
24fn smeg() {
25 let _x = return;
26 foo(_x);
0531ce1d
XL
27 //~^ ERROR the trait bound
28 //~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented
29 //~| NOTE the trait is implemented for `()`
8bb4bdeb
XL
30}
31
32fn main() {
cc61c64b 33 smeg();
8bb4bdeb 34}