Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb286722

Browse files
committed
Auto merge of#127635 - matthiaskrgr:rollup-foopajr, r=matthiaskrgr
Rollup of 6 pull requestsSuccessful merges: -#127164 (match lowering: Clarify the main loop of the algorithm) -#127422 (as_simd: fix doc comment to be in line with align_to) -#127596 (More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>`) -#127607 (compiletest: Better error message for bad `normalize-*` headers) -#127622 (Mark `builtin_syntax` as internal) -#127625 (Revert accidental comment deletion)r? `@ghost``@rustbot` modify labels: rollup
2 parents4a31a6c +c2b7842 commitb286722

File tree

28 files changed

+506
-585
lines changed

28 files changed

+506
-585
lines changed

‎compiler/rustc_borrowck/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ impl<'a, 'mir, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'mir, 'tcx, R>
821821
|TerminatorKind::Return
822822
|TerminatorKind::TailCall{ ..}
823823
|TerminatorKind::CoroutineDrop =>{
824+
// Returning from the function implicitly kills storage for all locals and statics.
825+
// Often, the storage will already have been killed by an explicit
824826
// StorageDead, but we don't always emit those (notably on unwind paths),
825827
// so this "extra check" serves as a kind of backup.
826828
let borrow_set =self.borrow_set.clone();

‎compiler/rustc_feature/src/unstable.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ declare_features! (
248248
(unstable, auto_traits,"1.50.0",Some(13231)),
249249
/// Allows using `box` in patterns (RFC 469).
250250
(unstable, box_patterns,"1.0.0",Some(29641)),
251+
/// Allows builtin # foo() syntax
252+
(internal, builtin_syntax,"1.71.0",Some(110680)),
251253
/// Allows `#[doc(notable_trait)]`.
252254
/// Renamed from `doc_spotlight`.
253255
(unstable, doc_notable_trait,"1.52.0",Some(45040)),
@@ -361,8 +363,6 @@ declare_features! (
361363
(unstable, async_fn_track_caller,"1.73.0",Some(110011)),
362364
/// Allows `for await` loops.
363365
(unstable, async_for_loop,"1.77.0",Some(118898)),
364-
/// Allows builtin # foo() syntax
365-
(unstable, builtin_syntax,"1.71.0",Some(110680)),
366366
/// Allows using C-variadics.
367367
(unstable, c_variadic,"1.34.0",Some(44930)),
368368
/// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour.

‎compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs‎

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -466,21 +466,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
466466
borrow_removal_span,
467467
});
468468
returntrue;
469-
}elseifletSome((deref_ty, _)) =
470-
self.autoderef(expr.span, found_ty_inner).silence_errors().nth(1)
471-
&&self.can_eq(self.param_env, deref_ty, peeled)
472-
&& error_tys_equate_as_ref
473-
{
474-
let sugg =prefix_wrap(".as_deref()");
475-
err.subdiagnostic(errors::SuggestConvertViaMethod{
476-
span: expr.span.shrink_to_hi(),
477-
sugg,
478-
expected,
479-
found,
480-
borrow_removal_span,
481-
});
482-
returntrue;
483-
}elseiflet ty::Adt(adt, _) = found_ty_inner.peel_refs().kind()
469+
}elseiflet ty::Ref(_, peeled_found_ty, _) = found_ty_inner.kind()
470+
&&let ty::Adt(adt, _) = peeled_found_ty.peel_refs().kind()
484471
&&self.tcx.is_lang_item(adt.did(),LangItem::String)
485472
&& peeled.is_str()
486473
// `Result::map`, conversely, does not take ref of the error type.
@@ -496,12 +483,47 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
496483
Applicability::MachineApplicable,
497484
);
498485
returntrue;
486+
}else{
487+
if !error_tys_equate_as_ref{
488+
returnfalse;
489+
}
490+
letmut steps =self.autoderef(expr.span, found_ty_inner).silence_errors();
491+
ifletSome((deref_ty, _)) = steps.nth(1)
492+
&&self.can_eq(self.param_env, deref_ty, peeled)
493+
{
494+
let sugg =prefix_wrap(".as_deref()");
495+
err.subdiagnostic(errors::SuggestConvertViaMethod{
496+
span: expr.span.shrink_to_hi(),
497+
sugg,
498+
expected,
499+
found,
500+
borrow_removal_span,
501+
});
502+
returntrue;
503+
}
504+
for(deref_ty, n_step)in steps{
505+
ifself.can_eq(self.param_env, deref_ty, peeled){
506+
let explicit_deref ="*".repeat(n_step);
507+
let sugg =prefix_wrap(&format!(".map(|v| &{explicit_deref}v)"));
508+
err.subdiagnostic(errors::SuggestConvertViaMethod{
509+
span: expr.span.shrink_to_hi(),
510+
sugg,
511+
expected,
512+
found,
513+
borrow_removal_span,
514+
});
515+
returntrue;
516+
}
517+
}
499518
}
500519
}
501520

502521
false
503522
}
504523

524+
/// If `ty` is `Option<T>`, returns `T, T, None`.
525+
/// If `ty` is `Result<T, E>`, returns `T, T, Some(E, E)`.
526+
/// Otherwise, returns `None`.
505527
fndeconstruct_option_or_result(
506528
&self,
507529
found_ty:Ty<'tcx>,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp