-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #118282 - fee1-dead-contrib:enforce-more, r=compiler-er…
…rors effects: Run `enforce_context_effects` for all method calls So that we also perform checks when overloaded `PartialEq`s are called. r? `@compiler-errors`
- Loading branch information
Showing
11 changed files
with
103 additions
and
46 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
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
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
18 changes: 18 additions & 0 deletions
18
tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0277]: the trait bound `S: ~const Foo<false>` is not satisfied | ||
--> $DIR/call-generic-method-nonconst.rs:23:34 | ||
| | ||
LL | pub const EQ: bool = equals_self(&S); | ||
| ----------- ^^ the trait `Foo<false>` is not implemented for `S` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `Foo` is implemented for `S` | ||
note: required by a bound in `equals_self` | ||
--> $DIR/call-generic-method-nonconst.rs:16:25 | ||
| | ||
LL | const fn equals_self<T: ~const Foo>(t: &T) -> bool { | ||
| ^^^^^^^^^^ required by this bound in `equals_self` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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
75 changes: 52 additions & 23 deletions
75
tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,61 @@ | ||
error[E0369]: cannot add `i32` to `i32` | ||
--> $DIR/minicore.rs:33:20 | ||
warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` | ||
--> $DIR/minicore.rs:332:9 | ||
| | ||
LL | let x = 42_i32 + 43_i32; | ||
| ------ ^ ------ i32 | ||
| | | ||
| i32 | ||
LL | "true" => Ok(true), | ||
| ^^^^^^ | ||
| | ||
= 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 #116122 <https://github.com/rust-lang/rust/issues/116122> | ||
= note: `#[warn(const_patterns_without_partial_eq)]` on by default | ||
|
||
warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` | ||
--> $DIR/minicore.rs:333:9 | ||
| | ||
LL | "false" => Ok(false), | ||
| ^^^^^^^ | ||
| | ||
= 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 #116122 <https://github.com/rust-lang/rust/issues/116122> | ||
|
||
error[E0369]: cannot add `i32` to `i32` | ||
--> $DIR/minicore.rs:37:20 | ||
error[E0493]: destructor of `Self` cannot be evaluated at compile-time | ||
--> $DIR/minicore.rs:494:9 | ||
| | ||
LL | let x = 42_i32 + 43_i32; | ||
| ------ ^ ------ i32 | ||
| | | ||
| i32 | ||
LL | *self = source.clone() | ||
| ^^^^^ | ||
| | | ||
| the destructor for this type cannot be evaluated in constant functions | ||
| value is dropped here | ||
|
||
error[E0600]: cannot apply unary operator `!` to type `bool` | ||
--> $DIR/minicore.rs:343:9 | ||
error[E0493]: destructor of `T` cannot be evaluated at compile-time | ||
--> $DIR/minicore.rs:504:35 | ||
| | ||
LL | !self.eq(other) | ||
| ^^^^^^^^^^^^^^^ cannot apply unary operator `!` | ||
LL | const fn drop<T: ~const Destruct>(_: T) {} | ||
| ^ - value is dropped here | ||
| | | ||
| the destructor for this type cannot be evaluated in constant functions | ||
|
||
error[E0600]: cannot apply unary operator `!` to type `bool` | ||
--> $DIR/minicore.rs:365:9 | ||
error: aborting due to 2 previous errors; 2 warnings emitted | ||
|
||
For more information about this error, try `rustc --explain E0493`. | ||
Future incompatibility report: Future breakage diagnostic: | ||
warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` | ||
--> $DIR/minicore.rs:332:9 | ||
| | ||
LL | "true" => Ok(true), | ||
| ^^^^^^ | ||
| | ||
LL | !self | ||
| ^^^^^ cannot apply unary operator `!` | ||
= 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 #116122 <https://github.com/rust-lang/rust/issues/116122> | ||
= note: `#[warn(const_patterns_without_partial_eq)]` on by default | ||
|
||
error: aborting due to 4 previous errors | ||
Future breakage diagnostic: | ||
warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` | ||
--> $DIR/minicore.rs:333:9 | ||
| | ||
LL | "false" => Ok(false), | ||
| ^^^^^^^ | ||
| | ||
= 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 #116122 <https://github.com/rust-lang/rust/issues/116122> | ||
= note: `#[warn(const_patterns_without_partial_eq)]` on by default | ||
|
||
Some errors have detailed explanations: E0369, E0600. | ||
For more information about an error, try `rustc --explain E0369`. |