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 upMake all coercion valid casts and add trivial cast lints #23630
Conversation
rust-highfive
assigned
nikomatsakis
Mar 23, 2015
petrochenkov
reviewed
Mar 23, 2015
| @@ -23,6 +23,8 @@ | |||
| html_root_url = "http://doc.rust-lang.org/nightly/", | |||
| html_playground_url = "http://play.rust-lang.org/")] | |||
|
|
|||
| #![allow(trivial_cast)] | |||
| #![allow(trivial_numeric_cast)] | |||
This comment has been minimized.
This comment has been minimized.
petrochenkov
Mar 23, 2015
Contributor
The lint names don't follow the conventions. trivial_cast -> trivial_casts, trivial_numeric_cast -> trivial_numeric_casts?
This comment has been minimized.
This comment has been minimized.
|
This seems to not interfere too much with my own DST branch (where I did a similar change to coercions to have both |
This comment has been minimized.
This comment has been minimized.
|
I'm wondering if we want the lints to default to warn, in the absence of type ascription? I guess it is very rare to need to convert to a trait object, and one can typically use an intermediate variable, and that seems like the only case where one might require a cast today (other than the trivial numeric case, which is already separated). I agree that the lint names seem wrong. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, should be |
This comment has been minimized.
This comment has been minimized.
|
Type ascription doesn't let you do any more, it is just more convenient, given there's an implementation that just needs rebasing and an accepted RFC, I would expect it to land very soon in any case. |
This comment has been minimized.
This comment has been minimized.
|
r+ |
nrc
force-pushed the
nrc:coerce-tidy
branch
from
f441fbd
to
c2fde5a
Mar 23, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis c2fde5a |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
bors
added a commit
that referenced
this pull request
Mar 23, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
bors
added a commit
that referenced
this pull request
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
nrc
force-pushed the
nrc:coerce-tidy
branch
from
48287fe
to
fc7e9b3
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nrc
force-pushed the
nrc:coerce-tidy
branch
from
fc7e9b3
to
7315e0a
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nrc
force-pushed the
nrc:coerce-tidy
branch
from
7315e0a
to
a7b6af9
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
bors
added a commit
that referenced
this pull request
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis a7b6af9 |
This comment has been minimized.
This comment has been minimized.
|
@bors retry |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added a commit
that referenced
this pull request
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nrc
added some commits
Mar 20, 2015
nrc
force-pushed the
nrc:coerce-tidy
branch
from
a7b6af9
to
7e3ee02
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Mar 24, 2015
bors
merged commit 7e3ee02
into
rust-lang:master
Mar 25, 2015
1 check passed
Ms2ger
referenced this pull request
Mar 25, 2015
Closed
Coercion to an unspecified but easily inferrable raw pointer (`as *const _`) has regressed #23699
This comment has been minimized.
This comment has been minimized.
|
@nrc how would you feel about making the |
lilyball
referenced this pull request
Mar 26, 2015
Closed
trivial_numeric_casts warning incorrect when casting between type aliases #23739
This comment has been minimized.
This comment has been minimized.
|
I just filed #23739 requesting that |
This comment has been minimized.
This comment has been minimized.
|
Ah, breaking change needs to be exactly |
nrc commentedMar 23, 2015
See notes on the first commit
Closes #18601
r? @nikomatsakis
cc @eddyb