diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/const-generics/lookup-method.rs | 19 | ||||
| -rw-r--r-- | tests/ui/const-generics/lookup-method.stderr | 15 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/const-generics/lookup-method.rs b/tests/ui/const-generics/lookup-method.rs new file mode 100644 index 00000000000..915935c94a5 --- /dev/null +++ b/tests/ui/const-generics/lookup-method.rs @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/124946 + +struct Builder<const A: bool, const B: bool>; + +impl<const A: bool> Builder<A, false> { + fn cast(self) -> Builder<A, true> { + Builder + } +} + +impl Builder<true, true> { + fn build(self) {} +} + +fn main() { + let b = Builder::<false, false>; + b.cast().build(); + //~^ ERROR: no method named `build` found for struct `Builder<false, true>` in the current scope +} diff --git a/tests/ui/const-generics/lookup-method.stderr b/tests/ui/const-generics/lookup-method.stderr new file mode 100644 index 00000000000..4cbd1e17c7b --- /dev/null +++ b/tests/ui/const-generics/lookup-method.stderr @@ -0,0 +1,15 @@ +error[E0599]: no method named `build` found for struct `Builder<false, true>` in the current scope + --> $DIR/lookup-method.rs:17:14 + | +LL | struct Builder<const A: bool, const B: bool>; + | -------------------------------------------- method `build` not found for this struct +... +LL | b.cast().build(); + | ^^^^^ method not found in `Builder<false, true>` + | + = note: the method was found for + - `Builder<true, true>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. |
