Skip to content

Rollup of 9 pull requests #64115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5a446c1
Fix `window.hashchange is not a function`
fmckeogh Aug 21, 2019
cab607e
Emit a single error on if expr with expectation and no else clause
estebank Sep 1, 2019
aae2b24
deduplicate code
estebank Sep 1, 2019
a9ce33c
Account for arbitrary self types in E0599
estebank Sep 1, 2019
84ccbe2
librustc_errors: Extract sugg/subst handling into method
phansch Sep 1, 2019
35c9e5f
Fix const_err with `-(-0.0)`
JohnTitor Sep 1, 2019
3a6aada
Add `opt-level` check
JohnTitor Sep 1, 2019
ab12dfe
following the same style
Sep 1, 2019
4a0872b
Add `overflow_check` check
JohnTitor Sep 1, 2019
f53c217
review comments
estebank Sep 1, 2019
8e9825a
Fix overflow_check
JohnTitor Sep 1, 2019
141f5a7
review comments
estebank Sep 1, 2019
0cd9c16
Fix condition and tests' flags
JohnTitor Sep 1, 2019
a937d8c
Fix tests again
JohnTitor Sep 1, 2019
991f436
Fix regex replacement in theme detection
GuillaumeGomez Sep 2, 2019
52c68d1
Add buffer abstraction
Mark-Simulacrum Aug 27, 2019
3c83d64
Migrate top-level rendering to Buffer
Mark-Simulacrum Aug 30, 2019
a076816
Create buffers in top-level rendering
Mark-Simulacrum Aug 30, 2019
8850cb5
Remove needless clone of layout
Mark-Simulacrum Aug 30, 2019
a3539f9
Move constant parameters to render to Layout struct
Mark-Simulacrum Aug 30, 2019
d869748
Replace writeln!/write! with push_str
Mark-Simulacrum Aug 31, 2019
14fcaa1
Remove unnecessary Buffer in layout::render
Mark-Simulacrum Aug 31, 2019
ca2801f
Move sidebar to Buffer-printing
Mark-Simulacrum Aug 31, 2019
2367975
Implement Print for FnOnce(&mut Buffer)
Mark-Simulacrum Aug 31, 2019
8c06e79
Delete Sidebar struct in favor of FnOnce impl
Mark-Simulacrum Aug 31, 2019
6ab9b32
De-indent all fmt::Display impls for later replacement to functions
Mark-Simulacrum Aug 31, 2019
6165313
layout::render takes Print instead of fmt::Display
Mark-Simulacrum Aug 31, 2019
a57f00d
Move Source to Buffer
Mark-Simulacrum Aug 31, 2019
cd92ed2
Settings to function
Mark-Simulacrum Aug 31, 2019
b2eb65b
AllTypes to function
Mark-Simulacrum Aug 31, 2019
31391ca
Item to function
Mark-Simulacrum Aug 31, 2019
a9c6ef6
Move to buffers throughout print_item
Mark-Simulacrum Aug 31, 2019
dd323f8
Emit error on intrinsic to fn ptr casts
Mark-Simulacrum Sep 2, 2019
cdc821f
Rollup merge of #63774 - chocol4te:fix_63707, r=GuillaumeGomez
Centril Sep 3, 2019
85baeec
Rollup merge of #64044 - Mark-Simulacrum:rustdoc-clean-2, r=Guillaume…
Centril Sep 3, 2019
781f533
Rollup merge of #64049 - estebank:if-else-type-err, r=Centril
Centril Sep 3, 2019
43eac83
Rollup merge of #64056 - estebank:arbitrary-self-types, r=Centril
Centril Sep 3, 2019
dd8d419
Rollup merge of #64058 - phansch:refactor_out_method, r=estebank
Centril Sep 3, 2019
c1832a6
Rollup merge of #64063 - JohnTitor:fix-const-err, r=oli-obk
Centril Sep 3, 2019
ed13e27
Rollup merge of #64071 - guanqun:style-fix, r=Centril
Centril Sep 3, 2019
3e427d9
Rollup merge of #64096 - GuillaumeGomez:theme-regex-fix, r=Mark-Simul…
Centril Sep 3, 2019
0de3668
Rollup merge of #64104 - Mark-Simulacrum:intrinsic-fn-ptr-ice, r=este…
Centril Sep 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests again
  • Loading branch information
JohnTitor committed Sep 1, 2019
commit a937d8cdeb56ed72897ecf14469f89f18814554c
3 changes: 1 addition & 2 deletions src/test/ui/consts/const-err2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#![feature(rustc_attrs)]
#![allow(exceeding_bitshifts)]
// compile-flags: -C overflow-checks=on -O

#![deny(const_err)]

