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

Type Inference Fails on Beta and Nightly but not on Stable #40662

Closed
sunjay opened this issue Mar 20, 2017 · 5 comments
Closed

Type Inference Fails on Beta and Nightly but not on Stable #40662

sunjay opened this issue Mar 20, 2017 · 5 comments

Comments

@sunjay
Copy link
Member

sunjay commented Mar 20, 2017

I setup Travis to run on both beta and nightly. This is recommended by the Travis docs because it helps catch regressions.

For some reason, my build works on stable, but fails on beta and nightly. Is this a regression?

Here's the code that doesn't work:

    scope.declare_builtin_function(
        type_name.clone().concat(Identifier::from("writeln")),
        ItemType::Function {
            args: vec![
                FuncArgType::Arg(stdout_type),
                FuncArgType::Variadic(None),
            ],
            return_type: unit_type,
        },
        move |scope, args, _| {
            let mut ops = expression::call(scope, Expression::Identifier(write_method_name.clone()), args)?;

            // Write a newline using a temporary cell
            //TODO: ops.extend(...);
            unimplemented!();

            Ok(ops)
        }
    );

This is in stdio.rs.

For some reason on beta and nightly the compiler can no longer infer that type:

error[E0282]: type annotations needed
  --> src/core/io/stdio.rs:82:13
   |
82 |             Ok(ops)
   |             ^^ cannot infer type for `E`
error: aborting due to previous error

I think it should be able to figure it out based on the call to scope.declare_builtin_function().

@sunjay
Copy link
Member Author

sunjay commented Mar 20, 2017

This seems to have everything to do with the unimplemented!() call. Removing that makes it compile successfully on nightly. I still think this is a bug though, since I shouldn't have to remove that. It works in stable after all.

@sinkuu
Copy link
Contributor

sinkuu commented Mar 20, 2017

#39984?

@sunjay
Copy link
Member Author

sunjay commented Mar 20, 2017

@sinkuu This is probably the same as that one. I'll let someone who is sure close the issue.

@nikomatsakis
Copy link
Contributor

I can validate that this is fixed by #40636

@nikomatsakis
Copy link
Contributor

Closing as a dup of #39984

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

No branches or pull requests

3 participants