forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#64325 - cramertj:nested-self-types, r=mikeyhew
Stabilize nested self receivers in 1.41.0 Previously, only `Self`, `&Self`, `&mut Self`, `Arc<Self>`, `Rc<Self>`, and `Box<Self>` were available as stable method receivers. This commit stabilizes nested uses of all the above types. However, nested receivers remain non-object-safe.
- Loading branch information
Showing
58 changed files
with
214 additions
and
319 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
2 changes: 1 addition & 1 deletion
2
src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// run-pass | ||
|
||
use { | ||
std::{ | ||
rc::Rc, | ||
sync::Arc, | ||
}, | ||
}; | ||
|
||
#[derive(Default)] | ||
struct Ty; | ||
|
||
trait Trait { | ||
fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32; | ||
} | ||
|
||
const TRAIT_MAGIC: u32 = 42; | ||
const INHERENT_MAGIC: u32 = 1995; | ||
|
||
impl Trait for Ty { | ||
fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32 { | ||
TRAIT_MAGIC | ||
} | ||
} | ||
|
||
impl Ty { | ||
fn receive_inherent(self: &Arc<Rc<Box<Self>>>) -> u32 { | ||
INHERENT_MAGIC | ||
} | ||
} | ||
|
||
fn main() { | ||
let ty = <Arc<Rc<Box<Ty>>>>::default(); | ||
assert_eq!(TRAIT_MAGIC, ty.receive_trait()); | ||
assert_eq!(INHERENT_MAGIC, ty.receive_inherent()); | ||
} |
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,5 +1,4 @@ | ||
// run-pass | ||
#![feature(arbitrary_self_types)] | ||
|
||
use std::rc::Rc; | ||
|
||
|
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,5 +1,4 @@ | ||
// run-pass | ||
#![feature(arbitrary_self_types)] | ||
|
||
use std::rc::Rc; | ||
|
||
|
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,5 +1,4 @@ | ||
// run-pass | ||
#![feature(arbitrary_self_types)] | ||
|
||
use std::rc::Rc; | ||
|
||
|
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,7 +1,6 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,6 +1,5 @@ | ||
// check-pass | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,7 +1,6 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,6 +1,5 @@ | ||
// check-pass | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,7 +1,6 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,6 +1,5 @@ | ||
// check-pass | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,7 +1,6 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,6 +1,5 @@ | ||
// check-pass | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::rc::Rc; | ||
|
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,6 +1,5 @@ | ||
// edition:2018 | ||
|
||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::pin::Pin; | ||
|
Oops, something went wrong.