Expand All @@ -23,7 +22,7 @@ fn main() {
let d = 42u8 - (42u8 + 1);
//~^ ERROR const_err
let _e = [5u8][1];
//~^ ERROR const_err
//~^ ERROR index out of bounds
black_box(a);
black_box(b);
black_box(c);
Expand Down
28 changes: 14 additions & 14 deletions src/test/ui/consts/const-err2.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error: attempt to negate with overflow
--> $DIR/const-err2.rs:17:13
error: this expression will panic at runtime
--> $DIR/const-err2.rs:16:13
|
LL | let a = -std::i8::MIN;
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ attempt to negate with overflow
|
note: lint level defined here
--> $DIR/const-err2.rs:10:9
--> $DIR/const-err2.rs:9:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^

error: attempt to add with overflow
--> $DIR/const-err2.rs:19:13
error: this expression will panic at runtime
--> $DIR/const-err2.rs:18:13
|
LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ attempt to add with overflow

error: attempt to multiply with overflow
--> $DIR/const-err2.rs:21:13
error: this expression will panic at runtime
--> $DIR/const-err2.rs:20:13
|
LL | let c = 200u8 * 4;
| ^^^^^^^^^
| ^^^^^^^^^ attempt to multiply with overflow

error: attempt to subtract with overflow
--> $DIR/const-err2.rs:23:13
error: this expression will panic at runtime
--> $DIR/const-err2.rs:22:13
|
LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow

error: index out of bounds: the len is 1 but the index is 1
--> $DIR/const-err2.rs:25:14
--> $DIR/const-err2.rs:24:14
|
LL | let _e = [5u8][1];
| ^^^^^^^^
Expand Down
30 changes: 30 additions & 0 deletions src/test/ui/consts/const-err3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// needed because negating int::MIN will behave differently between
// optimized compilation and unoptimized compilation and thus would
// lead to different lints being emitted
// compile-flags: -C overflow-checks=on -O

#![feature(rustc_attrs)]
#![allow(exceeding_bitshifts)]

#![deny(const_err)]

fn black_box<T>(_: T) {
unimplemented!()
}

fn main() {
let a = -std::i8::MIN;
//~^ ERROR const_err
let b = 200u8 + 200u8 + 200u8;
//~^ ERROR const_err
let c = 200u8 * 4;
//~^ ERROR const_err
let d = 42u8 - (42u8 + 1);
//~^ ERROR const_err
let _e = [5u8][1];
//~^ ERROR const_err
black_box(a);
black_box(b);
black_box(c);
black_box(d);
}
38 changes: 38 additions & 0 deletions src/test/ui/consts/const-err3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
error: attempt to negate with overflow
--> $DIR/const-err3.rs:16:13
|
LL | let a = -std::i8::MIN;
| ^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/const-err3.rs:9:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^

error: attempt to add with overflow
--> $DIR/const-err3.rs:18:13
|
LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^

error: attempt to multiply with overflow
--> $DIR/const-err3.rs:20:13
|
LL | let c = 200u8 * 4;
| ^^^^^^^^^

error: attempt to subtract with overflow
--> $DIR/const-err3.rs:22:13
|
LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^

error: index out of bounds: the len is 1 but the index is 1
--> $DIR/const-err3.rs:24:14
|
LL | let _e = [5u8][1];
| ^^^^^^^^

error: aborting due to 5 previous errors

5 changes: 2 additions & 3 deletions src/test/ui/consts/const-eval/promoted_errors.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// compile-flags: -C overflow-checks=on -O
// compile-flags: -O

#![deny(const_err)]

fn main() {
println!("{}", 0u32 - 1);
//~^ ERROR attempt to subtract with overflow
let _x = 0u32 - 1;
//~^ ERROR attempt to subtract with overflow
//~^ ERROR const_err
println!("{}", 1/(1-1));
//~^ ERROR attempt to divide by zero [const_err]
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
Expand Down
32 changes: 13 additions & 19 deletions src/test/ui/consts/const-eval/promoted_errors.stderr
Original file line number Diff line number Diff line change
@@ -1,68 +1,62 @@
error: attempt to subtract with overflow
--> $DIR/promoted_errors.rs:6:20
error: this expression will panic at runtime
--> $DIR/promoted_errors.rs:7:14
|
LL | println!("{}", 0u32 - 1);
| ^^^^^^^^
LL | let _x = 0u32 - 1;
| ^^^^^^^^ attempt to subtract with overflow
|
note: lint level defined here
--> $DIR/promoted_errors.rs:3:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^

error: attempt to subtract with overflow
--> $DIR/promoted_errors.rs:8:14
|
LL | let _x = 0u32 - 1;
| ^^^^^^^^

error: attempt to divide by zero
--> $DIR/promoted_errors.rs:10:20
--> $DIR/promoted_errors.rs:9:20
|
LL | println!("{}", 1/(1-1));
| ^^^^^^^

error: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:10:20
--> $DIR/promoted_errors.rs:9:20
|
LL | println!("{}", 1/(1-1));
| ^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors.rs:13:14
--> $DIR/promoted_errors.rs:12:14
|
LL | let _x = 1/(1-1);
| ^^^^^^^

error: this expression will panic at runtime
--> $DIR/promoted_errors.rs:13:14
--> $DIR/promoted_errors.rs:12:14
|
LL | let _x = 1/(1-1);
| ^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors.rs:16:20
--> $DIR/promoted_errors.rs:15:20
|
LL | println!("{}", 1/(false as u32));
| ^^^^^^^^^^^^^^^^

error: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:16:20
--> $DIR/promoted_errors.rs:15:20
|
LL | println!("{}", 1/(false as u32));
| ^^^^^^^^^^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors.rs:19:14
--> $DIR/promoted_errors.rs:18:14
|
LL | let _x = 1/(false as u32);
| ^^^^^^^^^^^^^^^^

error: this expression will panic at runtime
--> $DIR/promoted_errors.rs:19:14
--> $DIR/promoted_errors.rs:18:14
|
LL | let _x = 1/(false as u32);
| ^^^^^^^^^^^^^^^^ attempt to divide by zero

error: aborting due to 10 previous errors
error: aborting due to 9 previous errors

22 changes: 22 additions & 0 deletions src/test/ui/consts/const-eval/promoted_errors2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// compile-flags: -C overflow-checks=on -O

#![deny(const_err)]

fn main() {
println!("{}", 0u32 - 1);
//~^ ERROR attempt to subtract with overflow
let _x = 0u32 - 1;
//~^ ERROR attempt to subtract with overflow
println!("{}", 1/(1-1));
//~^ ERROR attempt to divide by zero [const_err]
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
let _x = 1/(1-1);
//~^ ERROR const_err
//~| ERROR const_err
println!("{}", 1/(false as u32));
//~^ ERROR attempt to divide by zero [const_err]
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
let _x = 1/(false as u32);
//~^ ERROR const_err
//~| ERROR const_err
}
68 changes: 68 additions & 0 deletions src/test/ui/consts/const-eval/promoted_errors2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
error: attempt to subtract with overflow
--> $DIR/promoted_errors2.rs:6:20
|
LL | println!("{}", 0u32 - 1);
| ^^^^^^^^
|
note: lint level defined here
--> $DIR/promoted_errors2.rs:3:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^

error: attempt to subtract with overflow
--> $DIR/promoted_errors2.rs:8:14
|
LL | let _x = 0u32 - 1;
| ^^^^^^^^

error: attempt to divide by zero
--> $DIR/promoted_errors2.rs:10:20
|
LL | println!("{}", 1/(1-1));
| ^^^^^^^

error: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors2.rs:10:20
|
LL | println!("{}", 1/(1-1));
| ^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors2.rs:13:14
|
LL | let _x = 1/(1-1);
| ^^^^^^^

error: this expression will panic at runtime
--> $DIR/promoted_errors2.rs:13:14
|
LL | let _x = 1/(1-1);
| ^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors2.rs:16:20
|
LL | println!("{}", 1/(false as u32));
| ^^^^^^^^^^^^^^^^

error: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors2.rs:16:20
|
LL | println!("{}", 1/(false as u32));
| ^^^^^^^^^^^^^^^^ attempt to divide by zero

error: attempt to divide by zero
--> $DIR/promoted_errors2.rs:19:14
|
LL | let _x = 1/(false as u32);
| ^^^^^^^^^^^^^^^^

error: this expression will panic at runtime
--> $DIR/promoted_errors2.rs:19:14
|
LL | let _x = 1/(false as u32);
| ^^^^^^^^^^^^^^^^ attempt to divide by zero

error: aborting due to 10 previous errors

6 changes: 6 additions & 0 deletions src/test/ui/consts/issue-64059-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-flags: -C overflow-checks=on -O
// run-pass

fn main() {
let _ = -(-0.0);
}
1 change: 0 additions & 1 deletion src/test/ui/consts/issue-64059.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// compile-flags: -C overflow-checks=on -O
// run-pass

fn main() {
Expand Down
12 changes: 10 additions & 2 deletions src/test/ui/issues/issue-8460-const.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -C overflow-checks=on -O

#![deny(const_err)]

use std::{isize, i8, i16, i32, i64};
Expand All @@ -8,14 +6,19 @@ use std::thread;
fn main() {
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
//~^ ERROR attempt to divide with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
//~^ ERROR attempt to divide with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
//~^ ERROR attempt to divide with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
//~^ ERROR attempt to divide with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
//~^ ERROR attempt to divide with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
//~^ ERROR attempt to divide by zero
//~| ERROR this expression will panic at runtime
Expand All @@ -33,14 +36,19 @@ fn main() {
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with overflow
//~| ERROR this expression will panic at runtime
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
//~^ ERROR attempt to calculate the remainder with a divisor of zero
//~| ERROR this expression will panic at runtime
Expand Down
Loading