Skip to content

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

Closed
@sunjay

Description

@sunjay

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions