Skip to content
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

don't rely on a rustc bug #7508

Merged
merged 1 commit into from
Jul 29, 2022
Merged

don't rely on a rustc bug #7508

merged 1 commit into from
Jul 29, 2022

Conversation

aliemjay
Copy link
Contributor

Hi,

rust-lang/rust#98835 fixes a rustc bug that makes it incorrectly accepts the following code:

fn test<'a: 'a>() { // 'a is longer than the entire function body
    let f = |_: &'a str| {}; // expects an argument that lives as long as 'a
    f(&String::new()); // the passed reference is shorter that `'a`
}

The crater run found that ruffle relies on this bug. I'm not sure when this change reaches stable, if ever, but it's better to not rely on such a bug. This PR tries to fix this.

If you have an opinion on this change, please let me know here or by commenting on the PR.

You can install and test the toolchain locally by running the command: rustup-toolchain-install-master cb1f7c96119295882e08b09b4bd01051669c071b

let tag_callback = |reader: &mut SwfStream<'gc>, tag_code, tag_len| match tag_code {
let tag_callback = |reader: &mut _, tag_code, tag_len| match tag_code {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the required change would be to only remove the lifetime annotation:

-            let tag_callback = |reader: &mut SwfStream<'gc>, tag_code, tag_len| match tag_code {
+           let tag_callback = |reader: &mut SwfStream<'_>, tag_code, tag_len| match tag_code {

but this unfortunately exposes another rust bug that requires such a hacky solution. See rust-lang/rust#58052 rust-lang/rust#70263.

@Aaron1011 Aaron1011 self-assigned this Jul 29, 2022
@Aaron1011 Aaron1011 merged commit 67fbc84 into ruffle-rs:master Jul 29, 2022
@Aaron1011
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants