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

Borrowck doesn't consider calls to fn~ to be borrows #2978

Closed
nikomatsakis opened this issue Jul 21, 2012 · 0 comments
Closed

Borrowck doesn't consider calls to fn~ to be borrows #2978

nikomatsakis opened this issue Jul 21, 2012 · 0 comments
Assignees
Labels
A-lifetimes Area: lifetime related

Comments

@nikomatsakis
Copy link
Contributor

This program should fail:

fn call(x: @{mut f: fn~()}) {
    x.f(); //~ ERROR foo
    //~^ NOTE bar
}

fn main() {}

the reason is that it would be possible for the closure to cause itself to be freed. well, of course it's not actually possible in this case but it'd require alias analysis to know that.

@ghost ghost assigned nikomatsakis Jul 21, 2012
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 6, 2012
Fixes rust-lang#1896 which was never truly fixed, just masked.
The given tests would have failed had they used `~fn()` and
not `@fn()`.  They now result in compilation errors.

Fixes rust-lang#2978.

Necessary first step for rust-lang#2202, rust-lang#2263.
fhahn added a commit to fhahn/rust that referenced this issue Feb 12, 2014
* src/test/run-pass/issue-3559.rs was fixed in rust-lang#4726
* src/test/compile-fail/borrowck-call-sendfn.rs was fixed in rust-lang#2978
* update src/test/compile-fail/issue-5500-1.rs to work with current Rust
* removed src/test/compile-fail/issue-5500.rs because it is tested in
    src/test/run-fail/issue-5500.rs
* src/test/compile-fail/view-items-at-top.rs fixed
* rust-lang#897 fixed
* compile-fail/issue-6762.rs issue was closed as dup of rust-lang#6801
* deleted compile-fail/issue-2074.rs because it became irelevant and is
  irrelevant rust-lang#2074, a test covering this was added in
  4f92f45
bors added a commit that referenced this issue Feb 12, 2014
While working on #11363 I stumbled over a couple of ignored tests, that seem to be fixed or invalid.

* src/test/run-pass/issue-3559.rs was fixed in #4726
* src/test/compile-fail/borrowck-call-sendfn.rs was fixed in #2978
* update src/test/compile-fail/issue-5500-1.rs to work with current Rust (I'm not 100% sure if the original condition is tested as mentioned in #5500, but I think so)
* removed src/test/compile-fail/issue-5500.rs because it is tested in
    src/test/run-fail/issue-5500.rs (they are the same test cases, I just renamed src/test/run-fail/addr-of-bot.rs to be consistent with the other issue name
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Starting from clap v4.4.15 clap-rs/clap#5298 in
some cases `UnknownArgument` errors are reported as `ArgumentConflict`
errors.

Co-authored-by: Remi Delmas <delmasrd@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related
Projects
None yet
Development

No branches or pull requests

1 participant