mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 06:33:58 +00:00
Simplify
This commit is contained in:
parent
d6b908ec41
commit
e844784d8d
11 changed files with 110 additions and 110 deletions
|
@ -54,7 +54,7 @@ pub(super) fn print_body_hir(db: &dyn DefDatabase, body: &Body, owner: DefWithBo
|
||||||
let mut p = Printer { db, body, buf: header, indent_level: 0, needs_indent: false };
|
let mut p = Printer { db, body, buf: header, indent_level: 0, needs_indent: false };
|
||||||
if let DefWithBodyId::FunctionId(it) = owner {
|
if let DefWithBodyId::FunctionId(it) = owner {
|
||||||
p.buf.push('(');
|
p.buf.push('(');
|
||||||
body.params.iter().zip(&db.function_data(it).params).for_each(|(¶m, ty)| {
|
body.params.iter().zip(db.function_data(it).params.iter()).for_each(|(¶m, ty)| {
|
||||||
p.print_pat(param);
|
p.print_pat(param);
|
||||||
p.buf.push(':');
|
p.buf.push(':');
|
||||||
p.print_type_ref(ty);
|
p.print_type_ref(ty);
|
||||||
|
|
|
@ -34,7 +34,7 @@ use crate::{
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct FunctionData {
|
pub struct FunctionData {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub params: Vec<Interned<TypeRef>>,
|
pub params: Box<[Interned<TypeRef>]>,
|
||||||
pub ret_type: Interned<TypeRef>,
|
pub ret_type: Interned<TypeRef>,
|
||||||
pub attrs: Attrs,
|
pub attrs: Attrs,
|
||||||
pub visibility: RawVisibility,
|
pub visibility: RawVisibility,
|
||||||
|
@ -177,7 +177,7 @@ pub struct TypeAliasData {
|
||||||
pub rustc_has_incoherent_inherent_impls: bool,
|
pub rustc_has_incoherent_inherent_impls: bool,
|
||||||
pub rustc_allow_incoherent_impl: bool,
|
pub rustc_allow_incoherent_impl: bool,
|
||||||
/// Bounds restricting the type alias itself (eg. `type Ty: Bound;` in a trait or impl).
|
/// Bounds restricting the type alias itself (eg. `type Ty: Bound;` in a trait or impl).
|
||||||
pub bounds: Vec<Interned<TypeBound>>,
|
pub bounds: Box<[Interned<TypeBound>]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TypeAliasData {
|
impl TypeAliasData {
|
||||||
|
@ -210,7 +210,7 @@ impl TypeAliasData {
|
||||||
is_extern: matches!(loc.container, ItemContainerId::ExternBlockId(_)),
|
is_extern: matches!(loc.container, ItemContainerId::ExternBlockId(_)),
|
||||||
rustc_has_incoherent_inherent_impls,
|
rustc_has_incoherent_inherent_impls,
|
||||||
rustc_allow_incoherent_impl,
|
rustc_allow_incoherent_impl,
|
||||||
bounds: typ.bounds.to_vec(),
|
bounds: typ.bounds.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ impl GenericParams {
|
||||||
let mut expander = Lazy::new(|| {
|
let mut expander = Lazy::new(|| {
|
||||||
(module.def_map(db), Expander::new(db, loc.source(db).file_id, module))
|
(module.def_map(db), Expander::new(db, loc.source(db).file_id, module))
|
||||||
});
|
});
|
||||||
for param in &func_data.params {
|
for param in func_data.params.iter() {
|
||||||
generic_params.fill_implicit_impl_trait_args(db, &mut expander, param);
|
generic_params.fill_implicit_impl_trait_args(db, &mut expander, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,14 +396,7 @@ impl<'a> Ctx<'a> {
|
||||||
let bounds = self.lower_type_bounds(type_alias);
|
let bounds = self.lower_type_bounds(type_alias);
|
||||||
let generic_params = self.lower_generic_params(HasImplicitSelf::No, type_alias);
|
let generic_params = self.lower_generic_params(HasImplicitSelf::No, type_alias);
|
||||||
let ast_id = self.source_ast_id_map.ast_id(type_alias);
|
let ast_id = self.source_ast_id_map.ast_id(type_alias);
|
||||||
let res = TypeAlias {
|
let res = TypeAlias { name, visibility, bounds, generic_params, type_ref, ast_id };
|
||||||
name,
|
|
||||||
visibility,
|
|
||||||
bounds: bounds.into_boxed_slice(),
|
|
||||||
generic_params,
|
|
||||||
type_ref,
|
|
||||||
ast_id,
|
|
||||||
};
|
|
||||||
Some(id(self.data().type_aliases.alloc(res)))
|
Some(id(self.data().type_aliases.alloc(res)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,13 +630,13 @@ impl<'a> Ctx<'a> {
|
||||||
Interned::new(generics)
|
Interned::new(generics)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_type_bounds(&mut self, node: &dyn ast::HasTypeBounds) -> Vec<Interned<TypeBound>> {
|
fn lower_type_bounds(&mut self, node: &dyn ast::HasTypeBounds) -> Box<[Interned<TypeBound>]> {
|
||||||
match node.type_bound_list() {
|
match node.type_bound_list() {
|
||||||
Some(bound_list) => bound_list
|
Some(bound_list) => bound_list
|
||||||
.bounds()
|
.bounds()
|
||||||
.map(|it| Interned::new(TypeBound::from_ast(&self.body_ctx, it)))
|
.map(|it| Interned::new(TypeBound::from_ast(&self.body_ctx, it)))
|
||||||
.collect(),
|
.collect(),
|
||||||
None => Vec::new(),
|
None => Box::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ use crate::{
|
||||||
method_resolution::{InherentImpls, TraitImpls, TyFingerprint},
|
method_resolution::{InherentImpls, TraitImpls, TyFingerprint},
|
||||||
mir::{BorrowckResult, MirBody, MirLowerError},
|
mir::{BorrowckResult, MirBody, MirLowerError},
|
||||||
Binders, CallableDefId, ClosureId, Const, FnDefId, GenericArg, ImplTraitId, InferenceResult,
|
Binders, CallableDefId, ClosureId, Const, FnDefId, GenericArg, ImplTraitId, InferenceResult,
|
||||||
Interner, PolyFnSig, QuantifiedWhereClause, ReturnTypeImplTraits, Substitution, TraitRef, Ty,
|
Interner, PolyFnSig, QuantifiedWhereClause, ReturnTypeImplTraits, Substitution,
|
||||||
TyDefId, ValueTyDefId,
|
TraitEnvironment, TraitRef, Ty, TyDefId, ValueTyDefId,
|
||||||
};
|
};
|
||||||
use hir_expand::name::Name;
|
use hir_expand::name::Name;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
&self,
|
&self,
|
||||||
def: DefWithBodyId,
|
def: DefWithBodyId,
|
||||||
subst: Substitution,
|
subst: Substitution,
|
||||||
env: Arc<crate::TraitEnvironment>,
|
env: Arc<TraitEnvironment>,
|
||||||
) -> Result<Arc<MirBody>, MirLowerError>;
|
) -> Result<Arc<MirBody>, MirLowerError>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::mir::monomorphized_mir_body_for_closure_query)]
|
#[salsa::invoke(crate::mir::monomorphized_mir_body_for_closure_query)]
|
||||||
|
@ -55,7 +55,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
&self,
|
&self,
|
||||||
def: ClosureId,
|
def: ClosureId,
|
||||||
subst: Substitution,
|
subst: Substitution,
|
||||||
env: Arc<crate::TraitEnvironment>,
|
env: Arc<TraitEnvironment>,
|
||||||
) -> Result<Arc<MirBody>, MirLowerError>;
|
) -> Result<Arc<MirBody>, MirLowerError>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::mir::borrowck_query)]
|
#[salsa::invoke(crate::mir::borrowck_query)]
|
||||||
|
@ -81,7 +81,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
&self,
|
&self,
|
||||||
def: GeneralConstId,
|
def: GeneralConstId,
|
||||||
subst: Substitution,
|
subst: Substitution,
|
||||||
trait_env: Option<Arc<crate::TraitEnvironment>>,
|
trait_env: Option<Arc<TraitEnvironment>>,
|
||||||
) -> Result<Const, ConstEvalError>;
|
) -> Result<Const, ConstEvalError>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::consteval::const_eval_static_query)]
|
#[salsa::invoke(crate::consteval::const_eval_static_query)]
|
||||||
|
@ -104,16 +104,12 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
&self,
|
&self,
|
||||||
def: AdtId,
|
def: AdtId,
|
||||||
subst: Substitution,
|
subst: Substitution,
|
||||||
env: Arc<crate::TraitEnvironment>,
|
env: Arc<TraitEnvironment>,
|
||||||
) -> Result<Arc<Layout>, LayoutError>;
|
) -> Result<Arc<Layout>, LayoutError>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::layout::layout_of_ty_query)]
|
#[salsa::invoke(crate::layout::layout_of_ty_query)]
|
||||||
#[salsa::cycle(crate::layout::layout_of_ty_recover)]
|
#[salsa::cycle(crate::layout::layout_of_ty_recover)]
|
||||||
fn layout_of_ty(
|
fn layout_of_ty(&self, ty: Ty, env: Arc<TraitEnvironment>) -> Result<Arc<Layout>, LayoutError>;
|
||||||
&self,
|
|
||||||
ty: Ty,
|
|
||||||
env: Arc<crate::TraitEnvironment>,
|
|
||||||
) -> Result<Arc<Layout>, LayoutError>;
|
|
||||||
|
|
||||||
#[salsa::invoke(crate::layout::target_data_layout_query)]
|
#[salsa::invoke(crate::layout::target_data_layout_query)]
|
||||||
fn target_data_layout(&self, krate: CrateId) -> Option<Arc<TargetDataLayout>>;
|
fn target_data_layout(&self, krate: CrateId) -> Option<Arc<TargetDataLayout>>;
|
||||||
|
@ -121,7 +117,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
#[salsa::invoke(crate::method_resolution::lookup_impl_method_query)]
|
#[salsa::invoke(crate::method_resolution::lookup_impl_method_query)]
|
||||||
fn lookup_impl_method(
|
fn lookup_impl_method(
|
||||||
&self,
|
&self,
|
||||||
env: Arc<crate::TraitEnvironment>,
|
env: Arc<TraitEnvironment>,
|
||||||
func: FunctionId,
|
func: FunctionId,
|
||||||
fn_subst: Substitution,
|
fn_subst: Substitution,
|
||||||
) -> (FunctionId, Substitution);
|
) -> (FunctionId, Substitution);
|
||||||
|
@ -149,10 +145,10 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
|
|
||||||
#[salsa::invoke(crate::lower::trait_environment_for_body_query)]
|
#[salsa::invoke(crate::lower::trait_environment_for_body_query)]
|
||||||
#[salsa::transparent]
|
#[salsa::transparent]
|
||||||
fn trait_environment_for_body(&self, def: DefWithBodyId) -> Arc<crate::TraitEnvironment>;
|
fn trait_environment_for_body(&self, def: DefWithBodyId) -> Arc<TraitEnvironment>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::lower::trait_environment_query)]
|
#[salsa::invoke(crate::lower::trait_environment_query)]
|
||||||
fn trait_environment(&self, def: GenericDefId) -> Arc<crate::TraitEnvironment>;
|
fn trait_environment(&self, def: GenericDefId) -> Arc<TraitEnvironment>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::lower::generic_defaults_query)]
|
#[salsa::invoke(crate::lower::generic_defaults_query)]
|
||||||
#[salsa::cycle(crate::lower::generic_defaults_recover)]
|
#[salsa::cycle(crate::lower::generic_defaults_recover)]
|
||||||
|
@ -249,7 +245,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
fn normalize_projection(
|
fn normalize_projection(
|
||||||
&self,
|
&self,
|
||||||
projection: crate::ProjectionTy,
|
projection: crate::ProjectionTy,
|
||||||
env: Arc<crate::TraitEnvironment>,
|
env: Arc<TraitEnvironment>,
|
||||||
) -> Ty;
|
) -> Ty;
|
||||||
|
|
||||||
#[salsa::invoke(trait_solve_wait)]
|
#[salsa::invoke(trait_solve_wait)]
|
||||||
|
|
|
@ -1383,51 +1383,50 @@ pub(crate) fn generic_predicates_for_param_query(
|
||||||
let ctx = TyLoweringContext::new(db, &resolver, def.into())
|
let ctx = TyLoweringContext::new(db, &resolver, def.into())
|
||||||
.with_type_param_mode(ParamLoweringMode::Variable);
|
.with_type_param_mode(ParamLoweringMode::Variable);
|
||||||
let generics = generics(db.upcast(), def);
|
let generics = generics(db.upcast(), def);
|
||||||
|
|
||||||
|
// we have to filter out all other predicates *first*, before attempting to lower them
|
||||||
|
let predicate = |pred: &&_| match pred {
|
||||||
|
WherePredicate::ForLifetime { target, bound, .. }
|
||||||
|
| WherePredicate::TypeBound { target, bound, .. } => {
|
||||||
|
let invalid_target = match target {
|
||||||
|
WherePredicateTypeTarget::TypeRef(type_ref) => {
|
||||||
|
ctx.lower_ty_only_param(type_ref) != Some(param_id)
|
||||||
|
}
|
||||||
|
&WherePredicateTypeTarget::TypeOrConstParam(local_id) => {
|
||||||
|
let target_id = TypeOrConstParamId { parent: def, local_id };
|
||||||
|
target_id != param_id
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if invalid_target {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
match &**bound {
|
||||||
|
TypeBound::ForLifetime(_, path) | TypeBound::Path(path, _) => {
|
||||||
|
// Only lower the bound if the trait could possibly define the associated
|
||||||
|
// type we're looking for.
|
||||||
|
|
||||||
|
let Some(assoc_name) = &assoc_name else { return true };
|
||||||
|
let Some(TypeNs::TraitId(tr)) =
|
||||||
|
resolver.resolve_path_in_type_ns_fully(db.upcast(), path)
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
all_super_traits(db.upcast(), tr).iter().any(|tr| {
|
||||||
|
db.trait_data(*tr).items.iter().any(|(name, item)| {
|
||||||
|
matches!(item, AssocItemId::TypeAliasId(_)) && name == assoc_name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
TypeBound::Lifetime(_) | TypeBound::Error => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WherePredicate::Lifetime { .. } => false,
|
||||||
|
};
|
||||||
let mut predicates: Vec<_> = resolver
|
let mut predicates: Vec<_> = resolver
|
||||||
.where_predicates_in_scope()
|
.where_predicates_in_scope()
|
||||||
// we have to filter out all other predicates *first*, before attempting to lower them
|
.filter(predicate)
|
||||||
.filter(|pred| match pred {
|
|
||||||
WherePredicate::ForLifetime { target, bound, .. }
|
|
||||||
| WherePredicate::TypeBound { target, bound, .. } => {
|
|
||||||
match target {
|
|
||||||
WherePredicateTypeTarget::TypeRef(type_ref) => {
|
|
||||||
if ctx.lower_ty_only_param(type_ref) != Some(param_id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&WherePredicateTypeTarget::TypeOrConstParam(local_id) => {
|
|
||||||
let target_id = TypeOrConstParamId { parent: def, local_id };
|
|
||||||
if target_id != param_id {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
match &**bound {
|
|
||||||
TypeBound::ForLifetime(_, path) | TypeBound::Path(path, _) => {
|
|
||||||
// Only lower the bound if the trait could possibly define the associated
|
|
||||||
// type we're looking for.
|
|
||||||
|
|
||||||
let assoc_name = match &assoc_name {
|
|
||||||
Some(it) => it,
|
|
||||||
None => return true,
|
|
||||||
};
|
|
||||||
let tr = match resolver.resolve_path_in_type_ns_fully(db.upcast(), path) {
|
|
||||||
Some(TypeNs::TraitId(tr)) => tr,
|
|
||||||
_ => return false,
|
|
||||||
};
|
|
||||||
|
|
||||||
all_super_traits(db.upcast(), tr).iter().any(|tr| {
|
|
||||||
db.trait_data(*tr).items.iter().any(|(name, item)| {
|
|
||||||
matches!(item, AssocItemId::TypeAliasId(_)) && name == assoc_name
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
TypeBound::Lifetime(_) | TypeBound::Error => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WherePredicate::Lifetime { .. } => false,
|
|
||||||
})
|
|
||||||
.flat_map(|pred| {
|
.flat_map(|pred| {
|
||||||
ctx.lower_where_predicate(pred, true).map(|p| make_binders(db, &generics, p))
|
ctx.lower_where_predicate(pred, true).map(|p| make_binders(db, &generics, p))
|
||||||
})
|
})
|
||||||
|
@ -1519,7 +1518,12 @@ pub(crate) fn trait_environment_query(
|
||||||
|
|
||||||
let env = chalk_ir::Environment::new(Interner).add_clauses(Interner, clauses);
|
let env = chalk_ir::Environment::new(Interner).add_clauses(Interner, clauses);
|
||||||
|
|
||||||
Arc::new(TraitEnvironment { krate, block: None, traits_from_clauses: traits_in_scope, env })
|
Arc::new(TraitEnvironment {
|
||||||
|
krate,
|
||||||
|
block: None,
|
||||||
|
traits_from_clauses: traits_in_scope.into_boxed_slice(),
|
||||||
|
env,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve the where clause(s) of an item with generics.
|
/// Resolve the where clause(s) of an item with generics.
|
||||||
|
|
|
@ -4439,42 +4439,42 @@ fn test(v: S<i32>) {
|
||||||
fn associated_type_in_argument() {
|
fn associated_type_in_argument() {
|
||||||
check(
|
check(
|
||||||
r#"
|
r#"
|
||||||
trait A {
|
trait A {
|
||||||
fn m(&self) -> i32;
|
fn m(&self) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn x<T: B>(k: &<T as B>::Ty) {
|
fn x<T: B>(k: &<T as B>::Ty) {
|
||||||
k.m();
|
k.m();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct X;
|
struct X;
|
||||||
struct Y;
|
struct Y;
|
||||||
|
|
||||||
impl A for X {
|
impl A for X {
|
||||||
fn m(&self) -> i32 {
|
fn m(&self) -> i32 {
|
||||||
8
|
8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl A for Y {
|
impl A for Y {
|
||||||
fn m(&self) -> i32 {
|
fn m(&self) -> i32 {
|
||||||
32
|
32
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait B {
|
trait B {
|
||||||
type Ty: A;
|
type Ty: A;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl B for u16 {
|
impl B for u16 {
|
||||||
type Ty = X;
|
type Ty = X;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ttt() {
|
fn ttt() {
|
||||||
let inp = Y;
|
let inp = Y;
|
||||||
x::<u16>(&inp);
|
x::<u16>(&inp);
|
||||||
//^^^^ expected &X, got &Y
|
//^^^^ expected &X, got &Y
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub struct TraitEnvironment {
|
||||||
pub krate: CrateId,
|
pub krate: CrateId,
|
||||||
pub block: Option<BlockId>,
|
pub block: Option<BlockId>,
|
||||||
// FIXME make this a BTreeMap
|
// FIXME make this a BTreeMap
|
||||||
pub(crate) traits_from_clauses: Vec<(Ty, TraitId)>,
|
pub(crate) traits_from_clauses: Box<[(Ty, TraitId)]>,
|
||||||
pub env: chalk_ir::Environment<Interner>,
|
pub env: chalk_ir::Environment<Interner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ impl TraitEnvironment {
|
||||||
TraitEnvironment {
|
TraitEnvironment {
|
||||||
krate,
|
krate,
|
||||||
block: None,
|
block: None,
|
||||||
traits_from_clauses: Vec::new(),
|
traits_from_clauses: Box::default(),
|
||||||
env: chalk_ir::Environment::new(Interner),
|
env: chalk_ir::Environment::new(Interner),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ impl HirDisplay for TypeAlias {
|
||||||
write_where_clause(def_id, f)?;
|
write_where_clause(def_id, f)?;
|
||||||
if !data.bounds.is_empty() {
|
if !data.bounds.is_empty() {
|
||||||
f.write_str(": ")?;
|
f.write_str(": ")?;
|
||||||
f.write_joined(&data.bounds, " + ")?;
|
f.write_joined(data.bounds.iter(), " + ")?;
|
||||||
}
|
}
|
||||||
if let Some(ty) = &data.type_ref {
|
if let Some(ty) = &data.type_ref {
|
||||||
f.write_str(" = ")?;
|
f.write_str(" = ")?;
|
||||||
|
|
|
@ -301,9 +301,9 @@ pub fn diagnostics(
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let parse = sema.parse(file_id);
|
let parse = parse.syntax_node();
|
||||||
|
|
||||||
for node in parse.syntax().descendants() {
|
for node in parse.descendants() {
|
||||||
handlers::useless_braces::useless_braces(&mut res, file_id, &node);
|
handlers::useless_braces::useless_braces(&mut res, file_id, &node);
|
||||||
handlers::field_shorthand::field_shorthand(&mut res, file_id, &node);
|
handlers::field_shorthand::field_shorthand(&mut res, file_id, &node);
|
||||||
handlers::json_is_not_rust::json_in_items(&sema, &mut res, file_id, &node, config);
|
handlers::json_is_not_rust::json_in_items(&sema, &mut res, file_id, &node, config);
|
||||||
|
@ -386,7 +386,7 @@ pub fn diagnostics(
|
||||||
|
|
||||||
handle_lint_attributes(
|
handle_lint_attributes(
|
||||||
&ctx.sema,
|
&ctx.sema,
|
||||||
parse.syntax(),
|
&parse,
|
||||||
&mut rustc_stack,
|
&mut rustc_stack,
|
||||||
&mut clippy_stack,
|
&mut clippy_stack,
|
||||||
&mut diagnostics_of_range,
|
&mut diagnostics_of_range,
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
//! panic: fmt
|
//! panic: fmt
|
||||||
//! phantom_data:
|
//! phantom_data:
|
||||||
//! pin:
|
//! pin:
|
||||||
//! pointee:
|
//! pointee: copy, send, sync, ord, hash, unpin
|
||||||
//! range:
|
//! range:
|
||||||
//! result:
|
//! result:
|
||||||
//! send: sized
|
//! send: sized
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
//! sync: sized
|
//! sync: sized
|
||||||
//! transmute:
|
//! transmute:
|
||||||
//! try: infallible
|
//! try: infallible
|
||||||
|
//! unpin: sized
|
||||||
//! unsize: sized
|
//! unsize: sized
|
||||||
|
|
||||||
#![rustc_coherence_is_core]
|
#![rustc_coherence_is_core]
|
||||||
|
@ -89,6 +90,11 @@ pub mod marker {
|
||||||
pub trait Unsize<T: ?Sized> {}
|
pub trait Unsize<T: ?Sized> {}
|
||||||
// endregion:unsize
|
// endregion:unsize
|
||||||
|
|
||||||
|
// region:unpin
|
||||||
|
#[lang = "unpin"]
|
||||||
|
pub auto trait Unpin {}
|
||||||
|
// endregion:unpin
|
||||||
|
|
||||||
// region:copy
|
// region:copy
|
||||||
#[lang = "copy"]
|
#[lang = "copy"]
|
||||||
pub trait Copy: Clone {}
|
pub trait Copy: Clone {}
|
||||||
|
@ -387,9 +393,10 @@ pub mod ptr {
|
||||||
|
|
||||||
// region:pointee
|
// region:pointee
|
||||||
#[lang = "pointee_trait"]
|
#[lang = "pointee_trait"]
|
||||||
|
#[rustc_deny_explicit_impl(implement_via_object = false)]
|
||||||
pub trait Pointee {
|
pub trait Pointee {
|
||||||
#[lang = "metadata_type"]
|
#[lang = "metadata_type"]
|
||||||
type Metadata;
|
type Metadata: Copy + Send + Sync + Ord + Hash + Unpin;
|
||||||
}
|
}
|
||||||
// endregion:pointee
|
// endregion:pointee
|
||||||
// region:non_null
|
// region:non_null
|
||||||
|
|
Loading…
Reference in a new issue