fix tidy, small cleanup
This commit is contained in:
parent
8667f93040
commit
300b0acb85
5 changed files with 28 additions and 13 deletions
|
@ -586,7 +586,7 @@ declare_features! (
|
||||||
(active, if_let_guard, "1.47.0", Some(51114), None),
|
(active, if_let_guard, "1.47.0", Some(51114), None),
|
||||||
|
|
||||||
/// Allows non trivial generic constants which have to be manually propageted upwards.
|
/// Allows non trivial generic constants which have to be manually propageted upwards.
|
||||||
(active, const_evaluatable_checked, "1.48.0", Some(0), None),
|
(active, const_evaluatable_checked, "1.48.0", Some(76560), None),
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// feature-group-end: actual feature gates
|
// feature-group-end: actual feature gates
|
||||||
|
|
|
@ -73,10 +73,6 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if concrete.is_ok() {
|
debug!(?concrete, "is_const_evaluatable");
|
||||||
debug!("is_const_evaluatable: concrete ~~> ok");
|
|
||||||
} else {
|
|
||||||
debug!("is_const_evaluatable: concrete ~~> err");
|
|
||||||
}
|
|
||||||
concrete.map(drop)
|
concrete.map(drop)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1678,13 +1678,8 @@ fn predicates_defined_on(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicate
|
||||||
|
|
||||||
if tcx.features().const_evaluatable_checked {
|
if tcx.features().const_evaluatable_checked {
|
||||||
let const_evaluatable = const_evaluatable_predicates_of(tcx, def_id, &result);
|
let const_evaluatable = const_evaluatable_predicates_of(tcx, def_id, &result);
|
||||||
if result.predicates.is_empty() {
|
result.predicates =
|
||||||
result.predicates = tcx.arena.alloc_from_iter(const_evaluatable);
|
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(const_evaluatable));
|
||||||
} else {
|
|
||||||
result.predicates = tcx
|
|
||||||
.arena
|
|
||||||
.alloc_from_iter(result.predicates.iter().copied().chain(const_evaluatable));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("predicates_defined_on({:?}) = {:?}", def_id, result);
|
debug!("predicates_defined_on({:?}) = {:?}", def_id, result);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#![feature(const_generics)]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
type Arr<const N: usize> = [u8; N - 1];
|
||||||
|
|
||||||
|
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
|
||||||
|
//~^ ERROR constant expression depends
|
||||||
|
Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x = test::<33>();
|
||||||
|
assert_eq!(x, [0; 32]);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
error: constant expression depends on a generic parameter
|
||||||
|
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:30
|
||||||
|
|
|
||||||
|
LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
|
||||||
|
| ^^^^^^
|
||||||
|
|
|
||||||
|
= note: this may fail depending on what value the parameter takes
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue