Skip to content

Commit aedd4c6

Browse files
committed
Regenerate tests
1 parent 6cfda07 commit aedd4c6

34 files changed

+247
-283
lines changed

src/Cargo.lock

Lines changed: 3 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ for ty::subst::Kind<'gcx> {
6161
}
6262
}
6363

64-
impl<'gcx> HashStable<StableHashingContext<'gcx>>
64+
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
6565
for ty::subst::UnpackedKind<'gcx> {
6666
fn hash_stable<W: StableHasherResult>(&self,
67-
hcx: &mut StableHashingContext<'gcx>,
67+
hcx: &mut StableHashingContext<'a>,
6868
hasher: &mut StableHasher<W>) {
6969
match self {
7070
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),

src/librustc/ty/maps/on_disk_cache.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ impl<'sess> OnDiskCache<'sess> {
362362
cnum_map: cnum_map.as_ref().unwrap(),
363363
file_index_to_file: &self.file_index_to_file,
364364
file_index_to_stable_id: &self.file_index_to_stable_id,
365+
synthetic_expansion_infos: &self.synthetic_expansion_infos,
365366
interpret_alloc_cache: FxHashMap::default(),
366367
};
367368

src/librustc_driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use rustc_typeck as typeck;
3636
use rustc_privacy;
3737
use rustc_plugin::registry::Registry;
3838
use rustc_plugin as plugin;
39-
use rustc_passes::{self, ast_validation, loops, consts, hir_stats};
39+
use rustc_passes::{self, ast_validation, loops, rvalue_promotion, hir_stats};
4040
use super::Compilation;
4141

4242
use serialize::json;

src/librustc_mir/hair/pattern/mod.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,17 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
373373
PatternKind::Constant { value: hi }) => {
374374
use std::cmp::Ordering;
375375
match (end, compare_const_vals(&lo.val, &hi.val, ty).unwrap()) {
376-
(RangeEnd::Excluded, Ordering::Less) => {},
377-
(RangeEnd::Excluded, _) => span_err!(
378-
self.tcx.sess,
379-
lo_expr.span,
380-
E0579,
381-
"lower range bound must be less than upper",
382-
),
376+
(RangeEnd::Excluded, Ordering::Less) =>
377+
PatternKind::Range { lo, hi, end },
378+
(RangeEnd::Excluded, _) => {
379+
span_err!(
380+
self.tcx.sess,
381+
lo_expr.span,
382+
E0579,
383+
"lower range bound must be less than upper",
384+
);
385+
PatternKind::Wild
386+
},
383387
(RangeEnd::Included, Ordering::Greater) => {
384388
let mut err = struct_span_err!(
385389
self.tcx.sess,
@@ -399,10 +403,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
399403
to be less than or equal to the end of the range.");
400404
}
401405
err.emit();
406+
PatternKind::Wild
402407
},
403-
(RangeEnd::Included, _) => {}
408+
(RangeEnd::Included, _) => PatternKind::Range { lo, hi, end },
404409
}
405-
PatternKind::Range { lo, hi, end }
406410
}
407411
_ => PatternKind::Wild
408412
}

src/librustc_mir/monomorphize/collector.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,7 @@ fn collect_miri<'a, 'tcx>(
10901090
let instance = Instance::mono(tcx, did);
10911091
if should_monomorphize_locally(tcx, &instance) {
10921092
trace!("collecting static {:?}", did);
1093-
let node_id = tcx.hir.as_local_node_id(did).unwrap();
1094-
output.push(MonoItem::Static(node_id));
1093+
output.push(MonoItem::Static(did));
10951094
}
10961095
} else if let Some(alloc) = tcx.interpret_interner.get_alloc(alloc_id) {
10971096
trace!("collecting {:?} with {:#?}", alloc_id, alloc);

src/librustc_mir/transform/uniform_array_move_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut {
203203
let opt_size = opt_src_place.and_then(|src_place| {
204204
let src_ty = src_place.ty(mir, tcx).to_ty(tcx);
205205
if let ty::TyArray(_, ref size_o) = src_ty.sty {
206-
size_o.val.to_const_int().and_then(|v| v.to_u64())
206+
size_o.val.to_raw_bits().map(|n| n as u64)
207207
} else {
208208
None
209209
}

src/librustc_passes/rvalue_promotion.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc::middle::expr_use_visitor as euv;
3232
use rustc::middle::mem_categorization as mc;
3333
use rustc::middle::mem_categorization::Categorization;
3434
use rustc::ty::{self, Ty, TyCtxt};
35-
use rustc::ty::maps::{queries, Providers};
35+
use rustc::ty::maps::Providers;
3636
use rustc::ty::subst::Substs;
3737
use rustc::traits::Reveal;
3838
use rustc::util::nodemap::{ItemLocalSet, NodeSet};
@@ -325,16 +325,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
325325
// Don't peek inside trait associated constants.
326326
false
327327
} else {
328-
queries::const_is_rvalue_promotable_to_static::try_get(v.tcx, e.span, did)
329-
.unwrap_or_else(|mut err| {
330-
// A cycle between constants ought to be reported elsewhere.
331-
err.cancel();
332-
v.tcx.sess.delay_span_bug(
333-
e.span,
334-
&format!("cycle encountered during const qualification: {:?}",
335-
did));
336-
false
337-
})
328+
v.tcx.at(e.span).const_is_rvalue_promotable_to_static(did)
338329
};
339330

340331
// Just in case the type is more specific than the definition,

src/test/ui/const-eval-overflow-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | const NEG_NEG_128: i8 = -NEG_128;
55
| ^^^^^^^^ attempt to negate with overflow
66
|
77
note: for pattern here
8-
--> $DIR/const-eval-overflow-2.rs:27:9
8+
--> $DIR/const-eval-overflow-2.rs:26:9
99
|
1010
LL | NEG_NEG_128 => println!("A"),
1111
| ^^^^^^^^^^^

src/test/ui/const-eval-overflow-4.stderr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
warning: constant evaluation error: attempt to add with overflow
2-
--> $DIR/const-eval-overflow-4.rs:23:13
3-
|
4-
LL | : [u32; (i8::MAX as i8 + 1i8) as usize]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: #[warn(const_err)] on by default
8-
91
error[E0080]: constant evaluation error
102
--> $DIR/const-eval-overflow-4.rs:23:13
113
|
Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
error[E0080]: constant evaluation error
2-
--> $DIR/conditional_array_execution.rs:13:19
3-
|
4-
13 | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080
5-
| ^^^^^ attempt to subtract with overflow
6-
|
7-
note: inside call to FOO
8-
--> $DIR/conditional_array_execution.rs:13:1
2+
--> $DIR/conditional_array_execution.rs:16:20
93
|
10-
13 | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | println!("{}", FOO); //~ E0080
5+
| ^^^ referenced constant has errors
126

137
error[E0080]: constant evaluation error
14-
--> $DIR/conditional_array_execution.rs:16:20
15-
|
16-
16 | println!("{}", FOO); //~ E0080
17-
| ^^^ attempt to subtract with overflow
18-
|
19-
note: inside call to main
20-
--> $DIR/conditional_array_execution.rs:16:20
8+
--> $DIR/conditional_array_execution.rs:13:19
219
|
22-
16 | println!("{}", FOO); //~ E0080
23-
| ^^^
10+
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080
11+
| ^^^^^ attempt to subtract with overflow
2412

2513
error: aborting due to 2 previous errors
2614

15+
If you want more information on this error, try using "rustc --explain E0080"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0080]: constant evaluation error
2+
--> $DIR/index_out_of_bound.rs:11:19
3+
|
4+
LL | static FOO: i32 = [][0];
5+
| ^^^^^ index out of bounds: the len is 0 but the index is 0 at $DIR/index_out_of_bound.rs:11:19: 11:24
6+
7+
error: aborting due to previous error
8+
9+
If you want more information on this error, try using "rustc --explain E0080"
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
warning: constant evaluation error: attempt to subtract with overflow
2-
--> $DIR/issue-43197.rs:18:20
1+
error[E0080]: constant evaluation error
2+
--> $DIR/issue-43197.rs:20:23
33
|
4-
LL | const X: u32 = 0-1; //~ ERROR constant evaluation error
5-
| ^^^
4+
LL | println!("{} {}", X, Y);
5+
| ^ referenced constant has errors
6+
7+
error[E0080]: constant evaluation error
8+
--> $DIR/issue-43197.rs:20:26
69
|
7-
= note: #[warn(const_err)] on by default
10+
LL | println!("{} {}", X, Y);
11+
| ^ referenced constant has errors
812

9-
warning: constant evaluation error: attempt to subtract with overflow
10-
--> $DIR/issue-43197.rs:20:20
13+
error[E0080]: constant evaluation error
14+
--> $DIR/issue-43197.rs:19:24
1115
|
1216
LL | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error
13-
| ^^^^^^^^
17+
| ^^^ attempt to subtract with overflow
1418

1519
error[E0080]: constant evaluation error
1620
--> $DIR/issue-43197.rs:18:20
1721
|
1822
LL | const X: u32 = 0-1; //~ ERROR constant evaluation error
1923
| ^^^ attempt to subtract with overflow
2024

21-
error[E0080]: constant evaluation error
22-
--> $DIR/issue-43197.rs:20:24
23-
|
24-
LL | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error
25-
| ^^^ attempt to subtract with overflow
26-
27-
error: aborting due to 2 previous errors
25+
error: aborting due to 4 previous errors
2826

2927
If you want more information on this error, try using "rustc --explain E0080"
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
error[E0080]: constant evaluation error
2-
--> $DIR/const-expr-addr-operator.rs:15:29
3-
|
4-
LL | const X: &'static u32 = &22; //~ ERROR constant evaluation error
5-
| ^^^ unimplemented constant expression: address operator
6-
|
7-
note: for pattern here
8-
--> $DIR/const-expr-addr-operator.rs:17:9
9-
|
10-
LL | X => 0,
11-
| ^
12-
13-
error: aborting due to previous error
14-
15-
If you want more information on this error, try using "rustc --explain E0080"

src/test/ui/const-fn-error.stderr

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,35 @@
1-
<<<<<<< HEAD
2-
warning: constant evaluation error: non-constant path in constant expression
3-
--> $DIR/const-fn-error.rs:27:19
4-
|
5-
LL | let a : [i32; f(X)];
6-
| ^^^^
7-
|
8-
= note: #[warn(const_err)] on by default
9-
10-
error[E0016]: blocks in constant functions are limited to items and tail expressions
11-
--> $DIR/const-fn-error.rs:16:19
12-
|
13-
LL | let mut sum = 0; //~ ERROR blocks in constant functions are limited
14-
=======
151
error[E0016]: blocks in constant functions are limited to items and tail expressions
162
--> $DIR/const-fn-error.rs:16:19
173
|
18-
16 | let mut sum = 0;
19-
>>>>>>> Produce instead of pointers
4+
LL | let mut sum = 0;
205
| ^
216

227
error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors
238
--> $DIR/const-fn-error.rs:18:14
249
|
25-
<<<<<<< HEAD
26-
LL | for i in 0..x { //~ ERROR calls in constant functions
27-
=======
28-
18 | for i in 0..x {
29-
>>>>>>> Report errors in statics during collecting instead of translating
10+
LL | for i in 0..x {
3011
| ^^^^
3112

3213
error[E0019]: constant function contains unimplemented expression type
3314
--> $DIR/const-fn-error.rs:18:14
3415
|
35-
<<<<<<< HEAD
36-
LL | for i in 0..x { //~ ERROR calls in constant functions
37-
=======
38-
18 | for i in 0..x {
39-
>>>>>>> Report errors in statics during collecting instead of translating
16+
LL | for i in 0..x {
4017
| ^^^^
4118

4219
error[E0080]: constant evaluation error
43-
<<<<<<< HEAD
44-
--> $DIR/const-fn-error.rs:21:5
20+
--> $DIR/const-fn-error.rs:18:14
4521
|
46-
LL | sum //~ ERROR E0080
47-
| ^^^ non-constant path in constant expression
22+
LL | for i in 0..x {
23+
| ^^^^ calling non-const fn `<I as std::iter::IntoIterator><std::ops::Range<usize>>::into_iter`
24+
...
25+
LL | let a : [i32; f(X)];
26+
| ---- inside call to `f`
4827
|
4928
note: for constant expression here
50-
--> $DIR/const-fn-error.rs:27:13
29+
--> $DIR/const-fn-error.rs:29:13
5130
|
5231
LL | let a : [i32; f(X)];
5332
| ^^^^^^^^^^^
54-
=======
55-
--> $DIR/const-fn-error.rs:28:19
56-
|
57-
28 | let a : [i32; f(X)];
58-
| ^^^^ miri failed: machine error: Cannot evaluate within constants: "calling non-const fn `<I as std::iter::IntoIterator><std::ops::Range<usize>>::into_iter`"
59-
>>>>>>> Produce instead of pointers
6033

6134
error: aborting due to 4 previous errors
6235

0 commit comments

Comments
 (0)