fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0308]: mismatched types 2 --> $DIR/as-ref.rs:7:29 3 | 4LL | opt.map(|arg| takes_ref(arg)); 5 | --------- ^^^ expected `&Foo`, found `Foo` 6 | | 7 | arguments to this function are incorrect 8 | 9note: function defined here 10 --> $DIR/as-ref.rs:3:4 11 | 12LL | fn takes_ref(_: &Foo) {} 13 | ^^^^^^^^^ ------- 14help: consider using `as_ref` instead 15 | 16LL | opt.as_ref().map(|arg| takes_ref(arg)); 17 | +++++++++ 18 19error[E0308]: mismatched types 20 --> $DIR/as-ref.rs:8:39 21 | 22LL | opt.and_then(|arg| Some(takes_ref(arg))); 23 | --------- ^^^ expected `&Foo`, found `Foo` 24 | | 25 | arguments to this function are incorrect 26 | 27note: function defined here 28 --> $DIR/as-ref.rs:3:4 29 | 30LL | fn takes_ref(_: &Foo) {} 31 | ^^^^^^^^^ ------- 32help: consider using `as_ref` instead 33 | 34LL | opt.as_ref().and_then(|arg| Some(takes_ref(arg))); 35 | +++++++++ 36 37error[E0308]: mismatched types 38 --> $DIR/as-ref.rs:10:29 39 | 40LL | opt.map(|arg| takes_ref(arg)); 41 | --------- ^^^ expected `&Foo`, found `Foo` 42 | | 43 | arguments to this function are incorrect 44 | 45note: function defined here 46 --> $DIR/as-ref.rs:3:4 47 | 48LL | fn takes_ref(_: &Foo) {} 49 | ^^^^^^^^^ ------- 50help: consider using `as_ref` instead 51 | 52LL | opt.as_ref().map(|arg| takes_ref(arg)); 53 | +++++++++ 54 55error[E0308]: mismatched types 56 --> $DIR/as-ref.rs:11:37 57 | 58LL | opt.and_then(|arg| Ok(takes_ref(arg))); 59 | --------- ^^^ expected `&Foo`, found `Foo` 60 | | 61 | arguments to this function are incorrect 62 | 63note: function defined here 64 --> $DIR/as-ref.rs:3:4 65 | 66LL | fn takes_ref(_: &Foo) {} 67 | ^^^^^^^^^ ------- 68help: consider using `as_ref` instead 69 | 70LL | opt.as_ref().and_then(|arg| Ok(takes_ref(arg))); 71 | +++++++++ 72 73error[E0308]: mismatched types 74 --> $DIR/as-ref.rs:13:29 75 | 76LL | let y: Option<&usize> = x; 77 | -------------- ^ expected `Option<&usize>`, found `&Option<usize>` 78 | | 79 | expected due to this 80 | 81 = note: expected enum `Option<&usize>` 82 found reference `&Option<usize>` 83help: try using `.as_ref()` to convert `&Option<usize>` to `Option<&usize>` 84 | 85LL | let y: Option<&usize> = x.as_ref(); 86 | +++++++++ 87 88error[E0308]: mismatched types 89 --> $DIR/as-ref.rs:15:37 90 | 91LL | let y: Result<&usize, &usize> = x; 92 | ---------------------- ^ expected `Result<&usize, &usize>`, found `&Result<usize, usize>` 93 | | 94 | expected due to this 95 | 96 = note: expected enum `Result<&usize, &usize>` 97 found reference `&Result<usize, usize>` 98help: try using `.as_ref()` to convert `&Result<usize, usize>` to `Result<&usize, &usize>` 99 | 100LL | let y: Result<&usize, &usize> = x.as_ref(); 101 | +++++++++ 102 103error[E0308]: mismatched types 104 --> $DIR/as-ref.rs:19:36 105 | 106LL | let y: Result<&usize, usize> = x; 107 | --------------------- ^ expected `Result<&usize, usize>`, found `&Result<usize, usize>` 108 | | 109 | expected due to this 110 | 111 = note: expected enum `Result<&usize, usize>` 112 found reference `&Result<usize, usize>` 113 114error[E0308]: mismatched types 115 --> $DIR/as-ref.rs:22:42 116 | 117LL | multiple_ref_opt.map(|arg| takes_ref(arg)); 118 | --------- ^^^ expected `&Foo`, found `Foo` 119 | | 120 | arguments to this function are incorrect 121 | 122note: function defined here 123 --> $DIR/as-ref.rs:3:4 124 | 125LL | fn takes_ref(_: &Foo) {} 126 | ^^^^^^^^^ ------- 127help: consider using `as_ref` instead 128 | 129LL | multiple_ref_opt.as_ref().map(|arg| takes_ref(arg)); 130 | +++++++++ 131 132error[E0308]: mismatched types 133 --> $DIR/as-ref.rs:23:52 134 | 135LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); 136 | --------- ^^^ expected `&Foo`, found `Foo` 137 | | 138 | arguments to this function are incorrect 139 | 140note: function defined here 141 --> $DIR/as-ref.rs:3:4 142 | 143LL | fn takes_ref(_: &Foo) {} 144 | ^^^^^^^^^ ------- 145help: consider using `as_ref` instead 146 | 147LL | multiple_ref_opt.as_ref().and_then(|arg| Some(takes_ref(arg))); 148 | +++++++++ 149 150error[E0308]: mismatched types 151 --> $DIR/as-ref.rs:25:45 152 | 153LL | multiple_ref_result.map(|arg| takes_ref(arg)); 154 | --------- ^^^ expected `&Foo`, found `Foo` 155 | | 156 | arguments to this function are incorrect 157 | 158note: function defined here 159 --> $DIR/as-ref.rs:3:4 160 | 161LL | fn takes_ref(_: &Foo) {} 162 | ^^^^^^^^^ ------- 163help: consider using `as_ref` instead 164 | 165LL | multiple_ref_result.as_ref().map(|arg| takes_ref(arg)); 166 | +++++++++ 167 168error[E0308]: mismatched types 169 --> $DIR/as-ref.rs:26:53 170 | 171LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); 172 | --------- ^^^ expected `&Foo`, found `Foo` 173 | | 174 | arguments to this function are incorrect 175 | 176note: function defined here 177 --> $DIR/as-ref.rs:3:4 178 | 179LL | fn takes_ref(_: &Foo) {} 180 | ^^^^^^^^^ ------- 181help: consider using `as_ref` instead 182 | 183LL | multiple_ref_result.as_ref().and_then(|arg| Ok(takes_ref(arg))); 184 | +++++++++ 185 186error[E0308]: mismatched types 187 --> $DIR/as-ref.rs:28:32 188 | 189LL | let _: Result<&usize, _> = &Ok(42); 190 | ----------------- ^^^^^^^ expected `Result<&usize, _>`, found `&Result<{integer}, _>` 191 | | 192 | expected due to this 193 | 194 = note: expected enum `Result<&usize, _>` 195 found reference `&Result<{integer}, _>` 196help: try using `.as_ref()` to convert `&Result<{integer}, _>` to `Result<&usize, _>` 197 | 198LL - let _: Result<&usize, _> = &Ok(42); 199LL + let _: Result<&usize, _> = Ok(42).as_ref(); 200 | 201 202error: aborting due to 12 previous errors 203 204For more information about this error, try `rustc --explain E0308`.