Skip to content

Commit

Permalink
Auto merge of rust-lang#120639 - fee1-dead-contrib:new-effects-desuga…
Browse files Browse the repository at this point in the history
…ring, r=oli-obk

Implement new effects desugaring

cc `@rust-lang/project-const-traits.` Will write down notes once I have finished.

* [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>`
* [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>`
* [ ] add types and traits to minicore test
* [ ] update rustc-dev-guide

Fixes rust-lang#119717
Fixes rust-lang#123664
Fixes rust-lang#124857
Fixes rust-lang#126148
  • Loading branch information
bors committed Jun 29, 2024
2 parents 4116552 + 2fcef6e commit b5f9436
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
5 changes: 4 additions & 1 deletion tests/ui/missing_const_for_fn/could_be_const.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ fn main() {}

struct D;

/* FIXME(effects)
impl const Drop for D {
fn drop(&mut self) {
todo!();
}
}
*/

// Lint this, since it can be dropped in const contexts
// FIXME(effects)
fn d(this: D) {}
const fn d(this: D) {}
//~^ ERROR: this could be a `const fn`

mod msrv {
struct Foo(*const u8, &'static u8);
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/missing_const_for_fn/could_be_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ fn main() {}

struct D;

/* FIXME(effects)
impl const Drop for D {
fn drop(&mut self) {
todo!();
}
}
*/

// Lint this, since it can be dropped in const contexts
// FIXME(effects)
fn d(this: D) {}
//~^ ERROR: this could be a `const fn`

mod msrv {
struct Foo(*const u8, &'static u8);
Expand Down
25 changes: 18 additions & 7 deletions tests/ui/missing_const_for_fn/could_be_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,18 @@ LL | const fn msrv_1_46() -> i32 {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:122:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:117:1
|
LL | fn d(this: D) {}
| ^^^^^^^^^^^^^^^^
|
help: make the function `const`
|
LL | const fn d(this: D) {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
|
LL | / fn deref_ptr_can_be_const(self) -> usize {
LL | |
Expand All @@ -171,7 +182,7 @@ LL | const fn deref_ptr_can_be_const(self) -> usize {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:127:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:130:9
|
LL | / fn deref_copied_val(self) -> usize {
LL | |
Expand All @@ -185,7 +196,7 @@ LL | const fn deref_copied_val(self) -> usize {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:138:5
--> tests/ui/missing_const_for_fn/could_be_const.rs:141:5
|
LL | / fn union_access_can_be_const() {
LL | |
Expand All @@ -200,7 +211,7 @@ LL | const fn union_access_can_be_const() {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:152:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:155:9
|
LL | / pub fn new(strings: Vec<String>) -> Self {
LL | | Self { strings }
Expand All @@ -213,7 +224,7 @@ LL | pub const fn new(strings: Vec<String>) -> Self {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:157:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:160:9
|
LL | / pub fn empty() -> Self {
LL | | Self { strings: Vec::new() }
Expand All @@ -226,7 +237,7 @@ LL | pub const fn empty() -> Self {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:168:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:171:9
|
LL | / pub fn new(text: String) -> Self {
LL | | let vec = Vec::new();
Expand All @@ -239,5 +250,5 @@ help: make the function `const`
LL | pub const fn new(text: String) -> Self {
| +++++

error: aborting due to 17 previous errors
error: aborting due to 18 previous errors

0 comments on commit b5f9436

Please sign in to comment.