]> git.lizzy.rs Git - rust.git/commitdiff
update tests
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Tue, 26 May 2020 21:13:18 +0000 (23:13 +0200)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Tue, 2 Jun 2020 13:02:36 +0000 (15:02 +0200)
src/librustc_trait_selection/traits/wf.rs
src/librustc_typeck/check/mod.rs
src/test/ui/const-generics/issues/issue-61935.rs
src/test/ui/const-generics/issues/issue-61935.stderr
src/test/ui/const-generics/lazy-normalization/issue-71922.rs
src/test/ui/const-generics/lazy-normalization/issue-71922.stderr [new file with mode: 0644]

index dde50a849527de4fb2e04019b02b6e8ccdb61860..5024392a0f98df03a686517f602beba2079009dc 100644 (file)
@@ -398,7 +398,7 @@ fn compute(&mut self, arg: GenericArg<'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;
@@ -434,6 +434,7 @@ fn compute(&mut self, arg: GenericArg<'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) => {
@@ -445,11 +446,11 @@ fn compute(&mut self, arg: GenericArg<'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);
                 }
 
index 275581318f75d58c4fc1db75f52525a93a84d53f..ba4bca8cd9981cfe85fca2ad5f10705299ccba4f 100644 (file)
@@ -3389,8 +3389,7 @@ pub fn node_ty(&self, id: hir::HirId) -> Ty<'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>,
index 5c987e63a9e070c480478143c48393a317db1979..0d42ff1895cdb109f47329284c4870fe8455e904 100644 (file)
@@ -1,5 +1,3 @@
-// check-pass
-
 #![feature(const_generics)]
 //~^ WARN the feature `const_generics` is incomplete
 
@@ -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>{}
index cf0c0e24a7604b47dc2eabb0a7ae59b752154dde..a785af5f008ea739876541dea982df9a1336acd8 100644 (file)
@@ -1,5 +1,5 @@
 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)]
    |            ^^^^^^^^^^^^^^
@@ -7,5 +7,13 @@ 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
 
index 36513f94a9e97562431adca9dc10b06c0fa67139..0d392ddcaedcc4f4a109d0b035e34830e605ed5e 100644 (file)
@@ -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> {}
 
diff --git a/src/test/ui/const-generics/lazy-normalization/issue-71922.stderr b/src/test/ui/const-generics/lazy-normalization/issue-71922.stderr
new file mode 100644 (file)
index 0000000..0091757
--- /dev/null
@@ -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
+