Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2f5294e
Fixes #35304
mikhail-m1 Aug 5, 2016
e7e5cfe
Merge branch 'master' of https://github.com/rust-lang/rust
mikhail-m1 Aug 5, 2016
9f09ee5
Updates compiler error E0046 with new format
shri3k Aug 5, 2016
e5a4a7a
Updates compiler error E0040 with new format
shri3k Aug 5, 2016
5bab0e6
Update E0206 message to new format
KiChjang Aug 5, 2016
065c685
Update E0223 to the new format
KiChjang Aug 6, 2016
c9e9d42
Update compiler error 0027 to use new error format.
silenuss Aug 6, 2016
1d25e2e
Update compiler error 0029 to use new error format.
silenuss Aug 6, 2016
f4dd1f9
Updated error message E0252
Aug 5, 2016
eb469d6
Updated E0225 to new format.
razielgn Aug 6, 2016
6eba89e
Fixing compiler error E0121
intrepion Aug 6, 2016
95cce86
Indicate tracking issue for `exact_size_is_empty` unstability.
frewsxcv Aug 6, 2016
19e4579
Updated error message E0282
Aug 5, 2016
0a6b862
Add doc example for `std::ffi::NulError::into_vec`.
frewsxcv Aug 6, 2016
5e06da2
E0131 updated to new format
Aug 6, 2016
31f0204
Rollup merge of #35355 - shri3k:E0046, r=jonathandturner
Aug 7, 2016
ef75709
Rollup merge of #35357 - shri3k:E0040, r=GuillaumeGomez
Aug 7, 2016
7794eb6
Rollup merge of #35362 - medzin:E0252, r=GuillaumeGomez
Aug 7, 2016
4985246
Rollup merge of #35366 - medzin:E0282, r=jonathandturner
Aug 7, 2016
61ce47a
Rollup merge of #35394 - mikhail-m1:master, r=jonathandturner
Aug 7, 2016
c67a142
Rollup merge of #35402 - KiChjang:e0206-new-msg, r=GuillaumeGomez
Aug 7, 2016
d25e47c
Rollup merge of #35410 - silenuss:e0027-formatting, r=jonathandturner
Aug 7, 2016
8b5f384
Rollup merge of #35411 - KiChjang:e0223-new-format, r=jonathandturner
Aug 7, 2016
06a217d
Rollup merge of #35413 - silenuss:e0029-formatting, r=jonathandturner
Aug 7, 2016
85bf1b6
Rollup merge of #35417 - Limeth:master, r=jonathandturner
Aug 7, 2016
6a720fb
Rollup merge of #35421 - razielgn:updated-e0225-to-new-format, r=jona…
Aug 7, 2016
1c203e3
Rollup merge of #35429 - frewsxcv:tracking-is-empty, r=apasel422
Aug 7, 2016
c150ce6
Rollup merge of #35434 - intrepion:fix-compile-fail-e0121, r=jonathan…
Aug 7, 2016
d9e6bbd
Rollup merge of #35436 - frewsxcv:into-vec, r=GuillaumeGomez
Aug 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,13 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> {
_substs: Option<&mut Substs<'tcx>>,
_space: Option<ParamSpace>,
span: Span) -> Ty<'tcx> {
span_err!(self.tcx().sess, span, E0121,
"the type placeholder `_` is not allowed within types on item signatures");
struct_span_err!(
self.tcx().sess,
span,
E0121,
"the type placeholder `_` is not allowed within types on item signatures"
).span_label(span, &format!("not allowed in type signatures"))
.emit();
self.tcx().types.err
}

Expand Down
34 changes: 34 additions & 0 deletions src/test/compile-fail/typeck_type_placeholder_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,107 +13,141 @@

fn test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

static TEST3: _ = "test";
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static TEST4: _ = 145;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static TEST5: (_, _) = (1, 2);
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

fn test6(_: _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test7(x: _) { let _x: usize = x; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test8(_f: fn() -> _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

struct Test9;

impl Test9 {
fn test9(&self) -> _ { () }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test10(&self, _x : _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

impl Clone for Test9 {
fn clone(&self) -> _ { Test9 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn clone_from(&mut self, other: _) { *self = Test9; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

struct Test10 {
a: _,
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
b: (_, _),
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures
}

pub fn main() {
fn fn_test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

static FN_TEST3: _ = "test";
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static FN_TEST4: _ = 145;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static FN_TEST5: (_, _) = (1, 2);
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

fn fn_test6(_: _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test7(x: _) { let _x: usize = x; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test8(_f: fn() -> _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

struct FnTest9;

impl FnTest9 {
fn fn_test9(&self) -> _ { () }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test10(&self, _x : _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

impl Clone for FnTest9 {
fn clone(&self) -> _ { FnTest9 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn clone_from(&mut self, other: _) { *self = FnTest9; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

struct FnTest10 {
a: _,
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
b: (_, _),
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures
}

}