Skip to content

Commit 4ac1ab7

Browse files
committed
---
yaml --- r: 275927 b: refs/heads/master c: 2b71219 h: refs/heads/master i: 275925: 09ac66a 275923: 05f5151 275919: 514f7e8
1 parent 90aed4d commit 4ac1ab7

File tree

33 files changed

+103
-370
lines changed

33 files changed

+103
-370
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 03bef4c43b2f51df6bfd558b57b492cb821dd5ec
2+
refs/heads/master: 2b71219a618a8c9ad65cdcf008c2a1c6377eb1cd
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
623623
--lldb-python $$(CFG_LLDB_PYTHON) \
624624
--gdb-version="$(CFG_GDB_VERSION)" \
625625
--lldb-version="$(CFG_LLDB_VERSION)" \
626-
--android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \
626+
--android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
627627
--adb-path=$(CFG_ADB) \
628628
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
629629
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \

trunk/src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl RegionMaps {
389389
// but this isn't the only place
390390
}
391391
let idx = CodeExtent(self.code_extents.borrow().len() as u32);
392-
debug!("CodeExtent({}) = {:?} [parent={}]", idx.0, e, parent.0);
392+
info!("CodeExtent({}) = {:?} [parent={}]", idx.0, e, parent.0);
393393
self.code_extents.borrow_mut().push(e);
394394
self.scope_map.borrow_mut().push(parent);
395395
*v.insert(idx)

trunk/src/librustc/traits/fulfill.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,12 @@ fn process_predicate1<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
542542
let trait_obligation = obligation.with(data.clone());
543543
match selcx.select(&trait_obligation) {
544544
Ok(Some(vtable)) => {
545-
debug!("selecting trait `{:?}` at depth {} yielded Ok(Some)",
545+
info!("selecting trait `{:?}` at depth {} yielded Ok(Some)",
546546
data, obligation.recursion_depth);
547547
Ok(Some(vtable.nested_obligations()))
548548
}
549549
Ok(None) => {
550-
debug!("selecting trait `{:?}` at depth {} yielded Ok(None)",
550+
info!("selecting trait `{:?}` at depth {} yielded Ok(None)",
551551
data, obligation.recursion_depth);
552552

553553
// This is a bit subtle: for the most part, the
@@ -781,6 +781,8 @@ impl<'tcx> GlobalFulfilledPredicates<'tcx> {
781781
self.dep_graph.read(data.dep_node());
782782
debug!("check_duplicate: global predicate `{:?}` already proved elsewhere", data);
783783

784+
info!("check_duplicate_trait hit: `{:?}`", data);
785+
784786
true
785787
} else {
786788
false
@@ -796,6 +798,7 @@ impl<'tcx> GlobalFulfilledPredicates<'tcx> {
796798
if data.is_global() {
797799
if self.set.insert(data.clone()) {
798800
debug!("add_if_global: global predicate `{:?}` added", data);
801+
info!("check_duplicate_trait entry: `{:?}`", data);
799802
}
800803
}
801804
}

trunk/src/librustc_back/target/arm_linux_androideabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::Target;
1212

1313
pub fn target() -> Target {
1414
let mut base = super::android_base::opts();
15-
base.features = "+v7,+vfp3,+d16".to_string();
15+
base.features = "+v7".to_string();
1616

1717
Target {
1818
llvm_target: "arm-linux-androideabi".to_string(),

trunk/src/librustc_trans/debuginfo/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use rustc::hir;
3434
use abi::Abi;
3535
use common::{NodeIdAndSpan, CrateContext, FunctionContext, Block, BlockAndBuilder};
3636
use monomorphize::Instance;
37-
use rustc::infer::normalize_associated_type;
3837
use rustc::ty::{self, Ty};
3938
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
4039
use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet};
@@ -369,7 +368,6 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
369368

370369
name_to_append_suffix_to.push('<');
371370
for (i, &actual_type) in actual_types.iter().enumerate() {
372-
let actual_type = normalize_associated_type(cx.tcx(), &actual_type);
373371
// Add actual type name to <...> clause of function name
374372
let actual_type_name = compute_debuginfo_type_name(cx,
375373
actual_type,
@@ -385,7 +383,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
385383
// Again, only create type information if full debuginfo is enabled
386384
let template_params: Vec<_> = if cx.sess().opts.debuginfo == FullDebugInfo {
387385
generics.types.as_slice().iter().enumerate().map(|(i, param)| {
388-
let actual_type = normalize_associated_type(cx.tcx(), &actual_types[i]);
386+
let actual_type = actual_types[i];
389387
let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP);
390388
let name = CString::new(param.name.as_str().as_bytes()).unwrap();
391389
unsafe {

trunk/src/librustc_typeck/coherence/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ use CrateCtxt;
3434
use rustc::infer::{self, InferCtxt, TypeOrigin, new_infer_ctxt};
3535
use std::cell::RefCell;
3636
use std::rc::Rc;
37+
use syntax::ast;
3738
use syntax::codemap::Span;
39+
use syntax::errors::DiagnosticBuilder;
3840
use util::nodemap::{DefIdMap, FnvHashMap};
3941
use rustc::dep_graph::DepNode;
4042
use rustc::hir::map as hir_map;
@@ -515,6 +517,13 @@ fn enforce_trait_manually_implementable(tcx: &TyCtxt, sp: Span, trait_def_id: De
515517
err.emit();
516518
}
517519

520+
// Factored out into helper because the error cannot be defined in multiple locations.
521+
pub fn report_duplicate_item<'tcx>(tcx: &TyCtxt<'tcx>, sp: Span, name: ast::Name)
522+
-> DiagnosticBuilder<'tcx>
523+
{
524+
struct_span_err!(tcx.sess, sp, E0201, "duplicate definitions with name `{}`:", name)
525+
}
526+
518527
pub fn check_coherence(crate_context: &CrateCtxt) {
519528
let _task = crate_context.tcx.dep_graph.in_task(DepNode::Coherence);
520529
let infcx = new_infer_ctxt(crate_context.tcx,

trunk/src/librustc_typeck/collect.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ use lint;
6363
use hir::def::Def;
6464
use hir::def_id::DefId;
6565
use constrained_type_params as ctp;
66+
use coherence;
6667
use middle::lang_items::SizedTraitLangItem;
6768
use middle::resolve_lifetime;
6869
use middle::const_val::ConstVal;
@@ -79,14 +80,13 @@ use rscope::*;
7980
use rustc::dep_graph::DepNode;
8081
use rustc::hir::map as hir_map;
8182
use util::common::{ErrorReported, MemoizationMap};
82-
use util::nodemap::FnvHashMap;
83+
use util::nodemap::{FnvHashMap, FnvHashSet};
8384
use write_ty_to_tcx;
8485

8586
use rustc_const_math::ConstInt;
8687

8788
use std::cell::RefCell;
8889
use std::collections::HashSet;
89-
use std::collections::hash_map::Entry::{Occupied, Vacant};
9090
use std::rc::Rc;
9191

9292
use syntax::abi;
@@ -746,27 +746,16 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
746746

747747
// Convert all the associated consts.
748748
// Also, check if there are any duplicate associated items
749-
let mut seen_type_items = FnvHashMap();
750-
let mut seen_value_items = FnvHashMap();
749+
let mut seen_type_items = FnvHashSet();
750+
let mut seen_value_items = FnvHashSet();
751751

752752
for impl_item in impl_items {
753753
let seen_items = match impl_item.node {
754754
hir::ImplItemKind::Type(_) => &mut seen_type_items,
755755
_ => &mut seen_value_items,
756756
};
757-
match seen_items.entry(impl_item.name) {
758-
Occupied(entry) => {
759-
let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201,
760-
"duplicate definitions with name `{}`:",
761-
impl_item.name);
762-
span_note!(&mut err, *entry.get(),
763-
"previous definition of `{}` here",
764-
impl_item.name);
765-
err.emit();
766-
}
767-
Vacant(entry) => {
768-
entry.insert(impl_item.span);
769-
}
757+
if !seen_items.insert(impl_item.name) {
758+
coherence::report_duplicate_item(tcx, impl_item.span, impl_item.name).emit();
770759
}
771760

772761
if let hir::ImplItemKind::Const(ref ty, _) = impl_item.node {

trunk/src/librustc_typeck/diagnostics.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,37 +3405,6 @@ parameters. You can read more about it in the API documentation:
34053405
https://doc.rust-lang.org/std/marker/struct.PhantomData.html
34063406
"##,
34073407

3408-
E0393: r##"
3409-
A type parameter which references `Self` in its default value was not specified.
3410-
Example of erroneous code:
3411-
3412-
```compile_fail
3413-
trait A<T=Self> {}
3414-
3415-
fn together_we_will_rule_the_galaxy(son: &A) {}
3416-
// error: the type parameter `T` must be explicitly specified in an
3417-
// object type because its default value `Self` references the
3418-
// type `Self`
3419-
```
3420-
3421-
A trait object is defined over a single, fully-defined trait. With a regular
3422-
default parameter, this parameter can just be substituted in. However, if the
3423-
default parameter is `Self`, the trait changes for each concrete type; i.e.
3424-
`i32` will be expected to implement `A<i32>`, `bool` will be expected to
3425-
implement `A<bool>`, etc... These types will not share an implementation of a
3426-
fully-defined trait; instead they share implementations of a trait with
3427-
different parameters substituted in for each implementation. This is
3428-
irreconcilable with what we need to make a trait object work, and is thus
3429-
disallowed. Making the trait concrete by explicitly specifying the value of the
3430-
defaulted parameter will fix this issue. Fixed example:
3431-
3432-
```
3433-
trait A<T=Self> {}
3434-
3435-
fn together_we_will_rule_the_galaxy(son: &A<i32>) {} // Ok!
3436-
```
3437-
"##,
3438-
34393408
E0439: r##"
34403409
The length of the platform-intrinsic function `simd_shuffle`
34413410
wasn't specified. Erroneous code example:
@@ -3786,6 +3755,8 @@ register_diagnostics! {
37863755
// between structures
37873756
E0377, // the trait `CoerceUnsized` may only be implemented for a coercion
37883757
// between structures with the same definition
3758+
E0393, // the type parameter `{}` must be explicitly specified in an object
3759+
// type because its default value `{}` references the type `Self`"
37893760
E0399, // trait items need to be implemented because the associated
37903761
// type `{}` was overridden
37913762
E0436, // functional record update requires a struct

trunk/src/librustdoc/clean/inline.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ fn try_inline_def(cx: &DocContext, tcx: &TyCtxt,
7676
let inner = match def {
7777
Def::Trait(did) => {
7878
record_extern_fqn(cx, did, clean::TypeTrait);
79-
ret.extend(build_impls(cx, tcx, did));
8079
clean::TraitItem(build_external_trait(cx, tcx, did))
8180
}
8281
Def::Fn(did) => {
@@ -248,10 +247,12 @@ pub fn build_impls(cx: &DocContext,
248247
// Primarily, the impls will be used to populate the documentation for this
249248
// type being inlined, but impls can also be used when generating
250249
// documentation for primitives (no way to find those specifically).
251-
if cx.populated_crate_impls.borrow_mut().insert(did.krate) {
250+
if !cx.all_crate_impls.borrow_mut().contains_key(&did.krate) {
251+
let mut impls = Vec::new();
252252
for item in tcx.sess.cstore.crate_top_level_items(did.krate) {
253253
populate_impls(cx, tcx, item.def, &mut impls);
254254
}
255+
cx.all_crate_impls.borrow_mut().insert(did.krate, impls);
255256

256257
fn populate_impls(cx: &DocContext, tcx: &TyCtxt,
257258
def: cstore::DefLike,
@@ -268,7 +269,21 @@ pub fn build_impls(cx: &DocContext,
268269
}
269270
}
270271

271-
impls
272+
let mut candidates = cx.all_crate_impls.borrow_mut();
273+
let candidates = candidates.get_mut(&did.krate).unwrap();
274+
for i in (0..candidates.len()).rev() {
275+
let remove = match candidates[i].inner {
276+
clean::ImplItem(ref i) => {
277+
i.for_.def_id() == Some(did) || i.for_.primitive_type().is_some()
278+
}
279+
_ => continue,
280+
};
281+
if remove {
282+
impls.push(candidates.swap_remove(i));
283+
}
284+
}
285+
286+
return impls;
272287
}
273288

274289
pub fn build_impl(cx: &DocContext,

trunk/src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use rustc_trans::back::link;
3838
use rustc::middle::cstore::{self, CrateStore};
3939
use rustc::middle::privacy::AccessLevels;
4040
use rustc::hir::def::Def;
41-
use rustc::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
41+
use rustc::hir::def_id::{DefId, DefIndex};
4242
use rustc::ty::subst::{self, ParamSpace, VecPerParamSpace};
4343
use rustc::ty;
4444
use rustc::middle::stability;
@@ -2388,7 +2388,7 @@ impl Clean<Item> for doctree::ExternCrate {
23882388
name: None,
23892389
attrs: self.attrs.clean(cx),
23902390
source: self.whence.clean(cx),
2391-
def_id: DefId { krate: self.cnum, index: CRATE_DEF_INDEX },
2391+
def_id: cx.map.local_def_id(0),
23922392
visibility: self.vis.clean(cx),
23932393
stability: None,
23942394
deprecation: None,

trunk/src/librustdoc/core.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use syntax::feature_gate::UnstableFeatures;
3030
use syntax::parse::token;
3131

3232
use std::cell::{RefCell, Cell};
33-
use std::collections::{HashMap, HashSet};
33+
use std::collections::HashMap;
3434
use std::rc::Rc;
3535

3636
use visit_ast::RustdocVisitor;
@@ -54,7 +54,7 @@ pub struct DocContext<'a, 'tcx: 'a> {
5454
pub map: &'a hir_map::Map<'tcx>,
5555
pub maybe_typed: MaybeTyped<'a, 'tcx>,
5656
pub input: Input,
57-
pub populated_crate_impls: RefCell<HashSet<ast::CrateNum>>,
57+
pub all_crate_impls: RefCell<HashMap<ast::CrateNum, Vec<clean::Item>>>,
5858
pub deref_trait_did: Cell<Option<DefId>>,
5959
// Note that external items for which `doc(hidden)` applies to are shown as
6060
// non-reachable while local items aren't. This is because we're reusing
@@ -189,7 +189,7 @@ pub fn run_core(search_paths: SearchPaths,
189189
map: &tcx.map,
190190
maybe_typed: Typed(tcx),
191191
input: input,
192-
populated_crate_impls: RefCell::new(HashSet::new()),
192+
all_crate_impls: RefCell::new(HashMap::new()),
193193
deref_trait_did: Cell::new(None),
194194
access_levels: RefCell::new(access_levels),
195195
external_traits: RefCell::new(HashMap::new()),

trunk/src/librustdoc/doctree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ pub struct Macro {
232232

233233
pub struct ExternCrate {
234234
pub name: Name,
235-
pub cnum: ast::CrateNum,
236235
pub path: Option<String>,
237236
pub vis: hir::Visibility,
238237
pub attrs: hir::HirVec<ast::Attribute>,

trunk/src/librustdoc/html/format.rs

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
5757
pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
5858
pub struct AbiSpace(pub Abi);
5959

60-
pub struct HRef<'a> {
61-
pub did: DefId,
62-
pub text: &'a str,
63-
}
64-
6560
impl<'a> VisSpace<'a> {
6661
pub fn get(self) -> &'a Option<clean::Visibility> {
6762
let VisSpace(v) = self; v
@@ -296,19 +291,17 @@ impl fmt::Display for clean::Path {
296291

297292
pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
298293
let cache = cache();
299-
if !did.is_local() && !cache.access_levels.is_doc_reachable(did) {
300-
return None
301-
}
302-
303294
let loc = CURRENT_LOCATION_KEY.with(|l| l.borrow().clone());
304295
let &(ref fqp, shortty) = match cache.paths.get(&did) {
305296
Some(p) => p,
306297
None => return None,
307298
};
308-
309299
let mut url = if did.is_local() || cache.inlined.contains(&did) {
310300
repeat("../").take(loc.len()).collect::<String>()
311301
} else {
302+
if !cache.access_levels.is_doc_reachable(did) {
303+
return None
304+
}
312305
match cache.extern_locations[&did.krate] {
313306
(_, render::Remote(ref s)) => s.to_string(),
314307
(_, render::Local) => repeat("../").take(loc.len()).collect(),
@@ -368,7 +361,15 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
368361
}
369362
}
370363
}
371-
write!(w, "{}{}", HRef::new(did, &last.name), last.params)?;
364+
365+
match href(did) {
366+
Some((url, shortty, fqp)) => {
367+
write!(w, "<a class='{}' href='{}' title='{}'>{}</a>",
368+
shortty, url, fqp.join("::"), last.name)?;
369+
}
370+
_ => write!(w, "{}", last.name)?,
371+
}
372+
write!(w, "{}", last.params)?;
372373
Ok(())
373374
}
374375

@@ -434,24 +435,6 @@ fn tybounds(w: &mut fmt::Formatter,
434435
}
435436
}
436437

437-
impl<'a> HRef<'a> {
438-
pub fn new(did: DefId, text: &'a str) -> HRef<'a> {
439-
HRef { did: did, text: text }
440-
}
441-
}
442-
443-
impl<'a> fmt::Display for HRef<'a> {
444-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
445-
match href(self.did) {
446-
Some((url, shortty, fqp)) => {
447-
write!(f, "<a class='{}' href='{}' title='{}'>{}</a>",
448-
shortty, url, fqp.join("::"), self.text)
449-
}
450-
_ => write!(f, "{}", self.text),
451-
}
452-
}
453-
}
454-
455438
impl fmt::Display for clean::Type {
456439
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
457440
match *self {

0 commit comments

Comments
 (0)