Skip to content

Rollup of 7 pull requests #42494

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

Merged
merged 21 commits into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
83e106a
Better docs for librustc/hir/def.rs
bjorn3 Jun 3, 2017
8df5dfb
Add single doc comment to librustc/hir/def_id.rs
bjorn3 Jun 3, 2017
472199e
Doc comments for librustc/hir/lowering.rs
bjorn3 Jun 3, 2017
6f8426a
Remove leftover? of old code
bjorn3 Jun 3, 2017
a555d49
Add doc comments to librustc/infer/region_inference/mod.rs
bjorn3 Jun 3, 2017
7ed771f
Remove 'elided' from lifetime resolution error
stephen-lazaro Jun 3, 2017
a9c2cdc
Update def.rs
bjorn3 Jun 4, 2017
d1bdcbc
Update lowering.rs
bjorn3 Jun 4, 2017
949b2a3
Update mod.rs
bjorn3 Jun 4, 2017
40f8536
rustc_llvm: re-run build script if config.toml changes
venkatagiri Jun 4, 2017
018722e
doc rewording
king6cong Jun 5, 2017
867ed2e
Doc changes for assert macros
citizen428 Jun 5, 2017
c47df30
syntax_pos::Symbol should not implement Sync
wesleywiser Jun 6, 2017
bc8fabb
Skip printing for skipped doc tests.
Mark-Simulacrum Jun 6, 2017
e702b75
Rollup merge of #42409 - bjorn3:patch-3, r=frewsxcv
frewsxcv Jun 7, 2017
915b19d
Rollup merge of #42415 - stephen-lazaro:Issue29094, r=arielb1
frewsxcv Jun 7, 2017
b472b66
Rollup merge of #42429 - venkatagiri:llvm_config, r=alexcrichton
frewsxcv Jun 7, 2017
9e8c94c
Rollup merge of #42438 - king6cong:master, r=alexcrichton
frewsxcv Jun 7, 2017
bedead2
Rollup merge of #42466 - wesleywiser:fix_42407, r=arielb1
frewsxcv Jun 7, 2017
7f8467e
Rollup merge of #42469 - citizen428:document-assert-macros, r=stevekl…
frewsxcv Jun 7, 2017
24f48d0
Rollup merge of #42485 - Mark-Simulacrum:skip-no-doc, r=alexcrichton
frewsxcv Jun 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ pub fn docs(build: &Build, compiler: &Compiler) {
continue
}

println!("doc tests for: {}", p.display());
markdown_test(build, compiler, &p);
}
}
Expand Down Expand Up @@ -375,6 +374,7 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
return;
}

println!("doc tests for: {}", markdown.display());
let mut cmd = Command::new(build.rustdoc(compiler));
build.add_rustc_lib_path(compiler, &mut cmd);
build.add_rust_test_threads(&mut cmd);
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
if build.is_rust_llvm(target) {
cargo.env("LLVM_RUSTLLVM", "1");
}
if let Some(ref cfg_file) = build.flags.config {
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
}
cargo.env("LLVM_CONFIG", build.llvm_config(target));
let target_config = build.config.target_config.get(target);
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
Expand Down
18 changes: 13 additions & 5 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ macro_rules! panic {
/// This will invoke the [`panic!`] macro if the provided expression cannot be
/// evaluated to `true` at runtime.
///
/// # Uses
///
/// Assertions are always checked in both debug and release builds, and cannot
/// be disabled. See [`debug_assert!`] for assertions that are not enabled in
/// release builds by default.
Expand All @@ -45,7 +47,9 @@ macro_rules! panic {
/// Other use-cases of `assert!` include [testing] and enforcing run-time
/// invariants in safe code (whose violation cannot result in unsafety).
///
/// This macro has a second version, where a custom panic message can
/// # Custom Messages
///
/// This macro has a second form, where a custom panic message can
/// be provided with or without arguments for formatting.
///
/// [`panic!`]: macro.panic.html
Expand Down Expand Up @@ -85,14 +89,15 @@ macro_rules! assert {
);
}

/// Asserts that two expressions are equal to each other.
/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
///
/// On panic, this macro will print the values of the expressions with their
/// debug representations.
///
/// Like [`assert!`], this macro has a second version, where a custom
/// Like [`assert!`], this macro has a second form, where a custom
/// panic message can be provided.
///
/// [`PartialEq`]: cmp/trait.PartialEq.html
/// [`assert!`]: macro.assert.html
///
/// # Examples
Expand Down Expand Up @@ -130,14 +135,15 @@ macro_rules! assert_eq {
});
}

/// Asserts that two expressions are not equal to each other.
/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
///
/// On panic, this macro will print the values of the expressions with their
/// debug representations.
///
/// Like `assert!()`, this macro has a second version, where a custom
/// Like [`assert!`], this macro has a second form, where a custom
/// panic message can be provided.
///
/// [`PartialEq`]: cmp/trait.PartialEq.html
/// [`assert!`]: macro.assert.html
///
/// # Examples
Expand Down Expand Up @@ -183,6 +189,8 @@ macro_rules! assert_ne {
/// Like [`assert!`], this macro also has a second version, where a custom panic
/// message can be provided.
///
/// # Uses
///
/// Unlike [`assert!`], `debug_assert!` statements are only enabled in non
/// optimized builds by default. An optimized build will omit all
/// `debug_assert!` statements unless `-C debug-assertions` is passed to the
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub trait Unsize<T: ?Sized> {
/// but not `Copy`.
///
/// [`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation need only return `*self`
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`
/// (see the example above).
///
/// ## When can my type be `Copy`?
Expand Down
23 changes: 14 additions & 9 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use hir;

#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum CtorKind {
// Constructor function automatically created by a tuple struct/variant.
/// Constructor function automatically created by a tuple struct/variant.
Fn,
// Constructor constant automatically created by a unit struct/variant.
/// Constructor constant automatically created by a unit struct/variant.
Const,
// Unusable name in value namespace created by a struct variant.
/// Unusable name in value namespace created by a struct variant.
Fictive,
}

Expand Down Expand Up @@ -109,17 +109,21 @@ impl PathResolution {
}
}

// Definition mapping
/// Definition mapping
pub type DefMap = NodeMap<PathResolution>;
// This is the replacement export map. It maps a module to all of the exports
// within.

/// This is the replacement export map. It maps a module to all of the exports
/// within.
pub type ExportMap = NodeMap<Vec<Export>>;

#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
pub struct Export {
pub ident: ast::Ident, // The name of the target.
pub def: Def, // The definition of the target.
pub span: Span, // The span of the target definition.
/// The name of the target.
pub ident: ast::Ident,
/// The definition of the target.
pub def: Def,
/// The span of the target definition.
pub span: Span,
}

impl CtorKind {
Expand Down Expand Up @@ -160,6 +164,7 @@ impl Def {
}
}

/// A human readable kind name
pub fn kind_name(&self) -> &'static str {
match *self {
Def::Fn(..) => "function",
Expand Down
1 change: 1 addition & 0 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl fmt::Debug for DefId {


impl DefId {
/// Make a local `DefId` with the given index.
pub fn local(index: DefIndex) -> DefId {
DefId { krate: LOCAL_CRATE, index: index }
}
Expand Down
72 changes: 37 additions & 35 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Lowers the AST to the HIR.
//
// Since the AST and HIR are fairly similar, this is mostly a simple procedure,
// much like a fold. Where lowering involves a bit more work things get more
// interesting and there are some invariants you should know about. These mostly
// concern spans and ids.
//
// Spans are assigned to AST nodes during parsing and then are modified during
// expansion to indicate the origin of a node and the process it went through
// being expanded. Ids are assigned to AST nodes just before lowering.
//
// For the simpler lowering steps, ids and spans should be preserved. Unlike
// expansion we do not preserve the process of lowering in the spans, so spans
// should not be modified here. When creating a new node (as opposed to
// 'folding' an existing one), then you create a new id using `next_id()`.
//
// You must ensure that ids are unique. That means that you should only use the
// id from an AST node in a single HIR node (you can assume that AST node ids
// are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
// If you do, you must then set the new node's id to a fresh one.
//
// Spans are used for error messages and for tools to map semantics back to
// source code. It is therefore not as important with spans as ids to be strict
// about use (you can't break the compiler by screwing up a span). Obviously, a
// HIR node can only have a single span. But multiple nodes can have the same
// span and spans don't need to be kept in order, etc. Where code is preserved
// by lowering, it should have the same span as in the AST. Where HIR nodes are
// new it is probably best to give a span for the whole AST node being lowered.
// All nodes should have real spans, don't use dummy spans. Tools are likely to
// get confused if the spans from leaf AST nodes occur in multiple places
// in the HIR, especially for multiple identifiers.
//! Lowers the AST to the HIR.
//!
//! Since the AST and HIR are fairly similar, this is mostly a simple procedure,
//! much like a fold. Where lowering involves a bit more work things get more
//! interesting and there are some invariants you should know about. These mostly
//! concern spans and ids.
//!
//! Spans are assigned to AST nodes during parsing and then are modified during
//! expansion to indicate the origin of a node and the process it went through
//! being expanded. Ids are assigned to AST nodes just before lowering.
//!
//! For the simpler lowering steps, ids and spans should be preserved. Unlike
//! expansion we do not preserve the process of lowering in the spans, so spans
//! should not be modified here. When creating a new node (as opposed to
//! 'folding' an existing one), then you create a new id using `next_id()`.
//!
//! You must ensure that ids are unique. That means that you should only use the
//! id from an AST node in a single HIR node (you can assume that AST node ids
//! are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
//! If you do, you must then set the new node's id to a fresh one.
//!
//! Spans are used for error messages and for tools to map semantics back to
//! source code. It is therefore not as important with spans as ids to be strict
//! about use (you can't break the compiler by screwing up a span). Obviously, a
//! HIR node can only have a single span. But multiple nodes can have the same
//! span and spans don't need to be kept in order, etc. Where code is preserved
//! by lowering, it should have the same span as in the AST. Where HIR nodes are
//! new it is probably best to give a span for the whole AST node being lowered.
//! All nodes should have real spans, don't use dummy spans. Tools are likely to
//! get confused if the spans from leaf AST nodes occur in multiple places
//! in the HIR, especially for multiple identifiers.

use hir;
use hir::map::{Definitions, DefKey, REGULAR_SPACE};
Expand Down Expand Up @@ -70,8 +70,10 @@ const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;

pub struct LoweringContext<'a> {
crate_root: Option<&'static str>,

// Use to assign ids to hir nodes that do not directly correspond to an ast node
sess: &'a Session,

// As we walk the AST we must keep track of the current 'parent' def id (in
// the form of a DefIndex) so that if we create a new node which introduces
// a definition, then we can properly create the def id.
Expand Down Expand Up @@ -102,14 +104,14 @@ pub struct LoweringContext<'a> {
}

pub trait Resolver {
// Resolve a hir path generated by the lowerer when expanding `for`, `if let`, etc.
/// Resolve a hir path generated by the lowerer when expanding `for`, `if let`, etc.
fn resolve_hir_path(&mut self, path: &mut hir::Path, is_value: bool);

// Obtain the resolution for a node id
/// Obtain the resolution for a node id
fn get_resolution(&mut self, id: NodeId) -> Option<PathResolution>;

// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
// This should only return `None` during testing.
/// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
/// This should only return `None` during testing.
fn definitions(&mut self) -> &mut Definitions;
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc/infer/region_inference/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ enum Node {
Region(ty::RegionKind),
}

// type Edge = Constraint;
#[derive(Clone, PartialEq, Eq, Debug, Copy)]
enum Edge<'tcx> {
Constraint(Constraint<'tcx>),
Expand Down
Loading