Auto merge of #109253 - matthiaskrgr:rollup-2xmv5zk, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #108958 (Remove box expressions from HIR) - #109044 (Prevent stable `libtest` from supporting `-Zunstable-options`) - #109155 (Fix riscv64 fuchsia LLVM target name) - #109156 (Fix linker detection for clang with prefix) - #109181 (inherit_overflow: adapt pattern to also work with v0 mangling) - #109198 (Install projection from RPITIT to default trait method opaque correctly) - #109215 (Use sort_by_key instead of sort_by) - #109229 (Fix invalid markdown link references) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
03b01c5bec
83 changed files with 451 additions and 192 deletions
|
|
@ -339,6 +339,12 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
|
|||
""
|
||||
};
|
||||
|
||||
// `libtest` uses this to know whether or not to support
|
||||
// `-Zunstable-options`.
|
||||
if !builder.unstable_features() {
|
||||
cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
|
||||
}
|
||||
|
||||
let mut features = String::new();
|
||||
|
||||
// Cranelift doesn't support `asm`.
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ fn clean_projection<'tcx>(
|
|||
cx: &mut DocContext<'tcx>,
|
||||
def_id: Option<DefId>,
|
||||
) -> Type {
|
||||
if cx.tcx.def_kind(ty.skip_binder().def_id) == DefKind::ImplTraitPlaceholder {
|
||||
if cx.tcx.is_impl_trait_in_trait(ty.skip_binder().def_id) {
|
||||
let bounds = cx
|
||||
.tcx
|
||||
.explicit_item_bounds(ty.skip_binder().def_id)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# Style for Templates
|
||||
|
||||
This directory has templates in the [Tera templating language](teradoc), which is very
|
||||
similar to [Jinja2](jinjadoc) and [Django](djangodoc) templates, and also to [Askama](askamadoc).
|
||||
This directory has templates in the [Tera templating language][teradoc], which is very
|
||||
similar to [Jinja2][jinjadoc] and [Django][djangodoc] templates, and also to [Askama][askamadoc].
|
||||
|
||||
[teradoc]: https://tera.netlify.app/docs/#templates
|
||||
[jinjadoc]: https://jinja.palletsprojects.com/en/3.0.x/templates/
|
||||
[djangodoc]: https://docs.djangoproject.com/en/3.2/topics/templates/
|
||||
[askamadoc]: https://docs.rs/askama/0.10.5/askama/
|
||||
[jinjadoc]: https://jinja.palletsprojects.com/en/3.1.x/templates/
|
||||
[djangodoc]: https://docs.djangoproject.com/en/4.1/topics/templates/
|
||||
[askamadoc]: https://docs.rs/askama/latest/askama/
|
||||
|
||||
We want our rendered output to have as little unnecessary whitespace as
|
||||
possible, so that pages load quickly. To achieve that we use Tera's
|
||||
|
|
@ -30,8 +30,8 @@ contents don't necessarily need a new line.
|
|||
|
||||
Askama templates support quite sophisticated control flow. To keep our templates
|
||||
simple and understandable, we use only a subset: `if` and `for`. In particular
|
||||
we avoid [assignments in the template logic](assignments) and [Askama
|
||||
macros](macros). This also may make things easier if we switch to a different
|
||||
we avoid [assignments in the template logic][assignments] and [Askama
|
||||
macros][macros]. This also may make things easier if we switch to a different
|
||||
Jinja-style template system, like Askama, in the future.
|
||||
|
||||
[assignments]: https://djc.github.io/askama/template_syntax.html#assignments
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
|
|||
Finite
|
||||
},
|
||||
ExprKind::Block(block, _) => block.expr.as_ref().map_or(Finite, |e| is_infinite(cx, e)),
|
||||
ExprKind::Box(e) | ExprKind::AddrOf(BorrowKind::Ref, _, e) => is_infinite(cx, e),
|
||||
ExprKind::AddrOf(BorrowKind::Ref, _, e) => is_infinite(cx, e),
|
||||
ExprKind::Call(path, _) => {
|
||||
if let ExprKind::Path(ref qpath) = path.kind {
|
||||
cx.qpath_res(qpath, path.hir_id)
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ fn stmt_to_expr<'tcx>(stmt: &Stmt<'tcx>) -> Option<(&'tcx Expr<'tcx>, Option<&'t
|
|||
#[allow(clippy::too_many_lines)]
|
||||
fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: HirId) -> NeverLoopResult {
|
||||
match expr.kind {
|
||||
ExprKind::Box(e)
|
||||
| ExprKind::Unary(_, e)
|
||||
ExprKind::Unary(_, e)
|
||||
| ExprKind::Cast(e, _)
|
||||
| ExprKind::Type(e, _)
|
||||
| ExprKind::Field(e, _)
|
||||
|
|
|
|||
|
|
@ -321,7 +321,6 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
|
|||
self.has_significant_drop = true;
|
||||
}
|
||||
}
|
||||
ExprKind::Box(..) |
|
||||
ExprKind::Array(..) |
|
||||
ExprKind::Call(..) |
|
||||
ExprKind::Unary(..) |
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ struct SortByKeyDetection {
|
|||
/// contains a and the other replaces it with b)
|
||||
fn mirrored_exprs(a_expr: &Expr<'_>, a_ident: &Ident, b_expr: &Expr<'_>, b_ident: &Ident) -> bool {
|
||||
match (&a_expr.kind, &b_expr.kind) {
|
||||
// Two boxes with mirrored contents
|
||||
(ExprKind::Box(left_expr), ExprKind::Box(right_expr)) => {
|
||||
mirrored_exprs(left_expr, a_ident, right_expr, b_ident)
|
||||
},
|
||||
// Two arrays with mirrored contents
|
||||
(ExprKind::Array(left_exprs), ExprKind::Array(right_exprs)) => {
|
||||
iter::zip(*left_exprs, *right_exprs).all(|(left, right)| mirrored_exprs(left, a_ident, right, b_ident))
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
|||
| ExprKind::Type(inner, _)
|
||||
| ExprKind::Unary(_, inner)
|
||||
| ExprKind::Field(inner, _)
|
||||
| ExprKind::AddrOf(_, _, inner)
|
||||
| ExprKind::Box(inner) => has_no_effect(cx, inner),
|
||||
| ExprKind::AddrOf(_, _, inner) => has_no_effect(cx, inner),
|
||||
ExprKind::Struct(_, fields, ref base) => {
|
||||
!has_drop(cx, cx.typeck_results().expr_ty(expr))
|
||||
&& fields.iter().all(|field| has_no_effect(cx, field.expr))
|
||||
|
|
@ -234,8 +233,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec
|
|||
| ExprKind::Type(inner, _)
|
||||
| ExprKind::Unary(_, inner)
|
||||
| ExprKind::Field(inner, _)
|
||||
| ExprKind::AddrOf(_, _, inner)
|
||||
| ExprKind::Box(inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
|
||||
| ExprKind::AddrOf(_, _, inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
|
||||
ExprKind::Struct(_, fields, ref base) => {
|
||||
if has_drop(cx, cx.typeck_results().expr_ty(expr)) {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -213,8 +213,7 @@ fn is_self_shadow(cx: &LateContext<'_>, pat: &Pat<'_>, mut expr: &Expr<'_>, hir_
|
|||
}
|
||||
loop {
|
||||
expr = match expr.kind {
|
||||
ExprKind::Box(e)
|
||||
| ExprKind::AddrOf(_, _, e)
|
||||
ExprKind::AddrOf(_, _, e)
|
||||
| ExprKind::Block(
|
||||
&Block {
|
||||
stmts: [],
|
||||
|
|
|
|||
|
|
@ -380,7 +380,6 @@ impl<'cx, 'sdt, 'tcx> Visitor<'tcx> for SigDropFinder<'cx, 'sdt, 'tcx> {
|
|||
| hir::ExprKind::Assign(..)
|
||||
| hir::ExprKind::AssignOp(..)
|
||||
| hir::ExprKind::Binary(..)
|
||||
| hir::ExprKind::Box(..)
|
||||
| hir::ExprKind::Call(..)
|
||||
| hir::ExprKind::Field(..)
|
||||
| hir::ExprKind::If(..)
|
||||
|
|
|
|||
|
|
@ -395,11 +395,6 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
|
|||
}
|
||||
self.expr(field!(let_expr.init));
|
||||
},
|
||||
ExprKind::Box(inner) => {
|
||||
bind!(self, inner);
|
||||
kind!("Box({inner})");
|
||||
self.expr(inner);
|
||||
},
|
||||
ExprKind::Array(elements) => {
|
||||
bind!(self, elements);
|
||||
kind!("Array({elements})");
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ fn qpath_search_pat(path: &QPath<'_>) -> (Pat, Pat) {
|
|||
/// Get the search patterns to use for the given expression
|
||||
fn expr_search_pat(tcx: TyCtxt<'_>, e: &Expr<'_>) -> (Pat, Pat) {
|
||||
match e.kind {
|
||||
ExprKind::Box(e) => (Pat::Str("box"), expr_search_pat(tcx, e).1),
|
||||
ExprKind::ConstBlock(_) => (Pat::Str("const"), Pat::Str("}")),
|
||||
ExprKind::Tup([]) => (Pat::Str(")"), Pat::Str("(")),
|
||||
ExprKind::Unary(UnOp::Deref, e) => (Pat::Str("*"), expr_search_pat(tcx, e).1),
|
||||
|
|
|
|||
|
|
@ -199,8 +199,7 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
|
|||
},
|
||||
|
||||
// Memory allocation, custom operator, loop, or call to an unknown function
|
||||
ExprKind::Box(_)
|
||||
| ExprKind::Unary(..)
|
||||
ExprKind::Unary(..)
|
||||
| ExprKind::Binary(..)
|
||||
| ExprKind::Loop(..)
|
||||
| ExprKind::Call(..) => self.eagerness = Lazy,
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@ impl HirEqInterExpr<'_, '_, '_> {
|
|||
both(&li.label, &ri.label, |l, r| l.ident.name == r.ident.name)
|
||||
&& both(le, re, |l, r| self.eq_expr(l, r))
|
||||
},
|
||||
(&ExprKind::Box(l), &ExprKind::Box(r)) => self.eq_expr(l, r),
|
||||
(&ExprKind::Call(l_fun, l_args), &ExprKind::Call(r_fun, r_args)) => {
|
||||
self.inner.allow_side_effects && self.eq_expr(l_fun, r_fun) && self.eq_exprs(l_args, r_args)
|
||||
},
|
||||
|
|
@ -628,7 +627,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
|||
self.hash_expr(j);
|
||||
}
|
||||
},
|
||||
ExprKind::Box(e) | ExprKind::DropTemps(e) | ExprKind::Yield(e, _) => {
|
||||
ExprKind::DropTemps(e) | ExprKind::Yield(e, _) => {
|
||||
self.hash_expr(e);
|
||||
},
|
||||
ExprKind::Call(fun, args) => {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ impl<'a> Sugg<'a> {
|
|||
|
||||
match expr.kind {
|
||||
hir::ExprKind::AddrOf(..)
|
||||
| hir::ExprKind::Box(..)
|
||||
| hir::ExprKind::If(..)
|
||||
| hir::ExprKind::Let(..)
|
||||
| hir::ExprKind::Closure { .. }
|
||||
|
|
|
|||
|
|
@ -600,7 +600,6 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
|
|||
helper(typeck, false, e, f)?;
|
||||
},
|
||||
ExprKind::Block(&Block { expr: Some(e), .. }, _)
|
||||
| ExprKind::Box(e)
|
||||
| ExprKind::Cast(e, _)
|
||||
| ExprKind::Unary(_, e) => {
|
||||
helper(typeck, true, e, f)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue