diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2024-06-25 08:36:40 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2024-06-28 10:57:35 +0000 |
| commit | b9886c6872b1fc7fe8d67c7eea8a20eb9a666200 (patch) | |
| tree | 7fca75e20b0382536a2a0996e3e69887fda25669 /tests/ui/const-generics/generic_const_exprs | |
| parent | 74e7b5bd762ac9be7d84689271324826d2056a7f (diff) | |
| download | rust-b9886c6872b1fc7fe8d67c7eea8a20eb9a666200.tar.gz rust-b9886c6872b1fc7fe8d67c7eea8a20eb9a666200.zip | |
bless tests part 1
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs | 2 | ||||
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr | 55 |
2 files changed, 12 insertions, 45 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs index 2f903ea419e..bd9c08e5ad8 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs @@ -1,6 +1,6 @@ //@ known-bug: #110395 -#![feature(generic_const_exprs, adt_const_params, const_trait_impl)] +#![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)] #![allow(incomplete_features)] // test `N + N` unifies with explicit function calls for non-builtin-types diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr index 335130c958f..cf03bb9ad76 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr @@ -1,3 +1,12 @@ +error: const `impl` for trait `Add` which is not marked with `#[const_trait]` + --> $DIR/unify-op-with-fn-call.rs:10:12 + | +LL | impl const std::ops::Add for Foo { + | ^^^^^^^^^^^^^ + | + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change + error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter --> $DIR/unify-op-with-fn-call.rs:18:29 | @@ -45,48 +54,6 @@ help: try adding a `where` bound LL | fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) where [(); { std::ops::Add::add(N, N) }]: { | +++++++++++++++++++++++++++++++++++++++++ -error[E0015]: cannot call non-const operator in constants - --> $DIR/unify-op-with-fn-call.rs:20:39 - | -LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) { - | ^^^^^ - | -note: impl defined here, but it is not `const` - --> $DIR/unify-op-with-fn-call.rs:10:1 - | -LL | impl const std::ops::Add for Foo { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants - --> $DIR/unify-op-with-fn-call.rs:21:13 - | -LL | bar::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants - --> $DIR/unify-op-with-fn-call.rs:30:14 - | -LL | bar2::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0015, E0741. -For more information about an error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0741`. |
