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

Trait coercion issue #14589

Closed
edef1c opened this issue Jun 2, 2014 · 2 comments
Closed

Trait coercion issue #14589

edef1c opened this issue Jun 2, 2014 · 2 comments
Labels
A-typesystem Area: The type system

Comments

@edef1c
Copy link
Contributor

edef1c commented Jun 2, 2014

https://gist.github.com/edef1c/f968f1840b3ed6f007e0

 /tmp/f968f1840b3ed6f007e0 ⮀ ⭠ master ⮀ rustc fail.rs 
fail.rs:17:11: 17:24 error: mismatched types: expected `Box serialize::serialize::Encodable<serialize::json::Encoder<'a>,std::io::IoError>:Send` but found `~Output` (expected trait serialize::serialize::Encodable but found box)
fail.rs:17   tx.send(box Output(0));
                     ^~~~~~~~~~~~~
error: aborting due to previous error
 ✘ ⮀ /tmp/f968f1840b3ed6f007e0 ⮀ ⭠ master ⮀ rustc works.rs 
 /tmp/f968f1840b3ed6f007e0 ⮀ ⭠ master± ⮀ 
@luqmana
Copy link
Member

luqmana commented Jun 3, 2014

Here is a smaller test case:

fn main() {
    send::<Box<Foo>>(box Output(0));               // 1  free function
    Test::<Box<Foo>>::foo(box Output(0));          // 2  static function
    Test::<Box<Foo>>.send(box Output(0));          // 3  method
}

fn send<T>(_: T) {}

struct Test<T>;
impl<T> Test<T> {
    fn foo(_: T) {}
    fn send(&self, _: T) {}
}

trait Foo {}
struct Output(int);
impl Foo for Output {}

All three should work but 3 fails to coerce. It seems to be because we have unresolved types and thus we can't add an adjustment.

@luqmana
Copy link
Member

luqmana commented Jun 4, 2014

Closed by #14628.

@luqmana luqmana closed this as completed Jun 4, 2014
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2024
Add test explorer

This PR implements the vscode testing api similar to rust-lang#14589, this time using a set of lsp extensions in order to make it useful for clients other than vscode, and make the vscode client side logic simpler (its now around ~100 line of TS code)

Fix rust-lang#3601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system
Projects
None yet
Development

No branches or pull requests

2 participants