Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jun 2, 2020
1 parent ef4d2c1 commit 631ac9c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/librustc_trait_selection/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
// 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;
Expand Down Expand Up @@ -434,6 +434,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {

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) => {
Expand All @@ -445,11 +446,11 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
}

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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3389,8 +3389,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}

/// 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>,
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/const-generics/issues/issue-61935.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete

Expand All @@ -8,6 +6,7 @@ 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>{}
Expand Down
12 changes: 10 additions & 2 deletions src/test/ui/const-generics/issues/issue-61935.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
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

4 changes: 2 additions & 2 deletions src/test/ui/const-generics/lazy-normalization/issue-71922.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 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> {}

Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/const-generics/lazy-normalization/issue-71922.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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

0 comments on commit 631ac9c

Please sign in to comment.