File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ symbols! {
6161 Mod : "mod" ,
6262 Move : "move" ,
6363 Mut : "mut" ,
64- Only : "only" ,
6564 Pub : "pub" ,
6665 Ref : "ref" ,
6766 Return : "return" ,
@@ -130,6 +129,7 @@ symbols! {
130129 ContractRequires : "contract_requires" ,
131130 Default : "default" ,
132131 MacroRules : "macro_rules" ,
132+ Only : "only" ,
133133 Raw : "raw" ,
134134 Reuse : "reuse" ,
135135 Safe : "safe" ,
Original file line number Diff line number Diff line change @@ -50,4 +50,37 @@ trait InheritedOnly: OnlyPointeeSized {
5050 }
5151}
5252
53+
54+
55+ fn only ( ) {
56+ let only = 0u32 ;
57+ }
58+
59+ mod a{
60+ #[ allow( non_camel_case_types) ]
61+ struct only { }
62+ }
63+
64+ mod b {
65+ use std:: marker:: { MetaSized , PointeeSized } ;
66+
67+ #[ allow( non_camel_case_types) ]
68+ trait only : only PointeeSized {
69+ fn foo ( & self ) {
70+ size_of_val ( self ) ;
71+ //~^ ERROR the size for values of type `Self` cannot be known
72+ }
73+ }
74+ }
75+
76+ mod only{
77+ pub trait Alpha { }
78+ }
79+
80+ // In the below context, rust will attempt to look for `Alpha` in the crate root, not in a module
81+ // `only`
82+ //fn alpha<T: only::Alpha>(){
83+ //}
84+
85+
5386fn main ( ) { }
Original file line number Diff line number Diff line change @@ -77,6 +77,24 @@ LL | size_of_val(&self);
7777LL | size_of_val(&mut self);
7878 | ++++
7979
80- error: aborting due to 7 previous errors
80+ error[E0277]: the size for values of type `Self` cannot be known
81+ --> $DIR/only-bound.rs:70:25
82+ |
83+ LL | size_of_val(self);
84+ | ----------- ^^^^ the trait `MetaSized` is not implemented for `Self`
85+ | |
86+ | required by a bound introduced by this call
87+ |
88+ = note: the trait bound `Self: MetaSized` is not satisfied
89+ note: required by a bound in `std::mem::size_of_val`
90+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
91+ help: consider borrowing here
92+ |
93+ LL | size_of_val(&self);
94+ | +
95+ LL | size_of_val(&mut self);
96+ | ++++
97+
98+ error: aborting due to 8 previous errors
8199
82100For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments