1
Fork 0
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::TraitAlias(ref d) => write!(f, "{:?}", d),
super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d), super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d),
super::ImplSource::ConstDrop(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(); let tcx = self.tcx();
// Respect const trait obligations // Respect const trait obligations
if self.is_trait_predicate_const(obligation.predicate.skip_binder()) { if self.is_trait_predicate_const(obligation.predicate.skip_binder()) {
match candidate { match candidate {
// const impl // const impl
ImplCandidate(def_id) ImplCandidate(def_id) if tcx.impl_constness(def_id) == hir::Constness::Const => {}
if tcx.impl_constness(def_id) == hir::Constness::Const => {} // const param
// const param ParamCandidate(ty::ConstnessAnd {
ParamCandidate(ty::ConstnessAnd { constness: ty::BoundConstness::ConstIfConst,
constness: ty::BoundConstness::ConstIfConst, ..
.. }) => {}
}) => {} // auto trait impl
// auto trait impl AutoImplCandidate(..) => {}
AutoImplCandidate(..) => {} // generator, this will raise error in other places
// generator, this will raise error in other places // or ignore error with const_async_blocks feature
// or ignore error with const_async_blocks feature GeneratorCandidate => {}
GeneratorCandidate => {} ConstDropCandidate => {}
ConstDropCandidate => {} _ => {
_ => { // reject all other types of candidates
// reject all other types of candidates return Err(Unimplemented);
return Err(Unimplemented);
}
} }
}
} }
// Treat negative impls as unimplemented, and reservation impls as ambiguity. // Treat negative impls as unimplemented, and reservation impls as ambiguity.
if let ImplCandidate(def_id) = candidate { if let ImplCandidate(def_id) = candidate {

View file

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