Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement revised coercion rules #18469
Comments
aturon
added
B-RFC-approved
I-nominated
labels
Oct 30, 2014
This comment has been minimized.
This comment has been minimized.
|
Nominating: this contains backwards-incompatible changes. For triage purposes, we probably want to pull out the DST coercions part of this as P-High. |
This comment has been minimized.
This comment has been minimized.
|
Summary of changes to make from the RFC:
We should double check that these changes actually get us to the right destination as defined by the RFC. I filed bugs for the larger pieces of work, the rest are pretty minor and can be tracked here. Those marked with an asterisk are backwards incompatible. |
This was referenced Nov 4, 2014
nrc
self-assigned this
Nov 4, 2014
This comment has been minimized.
This comment has been minimized.
|
Assigning myself for misc back-compat parts of this, I don't intend to do the rest right now. |
This comment has been minimized.
This comment has been minimized.
|
Assigning P-backcompat-lang, 1.0. |
pnkfelix
added
P-backcompat-lang
and removed
I-nominated
labels
Nov 6, 2014
pnkfelix
added this to the 1.0 milestone
Nov 6, 2014
nrc
added a commit
to nrc/rust
that referenced
this issue
Dec 12, 2014
This was referenced Dec 12, 2014
nrc
added a commit
to nrc/rust
that referenced
this issue
Dec 12, 2014
nrc
added a commit
to nrc/rust
that referenced
this issue
Dec 16, 2014
bors
added a commit
that referenced
this issue
Dec 17, 2014
This comment has been minimized.
This comment has been minimized.
|
@nick29581 Are the back-compat parts done? If so, let's re-nominate. |
nrc
added
the
I-nominated
label
Jan 5, 2015
This comment has been minimized.
This comment has been minimized.
|
Yep, should no longer block |
This comment has been minimized.
This comment has been minimized.
|
No more back incompat stuff; just usability issues. P-high. |
pnkfelix
added
P-medium
and removed
P-backcompat-lang
labels
Jan 8, 2015
pnkfelix
removed this from the 1.0 milestone
Jan 8, 2015
This comment has been minimized.
This comment has been minimized.
|
You can involve type inference quite deeply here: fn unify<T>(a: T, _: T) -> T { a }
trait Confusing { fn get() -> Self; }
impl Confusing for Box<[u32]> { fn get() -> Box<[u32]> { Box::new([0]) } }
impl Confusing for Box<[u32; 3]> { fn get() -> Box<[u32; 3]> { Box::new([7,8,9]) } }
#[cfg(not(type_error))]
fn f(x: bool) -> u32 {
let a = Confusing::get();
let v: Box<[u32]> = Box::new([1,2,3]);
let s = match x {
true => unify(a, v),
false => unify(a, Box::new([1,2,3])),
};
s[0]
}
#[cfg(type_error)]
fn f(x: bool) -> u32 {
let a = Confusing::get();
let v: Box<[u32]> = Box::new([1,2,3]);
let s = match x {
false => unify(a, Box::new([1,2,3])),
true => unify(a, v), //~ ERROR mismatched types
//| expected `Box<[u32; 3]>`
//| found `Box<[u32]>`
};
s[0]
}
fn main() { println!("{}", f(false)); }But I guess we have to do something like this. |
lorenzb
referenced this issue
May 30, 2015
Merged
Extend rust reference with section about subtyping and type coercions #25900
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Jun 4, 2015
bors
added a commit
that referenced
this issue
Jun 4, 2015
bors
added a commit
that referenced
this issue
Jun 4, 2015
bors
added a commit
that referenced
this issue
Jun 4, 2015
alexcrichton
added
the
T-lang
label
Aug 11, 2015
brson
added
the
I-nominated
label
Jul 14, 2016
This comment has been minimized.
This comment has been minimized.
|
Triage: ancient RFC tracking bug slipping through the cracks cc @rust-lang/lang what's up? |
This comment has been minimized.
This comment has been minimized.
|
Discussed at the lang meeting. I will go through the checklist to make sure it is up to date. We think it should remain p-medium since periodic check ins will be worthwhile. |
nrc
removed
the
I-nominated
label
Jul 14, 2016
petrochenkov
referenced this issue
Nov 1, 2016
Merged
rustc_typeck: Allow reification from fn item to unsafe ptr #37389
This comment has been minimized.
This comment has been minimized.
|
Looking through rust-lang/rfcs#401, #37685, #32702, #34451, and this, it seems that tuple DSTs and their coercion should be allowed but the coercion is not implemented. Am I right? |
This comment has been minimized.
This comment has been minimized.
|
@qnighy I think that is correct. I'm not sure just how much implementation work would be needed, there may be random bits of the compiler that need to be updated scattered around. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Thank you. I'm working on it. |
This comment has been minimized.
This comment has been minimized.
|
Another question: |
This comment has been minimized.
This comment has been minimized.
|
@qnighy not that I'm aware of; I don't think we necessarily need an RFC for such a thing though |
bors
added a commit
that referenced
this issue
Jun 29, 2017
qnighy
referenced this issue
Jul 2, 2017
Merged
Implement Eq/Hash/Debug etc. for unsized tuples. #43011
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Jul 12, 2017
Mark-Simulacrum
added
C-tracking-issue
and removed
C-enhancement
C-feature-request
labels
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
torkleyy
commented
Mar 30, 2018
|
Can I use any workaround until this is resolved? I have a custom type that I want to convert from |
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/lang Do we want to close this and all the unfinished sub-issues, and require a new RFC for any new features in this area, even if the old RFC covers them? |
This comment has been minimized.
This comment has been minimized.
|
@eddyb What exactly remains to be done here; could you clarify the unfinished sub-issues? |
This comment has been minimized.
This comment has been minimized.
|
@Centril I'm just referring to this comment #18469 (comment) and the unchecked checkboxes in it. |
aturon commentedOct 30, 2014
Tracking issue for RFC 401.