-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deref patterns: bare-bones feature gate and typechecking #122222
Conversation
This comment has been minimized.
This comment has been minimized.
8242838
to
2e1f7ab
Compare
pls squash as well, ty regarding the lang team experiment, it may need a new liaison since @cramertj is no longer on T-lang |
4cca41b
to
bf7951d
Compare
Ok, I've asked around for a new lang-team liaison |
Please, add more tests. I want to see how this is supposed to work. In particular I'd like to see this code in tests: let a = Rc::new(vec![0]);
let x = match a {
box x => x,
} let a = Rc::new(vec![0]);
let x: &Vec<i32> = match &a {
box x => x,
} As well as I understand the first example should not compile (because you cannot move out of |
These test are not yet possible, because patterns are not lowered correctly to MIR. This is the very first beginnings of implementing the feature, more tests will come in later PRs. (I've just added your examples to my next PR, thank you for them. You are correct about how they should work). |
We have a liaison! |
@bors r+ |
Actually @bors r- this needs rebasing |
Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
bf7951d
to
120d357
Compare
@bors r+ |
…r=compiler-errors deref patterns: bare-bones feature gate and typechecking I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team [experimental feature](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [`@cramertj` as lang-team liaison](rust-lang/lang-team#88) (it's been a while though, you still ok with this `@cramertj?).` Tracking issue: rust-lang#87121. This is the barest-bones implementation I could think of: - explicit syntax, reusing `box <pat>` because that saves me a ton of work; - use `Deref` as a marker trait (instead of a yet-to-design `DerefPure`); - no support for mutable patterns with `DerefMut` for now; - MIR lowering will come in the next PR. It's the trickiest part. My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon. This is in large part salvaged from `@fee1-dead's` rust-lang#119467. r? `@compiler-errors`
…r=compiler-errors deref patterns: bare-bones feature gate and typechecking I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team [experimental feature](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [``@cramertj`` as lang-team liaison](rust-lang/lang-team#88) (it's been a while though, you still ok with this ``@cramertj?).`` Tracking issue: rust-lang#87121. This is the barest-bones implementation I could think of: - explicit syntax, reusing `box <pat>` because that saves me a ton of work; - use `Deref` as a marker trait (instead of a yet-to-design `DerefPure`); - no support for mutable patterns with `DerefMut` for now; - MIR lowering will come in the next PR. It's the trickiest part. My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon. This is in large part salvaged from ``@fee1-dead's`` rust-lang#119467. r? ``@compiler-errors``
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#122222 (deref patterns: bare-bones feature gate and typechecking) - rust-lang#122456 (CFI: Skip non-passed arguments) - rust-lang#122696 (Add bare metal riscv32 target.) - rust-lang#122771 (add some comments to hir::ModuleItems) - rust-lang#122773 (make "expected paren or brace" error translatable) - rust-lang#122795 (Inherit `RUSTC_BOOTSTRAP` when testing wasm) - rust-lang#122799 (Replace closures with `_` when suggesting fully qualified path for method call) - rust-lang#122801 (Fix misc printing issues in emit=stable_mir) - rust-lang#122806 (Make `type_ascribe!` not a built-in) r? `@ghost` `@rustbot` modify labels: rollup
…r=compiler-errors deref patterns: bare-bones feature gate and typechecking I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team [experimental feature](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [```@cramertj``` as lang-team liaison](rust-lang/lang-team#88) (it's been a while though, you still ok with this ```@cramertj?).``` Tracking issue: rust-lang#87121. This is the barest-bones implementation I could think of: - explicit syntax, reusing `box <pat>` because that saves me a ton of work; - use `Deref` as a marker trait (instead of a yet-to-design `DerefPure`); - no support for mutable patterns with `DerefMut` for now; - MIR lowering will come in the next PR. It's the trickiest part. My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon. This is in large part salvaged from ```@fee1-dead's``` rust-lang#119467. r? ```@compiler-errors```
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#122222 (deref patterns: bare-bones feature gate and typechecking) - rust-lang#122358 (Don't ICE when encountering bound regions in generator interior type) - rust-lang#122696 (Add bare metal riscv32 target.) - rust-lang#122773 (make "expected paren or brace" error translatable) - rust-lang#122795 (Inherit `RUSTC_BOOTSTRAP` when testing wasm) - rust-lang#122799 (Replace closures with `_` when suggesting fully qualified path for method call) - rust-lang#122801 (Fix misc printing issues in emit=stable_mir) - rust-lang#122806 (Make `type_ascribe!` not a built-in) Failed merges: - rust-lang#122771 (add some comments to hir::ModuleItems) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122222 - Nadrieril:deref-pat-feature-gate, r=compiler-errors deref patterns: bare-bones feature gate and typechecking I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team [experimental feature](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [````@cramertj```` as lang-team liaison](rust-lang/lang-team#88) (it's been a while though, you still ok with this ````@cramertj?).```` Tracking issue: rust-lang#87121. This is the barest-bones implementation I could think of: - explicit syntax, reusing `box <pat>` because that saves me a ton of work; - use `Deref` as a marker trait (instead of a yet-to-design `DerefPure`); - no support for mutable patterns with `DerefMut` for now; - MIR lowering will come in the next PR. It's the trickiest part. My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon. This is in large part salvaged from ````@fee1-dead's```` rust-lang#119467. r? ````@compiler-errors````
…r=Nadrieril Implement macro-based deref!() syntax for deref patterns Stop using `box PAT` syntax for deref patterns, and instead use a perma-unstable macro. Blocked on rust-lang#122222 r? `@Nadrieril`
Rollup merge of rust-lang#122793 - compiler-errors:deref-pat-syntax, r=Nadrieril Implement macro-based deref!() syntax for deref patterns Stop using `box PAT` syntax for deref patterns, and instead use a perma-unstable macro. Blocked on rust-lang#122222 r? `@Nadrieril`
I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team experimental feature process, with @cramertj as lang-team liaison (it's been a while though, you still ok with this @cramertj?). Tracking issue: #87121.
This is the barest-bones implementation I could think of:
box <pat>
because that saves me a ton of work;Deref
as a marker trait (instead of a yet-to-designDerefPure
);DerefMut
for now;My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.
This is in large part salvaged from @fee1-dead's #119467.
r? @compiler-errors