The path these notes are about is withdrawn. Nothing in the toolchain links
rustc_privateor builds arustc_ast::Crateany more: a.nikafile becomes Rust source text andrustccompiles it like any other Rust (ADR-004 D1). This page is kept as the notebook page it is — these were real findings about a real compiler, and a notebook is not edited when the experiment ends.../CHANGELOG.mdandwithdrawn-one-way-down.mdsay what happened.
Integration with rustc_private revealed specific details about the internal AST structure which differs from older versions.
rustc_ast::ItemThe Item struct does not store the identifier directly.
pub struct Item<K = ItemKind> {
pub attrs: AttrVec,
pub id: NodeId,
pub span: Span,
pub vis: Visibility,
pub kind: K, // Identifier is stored inside specific K variants (e.g. Fn)
pub tokens: Option<LazyAttrTokenStream>,
}
rustc_ast::FnThe Fn struct does store the identifier.
pub struct Fn {
pub defaultness: Defaultness,
pub ident: Ident, // <--- Name is here
pub generics: Generics,
pub sig: FnSig,
// ...
}
P<T> is widely used in the AST (Pointer to immutable data).P<T> seems to be an alias for Box<T> or compatible with it, as Box::new() is used for construction in place of P(...).rustc_ast::ptr::P failed, suggesting refactoring in the compiler source. Box works.Lit)rustc_ast::Lit is not the same as rustc_ast::token::Lit.ExprKind::Lit takes rustc_ast::token::Lit.LitKind::Int(u128_val.into(), LitIntType::Signed(IntTy::I64))
MacArgs is replaced/used in conjunction with DelimArgs.MacCall uses Box<DelimArgs>.rustc_driver requires feature(rustc_private).rustc_driver often fails with “cannot satisfy dependencies so std only shows up once” unless compiled with RUSTFLAGS="-C prefer-dynamic".