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 7 pull requests #101895

Merged
merged 22 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d6f385f
rustdoc mobile: move notable traits to return type
jsha Sep 6, 2022
fb42dae
Simplify CSS parser to check themes
GuillaumeGomez Sep 14, 2022
0b037c1
Update theme check tests
GuillaumeGomez Sep 14, 2022
e7d8ad6
Add check for missing CSS variables
GuillaumeGomez Sep 14, 2022
a528f68
Remove duplicate warnings
GuillaumeGomez Sep 14, 2022
669f2d4
Revert "Rollup merge of #101496 - spastorino:lower_lifetime_binder_ap…
spastorino Sep 14, 2022
8610550
Pass ImplTraitContext as &, there's no need for that to be &mut
spastorino Sep 14, 2022
45d8049
Get rid of 'b lifetime in lower_param_bounds_mut
spastorino Sep 14, 2022
98e20c0
fix #101797: Suggest associated const for incorrect use of let in traits
chenyukang Sep 15, 2022
d3529ce
Correctly handle parens
GuillaumeGomez Sep 15, 2022
6d7beaf
slight vertical formatting
Rageking8 Sep 15, 2022
4bf7d2c
tweak suggestion
chenyukang Sep 15, 2022
ef24747
rustdoc: use more precise URLs for jump-to-definition links
notriddle Sep 15, 2022
669498c
rustdoc: fix test cases
notriddle Sep 15, 2022
7c8e4ef
rustdoc: remove no-op CSS `.block { padding: 0 }`
notriddle Sep 16, 2022
e96abef
Rollup merge of #101494 - jsha:notable-traits-right, r=GuillaumeGomez
GuillaumeGomez Sep 16, 2022
6f8d41c
Rollup merge of #101813 - GuillaumeGomez:check-css-variables, r=notri…
GuillaumeGomez Sep 16, 2022
8ba133f
Rollup merge of #101825 - spastorino:fix-rpit-changes, r=oli-obk
GuillaumeGomez Sep 16, 2022
72d9e08
Rollup merge of #101843 - chenyukang:fix-101797, r=oli-obk
GuillaumeGomez Sep 16, 2022
9a72ded
Rollup merge of #101859 - Rageking8:slight-vertical-formatting, r=com…
GuillaumeGomez Sep 16, 2022
c21dcd7
Rollup merge of #101868 - notriddle:notriddle/short-links-jump-to-def…
GuillaumeGomez Sep 16, 2022
e284393
Rollup merge of #101877 - notriddle:notriddle/block, r=Dylan-DPC
GuillaumeGomez Sep 16, 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
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&sym.qself,
&sym.path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
);
hir::InlineAsmOperand::SymStatic { path, def_id }
} else {
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_ast_lowering/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}

fn lower_local(&mut self, l: &Local) -> &'hir hir::Local<'hir> {
let ty = l.ty.as_ref().map(|t| {
self.lower_ty(t, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Variable))
});
let ty = l
.ty
.as_ref()
.map(|t| self.lower_ty(t, &ImplTraitContext::Disallowed(ImplTraitPosition::Variable)));
let init = l.kind.init().map(|init| self.lower_expr(init));
let hir_id = self.lower_node_id(l.id);
let pat = self.lower_pat(&l.pat);
Expand Down
98 changes: 47 additions & 51 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
seg,
ParamMode::Optional,
ParenthesizedGenericArgs::Err,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
));
let receiver = self.lower_expr(receiver);
let args =
Expand All @@ -89,14 +89,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
ExprKind::Cast(ref expr, ref ty) => {
let expr = self.lower_expr(expr);
let ty = self
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
let ty =
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Type));
hir::ExprKind::Cast(expr, ty)
}
ExprKind::Type(ref expr, ref ty) => {
let expr = self.lower_expr(expr);
let ty = self
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
let ty =
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Type));
hir::ExprKind::Type(expr, ty)
}
ExprKind::AddrOf(k, m, ref ohs) => {
Expand Down Expand Up @@ -225,7 +225,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
qself,
path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
);
hir::ExprKind::Path(qpath)
}
Expand Down Expand Up @@ -259,7 +259,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
&se.qself,
&se.path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
)),
self.arena
.alloc_from_iter(se.fields.iter().map(|x| self.lower_expr_field(x))),
Expand Down Expand Up @@ -556,14 +556,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
async_gen_kind: hir::AsyncGeneratorKind,
body: impl FnOnce(&mut Self) -> hir::Expr<'hir>,
) -> hir::ExprKind<'hir> {
let output =
match ret_ty {
Some(ty) => hir::FnRetTy::Return(self.lower_ty(
&ty,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock),
)),
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
};
let output = match ret_ty {
Some(ty) => hir::FnRetTy::Return(
self.lower_ty(&ty, &ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock)),
),
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
};

// Resume argument type. We let the compiler infer this to simplify the lowering. It is
// fully constrained by `future::from_generator`.
Expand Down Expand Up @@ -855,22 +853,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
(body_id, generator_option)
});

self.lower_lifetime_binder(closure_id, generic_params, |lctx, bound_generic_params| {
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = lctx.lower_fn_decl(decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = lctx.arena.alloc(hir::Closure {
binder: binder_clause,
capture_clause,
bound_generic_params,
fn_decl,
body: body_id,
fn_decl_span: lctx.lower_span(fn_decl_span),
movability: generator_option,
});
let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
binder: binder_clause,
capture_clause,
bound_generic_params,
fn_decl,
body: body_id,
fn_decl_span: self.lower_span(fn_decl_span),
movability: generator_option,
});

hir::ExprKind::Closure(c)
})
hir::ExprKind::Closure(c)
}

fn generator_movability_for_fn(
Expand Down Expand Up @@ -957,24 +954,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
body_id
});

self.lower_lifetime_binder(closure_id, generic_params, |lctx, bound_generic_params| {
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl =
lctx.lower_fn_decl(&outer_decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = lctx.arena.alloc(hir::Closure {
binder: binder_clause,
capture_clause,
bound_generic_params,
fn_decl,
body,
fn_decl_span: lctx.lower_span(fn_decl_span),
movability: None,
});
hir::ExprKind::Closure(c)
})
let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl =
self.lower_fn_decl(&outer_decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
binder: binder_clause,
capture_clause,
bound_generic_params,
fn_decl,
body,
fn_decl_span: self.lower_span(fn_decl_span),
movability: None,
});
hir::ExprKind::Closure(c)
}

/// Destructure the LHS of complex assignments.
Expand Down Expand Up @@ -1133,7 +1129,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
qself,
path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
);
// Destructure like a tuple struct.
let tuple_struct_pat = hir::PatKind::TupleStruct(
Expand All @@ -1152,7 +1148,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
qself,
path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
);
// Destructure like a unit struct.
let unit_struct_pat = hir::PatKind::Path(qpath);
Expand All @@ -1176,7 +1172,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
&se.qself,
&se.path,
ParamMode::Optional,
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
);
let fields_omitted = match &se.rest {
StructRest::Base(e) => {
Expand Down
Loading