Skip to content

Commit c2804e6

Browse files
committed
Auto merge of rust-lang#101544 - matthiaskrgr:rollup-4urx917, r=matthiaskrgr
Rollup of 14 pull requests Successful merges: - rust-lang#101343 (Add -api-level to pm command) - rust-lang#101416 (stdio: Document no support for writing to non-blocking stdio/stderr) - rust-lang#101435 (Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`) - rust-lang#101493 (Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow) - rust-lang#101502 (Do not suggest a semicolon for a macro without `!`) - rust-lang#101503 (Add debug calls) - rust-lang#101506 (rustdoc: remove unused CSS `#main-content > .since`) - rust-lang#101507 (rustdoc: remove unused CSS `#main-content > table td`) - rust-lang#101521 (Rustdoc-Json: More accurate struct type.) - rust-lang#101525 (Fix typo in pass_manager.rs) - rust-lang#101534 (rustdoc: remove unused mobile CSS `.rustdoc { flex-direction }`) - rust-lang#101535 (Fix error printing mistake in tidy) - rust-lang#101536 (Add documentation for Attr::is_doc_comment) - rust-lang#101538 (rustdoc: remove unused CSS `.content .methods > div`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9682b5d + eae48c3 commit c2804e6

File tree

102 files changed

+326
-1361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+326
-1361
lines changed

compiler/rustc_ast/src/attr/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ impl AttrItem {
232232
}
233233

234234
impl Attribute {
235+
/// Returns `true` if it is a sugared doc comment (`///` or `//!` for example).
236+
/// So `#[doc = "doc"]` will return `false`.
235237
pub fn is_doc_comment(&self) -> bool {
236238
match self.kind {
237239
AttrKind::Normal(..) => false,

compiler/rustc_ast_lowering/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
220220
&sym.qself,
221221
&sym.path,
222222
ParamMode::Optional,
223-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
223+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
224224
);
225225
hir::InlineAsmOperand::SymStatic { path, def_id }
226226
} else {

compiler/rustc_ast_lowering/src/block.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
8484
}
8585

8686
fn lower_local(&mut self, l: &Local) -> &'hir hir::Local<'hir> {
87-
let ty = l
88-
.ty
89-
.as_ref()
90-
.map(|t| self.lower_ty(t, ImplTraitContext::Disallowed(ImplTraitPosition::Variable)));
87+
let ty = l.ty.as_ref().map(|t| {
88+
self.lower_ty(t, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Variable))
89+
});
9190
let init = l.kind.init().map(|init| self.lower_expr(init));
9291
let hir_id = self.lower_node_id(l.id);
9392
let pat = self.lower_pat(&l.pat);

compiler/rustc_ast_lowering/src/expr.rs

+18-16
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
6666
seg,
6767
ParamMode::Optional,
6868
ParenthesizedGenericArgs::Err,
69-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
69+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
7070
));
7171
let receiver = self.lower_expr(receiver);
7272
let args =
@@ -89,14 +89,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
8989
}
9090
ExprKind::Cast(ref expr, ref ty) => {
9191
let expr = self.lower_expr(expr);
92-
let ty =
93-
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Type));
92+
let ty = self
93+
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
9494
hir::ExprKind::Cast(expr, ty)
9595
}
9696
ExprKind::Type(ref expr, ref ty) => {
9797
let expr = self.lower_expr(expr);
98-
let ty =
99-
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Type));
98+
let ty = self
99+
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
100100
hir::ExprKind::Type(expr, ty)
101101
}
102102
ExprKind::AddrOf(k, m, ref ohs) => {
@@ -219,7 +219,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
219219
qself,
220220
path,
221221
ParamMode::Optional,
222-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
222+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
223223
);
224224
hir::ExprKind::Path(qpath)
225225
}
@@ -253,7 +253,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
253253
&se.qself,
254254
&se.path,
255255
ParamMode::Optional,
256-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
256+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
257257
)),
258258
self.arena
259259
.alloc_from_iter(se.fields.iter().map(|x| self.lower_expr_field(x))),
@@ -550,12 +550,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
550550
async_gen_kind: hir::AsyncGeneratorKind,
551551
body: impl FnOnce(&mut Self) -> hir::Expr<'hir>,
552552
) -> hir::ExprKind<'hir> {
553-
let output = match ret_ty {
554-
Some(ty) => hir::FnRetTy::Return(
555-
self.lower_ty(&ty, ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock)),
556-
),
557-
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
558-
};
553+
let output =
554+
match ret_ty {
555+
Some(ty) => hir::FnRetTy::Return(self.lower_ty(
556+
&ty,
557+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock),
558+
)),
559+
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
560+
};
559561

560562
// Resume argument type. We let the compiler infer this to simplify the lowering. It is
561563
// fully constrained by `future::from_generator`.
@@ -1123,7 +1125,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11231125
qself,
11241126
path,
11251127
ParamMode::Optional,
1126-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1128+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
11271129
);
11281130
// Destructure like a tuple struct.
11291131
let tuple_struct_pat =
@@ -1139,7 +1141,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11391141
qself,
11401142
path,
11411143
ParamMode::Optional,
1142-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1144+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
11431145
);
11441146
// Destructure like a unit struct.
11451147
let unit_struct_pat = hir::PatKind::Path(qpath);
@@ -1163,7 +1165,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11631165
&se.qself,
11641166
&se.path,
11651167
ParamMode::Optional,
1166-
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
1168+
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
11671169
);
11681170
let fields_omitted = match &se.rest {
11691171
StructRest::Base(e) => {

0 commit comments

Comments
 (0)