Fixes tests
This commit is contained in:
parent
99a108c036
commit
f842f7547e
@ -115,6 +115,8 @@ use syntax::ast;
|
|||||||
use syntax::abi::Abi;
|
use syntax::abi::Abi;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
// NB: This module needs to be declared first so diagnostics are
|
// NB: This module needs to be declared first so diagnostics are
|
||||||
// registered before they are used.
|
// registered before they are used.
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
@ -199,6 +201,25 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let actual = tcx.fn_sig(main_def_id);
|
||||||
|
|
||||||
|
let se_ty = tcx.mk_fn_ptr(ty::Binder(
|
||||||
|
tcx.mk_fn_sig(
|
||||||
|
iter::empty(),
|
||||||
|
// the return type is checked in `check_fn`
|
||||||
|
actual.output().skip_binder(),
|
||||||
|
false,
|
||||||
|
hir::Unsafety::Normal,
|
||||||
|
Abi::Rust
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
require_same_types(
|
||||||
|
tcx,
|
||||||
|
&ObligationCause::new(main_span, main_id, ObligationCauseCode::MainFunctionType),
|
||||||
|
se_ty,
|
||||||
|
tcx.mk_fn_ptr(actual));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
span_bug!(main_span,
|
span_bug!(main_span,
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
fn main() -> i32 { 0 } //~ ERROR E0580
|
|
@ -7,8 +7,9 @@
|
|||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
#![feature(termination_trait)]
|
||||||
|
|
||||||
fn main() -> char {
|
fn main() -> char {
|
||||||
//~^ ERROR: main function has wrong type [E0580]
|
//~^ ERROR: the trait bound `char: std::Termination` is not satisfied
|
||||||
' '
|
' '
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user