Skip to content

Commit 631ac9c

Browse files
committed
update tests
1 parent ef4d2c1 commit 631ac9c

File tree

6 files changed

+37
-11
lines changed

6 files changed

+37
-11
lines changed

src/librustc_trait_selection/traits/wf.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
398398
// These variants are trivially WF, so nothing to do here.
399399
}
400400
ty::ConstKind::Value(..) => {
401-
// FIXME: Enforce that values are structually-matchable.
401+
// FIXME: Enforce that values are structurally-matchable.
402402
}
403403
}
404404
continue;
@@ -434,6 +434,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
434434

435435
ty::Array(subty, _) => {
436436
self.require_sized(subty, traits::SliceOrArrayElem);
437+
// Note that we handle the len is implicitly checked while walking `arg`.
437438
}
438439

439440
ty::Tuple(ref tys) => {
@@ -445,11 +446,11 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
445446
}
446447

447448
ty::RawPtr(_) => {
448-
// simple cases that are WF if their type args are WF
449+
// Simple cases that are WF if their type args are WF.
449450
}
450451

451452
ty::Projection(data) => {
452-
walker.skip_current_subtree(); // subtree handled by compute_projection
453+
walker.skip_current_subtree(); // Subtree handled by compute_projection.
453454
self.compute_projection(data);
454455
}
455456

src/librustc_typeck/check/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3389,8 +3389,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
33893389
}
33903390
}
33913391

3392-
/// Registers an obligation for checking later, during regionck, that the type `ty` must
3393-
/// outlive the region `r`.
3392+
/// Registers an obligation for checking later, during regionck, that `arg` is well-formed.
33943393
pub fn register_wf_obligation(
33953394
&self,
33963395
arg: subst::GenericArg<'tcx>,

src/test/ui/const-generics/issues/issue-61935.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// check-pass
2-
31
#![feature(const_generics)]
42
//~^ WARN the feature `const_generics` is incomplete
53

@@ -8,6 +6,7 @@ trait Foo {}
86
impl<const N: usize> Foo for [(); N]
97
where
108
Self:FooImpl<{N==0}>
9+
//~^ERROR constant expression depends on a generic parameter
1110
{}
1211

1312
trait FooImpl<const IS_ZERO: bool>{}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61935.rs:3:12
2+
--> $DIR/issue-61935.rs:1:12
33
|
44
LL | #![feature(const_generics)]
55
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

10-
warning: 1 warning emitted
10+
error: constant expression depends on a generic parameter
11+
--> $DIR/issue-61935.rs:8:14
12+
|
13+
LL | Self:FooImpl<{N==0}>
14+
| ^^^^^^^^^^^^^^^
15+
|
16+
= note: this may fail depending on what value the parameter takes
17+
18+
error: aborting due to previous error; 1 warning emitted
1119

src/test/ui/const-generics/lazy-normalization/issue-71922.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// run-pass
21
#![feature(const_generics)]
3-
#![allow(incomplete_features)]
2+
//~^ WARN the feature `const_generics` is incomplete
43
trait Foo {}
54

65
impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
6+
//~^ ERROR constant expression depends on a generic parameter
77

88
trait FooImpl<const IS_ZERO: bool> {}
99

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-71922.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
9+
10+
error: constant expression depends on a generic parameter
11+
--> $DIR/issue-71922.rs:5:50
12+
|
13+
LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
14+
| ^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: this may fail depending on what value the parameter takes
17+
18+
error: aborting due to previous error; 1 warning emitted
19+

0 commit comments

Comments
 (0)