Skip to content
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

Rollup of 5 pull requests #81718

Merged
merged 40 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
70704db
Do not lint when range is completely included into another one
ThibsG Jan 15, 2021
0518911
Add more tests for `match_overlapping_arm` lint
ThibsG Jan 24, 2021
69f2b8f
Updated some NITs in the documentation from #6630
xFrednet Jan 25, 2021
52fabbf
Added the rustbot claim command to the contribution guide.
xFrednet Jan 26, 2021
7f1595e
Fix let_and_return false positive
phlip9 Jan 30, 2021
ac912be
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup
flip1995 Jan 30, 2021
3a0ae08
Update clippy test output for panic macros.
m-ou-se Jan 30, 2021
da26b21
clippy_dev: Pass stderr to CommandFailed
phansch Jan 31, 2021
ed11274
Auto merge of #6656 - phansch:command-failed-print-stderr, r=flip1995
bors Jan 31, 2021
c5f3f9d
Auto merge of #6603 - ThibsG:MatchOverlappingArm5986, r=flip1995
bors Jan 31, 2021
939136d
Remove Option from path_to_res return type
camsteffen Jan 25, 2021
6fd01e0
Box the biggest ast::ItemKind variants
bugadani Jan 29, 2021
9607b5c
Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
bors Feb 1, 2021
0fb09d6
exhaustive_structs: don't trigger for structs with private fields
Manishearth Feb 2, 2021
4a13c8c
Fix test formatting
flip1995 Feb 2, 2021
8d82ac5
Auto merge of #6661 - Manishearth:exhaustive-fix, r=flip1995
bors Feb 2, 2021
f870876
Auto merge of #6659 - phlip9:let_and_return_fix, r=phansch
bors Feb 2, 2021
bde667a
Add missing_panics_doc lint
brightly-salty Dec 30, 2020
28794e9
Auto merge of #6523 - brightly-salty:missing-panic-doc, r=flip1995
bors Feb 2, 2021
9fd4f3e
Auto merge of #6664 - camsteffen:path-to-res, r=Manishearth
bors Feb 2, 2021
e05e477
Add .editorconfig
vn971 Jan 22, 2021
448a97b
Auto merge of #81405 - bugadani:ast, r=cjgillot
bors Feb 2, 2021
a2d2aee
Updated the list of active mentors
xFrednet Feb 2, 2021
11edf92
Auto merge of #6639 - xFrednet:0000-configuration-documentation-some-…
bors Feb 2, 2021
b56b751
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
jackh726 Feb 2, 2021
5c957b8
Merge remote-tracking branch 'origin/master' into rustup
Manishearth Feb 3, 2021
6fb1075
Rustup
Manishearth Feb 3, 2021
a31e5f5
Run rustfmt
Manishearth Feb 3, 2021
741259b
Merge branch 'sync-from-rust3' into rustup
Manishearth Feb 3, 2021
3e41797
Auto merge of #6667 - Manishearth:rustup, r=Manishearth
bors Feb 3, 2021
5889312
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-fro…
Manishearth Feb 3, 2021
8477d35
make const_err a future incompat lint
RalfJung Jan 30, 2021
ede0a71
Remove incorrect `delay_span_bug`
estebank Jan 29, 2021
18f6cc6
Reduce tab formatting assertions to debug only
jryans Feb 3, 2021
68cc12a
Fix non-existent-field ICE for generic fields.
m-ou-se Feb 3, 2021
00dabfb
Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk
m-ou-se Feb 3, 2021
6695944
Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix
m-ou-se Feb 3, 2021
508b470
Rollup merge of #81692 - Manishearth:clippyup, r=tmandry
m-ou-se Feb 3, 2021
65b3c0c
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
m-ou-se Feb 3, 2021
4617418
Rollup merge of #81716 - m-ou-se:fix-ice, r=eddyb
m-ou-se Feb 3, 2021
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
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ impl EmitterWriter {
margin: Margin,
) {
// Tabs are assumed to have been replaced by spaces in calling code.
assert!(!source_string.contains('\t'));
debug_assert!(!source_string.contains('\t'));
let line_len = source_string.len();
// Create the source line we will highlight.
let left = margin.left(line_len);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/styled_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl StyledBuffer {

pub fn render(&self) -> Vec<Vec<StyledString>> {
// Tabs are assumed to have been replaced by spaces in calling code.
assert!(self.text.iter().all(|r| !r.contains(&'\t')));
debug_assert!(self.text.iter().all(|r| !r.contains(&'\t')));

let mut output: Vec<Vec<StyledString>> = vec![];
let mut styled_vec: Vec<StyledString> = vec![];
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ declare_lint! {
pub CONST_ERR,
Deny,
"constant evaluation encountered erroneous expression",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
edition: None,
};
report_in_external_macro
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_typeck/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ pub(super) fn check_fn<'a, 'tcx>(
// possible cases.
fcx.check_expr(&body.value);
fcx.require_type_is_sized(declared_ret_ty, decl.output.span(), traits::SizedReturnType);
tcx.sess.delay_span_bug(decl.output.span(), "`!Sized` return type");
} else {
fcx.require_type_is_sized(declared_ret_ty, decl.output.span(), traits::SizedReturnType);
fcx.check_return_expr(&body.value);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

field_path.push(candidate_field.ident.normalize_to_macros_2_0());
let field_ty = candidate_field.ty(self.tcx, subst);
if let Some((nested_fields, _)) = self.get_field_candidates(span, &field_ty) {
if let Some((nested_fields, subst)) = self.get_field_candidates(span, &field_ty) {
for field in nested_fields.iter() {
let ident = field.ident.normalize_to_macros_2_0();
if ident == target_field {
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/array-slice-vec/array_const_index-0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const A: &'static [i32] = &[];
const B: i32 = (&A)[1];
//~^ index out of bounds: the length is 0 but the index is 1
//~| ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
let _ = B;
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/array-slice-vec/array_const_index-0.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | const B: i32 = (&A)[1];
| index out of bounds: the length is 0 but the index is 1
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to previous error

1 change: 1 addition & 0 deletions src/test/ui/array-slice-vec/array_const_index-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const A: [i32; 0] = [];
const B: i32 = A[1];
//~^ index out of bounds: the length is 0 but the index is 1
//~| ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
let _ = B;
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/array-slice-vec/array_const_index-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | const B: i32 = A[1];
| index out of bounds: the length is 0 but the index is 1
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/associated-consts/defaults-not-assumed-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ trait Tr {
// `Self::A` must not be assumed to hold inside the trait.
const B: u8 = Self::A + 1;
//~^ ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out
}

// An impl that doesn't override any constant will NOT cause a const eval error
Expand All @@ -33,6 +34,7 @@ fn main() {
assert_eq!(<() as Tr>::B, 0); // causes the error above
//~^ ERROR evaluation of constant value failed
//~| ERROR erroneous constant used
//~| WARN this was previously accepted by the compiler but is being phased out

assert_eq!(<u8 as Tr>::A, 254);
assert_eq!(<u8 as Tr>::B, 255);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ LL | const B: u8 = Self::A + 1;
| attempt to compute `u8::MAX + 1_u8`, which would overflow
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error[E0080]: evaluation of constant value failed
--> $DIR/defaults-not-assumed-fail.rs:33:16
--> $DIR/defaults-not-assumed-fail.rs:34:16
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^ referenced constant has errors

error: erroneous constant used
--> $DIR/defaults-not-assumed-fail.rs:33:5
--> $DIR/defaults-not-assumed-fail.rs:34:5
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/const-ptr/out_of_bounds_read.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
| ------------------------------------------------------
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
Expand All @@ -32,6 +34,9 @@ LL | unsafe { copy_nonoverlapping(src, dst, count) }
|
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
| --------------------------------------------------------
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
Expand All @@ -49,6 +54,9 @@ LL | unsafe { copy_nonoverlapping(src, dst, count) }
|
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };
| --------------------------------------------------------------------
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to 3 previous errors

1 change: 1 addition & 0 deletions src/test/ui/consts/assoc_const_generic_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trait ZeroSized: Sized {

impl<T: Sized> ZeroSized for T {
const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; //~ WARN any use of this value
//~| WARN this was previously accepted by the compiler but is being phased out
fn requires_zero_size(self) {
let () = Self::I_AM_ZERO_SIZED; //~ ERROR erroneous constant encountered
println!("requires_zero_size called");
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/consts/assoc_const_generic_impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ note: the lint level is defined here
|
LL | #![warn(const_err)]
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: erroneous constant encountered
--> $DIR/assoc_const_generic_impl.rs:13:18
--> $DIR/assoc_const_generic_impl.rs:14:18
|
LL | let () = Self::I_AM_ZERO_SIZED;
| ^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/consts/assume-type-intrinsics.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ LL | | };
| |______-
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to previous error

5 changes: 5 additions & 0 deletions src/test/ui/consts/const-err-early.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#![deny(const_err)]

pub const A: i8 = -i8::MIN; //~ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const C: u8 = 200u8 * 4; //~ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const E: u8 = [5u8][1]; //~ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
let _a = A;
Expand Down
22 changes: 18 additions & 4 deletions src/test/ui/consts/const-err-early.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,52 @@ note: the lint level is defined here
|
LL | #![deny(const_err)]
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-early.rs:4:19
--> $DIR/const-err-early.rs:5:19
|
LL | pub const B: u8 = 200u8 + 200u8;
| ------------------^^^^^^^^^^^^^-
| |
| attempt to compute `200_u8 + 200_u8`, which would overflow
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-early.rs:5:19
--> $DIR/const-err-early.rs:7:19
|
LL | pub const C: u8 = 200u8 * 4;
| ------------------^^^^^^^^^-
| |
| attempt to compute `200_u8 * 4_u8`, which would overflow
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-early.rs:6:19
--> $DIR/const-err-early.rs:9:19
|
LL | pub const D: u8 = 42u8 - (42u8 + 1);
| ------------------^^^^^^^^^^^^^^^^^-
| |
| attempt to compute `42_u8 - 43_u8`, which would overflow
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-early.rs:7:19
--> $DIR/const-err-early.rs:11:19
|
LL | pub const E: u8 = [5u8][1];
| ------------------^^^^^^^^-
| |
| index out of bounds: the length is 1 but the index is 1
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to 5 previous errors

4 changes: 4 additions & 0 deletions src/test/ui/consts/const-err-multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

pub const A: i8 = -i8::MIN;
//~^ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const B: i8 = A;
//~^ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const C: u8 = A as u8;
//~^ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out
pub const D: i8 = 50 - A;
//~^ ERROR const_err
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
let _ = (A, B, C, D);
Expand Down
17 changes: 14 additions & 3 deletions src/test/ui/consts/const-err-multi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,41 @@ note: the lint level is defined here
|
LL | #![deny(const_err)]
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:5:19
--> $DIR/const-err-multi.rs:6:19
|
LL | pub const B: i8 = A;
| ------------------^-
| |
| referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:7:19
--> $DIR/const-err-multi.rs:9:19
|
LL | pub const C: u8 = A as u8;
| ------------------^-------
| |
| referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:9:24
--> $DIR/const-err-multi.rs:12:24
|
LL | pub const D: i8 = 50 - A;
| -----------------------^-
| |
| referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to 4 previous errors

1 change: 1 addition & 0 deletions src/test/ui/consts/const-err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn black_box<T>(_: T) {

const FOO: u8 = [5u8][1];
//~^ WARN any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
black_box((FOO, FOO));
Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/consts/const-err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ note: the lint level is defined here
|
LL | #![warn(const_err)]
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error[E0080]: erroneous constant used
--> $DIR/const-err.rs:15:16
--> $DIR/const-err.rs:16:16
|
LL | black_box((FOO, FOO));
| ^^^ referenced constant has errors

error[E0080]: erroneous constant used
--> $DIR/const-err.rs:15:21
--> $DIR/const-err.rs:16:21
|
LL | black_box((FOO, FOO));
| ^^^ referenced constant has errors
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/consts/const-eval/conditional_array_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const X: u32 = 5;
const Y: u32 = 6;
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
//~^ WARN any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
println!("{}", FOO);
//~^ ERROR
//~| WARN erroneous constant used [const_err]
//~| WARN this was previously accepted by the compiler but is being phased out
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ note: the lint level is defined here
|
LL | #![warn(const_err)]
| ^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error[E0080]: evaluation of constant value failed
--> $DIR/conditional_array_execution.rs:11:20
--> $DIR/conditional_array_execution.rs:12:20
|
LL | println!("{}", FOO);
| ^^^ referenced constant has errors

warning: erroneous constant used
--> $DIR/conditional_array_execution.rs:11:20
--> $DIR/conditional_array_execution.rs:12:20
|
LL | println!("{}", FOO);
| ^^^ referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

error: aborting due to previous error; 2 warnings emitted

Expand Down
Loading