let parent_id = tcx.hir().get_parent_item(hir_id);
Some(tcx.hir().local_def_id(parent_id).to_def_id())
}
- // FIXME(#43408) always enable this once we use `lazy_normalization` is
+ // FIXME(#43408) always enable this once `lazy_normalization` is
// stable enough and does not need a feature gate anymore.
Node::AnonConst(_) => {
let parent_id = tcx.hir().get_parent_item(hir_id);
}
}
}
-
Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => {
Some(tcx.closure_base_def_id(def_id))
}
|
= note: this may fail depending on what value the parameter takes
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 2 previous errors; 2 warnings emitted
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
- --> $DIR/issue-61336-2.rs:9:5
+ --> $DIR/issue-61336-2.rs:11:5
|
LL | [x; { N }]
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| ^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error; 2 warnings emitted
For more information about this error, try `rustc --explain E0277`.
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
- --> $DIR/issue-61336.rs:9:5
+ --> $DIR/issue-61336.rs:11:5
|
LL | [x; N]
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| ^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error; 2 warnings emitted
For more information about this error, try `rustc --explain E0277`.
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
-<<<<<<< HEAD
-warning: 1 warning emitted
-=======
warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash
--> $DIR/issue-61747.rs:5:12
|
LL | #![feature(lazy_normalization_consts)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
->>>>>>> Added `lazy_normalization_consts` feature, and removed the -Z flag.
+
+warning: 2 warnings emitted
LL | #![feature(lazy_normalization_consts)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+warning: 2 warnings emitted
+
error: constant expression depends on a generic parameter
- --> $DIR/issue-66205.rs:5:12
+ --> $DIR/issue-66205.rs:6:12
|
LL | fact::<{ N - 1 }>();
| ^^^^^^^^^
LL | #![feature(lazy_normalization_consts)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+warning: 2 warnings emitted
+
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
--> $DIR/issue-67185-2.rs:27:6
|
+LL | trait Foo
+ | --- required by a bound in this
+...
+LL | <u8 as Baz>::Quaks: Bar,
+ | --- required by this bound in `Foo`
+...
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
--> $DIR/issue-67185-2.rs:27:6
|
+LL | trait Foo
+ | --- required by a bound in this
+...
+LL | [<u8 as Baz>::Quaks; 2]: Bar,
+ | --- required by this bound in `Foo`
+...
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
--> $DIR/issue-67185-2.rs:31:14
|
-LL | / trait Foo
-LL | |
-LL | | where
-LL | | [<u8 as Baz>::Quaks; 2]: Bar,
-LL | | <u8 as Baz>::Quaks: Bar,
-LL | | {
-LL | | }
- | |_- required by `Foo`
+LL | trait Foo
+ | --- required by a bound in this
+...
+LL | [<u8 as Baz>::Quaks; 2]: Bar,
+ | --- required by this bound in `Foo`
...
-LL | fn f(_: impl Foo) {}
- | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
+LL | fn f(_: impl Foo) {}
+ | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
--> $DIR/issue-67185-2.rs:31:14
|
-LL | / trait Foo
-LL | |
-LL | | where
-LL | | [<u8 as Baz>::Quaks; 2]: Bar,
-LL | | <u8 as Baz>::Quaks: Bar,
-LL | | {
-LL | | }
- | |_- required by `Foo`
+LL | trait Foo
+ | --- required by a bound in this
+...
+LL | <u8 as Baz>::Quaks: Bar,
+ | --- required by this bound in `Foo`
...
-LL | fn f(_: impl Foo) {}
- | ^^^ the trait `Bar` is not implemented for `[u16; 3]`
+LL | fn f(_: impl Foo) {}
+ | ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
-error: aborting due to 6 previous errors
+error: aborting due to 6 previous errors; 2 warnings emitted
For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// run-pass
+#![feature(const_generics)]
+#![feature(lazy_normalization_consts)]
+#![allow(incomplete_features)]
+trait Foo {}
+
+impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+
+trait FooImpl<const IS_ZERO: bool> {}
+
+impl FooImpl<{ 0u8 == 0u8 }> for [(); 0] {}
+
+impl<const N: usize> FooImpl<{ 0u8 != 0u8 }> for [(); N] {}
+
+fn foo<T: Foo>(_: T) {}
+
+fn main() {
+ foo([]);
+ foo([()]);
+}
--- /dev/null
+// gate-test-lazy_normalization_consts
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+trait Foo {}
+
+impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+//~^ ERROR cycle detected
+
+trait FooImpl<const IS_ZERO: bool> {}
+
+impl FooImpl<{ 0u8 == 0u8 }> for [(); 0] {}
+
+impl<const N: usize> FooImpl<{ 0u8 != 0u8 }> for [(); N] {}
+
+fn foo<T: Foo>(_: T) {}
+
+fn main() {
+ foo([]);
+ foo([()]);
+}
--- /dev/null
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:2:12
+ |
+LL | #![feature(const_generics)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0391]: cycle detected when const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:58
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`...
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:58
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^
+note: ...which requires const-evaluating `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`...
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:58
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^
+note: ...which requires type-checking `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`...
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:58
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^
+note: ...which requires processing `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`...
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:58
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^
+ = note: ...which again requires const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>::{{constant}}#0`, completing the cycle
+note: cycle used when processing `<impl at $DIR/lazy-normalization-feature-gate-hack.rs:6:1: 6:72>`
+ --> $DIR/lazy-normalization-feature-gate-hack.rs:6:1
+ |
+LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0391`.