Auto merge of #87540 - JohnTitor:rollup-8xc6bl5, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #87315 (Add docs for raw-dylib to unstable book) - #87330 (Use hashbrown's `extend_reserve()` in `HashMap`) - #87443 (Don't treat git repos as non-existent when `ignore_git` is set) - #87453 (Suggest removing unnecessary &mut as help message) - #87500 (Document math behind MIN/MAX consts on integers) - #87501 (Remove min_type_alias_impl_trait in favor of type_alias_impl_trait) - #87507 (SGX mutex is *not* moveable) - #87513 (bootstrap.py: change `git log` option to indicate desired behavior) - #87523 (Stop creating a reference then immediately dereferencing it.) - #87524 (Fix ICE in `diagnostic_hir_wf_check`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
a28109a767
393 changed files with 1125 additions and 5197 deletions
|
@ -287,7 +287,7 @@ impl<'a> PostExpansionVisitor<'a> {
|
|||
if let ast::TyKind::ImplTrait(..) = ty.kind {
|
||||
gate_feature_post!(
|
||||
&self.vis,
|
||||
min_type_alias_impl_trait,
|
||||
type_alias_impl_trait,
|
||||
ty.span,
|
||||
"`impl Trait` in type aliases is unstable"
|
||||
);
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#![feature(iter_map_while)]
|
||||
#![feature(maybe_uninit_uninit_array)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(min_type_alias_impl_trait)]
|
||||
#![cfg_attr(bootstrap, feature(min_type_alias_impl_trait))]
|
||||
#![cfg_attr(not(bootstrap), feature(type_alias_impl_trait))]
|
||||
#![feature(new_uninit)]
|
||||
#![feature(nll)]
|
||||
#![feature(once_cell)]
|
||||
|
|
|
@ -486,7 +486,7 @@ declare_features! (
|
|||
(active, async_closure, "1.37.0", Some(62290), None),
|
||||
|
||||
/// Allows `impl Trait` to be used inside type aliases (RFC 2515).
|
||||
(incomplete, type_alias_impl_trait, "1.38.0", Some(63063), None),
|
||||
(active, type_alias_impl_trait, "1.38.0", Some(63063), None),
|
||||
|
||||
/// Allows the definition of `const extern fn` and `const unsafe extern fn`.
|
||||
(active, const_extern_fn, "1.40.0", Some(64926), None),
|
||||
|
@ -619,9 +619,6 @@ declare_features! (
|
|||
/// Allows macro attributes to observe output of `#[derive]`.
|
||||
(active, macro_attributes_in_derive_output, "1.51.0", Some(81119), None),
|
||||
|
||||
/// Allows the use of type alias impl trait in function return positions
|
||||
(active, min_type_alias_impl_trait, "1.52.0", Some(63063), None),
|
||||
|
||||
/// Allows associated types in inherent impls.
|
||||
(incomplete, inherent_associated_types, "1.52.0", Some(8995), None),
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ declare_features! (
|
|||
Some("subsumed by `.await` syntax")),
|
||||
/// Allows defining `existential type`s.
|
||||
(removed, existential_type, "1.38.0", Some(63063), None,
|
||||
Some("removed in favor of `#![feature(min_type_alias_impl_trait)]`")),
|
||||
Some("removed in favor of `#![feature(type_alias_impl_trait)]`")),
|
||||
/// Allows using the macros:
|
||||
/// + `__diagnostic_used`
|
||||
/// + `__register_diagnostic`
|
||||
|
@ -152,6 +152,10 @@ declare_features! (
|
|||
(removed, impl_trait_in_bindings, "1.55.0", Some(63065), None,
|
||||
Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")),
|
||||
|
||||
/// Allows the use of type alias impl trait in function return positions
|
||||
(removed, min_type_alias_impl_trait, "1.55.0", Some(63063), None,
|
||||
Some("removed in favor of full type_alias_impl_trait")),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// feature-group-end: removed features
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -242,7 +242,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
.unwrap_or(false) =>
|
||||
{
|
||||
err.span_label(span, format!("cannot {ACT}", ACT = act));
|
||||
err.span_label(span, "try removing `&mut` here");
|
||||
err.span_suggestion(
|
||||
span,
|
||||
"try removing `&mut` here",
|
||||
String::new(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
||||
// We want to suggest users use `let mut` for local (user
|
||||
|
@ -324,7 +329,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
} =>
|
||||
{
|
||||
err.span_label(span, format!("cannot {ACT}", ACT = act));
|
||||
err.span_label(span, "try removing `&mut` here");
|
||||
err.span_suggestion(
|
||||
span,
|
||||
"try removing `&mut` here",
|
||||
String::new(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
||||
PlaceRef { local, projection: [ProjectionElem::Deref] }
|
||||
|
|
|
@ -240,8 +240,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
|
||||
let mut err = match *error {
|
||||
SelectionError::Unimplemented => {
|
||||
// If this obligation was generated as a result of well-formed checking, see if we
|
||||
// can get a better error message by performing HIR-based well formed checking.
|
||||
// If this obligation was generated as a result of well-formedness checking, see if we
|
||||
// can get a better error message by performing HIR-based well-formedness checking.
|
||||
if let ObligationCauseCode::WellFormed(Some(wf_loc)) =
|
||||
root_obligation.cause.code.peel_derives()
|
||||
{
|
||||
|
|
|
@ -38,20 +38,20 @@ fn diagnostic_hir_wf_check<'tcx>(
|
|||
// given the type `Option<MyStruct<u8>>`, we will check
|
||||
// `Option<MyStruct<u8>>`, `MyStruct<u8>`, and `u8`.
|
||||
// For each type, we perform a well-formed check, and see if we get
|
||||
// an erorr that matches our expected predicate. We keep save
|
||||
// an error that matches our expected predicate. We save
|
||||
// the `ObligationCause` corresponding to the *innermost* type,
|
||||
// which is the most specific type that we can point to.
|
||||
// In general, the different components of an `hir::Ty` may have
|
||||
// completely differentr spans due to macro invocations. Pointing
|
||||
// completely different spans due to macro invocations. Pointing
|
||||
// to the most accurate part of the type can be the difference
|
||||
// between a useless span (e.g. the macro invocation site)
|
||||
// and a useful span (e.g. a user-provided type passed in to the macro).
|
||||
// and a useful span (e.g. a user-provided type passed into the macro).
|
||||
//
|
||||
// This approach is quite inefficient - we redo a lot of work done
|
||||
// by the normal WF checker. However, this code is run at most once
|
||||
// per reported error - it will have no impact when compilation succeeds,
|
||||
// and should only have an impact if a very large number of errors are
|
||||
// displaydd to the user.
|
||||
// and should only have an impact if a very large number of errors is
|
||||
// displayed to the user.
|
||||
struct HirWfCheck<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
predicate: ty::Predicate<'tcx>,
|
||||
|
@ -126,10 +126,12 @@ fn diagnostic_hir_wf_check<'tcx>(
|
|||
WellFormedLoc::Ty(_) => match hir.get(hir_id) {
|
||||
hir::Node::ImplItem(item) => match item.kind {
|
||||
hir::ImplItemKind::TyAlias(ty) => Some(ty),
|
||||
hir::ImplItemKind::Const(ty, _) => Some(ty),
|
||||
ref item => bug!("Unexpected ImplItem {:?}", item),
|
||||
},
|
||||
hir::Node::TraitItem(item) => match item.kind {
|
||||
hir::TraitItemKind::Type(_, ty) => ty,
|
||||
hir::TraitItemKind::Const(ty, _) => Some(ty),
|
||||
ref item => bug!("Unexpected TraitItem {:?}", item),
|
||||
},
|
||||
hir::Node::Item(item) => match item.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue