File tree 3 files changed +29
-5
lines changed
3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
-
12
11
use middle:: freevars:: freevar_entry;
13
12
use middle:: freevars;
14
13
use middle:: subst;
@@ -587,15 +586,15 @@ fn check_ty(cx: &mut Context, aty: &Ty) {
587
586
match aty. node {
588
587
TyPath ( _, _, id) => {
589
588
match cx. tcx . item_substs . borrow ( ) . find ( & id) {
590
- None => { }
589
+ None => { }
591
590
Some ( ref item_substs) => {
592
591
let def_map = cx. tcx . def_map . borrow ( ) ;
593
592
let did = def_map. get_copy ( & id) . def_id ( ) ;
594
593
let generics = ty:: lookup_item_type ( cx. tcx , did) . generics ;
595
594
for def in generics. types . iter ( ) {
596
595
let ty = * item_substs. substs . types . get ( def. space ,
597
596
def. index ) ;
598
- check_typaram_bounds ( cx, aty. span , ty, def)
597
+ check_typaram_bounds ( cx, aty. span , ty, def) ;
599
598
}
600
599
}
601
600
}
@@ -668,7 +667,7 @@ fn check_bounds_on_structs_or_enums_in_type_if_possible(cx: &mut Context,
668
667
. zip ( polytype. generics
669
668
. types
670
669
. iter ( ) ) {
671
- check_typaram_bounds ( cx, span, * ty, type_param_def)
670
+ check_typaram_bounds ( cx, span, * ty, type_param_def) ;
672
671
}
673
672
674
673
// Check trait bounds.
Original file line number Diff line number Diff line change @@ -2410,7 +2410,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
2410
2410
}
2411
2411
2412
2412
ty_trait( box ty:: TyTrait { bounds, .. } ) => {
2413
- object_contents ( cx, bounds) | TC :: ReachesFfiUnsafe
2413
+ object_contents ( cx, bounds) | TC :: ReachesFfiUnsafe | TC :: Nonsized
2414
2414
}
2415
2415
2416
2416
ty_ptr( ref mt) => {
Original file line number Diff line number Diff line change
1
+ // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // ignore-tidy-linelength
12
+
13
+ use std:: cell:: RefCell ;
14
+
15
+ trait Trait { }
16
+
17
+ pub fn main ( ) {
18
+ let x: Vec < Trait + Sized > = Vec :: new ( ) ;
19
+ //~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
20
+ //~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
21
+ //~^^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
22
+ let x: Vec < Box < RefCell < Trait + Sized > > > = Vec :: new ( ) ;
23
+ //~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
24
+ //~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
25
+ }
You can’t perform that action at this time.
0 commit comments