Skip to content

Add object safety to TRPL #27536

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

Merged
merged 1 commit into from
Aug 18, 2015
Merged

Conversation

steveklabnik
Copy link
Member

Fixes #26938

@rust-highfive
Copy link
Contributor

r? @huonw

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

@steveklabnik
Copy link
Member Author

looks like a spurious travis failure?

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

Disagree?

run doc-trpl-trait-objects [x86_64-unknown-linux-gnu]
test The_Stack_0 ... �[32mok�(B�[m

running 11 tests
test _7 ... �[33mignored�(B�[m
test _8 ... �[33mignored�(B�[m
test _9 ... �[33mignored�(B�[m
test _10 ... �[31mFAILED�(B�[m
test The_Stack_2 ... �[32mok�(B�[m
test Arguments_and_borrowing_0 ... �[32mok�(B�[m
test The_Stack_1 ... �[32mok�(B�[m
test A_complex_example_0 ... �[32mok�(B�[m
test The_Heap_0 ... �[32mok�(B�[m


...


failures:

---- _10 stdout ----
    <anon>:2:59: 2:60 error: unknown start of token: `
<anon>:2     error: cannot convert to a trait object because trait `core::clone::Clone` is not object-safe [E0038]
                                                                   ^
thread '_10' panicked at 'Box<Any>', src/libsyntax/parse/lexer/mod.rs:167



failures:
    _10

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

(had to go into the full log: https://s3.amazonaws.com/archive.travis-ci.org/jobs/74270996/log.txt)


We get an error:

```
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't both of these be marked rust?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or rather, this one should be marked text (words are hard).

@steveklabnik
Copy link
Member Author

@gankro ahhh full log

@steveklabnik
Copy link
Member Author

failures should be addressed now, r?

or all of the following:

* must not have any type parameters
* must have a receiver that has type `Self` or which dereferences to the `Self` type
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "receiver that has type Self" even mean? (Jargon isn't clicking for me today)

Copy link
Member Author

Choose a reason for hiding this comment

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

I just copied it from the RFC... come to think of it, I'm not 100% sure either.

Copy link
Contributor

Choose a reason for hiding this comment

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

It sounds like it's saying it's fn foo(self) but that's not object safe today (though there is a possible route to making it so). This is why FnBox is a thing.

CC @nikomatsakis

Copy link
Contributor

Choose a reason for hiding this comment

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

@gankro ah, I never answered here, sorry. I think yes it was looking forward to a day where fn foo(self) is supported. In particular, at the time of the RFC, I think there was SOME kind of hacky support for by-value self methods in trait objects, though I later removed it because it didn't handle all cases and was hard to generalize.

@steveklabnik
Copy link
Member Author

I've removed the part you were wondering about, @gankro , based on @nikomatsakis 's feedback. r?

@alexcrichton
Copy link
Member

@bors: r+ ce1bdc7

@bors
Copy link
Collaborator

bors commented Aug 18, 2015

⌛ Testing commit ce1bdc7 with merge dc9b74f...

@bors bors merged commit ce1bdc7 into rust-lang:master Aug 18, 2015
@steveklabnik steveklabnik deleted the doc_object_safety branch June 19, 2016 20:32
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.

8 participants