Accumulation of various drive-by cosmetic changes.
This commit is contained in:
parent
589beb979c
commit
16ef295770
7 changed files with 45 additions and 51 deletions
|
|
@ -168,7 +168,7 @@ rustc_queries! {
|
|||
query predicates_defined_on(_: DefId)
|
||||
-> Lrc<ty::GenericPredicates<'tcx>> {}
|
||||
|
||||
/// Returns the predicates written explicit by the user.
|
||||
/// Returns the predicates written explicitly by the user.
|
||||
query explicit_predicates_of(_: DefId)
|
||||
-> Lrc<ty::GenericPredicates<'tcx>> {}
|
||||
|
||||
|
|
@ -216,9 +216,9 @@ rustc_queries! {
|
|||
_: DefId
|
||||
) -> Result<DtorckConstraint<'tcx>, NoSolution> {}
|
||||
|
||||
/// True if this is a const fn, use the `is_const_fn` to know whether your crate actually
|
||||
/// sees it as const fn (e.g., the const-fn-ness might be unstable and you might not have
|
||||
/// the feature gate active)
|
||||
/// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
|
||||
/// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
|
||||
/// not have the feature gate active).
|
||||
///
|
||||
/// **Do not call this function manually.** It is only meant to cache the base data for the
|
||||
/// `is_const_fn` function.
|
||||
|
|
@ -226,7 +226,7 @@ rustc_queries! {
|
|||
desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
/// Returns true if calls to the function may be promoted
|
||||
/// Returns `true` if calls to the function may be promoted.
|
||||
///
|
||||
/// This is either because the function is e.g., a tuple-struct or tuple-variant
|
||||
/// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should
|
||||
|
|
@ -237,25 +237,23 @@ rustc_queries! {
|
|||
|
||||
query const_fn_is_allowed_fn_ptr(_: DefId) -> bool {}
|
||||
|
||||
/// True if this is a foreign item (i.e., linked via `extern { ... }`).
|
||||
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
|
||||
query is_foreign_item(_: DefId) -> bool {}
|
||||
|
||||
/// Returns `Some(mutability)` if the node pointed to by `def_id` is a static item.
|
||||
query static_mutability(_: DefId) -> Option<hir::Mutability> {}
|
||||
|
||||
/// Get a map with the variance of every item; use `item_variance`
|
||||
/// instead.
|
||||
/// Gets a map with the variance of every item; use `item_variance` instead.
|
||||
query crate_variances(_: CrateNum) -> Lrc<ty::CrateVariancesMap<'tcx>> {
|
||||
desc { "computing the variances for items in this crate" }
|
||||
}
|
||||
|
||||
/// Maps from def-id of a type or region parameter to its
|
||||
/// (inferred) variance.
|
||||
/// Maps from def-ID of a type or region parameter to its (inferred) variance.
|
||||
query variances_of(_: DefId) -> &'tcx [ty::Variance] {}
|
||||
}
|
||||
|
||||
TypeChecking {
|
||||
/// Maps from def-id of a type to its (inferred) outlives.
|
||||
/// Maps from def-ID of a type to its (inferred) outlives.
|
||||
query inferred_outlives_crate(_: CrateNum)
|
||||
-> Lrc<ty::CratePredicatesMap<'tcx>> {
|
||||
desc { "computing the inferred outlives predicates for items in this crate" }
|
||||
|
|
@ -263,10 +261,10 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
Other {
|
||||
/// Maps from an impl/trait def-id to a list of the def-ids of its items
|
||||
/// Maps from an impl/trait def-ID to a list of the def-ids of its items.
|
||||
query associated_item_def_ids(_: DefId) -> Lrc<Vec<DefId>> {}
|
||||
|
||||
/// Maps from a trait item to the trait item "descriptor"
|
||||
/// Maps from a trait item to the trait item "descriptor".
|
||||
query associated_item(_: DefId) -> ty::AssociatedItem {}
|
||||
|
||||
query impl_trait_ref(_: DefId) -> Option<ty::TraitRef<'tcx>> {}
|
||||
|
|
@ -276,7 +274,7 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
TypeChecking {
|
||||
/// Maps a DefId of a type to a list of its inherent impls.
|
||||
/// Maps a def-ID of a type to a list of its inherent impls.
|
||||
/// Contains implementations of methods that are inherent to a type.
|
||||
/// Methods in these implementations don't need to be exported.
|
||||
query inherent_impls(_: DefId) -> Lrc<Vec<DefId>> {
|
||||
|
|
@ -300,7 +298,7 @@ rustc_queries! {
|
|||
desc { |tcx| "linting {}", key.describe_as_module(tcx) }
|
||||
}
|
||||
|
||||
/// Checks the attributes in the module
|
||||
/// Checks the attributes in the module.
|
||||
query check_mod_attrs(key: DefId) -> () {
|
||||
desc { |tcx| "checking attributes in {}", key.describe_as_module(tcx) }
|
||||
}
|
||||
|
|
@ -309,7 +307,7 @@ rustc_queries! {
|
|||
desc { |tcx| "checking for unstable API usage in {}", key.describe_as_module(tcx) }
|
||||
}
|
||||
|
||||
/// Checks the loops in the module
|
||||
/// Checks the loops in the module.
|
||||
query check_mod_loops(key: DefId) -> () {
|
||||
desc { |tcx| "checking loops in {}", key.describe_as_module(tcx) }
|
||||
}
|
||||
|
|
@ -338,7 +336,7 @@ rustc_queries! {
|
|||
desc { |tcx| "collecting item types in {}", key.describe_as_module(tcx) }
|
||||
}
|
||||
|
||||
/// Caches CoerceUnsized kinds for impls on custom types.
|
||||
/// Caches `CoerceUnsized` kinds for impls on custom types.
|
||||
query coerce_unsized_info(_: DefId)
|
||||
-> ty::adjustment::CoerceUnsizedInfo {}
|
||||
}
|
||||
|
|
@ -375,7 +373,7 @@ rustc_queries! {
|
|||
BorrowChecking {
|
||||
query borrowck(_: DefId) -> Lrc<BorrowCheckResult> {}
|
||||
|
||||
/// Borrow checks the function body. If this is a closure, returns
|
||||
/// Borrow-checks the function body. If this is a closure, returns
|
||||
/// additional requirements that the closure's creator must verify.
|
||||
query mir_borrowck(_: DefId) -> mir::BorrowCheckResult<'tcx> {}
|
||||
}
|
||||
|
|
@ -401,11 +399,11 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
Other {
|
||||
/// Evaluate a constant without running sanity checks
|
||||
/// Evaluates a constant without running sanity checks.
|
||||
///
|
||||
/// **Do not use this** outside const eval. Const eval uses this to break query cycles
|
||||
/// during validation. Please add a comment to every use site explaining why using
|
||||
/// `const_eval` isn't sufficient
|
||||
/// `const_eval` isn't sufficient.
|
||||
query const_eval_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
|
||||
-> ConstEvalRawResult<'tcx> {
|
||||
no_force
|
||||
|
|
@ -660,12 +658,12 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
Linking {
|
||||
// The DefIds of all non-generic functions and statics in the given crate
|
||||
// The `DefId`s of all non-generic functions and statics in the given crate
|
||||
// that can be reached from outside the crate.
|
||||
//
|
||||
// We expect this items to be available for being linked to.
|
||||
//
|
||||
// This query can also be called for LOCAL_CRATE. In this case it will
|
||||
// This query can also be called for `LOCAL_CRATE`. In this case it will
|
||||
// compute which items will be reachable to other crates, taking into account
|
||||
// the kind of crate that is currently compiled. Crates with only a
|
||||
// C interface have fewer reachable things.
|
||||
|
|
|
|||
|
|
@ -123,12 +123,10 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
|
|||
// Predicates declared on the trait.
|
||||
let predicates = tcx.super_predicates_of(data.def_id());
|
||||
|
||||
let mut predicates: Vec<_> =
|
||||
predicates.predicates
|
||||
.iter()
|
||||
.map(|(p, _)| p.subst_supertrait(tcx, &data.to_poly_trait_ref()))
|
||||
.collect();
|
||||
|
||||
let mut predicates: Vec<_> = predicates.predicates
|
||||
.iter()
|
||||
.map(|(pred, _)| pred.subst_supertrait(tcx, &data.to_poly_trait_ref()))
|
||||
.collect();
|
||||
debug!("super_predicates: data={:?} predicates={:?}",
|
||||
data, predicates);
|
||||
|
||||
|
|
@ -150,8 +148,8 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
|
|||
// predicates.
|
||||
}
|
||||
ty::Predicate::Subtype(..) => {
|
||||
// Currently, we do not "elaborate" predicates like `X
|
||||
// <: Y`, though conceivably we might.
|
||||
// Currently, we do not "elaborate" predicates like `X <: Y`,
|
||||
// though conceivably we might.
|
||||
}
|
||||
ty::Predicate::Projection(..) => {
|
||||
// Nothing to elaborate in a projection predicate.
|
||||
|
|
|
|||
|
|
@ -1075,25 +1075,25 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
|
|||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
|
||||
pub enum Predicate<'tcx> {
|
||||
/// Corresponds to `where Foo: Bar<A,B,C>`. `Foo` here would be
|
||||
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
|
||||
/// the `Self` type of the trait reference and `A`, `B`, and `C`
|
||||
/// would be the type parameters.
|
||||
Trait(PolyTraitPredicate<'tcx>),
|
||||
|
||||
/// where `'a: 'b`
|
||||
/// `where 'a: 'b`
|
||||
RegionOutlives(PolyRegionOutlivesPredicate<'tcx>),
|
||||
|
||||
/// where `T: 'a`
|
||||
/// `where T: 'a`
|
||||
TypeOutlives(PolyTypeOutlivesPredicate<'tcx>),
|
||||
|
||||
/// where `<T as TraitRef>::Name == X`, approximately.
|
||||
/// `where <T as TraitRef>::Name == X`, approximately.
|
||||
/// See the `ProjectionPredicate` struct for details.
|
||||
Projection(PolyProjectionPredicate<'tcx>),
|
||||
|
||||
/// no syntax: `T` well-formed
|
||||
WellFormed(Ty<'tcx>),
|
||||
|
||||
/// trait must be object-safe
|
||||
/// Trait must be object-safe.
|
||||
ObjectSafe(DefId),
|
||||
|
||||
/// No direct syntax. May be thought of as `where T: FnFoo<...>`
|
||||
|
|
|
|||
|
|
@ -100,8 +100,7 @@ pub use self::on_disk_cache::OnDiskCache;
|
|||
|
||||
rustc_query_append! { [define_queries!][ <'tcx>
|
||||
Other {
|
||||
/// Run analysis passes on the crate
|
||||
/// Runs analysis passes on the crate.
|
||||
[] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
|
||||
|
||||
},
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -1502,7 +1502,6 @@ enum StorageDeadOrDrop<'tcx> {
|
|||
}
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
|
||||
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
|
||||
/// is moved after being invoked.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -702,7 +702,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
|||
}
|
||||
|
||||
/// Instantiates the path for the given trait reference, assuming that it's
|
||||
/// bound to a valid trait type. Returns the def_id for the defining trait.
|
||||
/// bound to a valid trait type. Returns the def-ID for the defining trait.
|
||||
/// The type _cannot_ be a type other than a trait type.
|
||||
///
|
||||
/// If the `projections` argument is `None`, then assoc type bindings like `Foo<T = X>`
|
||||
|
|
@ -1035,7 +1035,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
|||
pred.skip_binder().ty.walk().any(|t| t == dummy_self);
|
||||
|
||||
// If the projection output contains `Self`, force the user to
|
||||
// elaborate it explicitly to avoid a bunch of complexity.
|
||||
// elaborate it explicitly to avoid a lot of complexity.
|
||||
//
|
||||
// The "classicaly useful" case is the following:
|
||||
// ```
|
||||
|
|
@ -1044,14 +1044,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
|||
// }
|
||||
// ```
|
||||
//
|
||||
// Here, the user could theoretically write `dyn MyTrait<Output=X>`,
|
||||
// Here, the user could theoretically write `dyn MyTrait<Output = X>`,
|
||||
// but actually supporting that would "expand" to an infinitely-long type
|
||||
// `fix $ τ → dyn MyTrait<MyOutput=X, Output=<τ as MyTrait>::MyOutput`.
|
||||
// `fix $ τ → dyn MyTrait<MyOutput = X, Output = <τ as MyTrait>::MyOutput`.
|
||||
//
|
||||
// Instead, we force the user to write `dyn MyTrait<MyOutput=X, Output=X>`,
|
||||
// Instead, we force the user to write `dyn MyTrait<MyOutput = X, Output = X>`,
|
||||
// which is uglier but works. See the discussion in #56288 for alternatives.
|
||||
if !references_self {
|
||||
// Include projections defined on supertraits,
|
||||
// Include projections defined on supertraits.
|
||||
projection_bounds.push((pred, DUMMY_SP))
|
||||
}
|
||||
}
|
||||
|
|
@ -2138,7 +2138,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> {
|
|||
pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>)
|
||||
-> Vec<(ty::Predicate<'tcx>, Span)>
|
||||
{
|
||||
// If it could be sized, and is, add the sized predicate.
|
||||
// If it could be sized, and is, add the `Sized` predicate.
|
||||
let sized_predicate = self.implicitly_sized.and_then(|span| {
|
||||
tcx.lang_items().sized_trait().map(|sized| {
|
||||
let trait_ref = ty::TraitRef {
|
||||
|
|
|
|||
|
|
@ -684,9 +684,9 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
|
|||
tcx.alloc_adt_def(def_id, kind, variants, repr)
|
||||
}
|
||||
|
||||
/// Ensures that the super-predicates of the trait with `DefId`
|
||||
/// trait_def_id are converted and stored. This also ensures that
|
||||
/// the transitive super-predicates are converted;
|
||||
/// Ensures that the super-predicates of the trait with a `DefId`
|
||||
/// of `trait_def_id` are converted and stored. This also ensures that
|
||||
/// the transitive super-predicates are converted.
|
||||
fn super_predicates_of<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
trait_def_id: DefId,
|
||||
|
|
@ -707,14 +707,14 @@ fn super_predicates_of<'a, 'tcx>(
|
|||
|
||||
let icx = ItemCtxt::new(tcx, trait_def_id);
|
||||
|
||||
// Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo : Bar + Zed`.
|
||||
// Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo: Bar + Zed`.
|
||||
let self_param_ty = tcx.mk_self_type();
|
||||
let superbounds1 = compute_bounds(&icx, self_param_ty, bounds, SizedByDefault::No, item.span);
|
||||
|
||||
let superbounds1 = superbounds1.predicates(tcx, self_param_ty);
|
||||
|
||||
// Convert any explicit superbounds in the where clause,
|
||||
// e.g., `trait Foo where Self : Bar`.
|
||||
// Convert any explicit superbounds in the wheree-clause,
|
||||
// e.g., `trait Foo where Self: Bar`.
|
||||
// In the case of trait aliases, however, we include all bounds in the where clause,
|
||||
// so e.g., `trait Foo = where u32: PartialEq<Self>` would include `u32: PartialEq<Self>`
|
||||
// as one of its "superpredicates".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue