

More informative error message for E0015 by fee1-dead · Pull Request #90532 · ru...
source link: https://github.com/rust-lang/rust/pull/90532
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Note: This is still not ready for review, but I added a lot of cases for desugarings which can help the users. Examples for the current change:
error[E0015]: cannot call non-const fn `<[closure@$DIR/issue-28113.rs:4:5: 4:19] as Fn<()>>::call` in constants --> $DIR/issue-28113.rs:4:5 | LL | || -> u8 { 5 }() | ^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const fn `Foo::{constant#0}::Foo::<17_usize>::value` in constants --> $DIR/nested-type.rs:15:5 | LL | Foo::<17>::value() | ^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot perform deref coercion on `A` in statics --> $DIR/issue-25901.rs:4:24 | LL | static S: &'static B = &A; | ^^ | = note: attempting to deref into `B` note: deref defined here --> $DIR/issue-25901.rs:10:5 | LL | type Target = B; | ^^^^^^^^^^^^^^^^ note: impl defined here, but it is not `const` --> $DIR/issue-25901.rs:9:1 | LL | impl Deref for A { | ^^^^^^^^^^^^^^^^ = note: calls in statics are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants --> $DIR/const-for.rs:5:14 | LL | for _ in 0..5 {} | ^^^^ | note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL | LL | impl<I: Iterator> IntoIterator for I { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constants are limited to constant functions, tuple structs and tuple variants error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants --> $DIR/const-for.rs:5:14 | LL | for _ in 0..5 {} | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const operator in constant functions --> $DIR/call-generic-method-fail.rs:5:5 | LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants help: consider further restricting this bound | LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { | ++++++++++++++++++++++++++++
Recommend
-
78
README.md ...
-
71
README.md Python Black Hole Raytracer Starless is a CPU black hole raytracer in numpy suitable for bo...
-
43
README.md ERNIE Source code and dataset for "ERNIE: Enhanced Language Representation with Informative Entiti...
-
6
New issue Adjust error message with offline and frozen. #9644
-
6
Steam’s downloads page just got a lot more informative An update also improves the software’s storage management feature By...
-
6
New issue Nicer error message if the user attempts to do let...else if #89974
-
11
New issue Show a more informative panic message when DefPathHash does not exist #93098
-
7
New issue Improved error message for failed bitcode load #94672 Merged ...
-
12
Improve error message for E0081 #97456 ...
-
2
Conversation Member...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK