-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert order of constant evaluation errors
Point at theh code the user wrote first and std functions last. ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ Some error occurred | note: called from `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some error occurred | note: called from `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ```
- Loading branch information
Showing
71 changed files
with
429 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
// Regression test for #81899. | ||
// The `panic!()` below is important to trigger the fixed ICE. | ||
|
||
const _CONST: &[u8] = &f(&[], |_| {}); | ||
const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed | ||
//~^ constant | ||
|
||
const fn f<F>(_: &[u8], _: F) -> &[u8] | ||
where | ||
F: FnMut(&u8), | ||
{ | ||
panic!() //~ ERROR evaluation of constant value failed | ||
//~^ panic | ||
panic!() //~ panic | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// Regression test related to issue 88434 | ||
|
||
const _CONST: &() = &f(&|_| {}); | ||
const _CONST: &() = &f(&|_| {}); //~ ERROR evaluation of constant value failed | ||
//~^ constant | ||
|
||
const fn f<F>(_: &F) | ||
where | ||
F: FnMut(&u8), | ||
{ | ||
panic!() //~ ERROR evaluation of constant value failed | ||
//~^ panic | ||
panic!() //~ panic | ||
} | ||
|
||
fn main() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// Regression test for issue 88434 | ||
|
||
const _CONST: &[u8] = &f(&[], |_| {}); | ||
const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed | ||
//~^ constant | ||
|
||
const fn f<F>(_: &[u8], _: F) -> &[u8] | ||
where | ||
F: FnMut(&u8), | ||
{ | ||
panic!() //~ ERROR evaluation of constant value failed | ||
//~^ panic | ||
panic!() //~ panic | ||
} | ||
|
||
fn main() { } |
14 changes: 7 additions & 7 deletions
14
tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
tests/ui/coherence/const-errs-dont-conflict-103369.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.