This commit is contained in:
Deadbeef 2021-09-02 09:02:19 +00:00
parent 4eab5c1f7b
commit f0a52128ee
No known key found for this signature in database
GPG Key ID: 027DF9338862ADDD
3 changed files with 20 additions and 21 deletions

View File

@ -32,7 +32,7 @@ impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> {
super::ImplSource::TraitAlias(ref d) => write!(f, "{:?}", d),
super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d),
super::ImplSource::ConstDrop(ref d) => write!(f, "{:?}", d),
}
}

View File

@ -1087,26 +1087,25 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let tcx = self.tcx();
// Respect const trait obligations
if self.is_trait_predicate_const(obligation.predicate.skip_binder()) {
match candidate {
// const impl
ImplCandidate(def_id)
if tcx.impl_constness(def_id) == hir::Constness::Const => {}
// const param
ParamCandidate(ty::ConstnessAnd {
constness: ty::BoundConstness::ConstIfConst,
..
}) => {}
// auto trait impl
AutoImplCandidate(..) => {}
// generator, this will raise error in other places
// or ignore error with const_async_blocks feature
GeneratorCandidate => {}
ConstDropCandidate => {}
_ => {
// reject all other types of candidates
return Err(Unimplemented);
}
match candidate {
// const impl
ImplCandidate(def_id) if tcx.impl_constness(def_id) == hir::Constness::Const => {}
// const param
ParamCandidate(ty::ConstnessAnd {
constness: ty::BoundConstness::ConstIfConst,
..
}) => {}
// auto trait impl
AutoImplCandidate(..) => {}
// generator, this will raise error in other places
// or ignore error with const_async_blocks feature
GeneratorCandidate => {}
ConstDropCandidate => {}
_ => {
// reject all other types of candidates
return Err(Unimplemented);
}
}
}
// Treat negative impls as unimplemented, and reservation impls as ambiguity.
if let ImplCandidate(def_id) = candidate {

View File

@ -20,7 +20,7 @@ const fn check<T: ~const Drop>() {}
macro_rules! check_all {
($($T:ty),*$(,)?) => {$(
const _: () = check::<$T>();
const _: () = check::<$T>();
)*};
}