diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-20 18:48:54 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-11-24 00:19:47 +0000 |
| commit | 04d1bdc377a97e61a44689e6ac701905cd54fd3a (patch) | |
| tree | adcbd2c4ce23c2e61ad1fd9c8c4a4dc4ed2c6b21 /tests/ui/issues | |
| parent | 15b663e684d0acf1b4299b7ad6b4f4ab106395bd (diff) | |
| download | rust-04d1bdc377a97e61a44689e6ac701905cd54fd3a.tar.gz rust-04d1bdc377a97e61a44689e6ac701905cd54fd3a.zip | |
Constify Deref and DerefMut
Diffstat (limited to 'tests/ui/issues')
| -rw-r--r-- | tests/ui/issues/issue-25901.rs | 2 | ||||
| -rw-r--r-- | tests/ui/issues/issue-25901.stderr | 20 |
2 files changed, 6 insertions, 16 deletions
diff --git a/tests/ui/issues/issue-25901.rs b/tests/ui/issues/issue-25901.rs index 85e12463a90..eae038c71a0 100644 --- a/tests/ui/issues/issue-25901.rs +++ b/tests/ui/issues/issue-25901.rs @@ -2,7 +2,7 @@ struct A; struct B; static S: &'static B = &A; -//~^ ERROR cannot perform deref coercion +//~^ ERROR cannot call conditionally-const method use std::ops::Deref; diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr index bcbc805908f..655a8b78c6a 100644 --- a/tests/ui/issues/issue-25901.stderr +++ b/tests/ui/issues/issue-25901.stderr @@ -1,23 +1,13 @@ -error[E0015]: cannot perform deref coercion on `A` in statics +error[E0658]: cannot call conditionally-const method `<A as Deref>::deref` in statics --> $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 - | -LL | type Target = B; - | ^^^^^^^^^^^ -note: impl defined here, but it is not `const` - --> $DIR/issue-25901.rs:9:1 - | -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 `std::sync::LazyLock::new(|| ...)` + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0658`. |
