Skip to content

Temporaries generated in alt expression have longer lifetime than expected #785

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

Closed
brson opened this issue Jul 29, 2011 · 2 comments
Closed

Comments

@brson
Copy link
Contributor

brson commented Jul 29, 2011

{
  alt gimmeboxes() {
    _ { }
  }
  // The thing returned from gimmeboxes is still refed here
}

I would not expect it to outlive the alt expression. Will produce a better test case later.

@brson
Copy link
Contributor Author

brson commented Jul 29, 2011

Test case:

resource r(i: @mutable int) {
    *i = 100;
}

fn main() {
    let i = @mutable 200;
    alt (r(i)) {
      _ { }
    }
    assert i == 100;
}

@marijnh
Copy link
Contributor

marijnh commented Aug 2, 2011

I would expect that, since they are created in the block context around the alt, that is also their lifetime. Do we have some kind of policy for lifetimes? (I don't know the details of what C++ does.)

@marijnh marijnh closed this as completed in eef9a0b Nov 2, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add preadv64/pwritev64 on Linux/Android
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Fix kani-compiler logs + add json option

This change fixes rust-lang#785. It allow users to configure the Kani logs via
KANI_LOG environment variable as well as via --log-level argument. Note
that the former allows finer grain control on a per crate configuration.

We also support the RUSTC_LOG variable to control the underlying rustc
packages. In order to control the rustc logging, we would need to match
the exact version of the tracing crate used by rustc. To avoid that,
we're keeping them separate.

* Use new --log-level option instead of env variable
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

No branches or pull requests

2 participants