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

Oibit2 #19566

Merged
merged 2 commits into from
Dec 9, 2014
Merged

Oibit2 #19566

merged 2 commits into from
Dec 9, 2014

Conversation

nikomatsakis
Copy link
Contributor

This is a merge of @pcwalton's oibit2 branch

@SimonSapin
Copy link
Contributor

As noted on Reddit, shouldn’t this remove the NoCopy marker?

@nikomatsakis nikomatsakis force-pushed the oibit2 branch 4 times, most recently from 40f9853 to ed33f82 Compare December 8, 2014 18:26
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.

A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.

For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.

This breaks code like:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

Change this code to:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    impl Copy for Point2D {}

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

This is the backwards-incompatible part of rust-lang#13231.

Part of RFC #3.

[breaking-change]
…older

behavior temporarily. This feature will eventually transition to REJECTED.
@nikomatsakis
Copy link
Contributor Author

@SimonSapin eventually, yes. I figure we'll do a cleanup of the marker module separately (this PR is big enough as is...)

@bors bors merged commit a16f60b into rust-lang:master Dec 9, 2014
@milibopp
Copy link
Contributor

Is it intended that #[deriving(Copy)] works as well? If so, why is it not used here?

@liigo
Copy link
Contributor

liigo commented Dec 10, 2014

The same question: why use blank impl instead of #[deriving(Copy)]?
2014年12月10日 下午10:52于 "Eduard Bopp" notifications@github.com写道:

Is it intended that #[deriving(Copy)] works as well? If so, why is it not
used here?


Reply to this email directly or view it on GitHub
#19566 (comment).

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.

5 participants