Closed
Description
Code
struct MyStruct {
foo: Option<UndefinedType>,
}
impl MyStruct {
pub const EMPTY_REF: &'static Self = &Self::EMPTY;
pub const EMPTY: Self = Self {
foo: None,
};
}
Current output
error[E0412]: cannot find type `UndefinedType` in this scope
--> src/lib.rs:2:17
|
2 | foo: Option<UndefinedType>,
| ^^^^^^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
1 | struct MyStruct<UndefinedType> {
| +++++++++++++++
error[E0492]: constants cannot refer to interior mutable data
--> src/lib.rs:5:42
|
5 | pub const EMPTY_REF: &'static Self = &Self::EMPTY;
| ^^^^^^^^^^^^ this borrow of an interior mutable value may end up in the final value
Desired output
The E0492 interior mutability error is spurious and should not be emitted.
Rust Version
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.1