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

impl trait for trait #20341

Merged
merged 8 commits into from
Jan 2, 2015
Merged

Conversation

nikomatsakis
Copy link
Contributor

Code that ensures that every trait object Foo implements the trait Foo.

This requires patching up some object safety concerns. Also more-or-less requires removing the default Sized bound for Self. Don't merge yet until we we reach final decision on these language changes.

@rust-highfive
Copy link
Collaborator

r? @nick29581

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

@@ -783,6 +783,9 @@ pub struct ctxt<'tcx> {

/// Caches whether types move by default.
pub type_moves_by_default_cache: RefCell<HashMap<Ty<'tcx>,bool>>,

/// Caches whether types move by default.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is for type_moves_by_default_cache, not object_safety_cache.

@pcwalton
Copy link
Contributor

r=me modulo nits

@nikomatsakis nikomatsakis force-pushed the impl-trait-for-trait-2 branch from 9086d0c to cf5642e Compare January 2, 2015 15:49
…; also

move get_method_index into traits and give it a better name (`get_vtable_index_of_object_method`).
check it more easily; also extend object safety to cover sized types
as well as static methods.  This makes it sufficient so that we can
always ensure that `Foo : Foo` holds for any trait `Foo`.
@nikomatsakis nikomatsakis force-pushed the impl-trait-for-trait-2 branch from 75a3396 to 704ed4c Compare January 2, 2015 17:10
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 2, 2015
Conflicts:
	src/librustc/middle/traits/mod.rs
	src/libstd/io/mod.rs
	src/test/run-pass/builtin-superkinds-self-type.rs
@bors bors merged commit 704ed4c into rust-lang:master Jan 2, 2015
@nikomatsakis nikomatsakis deleted the impl-trait-for-trait-2 branch March 30, 2016 16:13
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.

6 participants