Skip to content

Commit f73f675

Browse files
committed
Auto merge of #42494 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests - Successful merges: #42409, #42415, #42429, #42438, #42466, #42469, #42485 - Failed merges:
2 parents 21d0f91 + 24f48d0 commit f73f675

File tree

15 files changed

+149
-123
lines changed

15 files changed

+149
-123
lines changed

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ pub fn docs(build: &Build, compiler: &Compiler) {
338338
continue
339339
}
340340

341-
println!("doc tests for: {}", p.display());
342341
markdown_test(build, compiler, &p);
343342
}
344343
}
@@ -375,6 +374,7 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
375374
return;
376375
}
377376

377+
println!("doc tests for: {}", markdown.display());
378378
let mut cmd = Command::new(build.rustdoc(compiler));
379379
build.add_rustc_lib_path(compiler, &mut cmd);
380380
build.add_rust_test_threads(&mut cmd);

src/bootstrap/compile.rs

+4
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
276276
if build.is_rust_llvm(target) {
277277
cargo.env("LLVM_RUSTLLVM", "1");
278278
}
279+
if let Some(ref cfg_file) = build.flags.config {
280+
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
281+
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
282+
}
279283
cargo.env("LLVM_CONFIG", build.llvm_config(target));
280284
let target_config = build.config.target_config.get(target);
281285
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {

src/libcore/macros.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ macro_rules! panic {
3535
/// This will invoke the [`panic!`] macro if the provided expression cannot be
3636
/// evaluated to `true` at runtime.
3737
///
38+
/// # Uses
39+
///
3840
/// Assertions are always checked in both debug and release builds, and cannot
3941
/// be disabled. See [`debug_assert!`] for assertions that are not enabled in
4042
/// release builds by default.
@@ -45,7 +47,9 @@ macro_rules! panic {
4547
/// Other use-cases of `assert!` include [testing] and enforcing run-time
4648
/// invariants in safe code (whose violation cannot result in unsafety).
4749
///
48-
/// This macro has a second version, where a custom panic message can
50+
/// # Custom Messages
51+
///
52+
/// This macro has a second form, where a custom panic message can
4953
/// be provided with or without arguments for formatting.
5054
///
5155
/// [`panic!`]: macro.panic.html
@@ -85,14 +89,15 @@ macro_rules! assert {
8589
);
8690
}
8791

88-
/// Asserts that two expressions are equal to each other.
92+
/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
8993
///
9094
/// On panic, this macro will print the values of the expressions with their
9195
/// debug representations.
9296
///
93-
/// Like [`assert!`], this macro has a second version, where a custom
97+
/// Like [`assert!`], this macro has a second form, where a custom
9498
/// panic message can be provided.
9599
///
100+
/// [`PartialEq`]: cmp/trait.PartialEq.html
96101
/// [`assert!`]: macro.assert.html
97102
///
98103
/// # Examples
@@ -130,14 +135,15 @@ macro_rules! assert_eq {
130135
});
131136
}
132137

