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

Disallow constants and statics from having unsized types. #34443

Merged
merged 1 commit into from
Jul 2, 2016

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Jun 24, 2016

This is a [breaking-change] which fixes #34390 by banning unsized const and static, e.g.:

const A: [i32] = *(&[0, 1, 2] as &[i32]);
static B: str = *"foo";

This was not intentionally allowed, and other than for static since some versions ago, it ICE'd.
If you've been taking advantage of this with static, you should be able to just use references instead.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member Author

eddyb commented Jun 24, 2016

I'll start a crater run on this.

@eddyb
Copy link
Member Author

eddyb commented Jun 24, 2016

Crater report shows 0 regressions. r? @pnkfelix

@arielb1
Copy link
Contributor

arielb1 commented Jul 2, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Jul 2, 2016

📌 Commit fe7207f has been approved by arielb1

@bors
Copy link
Contributor

bors commented Jul 2, 2016

⌛ Testing commit fe7207f with merge e85adff...

bors added a commit that referenced this pull request Jul 2, 2016
Disallow constants and statics from having unsized types.

This is a `[breaking-change]` which fixes #34390 by banning unsized `const` and `static`, e.g.:
```rust
const A: [i32] = *(&[0, 1, 2] as &[i32]);
static B: str = *"foo";
```

This was not intentionally allowed, and other than for `static` since some versions ago, it ICE'd.
If you've been taking advantage of this with `static`, you should be able to just use references instead.
@bors bors merged commit fe7207f into rust-lang:master Jul 2, 2016
@eddyb eddyb deleted the sized-matters branch July 2, 2016 19:50
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.

Constants and statics are not required to be Sized.
6 participants