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

DST raw pointers - *-pointers are fat pointers #16805

Merged
merged 2 commits into from
Sep 2, 2014
Merged

Conversation

nrc
Copy link
Member

@nrc nrc commented Aug 27, 2014

@nrc nrc mentioned this pull request Aug 28, 2014
23 tasks
@nikomatsakis
Copy link
Contributor

I will review, I'd like to get more familiar with this code.

@nrc
Copy link
Member Author

nrc commented Aug 29, 2014

@nikomatsakis r? updated to fix coercion fn calls

@@ -167,5 +167,6 @@ register_diagnostics!(
E0155,
E0156,
E0157,
E0158
E0158,
E0159
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this new line could have a trailing , to make it work better in diffs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it can because our macro_rules does not allow for optional trailing commas. Or at least, you do not get them automatically with $(...),*, and I do not know if you can express them otherwise. The last time I tried to emulate the effect in macro_rules! i was not successful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this felt so much like an enum definition that didn't even cross my mind.

I guess we could have a compulsory trailing comma via $(... , )*. Also, [vec!`](http://doc.rust-lang.org/master/std/macro.vec!.html) somehow manages to satisfy the compiler to make optional trailing commas work.

Anyway, not important.

@nrc
Copy link
Member Author

nrc commented Aug 29, 2014

It occurs to me that we should not in fact allow implicit coercions where don't allow the corresponding implicit derefs for unsafe pointers. E.g.,

    let x: *const S = &S;
    let y: *const T = x;

The second line here should be an error. I believe combining the two statements is OK:

    let y: *const T = &S;

Since we derefing a borrowed pointer, unsizing, then making an unsafe reference.

I'll remove the ability to do the bogus adjustments on Monday.

@nikomatsakis
Copy link
Contributor

On Fri, Aug 29, 2014 at 01:39:48AM -0700, Nick Cameron wrote:

It occurs to me that we should not in fact allow implicit coercions where don't allow the corresponding implicit derefs for unsafe pointers. E.g.,

    let x: *const S = &S;
    let y: *const T = x;

The second line here should be an error. I believe combining the two statements is OK:

    let y: *const T = &S;

Since we derefing a borrowed pointer, unsizing, then making an unsafe reference.

I agree that we should be consistent, although I think we should
probably allow the adjustments in the case of *T. I think the bottom
line is that we need to agree upon the rules and write up a
"descriptive" RFC so that we are all on the same page. I'll take a
stab at that. Per our conversation at work week, we can eschew deep
conversions (for now, at least).

I'll remove the ability to do the bogus adjustments on Monday.

In a separate PR?

@nikomatsakis
Copy link
Contributor

r+ modulo nits

@nrc
Copy link
Member Author

nrc commented Sep 1, 2014

Addressed reviewer comments

@bors bors closed this Sep 2, 2014
@bors bors merged commit 5520ea8 into rust-lang:master Sep 2, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 31, 2024
feat: Implement resolving and lowering of Lifetimes (no inference yet)
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