Conversation
warning: casting raw pointers to the same type and constness is unnecessary (`*const dyn of::NonStaticAny` -> `*const dyn of::NonStaticAny`)
--> src/lib.rs:219:11
|
219 | &*(&phantom_data as *const dyn NonStaticAny as *const (dyn NonStaticAny + 'static))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&phantom_data as *const dyn NonStaticAny`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
On older compilers, the pointer cast does not compile due to a rustc bug.
error[E0310]: the parameter type `T` may not live long enough
--> src/lib.rs:223:12
|
223 | &*(&phantom_data as *const dyn NonStaticAny as *const (dyn NonStaticAny + 'static))
| ^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
203 | T: ?Sized + 'static,
| +++++++++
warning: borrow as raw pointer
--> src/lib.rs:223:12
|
223 | &*(&phantom_data as *const dyn NonStaticAny as *const (dyn NonStaticAny + 'static))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::addr_of!(phantom_data)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_as_ptr
= note: `-W clippy::borrow-as-ptr` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::borrow_as_ptr)]`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This requires Rust 1.75+ which contains rust-lang/rust#113262.