Skip to content

Commit 86b7546

Browse files
committed
fixing doctest failures in resurfaced extended information
After repatriating error explanations to the global registry, some lurking doctest failures surfaced and needed to be chased down. Sadly, a few doctests needed to be ignored due to a not-yet-understood regression in the doctest `compile_fail` functionality (filed #43707).
1 parent 7efeade commit 86b7546

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

src/librustc_mir/diagnostics.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,8 @@ On the other hand, static and constant pointers can point either to
122122
a known numeric address or to the address of a symbol.
123123
124124
```
125+
static MY_STATIC: u32 = 42;
125126
static MY_STATIC_ADDR: &'static u32 = &MY_STATIC;
126-
// ... and also
127-
static MY_STATIC_ADDR2: *const u32 = &MY_STATIC;
128-
129127
const CONST_ADDR: *const u8 = 0x5f3759df as *const u8;
130128
```
131129
@@ -160,6 +158,16 @@ Remember: you can't use a function call inside a const's initialization
160158
expression! However, you can totally use it anywhere else:
161159
162160
```
161+
enum Test {
162+
V1
163+
}
164+
165+
impl Test {
166+
fn func(&self) -> i32 {
167+
12
168+
}
169+
}
170+
163171
fn main() {
164172
const FOO: Test = Test::V1;
165173

src/librustc_passes/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ while break {}
221221
222222
To fix this, add a label specifying which loop is being broken out of:
223223
```
224-
`foo: while break `foo {}
224+
'foo: while break 'foo {}
225225
```
226226
"##
227227
}

src/libsyntax/diagnostic_list.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The `inline` attribute was malformed.
4242
4343
Erroneous code example:
4444
45-
```compile_fail,E0534
45+
```ignore (compile_fail not working here; see Issue #43707)
4646
#[inline()] // error: expected one argument
4747
pub fn something() {}
4848
@@ -80,7 +80,7 @@ An unknown argument was given to the `inline` attribute.
8080
8181
Erroneous code example:
8282
83-
```compile_fail,E0535
83+
```ignore (compile_fail not working here; see Issue #43707)
8484
#[inline(unknown)] // error: invalid argument
8585
pub fn something() {}
8686
@@ -190,7 +190,9 @@ A literal was used in an attribute that doesn't support literals.
190190
191191
Erroneous code example:
192192
193-
```compile_fail,E0565
193+
```ignore (compile_fail not working here; see Issue #43707)
194+
#![feature(attr_literals)]
195+
194196
#[inline("always")] // error: unsupported literal
195197
pub fn something() {}
196198
```
@@ -209,7 +211,7 @@ A file wasn't found for an out-of-line module.
209211
210212
Erroneous code example:
211213
212-
```compile_fail,E0583
214+
```ignore (compile_fail not working here; see Issue #43707)
213215
mod file_that_doesnt_exist; // error: file not found for module
214216
215217
fn main() {}
@@ -251,23 +253,33 @@ An inclusive range was used with no end.
251253
Erroneous code example:
252254
253255
```compile_fail,E0586
254-
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
255-
let x = &tmp[1...]; // error: inclusive range was used with no end
256+
#![feature(inclusive_range_syntax)]
257+
258+
fn main() {
259+
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
260+
let x = &tmp[1...]; // error: inclusive range was used with no end
261+
}
256262
```
257263
258264
An inclusive range needs an end in order to *include* it. If you just need a
259265
start and no end, use a non-inclusive range (with `..`):
260266
261267
```
262-
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
263-
let x = &tmp[1..]; // ok!
268+
fn main() {
269+
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
270+
let x = &tmp[1..]; // ok!
271+
}
264272
```
265273
266274
Or put an end to your inclusive range:
267275
268276
```
269-
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
270-
let x = &tmp[1...3]; // ok!
277+
#![feature(inclusive_range_syntax)]
278+
279+
fn main() {
280+
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
281+
let x = &tmp[1...3]; // ok!
282+
}
271283
```
272284
"##,
273285

0 commit comments

Comments
 (0)