diff options
| author | bors <bors@rust-lang.org> | 2022-09-22 04:22:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-22 04:22:24 +0000 |
| commit | 7a8636c843bd24038fe1d1f69b4a8e4b0ea55d4e (patch) | |
| tree | 242508adbaeccdb47f57c20a90717945a433130a /src/test/ui/issues | |
| parent | 626b02a8f97a9e35a647aa18fcdb67cbcb3b09c8 (diff) | |
| parent | 898c76cd8257ffd91e9de9714215ece477e1065b (diff) | |
| download | rust-7a8636c843bd24038fe1d1f69b4a8e4b0ea55d4e.tar.gz rust-7a8636c843bd24038fe1d1f69b4a8e4b0ea55d4e.zip | |
Auto merge of #100982 - fee1-dead-contrib:const-impl-requires-const-trait, r=oli-obk
Require `#[const_trait]` on `Trait` for `impl const Trait` r? `@oli-obk`
Diffstat (limited to 'src/test/ui/issues')
| -rw-r--r-- | src/test/ui/issues/issue-25901.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-25901.stderr | 22 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-50582.stderr | 4 |
3 files changed, 10 insertions, 18 deletions
diff --git a/src/test/ui/issues/issue-25901.rs b/src/test/ui/issues/issue-25901.rs index ba12e1ad021..1f7b341a97e 100644 --- a/src/test/ui/issues/issue-25901.rs +++ b/src/test/ui/issues/issue-25901.rs @@ -2,7 +2,7 @@ struct A; struct B; static S: &'static B = &A; -//~^ ERROR cannot perform deref coercion on `A` in statics +//~^ ERROR the trait bound use std::ops::Deref; diff --git a/src/test/ui/issues/issue-25901.stderr b/src/test/ui/issues/issue-25901.stderr index c6c80e41cf6..b9cac32229a 100644 --- a/src/test/ui/issues/issue-25901.stderr +++ b/src/test/ui/issues/issue-25901.stderr @@ -1,23 +1,15 @@ -error[E0015]: cannot perform deref coercion on `A` in statics +error[E0277]: the trait bound `A: Deref` is not satisfied --> $DIR/issue-25901.rs:4:24 | LL | static S: &'static B = &A; - | ^^ - | - = note: attempting to deref into `B` -note: deref defined here - --> $DIR/issue-25901.rs:10:5 + | ^^ the trait `~const Deref` is not implemented for `A` | -LL | type Target = B; - | ^^^^^^^^^^^ -note: impl defined here, but it is not `const` - --> $DIR/issue-25901.rs:9:1 +note: the trait `Deref` is implemented for `A`, but that implementation is not `const` + --> $DIR/issue-25901.rs:4:24 | -LL | impl Deref for A { - | ^^^^^^^^^^^^^^^^ - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell +LL | static S: &'static B = &A; + | ^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr index 3d527eb6b4e..53ecc6112ff 100644 --- a/src/test/ui/issues/issue-50582.stderr +++ b/src/test/ui/issues/issue-50582.stderr @@ -7,13 +7,13 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information = help: add `#![feature(const_for)]` to the crate attributes to enable -error[E0277]: cannot add `()` to `{integer}` +error[E0277]: cannot add `()` to `{integer}` in const contexts --> $DIR/issue-50582.rs:2:18 | LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | ^ no implementation for `{integer} + ()` | - = help: the trait `Add<()>` is not implemented for `{integer}` + = help: the trait `~const Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add<Rhs>`: <&'a f32 as Add<f32>> <&'a f64 as Add<f64>> |
