never is trivially const-drop, and add test
This commit is contained in:
parent
0eccd5feef
commit
8547f5732c
@ -1054,7 +1054,8 @@ pub fn trivial_const_drop<'tcx>(ty: Ty<'tcx>) -> bool {
|
|||||||
| ty::RawPtr(_)
|
| ty::RawPtr(_)
|
||||||
| ty::Ref(..)
|
| ty::Ref(..)
|
||||||
| ty::FnDef(..)
|
| ty::FnDef(..)
|
||||||
| ty::FnPtr(_) => true,
|
| ty::FnPtr(_)
|
||||||
|
| ty::Never => true,
|
||||||
|
|
||||||
ty::Opaque(..)
|
ty::Opaque(..)
|
||||||
| ty::Dynamic(..)
|
| ty::Dynamic(..)
|
||||||
@ -1062,7 +1063,6 @@ pub fn trivial_const_drop<'tcx>(ty: Ty<'tcx>) -> bool {
|
|||||||
| ty::Bound(..)
|
| ty::Bound(..)
|
||||||
| ty::Param(_)
|
| ty::Param(_)
|
||||||
| ty::Placeholder(_)
|
| ty::Placeholder(_)
|
||||||
| ty::Never
|
|
||||||
| ty::Foreign(_)
|
| ty::Foreign(_)
|
||||||
| ty::Projection(_)
|
| ty::Projection(_)
|
||||||
| ty::Infer(_) => false,
|
| ty::Infer(_) => false,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_fn_trait_bound)]
|
#![feature(const_fn_trait_bound)]
|
||||||
#![feature(const_mut_refs)]
|
#![feature(const_mut_refs)]
|
||||||
|
#![feature(never_type)]
|
||||||
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||||
|
|
||||||
struct S<'a>(&'a mut u8);
|
struct S<'a>(&'a mut u8);
|
||||||
@ -77,6 +78,7 @@ fn drop(&mut self) {
|
|||||||
&1,
|
&1,
|
||||||
&1 as *const i32,
|
&1 as *const i32,
|
||||||
ConstDropWithBound::<()>,
|
ConstDropWithBound::<()>,
|
||||||
|
Result::<i32, !>::Ok(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user