-
Notifications
You must be signed in to change notification settings - Fork 13.3k
1.64 - Unexpected dead_code
warning from inside macro expansion.
#102217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report! This should be fixed by |
This warning came from # Cargo.toml
[package]
name = "warn_test"
description = ""
authors = ["Jamie Ridding"]
license = "MIT OR Apache-2.0"
version = "0.0.0"
[dependencies]
pin-project = "=1.0.8" // main.rs
use pin_project::pin_project;
use std::future::Future;
use std::task::{Context, Poll};
use std::pin::Pin;
#[pin_project(project = PinProjectTestProj)]
#[derive(Debug)]
pub struct PinProjectTest<Fut>
where
Fut: Future<Output = ()>,
{
#[pin]
fut: Fut,
}
impl<Fut> PinProjectTest<Fut>
where
Fut: Future<Output = ()>,
{
pub fn new(fut: Fut) -> Self {
PinProjectTest {
fut,
}
}
}
impl<Fut> Future for PinProjectTest<Fut>
where
Fut: Future<Output = ()>,
{
type Output = Fut::Output;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let PinProjectTestProj { fut } = self.project();
fut.poll(cx)
}
}
#[allow(unused_must_use)]
fn main() {
let fut = async {};
let test = PinProjectTest::new(fut);
async {
test.await;
};
}
(Sorry for the huge amount of edits, I am terrible at remembering to include information. And writing, apparently.) |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium -E-needs-mcve |
Needed due to rust-lang/rust#102217 (comment) [ci skip-build-wheels]
Upgrade to Rust v1.64.0. [Blog](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html) Note: Upgraded `pin-project` crate due to rust-lang/rust#102217 (comment).
Give `def_span` the same SyntaxContext as `span_with_body`. rust-lang#102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
Give `def_span` the same SyntaxContext as `span_with_body`. rust-lang#102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
Give `def_span` the same SyntaxContext as `span_with_body`. rust-lang#102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
Give `def_span` the same SyntaxContext as `span_with_body`. rust-lang/rust#102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
possible dupe of #102217 |
You just said this issue is a possible dupe of this issue... |
Damn lol, too many tabs open |
This fixes a spurious dead-code warning that was causing tests to fail. See rust-lang/rust#102217
This fixes a spurious dead-code warning that was causing tests to fail. See rust-lang/rust#102217
This fixes a spurious dead-code warning that was causing tests to fail. See rust-lang/rust#102217
This fixes a spurious dead-code warning that was causing tests to fail. See rust-lang/rust#102217
I am getting an unexpected
dead_code
warning from inside a procedural macro's output. This warning did not appear in the previous version of the Rust Compiler. This is not present in the changelog for 1.64, so I do not believe it to be an expected change.Code
I tried this code:
I expected to see this happen: I expected the code to compile without warnings, as was true for the previous compiler version.
Instead, this happened: I get a
dead_code
warning from inside thepin_project
macro expansion, telling me thatMerge2Proj::project_ref
is unused. This warning is impossible for me to remove, as I have no need forproject_ref
and there is no way to tellpin_project
to not generate it.Version it worked on
It most recently worked on: 1.63
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: