Skip to content

Commit ab38d52

Browse files
authored
Auto merge of #36885 - Manishearth:rollup, r=Manishearth
Rollup of 6 pull requests - Successful merges: #36865, #36872, #36873, #36877, #36880, #36882 - Failed merges:
2 parents df9fa1a + 8457ab6 commit ab38d52

File tree

16 files changed

+150
-88
lines changed

16 files changed

+150
-88
lines changed

Diff for: src/libcore/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,11 @@ floating! { f64 }
15661566
// Implementation of Display/Debug for various core types
15671567

15681568
#[stable(feature = "rust1", since = "1.0.0")]
1569-
impl<T> Debug for *const T {
1569+
impl<T: ?Sized> Debug for *const T {
15701570
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15711571
}
15721572
#[stable(feature = "rust1", since = "1.0.0")]
1573-
impl<T> Debug for *mut T {
1573+
impl<T: ?Sized> Debug for *mut T {
15741574
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
15751575
}
15761576

Diff for: src/librustc_back/target/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ supported_targets! {
168168
("x86_64-unknown-netbsd", x86_64_unknown_netbsd),
169169
("x86_64-rumprun-netbsd", x86_64_rumprun_netbsd),
170170

171-
("i686_unknown_haiku", i686_unknown_haiku),
172-
("x86_64_unknown_haiku", x86_64_unknown_haiku),
171+
("i686-unknown-haiku", i686_unknown_haiku),
172+
("x86_64-unknown-haiku", x86_64_unknown_haiku),
173173

174174
("x86_64-apple-darwin", x86_64_apple_darwin),
175175
("i686-apple-darwin", i686_apple_darwin),

Diff for: src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
12881288
let link_meta = self.link_meta;
12891289
let is_rustc_macro = tcx.sess.crate_types.borrow().contains(&CrateTypeRustcMacro);
12901290
let root = self.lazy(&CrateRoot {
1291-
rustc_version: RUSTC_VERSION.to_string(),
1291+
rustc_version: rustc_version(),
12921292
name: link_meta.crate_name.clone(),
12931293
triple: tcx.sess.opts.target_triple.clone(),
12941294
hash: link_meta.crate_hash,

Diff for: src/librustc_metadata/loader.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
//! metadata::loader or metadata::creader for all the juicy details!
214214
215215
use cstore::MetadataBlob;
216-
use schema::{METADATA_HEADER, RUSTC_VERSION};
216+
use schema::{METADATA_HEADER, rustc_version};
217217

218218
use rustc::hir::svh::Svh;
219219
use rustc::session::Session;
@@ -382,7 +382,7 @@ impl<'a> Context<'a> {
382382
}
383383
if !self.rejected_via_version.is_empty() {
384384
err.help(&format!("please recompile that crate using this compiler ({})",
385-
RUSTC_VERSION));
385+
rustc_version()));
386386
let mismatches = self.rejected_via_version.iter();
387387
for (i, &CrateMismatch { ref path, ref got }) in mismatches.enumerate() {
388388
err.note(&format!("crate `{}` path #{}: {} compiled by {:?}",
@@ -597,9 +597,10 @@ impl<'a> Context<'a> {
597597

598598
fn crate_matches(&mut self, metadata: &MetadataBlob, libpath: &Path) -> Option<Svh> {
599599
let root = metadata.get_root();
600-
if root.rustc_version != RUSTC_VERSION {
600+
let rustc_version = rustc_version();
601+
if root.rustc_version != rustc_version {
601602
info!("Rejecting via version: expected {} got {}",
602-
RUSTC_VERSION, root.rustc_version);
603+
rustc_version, root.rustc_version);
603604
self.rejected_via_version.push(CrateMismatch {
604605
path: libpath.to_path_buf(),
605606
got: root.rustc_version

Diff for: src/librustc_metadata/schema.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ use syntax_pos::{self, Span};
2626

2727
use std::marker::PhantomData;
2828

29-
#[cfg(not(test))]
30-
pub const RUSTC_VERSION: &'static str = concat!("rustc ", env!("CFG_VERSION"));
31-
32-
#[cfg(test)]
33-
pub const RUSTC_VERSION: &'static str = "rustc 0.0.0-unit-test";
29+
pub fn rustc_version() -> String {
30+
format!("rustc {}", option_env!("CFG_VERSION").unwrap_or("unknown version"))
31+
}
3432

3533
/// Metadata encoding version.
3634
/// NB: increment this if you change the format of metadata such that

Diff for: src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3534,7 +3534,7 @@ fn module_to_string(module: Module) -> String {
35343534
} else {
35353535
// danger, shouldn't be ident?
35363536
names.push(token::intern("<opaque>"));
3537-
collect_mod(names, module);
3537+
collect_mod(names, module.parent.unwrap());
35383538
}
35393539
}
35403540
collect_mod(&mut names, module);

Diff for: src/librustc_typeck/check/method/confirm.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,25 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
312312

313313
if num_supplied_types > 0 && num_supplied_types != num_method_types {
314314
if num_method_types == 0 {
315-
span_err!(self.tcx.sess, self.span, E0035,
316-
"does not take type parameters");
315+
struct_span_err!(self.tcx.sess, self.span, E0035,
316+
"does not take type parameters")
317+
.span_label(self.span, &"called with unneeded type parameters")
318+
.emit();
317319
} else {
318-
span_err!(self.tcx.sess, self.span, E0036,
320+
struct_span_err!(self.tcx.sess, self.span, E0036,
319321
"incorrect number of type parameters given for this method: \
320322
expected {}, found {}",
321-
num_method_types, num_supplied_types);
323+
num_method_types, num_supplied_types)
324+
.span_label(self.span,
325+
&format!("Passed {} type argument{}, expected {}",
326+
num_supplied_types,
327+
if num_supplied_types != 1 {
328+
"s"
329+
} else {
330+
""
331+
},
332+
num_method_types))
333+
.emit();
322334
}
323335
supplied_method_types = vec![self.tcx.types.err; num_method_types];
324336
}

Diff for: src/librustc_typeck/collect.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1164,10 +1164,12 @@ fn convert_enum_def<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
11641164
} else if let Some(disr) = repr_type.disr_incr(tcx, prev_disr) {
11651165
Some(disr)
11661166
} else {
1167-
span_err!(tcx.sess, v.span, E0370,
1168-
"enum discriminant overflowed on value after {}; \
1169-
set explicitly via {} = {} if that is desired outcome",
1170-
prev_disr.unwrap(), v.node.name, wrapped_disr);
1167+
struct_span_err!(tcx.sess, v.span, E0370,
1168+
"enum discriminant overflowed")
1169+
.span_label(v.span, &format!("overflowed on value after {}", prev_disr.unwrap()))
1170+
.note(&format!("explicitly set `{} = {}` if that is desired outcome",
1171+
v.node.name, wrapped_disr))
1172+
.emit();
11711173
None
11721174
}.unwrap_or(wrapped_disr);
11731175
prev_disr = Some(disr);

Diff for: src/librustdoc/clean/mod.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -283,34 +283,34 @@ impl Item {
283283
}
284284
}
285285
pub fn is_mod(&self) -> bool {
286-
ItemType::from(self) == ItemType::Module
286+
self.type_() == ItemType::Module
287287
}
288288
pub fn is_trait(&self) -> bool {
289-
ItemType::from(self) == ItemType::Trait
289+
self.type_() == ItemType::Trait
290290
}
291291
pub fn is_struct(&self) -> bool {
292-
ItemType::from(self) == ItemType::Struct
292+
self.type_() == ItemType::Struct
293293
}
294294
pub fn is_enum(&self) -> bool {
295-
ItemType::from(self) == ItemType::Module
295+
self.type_() == ItemType::Module
296296
}
297297
pub fn is_fn(&self) -> bool {
298-
ItemType::from(self) == ItemType::Function
298+
self.type_() == ItemType::Function
299299
}
300300
pub fn is_associated_type(&self) -> bool {
301-
ItemType::from(self) == ItemType::AssociatedType
301+
self.type_() == ItemType::AssociatedType
302302
}
303303
pub fn is_associated_const(&self) -> bool {
304-
ItemType::from(self) == ItemType::AssociatedConst
304+
self.type_() == ItemType::AssociatedConst
305305
}
306306
pub fn is_method(&self) -> bool {
307-
ItemType::from(self) == ItemType::Method
307+
self.type_() == ItemType::Method
308308
}
309309
pub fn is_ty_method(&self) -> bool {
310-
ItemType::from(self) == ItemType::TyMethod
310+
self.type_() == ItemType::TyMethod
311311
}
312312
pub fn is_primitive(&self) -> bool {
313-
ItemType::from(self) == ItemType::Primitive
313+
self.type_() == ItemType::Primitive
314314
}
315315
pub fn is_stripped(&self) -> bool {
316316
match self.inner { StrippedItem(..) => true, _ => false }
@@ -342,6 +342,11 @@ impl Item {
342342
pub fn stable_since(&self) -> Option<&str> {
343343
self.stability.as_ref().map(|s| &s.since[..])
344344
}
345+
346+
/// Returns a documentation-level item type from the item.
347+
pub fn type_(&self) -> ItemType {
348+
ItemType::from(self)
349+
}
345350
}
346351

347352
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]

0 commit comments

Comments
 (0)