133-
/// Asserts that two expressions are not equal to each other.
138+
/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
134139
///
135140
/// On panic, this macro will print the values of the expressions with their
136141
/// debug representations.
137142
///
138-
/// Like `assert!()`, this macro has a second version, where a custom
143+
/// Like [`assert!`], this macro has a second form, where a custom
139144
/// panic message can be provided.
140145
///
146+
/// [`PartialEq`]: cmp/trait.PartialEq.html
141147
/// [`assert!`]: macro.assert.html
142148
///
143149
/// # Examples
@@ -183,6 +189,8 @@ macro_rules! assert_ne {
183189
/// Like [`assert!`], this macro also has a second version, where a custom panic
184190
/// message can be provided.
185191
///
192+
/// # Uses
193+
///
186194
/// Unlike [`assert!`], `debug_assert!` statements are only enabled in non
187195
/// optimized builds by default. An optimized build will omit all
188196
/// `debug_assert!` statements unless `-C debug-assertions` is passed to the

src/libcore/marker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub trait Unsize<T: ?Sized> {
205205
/// but not `Copy`.
206206
///
207207
/// [`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
208-
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation need only return `*self`
208+
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`
209209
/// (see the example above).
210210
///
211211
/// ## When can my type be `Copy`?

src/librustc/hir/def.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use hir;
1717

1818
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
1919
pub enum CtorKind {
20-
// Constructor function automatically created by a tuple struct/variant.
20+
/// Constructor function automatically created by a tuple struct/variant.
2121
Fn,
22-
// Constructor constant automatically created by a unit struct/variant.
22+
/// Constructor constant automatically created by a unit struct/variant.
2323
Const,
24-
// Unusable name in value namespace created by a struct variant.
24+
/// Unusable name in value namespace created by a struct variant.
2525
Fictive,
2626
}
2727

@@ -109,17 +109,21 @@ impl PathResolution {
109109
}
110110
}
111111

112-
// Definition mapping
112+
/// Definition mapping
113113
pub type DefMap = NodeMap<PathResolution>;
114-
// This is the replacement export map. It maps a module to all of the exports
115-
// within.
114+
115+
/// This is the replacement export map. It maps a module to all of the exports
116+
/// within.
116117
pub type ExportMap = NodeMap<Vec<Export>>;
117118

118119
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
119120
pub struct Export {
120-
pub ident: ast::Ident, // The name of the target.
121-
pub def: Def, // The definition of the target.
122-
pub span: Span, // The span of the target definition.
121+
/// The name of the target.
122+
pub ident: ast::Ident,
123+
/// The definition of the target.
124+
pub def: Def,
125+
/// The span of the target definition.
126+
pub span: Span,
123127
}
124128

125129
impl CtorKind {
@@ -160,6 +164,7 @@ impl Def {
160164
}
161165
}
162166

167+
/// A human readable kind name
163168
pub fn kind_name(&self) -> &'static str {
164169
match *self {
165170
Def::Fn(..) => "function",

src/librustc/hir/def_id.rs

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ impl fmt::Debug for DefId {
187187

188188

189189
impl DefId {
190+
/// Make a local `DefId` with the given index.
190191
pub fn local(index: DefIndex) -> DefId {
191192
DefId { krate: LOCAL_CRATE, index: index }
192193
}

src/librustc/hir/lowering.rs

+37-35
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Lowers the AST to the HIR.
12-
//
13-
// Since the AST and HIR are fairly similar, this is mostly a simple procedure,
14-
// much like a fold. Where lowering involves a bit more work things get more
15-
// interesting and there are some invariants you should know about. These mostly
16-
// concern spans and ids.
17-
//
18-
// Spans are assigned to AST nodes during parsing and then are modified during
19-
// expansion to indicate the origin of a node and the process it went through
20-
// being expanded. Ids are assigned to AST nodes just before lowering.
21-
//
22-
// For the simpler lowering steps, ids and spans should be preserved. Unlike
23-
// expansion we do not preserve the process of lowering in the spans, so spans
24-
// should not be modified here. When creating a new node (as opposed to
25-
// 'folding' an existing one), then you create a new id using `next_id()`.
26-
//
27-
// You must ensure that ids are unique. That means that you should only use the
28-
// id from an AST node in a single HIR node (you can assume that AST node ids
29-
// are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
30-
// If you do, you must then set the new node's id to a fresh one.
31-
//
32-
// Spans are used for error messages and for tools to map semantics back to
33-
// source code. It is therefore not as important with spans as ids to be strict
34-
// about use (you can't break the compiler by screwing up a span). Obviously, a
35-
// HIR node can only have a single span. But multiple nodes can have the same
36-
// span and spans don't need to be kept in order, etc. Where code is preserved
37-
// by lowering, it should have the same span as in the AST. Where HIR nodes are
38-
// new it is probably best to give a span for the whole AST node being lowered.
39-
// All nodes should have real spans, don't use dummy spans. Tools are likely to
40-
// get confused if the spans from leaf AST nodes occur in multiple places
41-
// in the HIR, especially for multiple identifiers.
11+
//! Lowers the AST to the HIR.
12+
//!
13+
//! Since the AST and HIR are fairly similar, this is mostly a simple procedure,
14+
//! much like a fold. Where lowering involves a bit more work things get more
15+
//! interesting and there are some invariants you should know about. These mostly
16+
//! concern spans and ids.
17+
//!
18+
//! Spans are assigned to AST nodes during parsing and then are modified during
19+
//! expansion to indicate the origin of a node and the process it went through
20+
//! being expanded. Ids are assigned to AST nodes just before lowering.
21+
//!
22+
//! For the simpler lowering steps, ids and spans should be preserved. Unlike
23+
//! expansion we do not preserve the process of lowering in the spans, so spans
24+
//! should not be modified here. When creating a new node (as opposed to
25+
//! 'folding' an existing one), then you create a new id using `next_id()`.
26+
//!
27+
//! You must ensure that ids are unique. That means that you should only use the
28+
//! id from an AST node in a single HIR node (you can assume that AST node ids
29+
//! are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
30+
//! If you do, you must then set the new node's id to a fresh one.
31+
//!
32+
//! Spans are used for error messages and for tools to map semantics back to
33+
//! source code. It is therefore not as important with spans as ids to be strict
34+
//! about use (you can't break the compiler by screwing up a span). Obviously, a
35+
//! HIR node can only have a single span. But multiple nodes can have the same
36+
//! span and spans don't need to be kept in order, etc. Where code is preserved
37+
//! by lowering, it should have the same span as in the AST. Where HIR nodes are
38+
//! new it is probably best to give a span for the whole AST node being lowered.
39+
//! All nodes should have real spans, don't use dummy spans. Tools are likely to
40+
//! get confused if the spans from leaf AST nodes occur in multiple places
41+
//! in the HIR, especially for multiple identifiers.
4242
4343
use hir;
4444
use hir::map::{Definitions, DefKey, REGULAR_SPACE};
@@ -70,8 +70,10 @@ const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
7070

7171
pub struct LoweringContext<'a> {
7272
crate_root: Option<&'static str>,
73+
7374
// Use to assign ids to hir nodes that do not directly correspond to an ast node
7475
sess: &'a Session,
76+
7577
// As we walk the AST we must keep track of the current 'parent' def id (in
7678
// the form of a DefIndex) so that if we create a new node which introduces
7779
// a definition, then we can properly create the def id.
@@ -102,14 +104,14 @@ pub struct LoweringContext<'a> {
102104
}
103105

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

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

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

src/librustc/infer/region_inference/graphviz.rs

-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ enum Node {
133133
Region(ty::RegionKind),
134134
}
135135

136-
// type Edge = Constraint;
137136
#[derive(Clone, PartialEq, Eq, Debug, Copy)]
138137
enum Edge<'tcx> {
139138
Constraint(Constraint<'tcx>),

0 commit comments

Comments
 (0)