Skip to content
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

Rollup of 10 pull requests #93069

Merged
merged 28 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3eb87db
doc: guarantee call order for sort_by_cached_key
digama0 Oct 7, 2021
61ff847
Use iterator instead of recursion in `codegen_place`
SparrowLii Nov 27, 2021
4b62a77
Little improves in CString `new` when creating from slice
AngelicosPhosphoros Dec 20, 2021
b9f008b
Update wording
digama0 Jan 4, 2022
06b17a2
Clarify that ordering is unspecified
digama0 Jan 5, 2022
bd1f09d
Annotate dead code lint with notes about ignored derived impls
FabianWolff Jan 11, 2022
8b459dd
Use span of ignored impls for explanatory note
FabianWolff Jan 15, 2022
0882bbb
Remove some unused `Ord` derivations based on `DefId`
pierwill Jan 18, 2022
b160564
Move expr-related pretty printing functions to module
dtolnay Jan 15, 2022
07a0325
Move item-related pretty printing functions to module
dtolnay Jan 15, 2022
282224e
Add Option::is_some_with.
m-ou-se Jan 18, 2022
aaebae9
Add Result::{is_ok_with, is_err_with}.
m-ou-se Jan 18, 2022
148234f
Add is_some_with tracking issue number.
m-ou-se Jan 18, 2022
45dee47
Improve is_err_with example.
m-ou-se Jan 18, 2022
5f74ef4
Formally implement let chains
c410-f3r Jan 18, 2022
5fee3e7
Fix is_some_with tests.
m-ou-se Jan 18, 2022
fa9a843
Remove horizontal lines at top of page
jsha Jan 11, 2022
84e0d9d
Update books
ehuss Jan 19, 2022
5d2928f
Rollup merge of #88642 - c410-f3r:let_chains_2, r=matthewjasper
matthiaskrgr Jan 19, 2022
2a4381d
Rollup merge of #89621 - digama0:patch-2, r=yaahc
matthiaskrgr Jan 19, 2022
3a1db90
Rollup merge of #91278 - SparrowLii:place, r=spastorino
matthiaskrgr Jan 19, 2022
3148a32
Rollup merge of #92124 - AngelicosPhosphoros:remove_extra_alloc_in_cs…
matthiaskrgr Jan 19, 2022
9a82f74
Rollup merge of #92783 - FabianWolff:issue-92726, r=nikomatsakis
matthiaskrgr Jan 19, 2022
7f2dbcb
Rollup merge of #92797 - jsha:fewer-lines, r=GuillaumeGomez
matthiaskrgr Jan 19, 2022
420ada6
Rollup merge of #92920 - dtolnay:printtidy, r=cjgillot
matthiaskrgr Jan 19, 2022
0b9056c
Rollup merge of #93041 - pierwill:rm-unused-defid-ords, r=cjgillot
matthiaskrgr Jan 19, 2022
d5bc168
Rollup merge of #93051 - m-ou-se:is-some-with, r=yaahc
matthiaskrgr Jan 19, 2022
ea1275a
Rollup merge of #93062 - ehuss:update-books, r=ehuss
matthiaskrgr Jan 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,20 @@ impl<'hir> LoweringContext<'_, 'hir> {
// If `cond` kind is `let`, returns `let`. Otherwise, wraps and returns `cond`
// in a temporary block.
fn manage_let_cond(&mut self, cond: &'hir hir::Expr<'hir>) -> &'hir hir::Expr<'hir> {
match cond.kind {
hir::ExprKind::Let(..) => cond,
_ => {
let span_block =
self.mark_span_with_reason(DesugaringKind::CondTemporary, cond.span, None);
self.expr_drop_temps(span_block, cond, AttrVec::new())
fn has_let_expr<'hir>(expr: &'hir hir::Expr<'hir>) -> bool {
match expr.kind {
hir::ExprKind::Binary(_, lhs, rhs) => has_let_expr(lhs) || has_let_expr(rhs),
hir::ExprKind::Let(..) => true,
_ => false,
}
}
if has_let_expr(cond) {
cond
} else {
let reason = DesugaringKind::CondTemporary;
let span_block = self.mark_span_with_reason(reason, cond.span, None);
self.expr_drop_temps(span_block, cond, AttrVec::new())
}
}

// We desugar: `'label: while $cond $body` into:
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
"`if let` guards are experimental",
"you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`"
);
gate_all!(
let_chains,
"`let` expressions in this position are experimental",
"you can write `matches!(<expr>, <pattern>)` instead of `let <pattern> = <expr>`"
);
gate_all!(let_chains, "`let` expressions in this position are unstable");
gate_all!(
async_closure,
"async closures are unstable",
Expand Down
Loading