introduce CoercePointeeWellformed for coherence checks at typeck stage
This commit is contained in:
parent
43ca9d18e3
commit
de405dcb8f
15 changed files with 337 additions and 36 deletions
|
@ -1,7 +1,8 @@
|
|||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::util::literal;
|
||||
use rustc_ast::{
|
||||
self as ast, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp, attr, token,
|
||||
self as ast, AnonConst, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp,
|
||||
attr, token,
|
||||
};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym};
|
||||
|
@ -138,6 +139,42 @@ impl<'a> ExtCtxt<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn lifetime_param(
|
||||
&self,
|
||||
span: Span,
|
||||
ident: Ident,
|
||||
bounds: ast::GenericBounds,
|
||||
) -> ast::GenericParam {
|
||||
ast::GenericParam {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
ident: ident.with_span_pos(span),
|
||||
attrs: AttrVec::new(),
|
||||
bounds,
|
||||
is_placeholder: false,
|
||||
kind: ast::GenericParamKind::Lifetime,
|
||||
colon_span: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn const_param(
|
||||
&self,
|
||||
span: Span,
|
||||
ident: Ident,
|
||||
bounds: ast::GenericBounds,
|
||||
ty: P<ast::Ty>,
|
||||
default: Option<AnonConst>,
|
||||
) -> ast::GenericParam {
|
||||
ast::GenericParam {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
ident: ident.with_span_pos(span),
|
||||
attrs: AttrVec::new(),
|
||||
bounds,
|
||||
is_placeholder: false,
|
||||
kind: ast::GenericParamKind::Const { ty, kw_span: DUMMY_SP, default },
|
||||
colon_span: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trait_ref(&self, path: ast::Path) -> ast::TraitRef {
|
||||
ast::TraitRef { path, ref_id: ast::DUMMY_NODE_ID }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue