Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename libsyntax to librustc_ast #69592

Merged
merged 3 commits into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 43 additions & 43 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ impl Step for Src {
"src/tools/rustc-std-workspace-alloc",
"src/tools/rustc-std-workspace-std",
"src/librustc",
"src/libsyntax",
"src/librustc_ast",
Comment on lines 998 to +999
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why these are included here, is this left over from when src/libproc_macro had a dependency on these two crates? If so, we've shipping a lot of pointless rustc source code for a while now.

cc @Mark-Simulacrum @dtolnay

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were added by #58269 to fix #58268

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, but why these crates specifically? #58268 doesn't explain why those vs the entire source distribution (which is still available.. somehow, right?)

Copy link
Member

@RalfJung RalfJung Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My best guess: intellij-rust/intellij-rust#2623 (referenced by that issue) mentions compiler plugins.

I don't think the entire source distribution is otherwise available as a rustup component.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this list is probably missing a couple crates in terms of plugin development and nobody brought this up, maybe it's time to remove them. I'll bring this up on the existing issue.

];

copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src);
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-ux-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ for details on how to format and write long error codes.
* All of them are accessible [online](http://doc.rust-lang.org/error-index.html),
which are auto-generated from rustc source code in different places:
[librustc](https://github.com/rust-lang/rust/blob/master/src/librustc/error_codes.rs),
[libsyntax](https://github.com/rust-lang/rust/blob/master/src/libsyntax/error_codes.rs),
[librustc_ast](https://github.com/rust-lang/rust/blob/master/src/librustc_ast/error_codes.rs),
[librustc_borrowck](https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/error_codes.rs),
[librustc_metadata](https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/error_codes.rs),
[librustc_mir](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/error_codes.rs),
Expand Down
6 changes: 3 additions & 3 deletions src/doc/unstable-book/src/language-features/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mechanics of defining and loading a plugin.

In the vast majority of cases, a plugin should *only* be used through
`#![plugin]` and not through an `extern crate` item. Linking a plugin would
pull in all of libsyntax and librustc as dependencies of your crate. This is
pull in all of librustc_ast and librustc as dependencies of your crate. This is
generally unwanted unless you are building another plugin.

The usual practice is to put compiler plugins in their own crate, separate from
Expand All @@ -42,7 +42,7 @@ that warns about any item named `lintme`.
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]

extern crate syntax;
extern crate rustc_ast;

// Load rustc as a plugin to get macros
#[macro_use]
Expand All @@ -52,7 +52,7 @@ extern crate rustc_driver;
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
EarlyLintPassObject, LintArray};
use rustc_driver::plugin::Registry;
use syntax::ast;
use rustc_ast::ast;

declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_index = { path = "../librustc_index" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
syntax = { path = "../libsyntax" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
backtrace = "0.3.40"
parking_lot = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ macro_rules! arena_types {
// HIR types
[few] hir_krate: rustc_hir::Crate<$tcx>,
[] arm: rustc_hir::Arm<$tcx>,
[] attribute: syntax::ast::Attribute,
[] attribute: rustc_ast::ast::Attribute,
[] block: rustc_hir::Block<$tcx>,
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
[few] global_asm: rustc_hir::GlobalAsm,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use crate::ty::TyCtxt;

use rustc_ast::ast::NodeId;
use rustc_hir::def_id::DefId;
use rustc_hir::BodyId;
use syntax::ast::NodeId;

/// The `DepGraphSafe` trait is used to specify what kinds of values
/// are safe to "leak" into a task. The idea is that this should be
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/exports.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::ty;

use rustc_ast::ast;
use rustc_hir::def::Res;
use rustc_hir::def_id::DefIdMap;
use rustc_macros::HashStable;
use rustc_span::Span;
use syntax::ast;

use std::fmt::Debug;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
//! for the `Code` associated with a particular NodeId.

use crate::hir::map::Map;
use rustc_ast::ast::{Attribute, Ident};
use rustc_hir as hir;
use rustc_hir::intravisit::FnKind;
use rustc_hir::{Expr, FnDecl, Node};
use rustc_span::Span;
use syntax::ast::{Attribute, Ident};

/// An FnLikeNode is a Node that is like a fn, in that it has a decl
/// and a body (as well as a NodeId, a span, etc).
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::hir::map::definitions::{self, DefPathHash};
use crate::hir::map::{Entry, HirEntryMap, Map};
use crate::ich::StableHashingContext;
use crate::middle::cstore::CrateStore;
use rustc_ast::ast::NodeId;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
Expand All @@ -16,7 +17,6 @@ use rustc_index::vec::IndexVec;
use rustc_session::{CrateDisambiguator, Session};
use rustc_span::source_map::SourceMap;
use rustc_span::{Span, Symbol, DUMMY_SP};
use syntax::ast::NodeId;

use std::iter::repeat;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! There are also some rather random cases (like const initializer
//! expressions) that are mostly just leftovers.

use rustc_ast::ast;
use rustc_ast::node_id::NodeMap;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::StableHasher;
Expand All @@ -14,8 +16,6 @@ use rustc_session::CrateDisambiguator;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use syntax::ast;
use syntax::node_id::NodeMap;

use std::borrow::Borrow;
use std::fmt::Write;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub use self::definitions::{
use crate::dep_graph::{DepGraph, DepKind, DepNode, DepNodeIndex};
use crate::middle::cstore::CrateStoreDyn;
use crate::ty::query::Providers;
use rustc_ast::ast::{self, Name, NodeId};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_hir::def::{DefKind, Res};
Expand All @@ -20,7 +21,6 @@ use rustc_span::source_map::Spanned;
use rustc_span::symbol::kw;
use rustc_span::Span;
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, Name, NodeId};

pub mod blocks;
mod collector;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::middle::cstore::CrateStore;
use crate::session::Session;
use crate::ty::{fast_reject, TyCtxt};

use rustc_ast::ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use rustc_data_structures::sync::Lrc;
Expand All @@ -13,7 +14,6 @@ use rustc_hir::def_id::{DefId, DefIndex};
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, SourceFile};
use syntax::ast;

use smallvec::SmallVec;
use std::cmp::Ord;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! This module contains `HashStable` implementations for various data types
//! from libsyntax in no particular order.
//! from librustc_ast in no particular order.

use crate::ich::StableHashingContext;

use rustc_ast::ast;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
use rustc_span::SourceFile;
use syntax::ast;

use smallvec::SmallVec;

Expand Down Expand Up @@ -35,7 +35,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
}
}

impl<'ctx> syntax::HashStableContext for StableHashingContext<'ctx> {
impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> {
fn hash_attr(&mut self, attr: &ast::Attribute, hasher: &mut StableHasher) {
// Make sure that these have been filtered out.
debug_assert!(!attr.ident().map_or(false, |ident| self.is_ignored_attr(ident.name)));
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use crate::session::search_paths::PathKind;
use crate::session::CrateDisambiguator;
use crate::ty::TyCtxt;

use rustc_ast::ast;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{self, MetadataRef};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
Expand All @@ -17,8 +19,6 @@ use rustc_span::Span;
use rustc_target::spec::Target;
use std::any::Any;
use std::path::{Path, PathBuf};
use syntax::ast;
use syntax::expand::allocator::AllocatorKind;

pub use self::NativeLibraryKind::*;
pub use rustc_session::utils::NativeLibraryKind;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/recursion_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use crate::session::Session;
use core::num::IntErrorKind;
use rustc::bug;
use rustc_ast::ast;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast;

use rustc_data_structures::sync::Once;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub use self::StabilityLevel::*;

use crate::session::{DiagnosticMessageId, Session};
use crate::ty::{self, TyCtxt};
use rustc_ast::ast::CRATE_NODE_ID;
use rustc_attr::{self as attr, ConstStability, Deprecation, RustcDeprecation, Stability};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{Applicability, DiagnosticBuilder};
Expand All @@ -18,7 +19,6 @@ use rustc_session::lint::{BuiltinLintDiagnostics, Lint, LintBuffer};
use rustc_session::parse::feature_err_issue;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span};
use syntax::ast::CRATE_NODE_ID;

use std::num::NonZeroU32;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use super::{

use crate::ty::layout::{Align, Size};

use rustc_ast::ast::Mutability;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_target::abi::HasDataLayout;
use std::borrow::Cow;
use std::iter;
use std::ops::{Deref, DerefMut, Range};
use syntax::ast::Mutability;

// NOTE: When adding new fields, make sure to adjust the `Snapshot` impl in
// `src/librustc_mir/interpret/snapshot.rs`.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ use crate::ty::layout::{self, Size};
use crate::ty::subst::GenericArgKind;
use crate::ty::{self, Instance, Ty, TyCtxt};
use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
use rustc_ast::ast::LitKind;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::{HashMapExt, Lock};
use rustc_data_structures::tiny_list::TinyList;
Expand All @@ -117,7 +118,6 @@ use std::fmt;
use std::io;
use std::num::NonZeroU32;
use std::sync::atomic::{AtomicU32, Ordering};
use syntax::ast::LitKind;

/// Uniquely identifies one of the following:
/// - A constant
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use rustc_hir::def_id::DefId;
use rustc_hir::{self, GeneratorKind};

use polonius_engine::Atom;
pub use rustc_ast::ast::Mutability;
use rustc_ast::ast::Name;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_data_structures::graph::{self, GraphSuccessors};
Expand All @@ -32,8 +34,6 @@ use std::fmt::{self, Debug, Display, Formatter, Write};
use std::ops::Index;
use std::slice;
use std::{iter, mem, option, u32};
pub use syntax::ast::Mutability;
use syntax::ast::Name;

pub use self::cache::{BodyAndCache, ReadOnlyBodyAndCache};
pub use self::query::*;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use crate::ty::fold::{TypeFolder, TypeVisitor};
use crate::ty::subst::SubstsRef;
use crate::ty::{self, AdtKind, List, Ty, TyCtxt};

use rustc_ast::ast;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_span::{Span, DUMMY_SP};
use smallvec::SmallVec;
use syntax::ast;

use std::borrow::Cow;
use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/specialization_graph.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::ich::{self, StableHashingContext};
use crate::ty::fast_reject::SimplifiedType;
use crate::ty::{self, TyCtxt};
use rustc_ast::ast::Ident;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::{DefId, DefIdMap};
use syntax::ast::Ident;

/// A per-trait graph of impls in specialization order. At the moment, this
/// graph forms a tree rooted with the trait itself, with all other nodes
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use crate::ty::{self, Ty};

use rustc_ast::ast;
use rustc_macros::HashStable;
use syntax::ast;

/// Types that are represented as ints.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ use crate::ty::{InferConst, ParamConst};
use crate::ty::{List, TyKind, TyS};
use crate::util::common::ErrorReported;
use rustc::lint::LintDiagnosticBuilder;
use rustc_ast::ast;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_ast::node_id::NodeMap;
use rustc_attr as attr;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::profiling::SelfProfilerRef;
Expand All @@ -65,9 +68,6 @@ use rustc_span::source_map::MultiSpan;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
use rustc_target::spec::abi;
use syntax::ast;
use syntax::expand::allocator::AllocatorKind;
use syntax::node_id::NodeMap;

use smallvec::SmallVec;
use std::any::Any;
Expand Down Expand Up @@ -1720,7 +1720,7 @@ pub mod tls {
set_tlv(context as *const _ as usize, || f(&context))
}

/// Enters `GlobalCtxt` by setting up libsyntax callbacks and
/// Enters `GlobalCtxt` by setting up librustc_ast callbacks and
/// creating a initial `TyCtxt` and `ImplicitCtxt`.
/// This happens once per rustc session and `TyCtxt`s only exists
/// inside the `f` function.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/error.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt};
use rustc_ast::ast;
use rustc_errors::{pluralize, Applicability, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_span::Span;
use rustc_target::spec::abi;
use syntax::ast;

use std::borrow::Cow;
use std::fmt;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/fast_reject.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::ich::StableHashingContext;
use crate::ty::{self, Ty, TyCtxt};
use rustc_ast::ast;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::DefId;
use std::fmt::Debug;
use std::hash::Hash;
use std::mem;
use syntax::ast;

use self::SimplifiedTypeGen::*;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::session::{self, DataTypeKind};
use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable};

use rustc_ast::ast::{self, Ident, IntTy, UintTy};
use rustc_attr as attr;
use rustc_span::DUMMY_SP;
use syntax::ast::{self, Ident, IntTy, UintTy};

use std::cmp;
use std::fmt;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use crate::ty::layout::VariantIdx;
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
use crate::ty::util::{Discr, IntTypeExt};
use crate::ty::walk::TypeWalker;
use rustc_ast::ast::{self, Ident, Name};
use rustc_ast::node_id::{NodeId, NodeMap, NodeSet};
use rustc_attr as attr;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashMap;
Expand All @@ -44,8 +46,6 @@ use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
use rustc_target::abi::Align;
use syntax::ast::{self, Ident, Name};
use syntax::node_id::{NodeId, NodeMap, NodeSet};

use std::cell::RefCell;
use std::cmp::{self, Ordering};
Expand Down
Loading