Skip to content

Commit 021861a

Browse files
committedJan 22, 2024
Auto merge of #120239 - matthiaskrgr:rollup-vqjn6ot, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #118578 (core: introduce split_at{,_mut}_checked) - #119369 (exclude unexported macro bindings from extern crate) - #119408 (xous: misc fixes + add network support) - #119943 (std::net: bind update for using backlog as `-1` too.) - #119948 (Make `unsafe_op_in_unsafe_fn` migrated in edition 2024) - #119999 (remote-test: use u64 to represent file size) - #120152 (add help message for `exclusive_range_pattern` error) - #120213 (Don't actually make bound ty/const for RTN) - #120225 (Fix -Zremap-path-scope typo) Failed merges: - #119972 (Add `ErrCode`) r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.77.0
2 parents 3066253 + 44e44f4 commit 021861a

File tree

60 files changed

+2374
-314
lines changed

Some content is hidden

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

60 files changed

+2374
-314
lines changed
 

‎compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
398398
&self,
399399
exclusive_range_pattern,
400400
pattern.span,
401-
"exclusive range pattern syntax is experimental"
401+
"exclusive range pattern syntax is experimental",
402+
"use an inclusive range pattern, like N..=M"
402403
);
403404
}
404405
_ => {}

‎compiler/rustc_hir_analysis/src/astconv/bounds.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
329329
}
330330

331331
let projection_ty = if let ty::AssocKind::Fn = assoc_kind {
332-
let mut emitted_bad_param_err = false;
332+
let mut emitted_bad_param_err = None;
333333
// If we have an method return type bound, then we need to substitute
334334
// the method's early bound params with suitable late-bound params.
335335
let mut num_bound_vars = candidate.bound_vars().len();
@@ -346,46 +346,30 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
346346
)
347347
.into(),
348348
ty::GenericParamDefKind::Type { .. } => {
349-
if !emitted_bad_param_err {
349+
let guar = *emitted_bad_param_err.get_or_insert_with(|| {
350350
tcx.dcx().emit_err(
351351
crate::errors::ReturnTypeNotationIllegalParam::Type {
352352
span: path_span,
353353
param_span: tcx.def_span(param.def_id),
354354
},
355-
);
356-
emitted_bad_param_err = true;
357-
}
358-
Ty::new_bound(
359-
tcx,
360-
ty::INNERMOST,
361-
ty::BoundTy {
362-
var: ty::BoundVar::from_usize(num_bound_vars),
363-
kind: ty::BoundTyKind::Param(param.def_id, param.name),
364-
},
365-
)
366-
.into()
355+
)
356+
});
357+
Ty::new_error(tcx, guar).into()
367358
}
368359
ty::GenericParamDefKind::Const { .. } => {
369-
if !emitted_bad_param_err {
360+
let guar = *emitted_bad_param_err.get_or_insert_with(|| {
370361
tcx.dcx().emit_err(
371362
crate::errors::ReturnTypeNotationIllegalParam::Const {
372363
span: path_span,
373364
param_span: tcx.def_span(param.def_id),
374365
},
375-
);
376-
emitted_bad_param_err = true;
377-
}
366+
)
367+
});
378368
let ty = tcx
379369
.type_of(param.def_id)
380370
.no_bound_vars()
381371
.expect("ct params cannot have early bound vars");
382-
ty::Const::new_bound(
383-
tcx,
384-
ty::INNERMOST,
385-
ty::BoundVar::from_usize(num_bound_vars),
386-
ty,
387-
)
388-
.into()
372+
ty::Const::new_error(tcx, guar, ty).into()
389373
}
390374
};
391375
num_bound_vars += 1;

0 commit comments

Comments
 (0)
Please sign in to comment.