diff options
| author | lcnr <rust@lcnr.de> | 2023-02-08 14:16:22 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2023-02-08 19:11:14 +0100 |
| commit | 4c7c5e597f2c7d6d9453a8288d54a211ae0414bb (patch) | |
| tree | f46d32c832d5505cb128b82d3a2545cb5ef853de | |
| parent | a5164605bc3b572cf2281ce81ad5339fd6249aea (diff) | |
| download | rust-4c7c5e597f2c7d6d9453a8288d54a211ae0414bb.tar.gz rust-4c7c5e597f2c7d6d9453a8288d54a211ae0414bb.zip | |
add (currently ICEing) test
| -rw-r--r-- | tests/ui/traits/new-solver/provisional-result-done.rs | 37 | ||||
| -rw-r--r-- | tests/ui/traits/new-solver/provisional-result-done.stderr | 6 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/traits/new-solver/provisional-result-done.rs b/tests/ui/traits/new-solver/provisional-result-done.rs new file mode 100644 index 00000000000..a3d97927bad --- /dev/null +++ b/tests/ui/traits/new-solver/provisional-result-done.rs @@ -0,0 +1,37 @@ +// known-bug: unknown +// compile-flags: -Ztrait-solver=next +// failure-status: 101 +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +// rustc-env:RUST_BACKTRACE=0 + +// This tests checks that we update results in the provisional cache when +// we pop a goal from the stack. +#![feature(auto_traits)] +auto trait Coinductive {} +struct Foo<T>(T); +struct Bar<T>(T); + +impl<T> Coinductive for Foo<T> +where + Bar<T>: Coinductive +{} + +impl<T> Coinductive for Bar<T> +where + Foo<T>: Coinductive, + Bar<T>: ConstrainInfer, +{} + +trait ConstrainInfer {} +impl ConstrainInfer for Bar<u8> {} +impl ConstrainInfer for Foo<u16> {} + +fn impls<T: Coinductive>() -> T { todo!() } + +fn constrain<T: ConstrainInfer>(_: T) {} + +fn main() { + // This should constrain `_` to `u8`. + impls::<Foo<_>>(); +} diff --git a/tests/ui/traits/new-solver/provisional-result-done.stderr b/tests/ui/traits/new-solver/provisional-result-done.stderr new file mode 100644 index 00000000000..ffc92b81f08 --- /dev/null +++ b/tests/ui/traits/new-solver/provisional-result-done.stderr @@ -0,0 +1,6 @@ +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [check_well_formed] checking that `<impl at $DIR/provisional-result-done.rs:20:1: 20:31>` is well-formed +#1 [check_mod_type_wf] checking that types are well-formed in top-level module +end of query stack |
