// These variants are trivially WF, so nothing to do here.
}
ty::ConstKind::Value(..) => {
- // FIXME: Enforce that values are structually-matchable.
+ // FIXME: Enforce that values are structurally-matchable.
}
}
continue;
ty::Array(subty, _) => {
self.require_sized(subty, traits::SliceOrArrayElem);
+ // Note that we handle the len is implicitly checked while walking `arg`.
}
ty::Tuple(ref tys) => {
}
ty::RawPtr(_) => {
- // simple cases that are WF if their type args are WF
+ // Simple cases that are WF if their type args are WF.
}
ty::Projection(data) => {
- walker.skip_current_subtree(); // subtree handled by compute_projection
+ walker.skip_current_subtree(); // Subtree handled by compute_projection.
self.compute_projection(data);
}
}
}
- /// Registers an obligation for checking later, during regionck, that the type `ty` must
- /// outlive the region `r`.
+ /// Registers an obligation for checking later, during regionck, that `arg` is well-formed.
pub fn register_wf_obligation(
&self,
arg: subst::GenericArg<'tcx>,
-// check-pass
-
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
impl<const N: usize> Foo for [(); N]
where
Self:FooImpl<{N==0}>
+//~^ERROR constant expression depends on a generic parameter
{}
trait FooImpl<const IS_ZERO: bool>{}
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/issue-61935.rs:3:12
+ --> $DIR/issue-61935.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
-warning: 1 warning emitted
+error: constant expression depends on a generic parameter
+ --> $DIR/issue-61935.rs:8:14
+ |
+LL | Self:FooImpl<{N==0}>
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: this may fail depending on what value the parameter takes
+
+error: aborting due to previous error; 1 warning emitted
-// run-pass
#![feature(const_generics)]
-#![allow(incomplete_features)]
+//~^ WARN the feature `const_generics` is incomplete
trait Foo {}
impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+//~^ ERROR constant expression depends on a generic parameter
trait FooImpl<const IS_ZERO: bool> {}
--- /dev/null
+warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/issue-71922.rs:1:12
+ |
+LL | #![feature(const_generics)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(incomplete_features)]` on by default
+ = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
+
+error: constant expression depends on a generic parameter
+ --> $DIR/issue-71922.rs:5:50
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this may fail depending on what value the parameter takes
+
+error: aborting due to previous error; 1 warning emitted
+