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

GLB of two regions is computed incorrectly #3180

Closed
nikomatsakis opened this issue Aug 11, 2012 · 1 comment
Closed

GLB of two regions is computed incorrectly #3180

nikomatsakis opened this issue Aug 11, 2012 · 1 comment
Labels
A-lifetimes Area: Lifetimes / regions

Comments

@nikomatsakis
Copy link
Contributor

This test case which came up in discussions of #3166 revealed a bug in our GLB computation. It successfully compiles but should not. The expected error is in the function set_desc(), which combines &self with &---this should yield a lifetime of only the body of the function itself, since that is the only lifetime that the two lifetime parameters are guaranteed to have in common, but it currently yields &. Wrong!

mod argparse {
    use std;

    import std::map;
    import either::{either, left, right};

    struct Flag {
        name: &str;
        desc: &str;
        max_count: uint;
        mut value: uint;
    }

    fn flag(name: &str, desc: &str) -> Flag {
        Flag { name: name, desc: desc, max_count: 1, value: 0 }
    }

    impl Flag {
        fn set_desc(self, s: &str) -> Flag {
            Flag {
                name: self.name,
                desc: s,
                max_count: self.max_count,
                value: self.value
            }
        }
    }
}

fn main () {
    let f : argparse::Flag = argparse::flag(~"flag", ~"My flag");
    let updated_flag = f.set_desc(~"My new flag");
    assert updated_flag.desc == "My new flag";
}

I have a fix underway.

@nikomatsakis
Copy link
Contributor Author

Fixed now.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 25, 2023
…ure, r=RalfJung

Check that target features required by LLVM intrinsics are enabled

Fixes rust-lang/miri#3178
RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 25, 2023
…ure, r=RalfJung

Check that target features required by LLVM intrinsics are enabled

Fixes rust-lang/miri#3178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

No branches or pull requests

1 participant