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 up[6/n] rustc: transition HIR function bodies from Block to Expr. #37412
Conversation
rust-highfive
assigned
nrc
Oct 26, 2016
This comment has been minimized.
This comment has been minimized.
|
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
This was referenced Oct 26, 2016
eddyb
reviewed
Oct 26, 2016
| hi: original_span.hi, | ||
| expn_id: original_span.expn_id | ||
| }; | ||
| err.span_help(span_semi, "consider removing this semicolon:"); |
This comment has been minimized.
This comment has been minimized.
eddyb
Oct 26, 2016
Author
Member
cc @GuillaumeGomez I wanted to show this on IRC but you left. This and the report_and_explain_type_error call above is how you can emit type errors with additional information (note/help) attached to them.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
nikomatsakis
and unassigned
nrc
Oct 26, 2016
eddyb
force-pushed the
eddyb:lazy-6
branch
2 times, most recently
from
73f8338
to
065e10a
Oct 26, 2016
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Feel free to merge this early (without a batch), just ping me when you do. |
eddyb
force-pushed the
eddyb:lazy-6
branch
from
065e10a
to
b0cdae9
Oct 26, 2016
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
force-pushed the
eddyb:lazy-6
branch
from
b0cdae9
to
7d8f770
Oct 28, 2016
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
force-pushed the
eddyb:lazy-6
branch
from
7d8f770
to
4790e25
Nov 2, 2016
nikomatsakis
approved these changes
Nov 2, 2016
|
r=me, presuming that there aren't any backcompat concerns here. |
| @@ -476,11 +484,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { | |||
| }; | |||
| } | |||
|
|
|||
| // We won't diverge unless the discriminant or all arms diverge. | |||
| self.diverges.set(discrim_diverges | all_pats_diverge | all_bodies_diverge); | |||
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Nov 2, 2016
Contributor
Not that I care too much here, but I guess plausibly you could have 50% of the patterns diverging and the other 50% of the bodies diverging, right?
i.e., the proper test is discrim_diverges | all_arms_diverge, where all_arms_diverge = pat_diverges | body_diverges
| @@ -53,7 +53,7 @@ pub unsafe extern fn __rust_maybe_catch_panic(f: fn(*mut u8), | |||
| // now hopefully. | |||
| #[no_mangle] | |||
| pub unsafe extern fn __rust_start_panic(_data: usize, _vtable: usize) -> u32 { | |||
| return abort(); | |||
| abort(); | |||
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Nov 2, 2016
Contributor
This is to silence a warning? Do we need to be concerned about back-compat? I guess this just causes new warnings, right?
This comment has been minimized.
This comment has been minimized.
eddyb
Nov 3, 2016
Author
Member
New lint warnings, which only cause problems because we use #![deny(warnings)].
This comment has been minimized.
This comment has been minimized.
|
hmm, so I'm not sure how precise the old code was around matches -- is it worth doing a crater run or anything? Probably -- if you are with me -- you should just fix the match imprecision anyhow. |
bors
added a commit
that referenced
this pull request
Nov 3, 2016
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Nov 4, 2016
bors
added a commit
that referenced
this pull request
Nov 5, 2016
bors
added a commit
that referenced
this pull request
Nov 5, 2016
bors
added a commit
that referenced
this pull request
Nov 5, 2016
bors
added a commit
that referenced
this pull request
Nov 5, 2016
bors
added a commit
that referenced
this pull request
Nov 5, 2016
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
force-pushed the
eddyb:lazy-6
branch
from
4790e25
to
aeb80a6
Nov 6, 2016
eddyb
referenced this pull request
Nov 7, 2016
Closed
Detect missing `;` on methods with return type `()` #36409
eddyb
force-pushed the
eddyb:lazy-6
branch
from
aeb80a6
to
695e17f
Nov 7, 2016
eddyb
referenced this pull request
Nov 9, 2016
Merged
[7/n] rustc: desugar UFCS in HIR and don't use DefMap for associated resolutions. #37676
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
added some commits
Oct 25, 2016
eddyb
force-pushed the
eddyb:lazy-6
branch
from
695e17f
to
8e9106c
Nov 9, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
|
eddyb commentedOct 26, 2016
•
edited
This is part of a series (prev | next) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. MIR-based early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.
The main change here is that functions and closures both use
Exprinstead ofBlockfor their bodies.For closures this actually allows a honest representation of brace-less closure bodies, e.g.
|x| x + 1is now distinguishable from|x| { x + 1 }, therefore this PR is[syntax-breaking](cc @Manishearth).Using
Exprallows more logic to be shared between constant bodies and function bodies, with some small such changes already part of this PR, and eventually easing #35078 and per-body type tables.Incidentally, there used to be some corners cut here and there and as such I had to (re)write divergence tracking for type-checking so that it is capable of understanding basic structured control-flow:
And since liveness' "not all control paths return a value" moved to type-checking we can have nice things: