Skip to content

Commit de28762

Browse files
committed
---
yaml --- r: 275928 b: refs/heads/master c: 092b073 h: refs/heads/master
1 parent 4ac1ab7 commit de28762

File tree

32 files changed

+368
-101
lines changed

32 files changed

+368
-101
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: 2b71219a618a8c9ad65cdcf008c2a1c6377eb1cd
2+
refs/heads/master: 092b0738b7f00740c997a3fb99dd0b8b50c4c157
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_ANDROID_CROSS_PATH) \
626+
--android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \
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-
info!("CodeExtent({}) = {:?} [parent={}]", idx.0, e, parent.0);
392+
debug!("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: 2 additions & 5 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-
info!("selecting trait `{:?}` at depth {} yielded Ok(Some)",
545+
debug!("selecting trait `{:?}` at depth {} yielded Ok(Some)",
546546
data, obligation.recursion_depth);
547547
Ok(Some(vtable.nested_obligations()))
548548
}
549549
Ok(None) => {
550-
info!("selecting trait `{:?}` at depth {} yielded Ok(None)",
550+
debug!("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,8 +781,6 @@ 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-
786784
true
787785
} else {
788786
false
@@ -798,7 +796,6 @@ impl<'tcx> GlobalFulfilledPredicates<'tcx> {
798796
if data.is_global() {
799797
if self.set.insert(data.clone()) {
800798
debug!("add_if_global: global predicate `{:?}` added", data);
801-
info!("check_duplicate_trait entry: `{:?}`", data);
802799
}
803800
}
804801
}

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".to_string();
15+
base.features = "+v7,+vfp3,+d16".to_string();
1616

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

trunk/src/librustc_trans/debuginfo/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ 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;
3738
use rustc::ty::{self, Ty};
3839
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
3940
use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet};
@@ -368,6 +369,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
368369

369370
name_to_append_suffix_to.push('<');
370371
for (i, &actual_type) in actual_types.iter().enumerate() {
372+
let actual_type = normalize_associated_type(cx.tcx(), &actual_type);
371373
// Add actual type name to <...> clause of function name
372374
let actual_type_name = compute_debuginfo_type_name(cx,
373375
actual_type,
@@ -383,7 +385,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
383385
// Again, only create type information if full debuginfo is enabled
384386
let template_params: Vec<_> = if cx.sess().opts.debuginfo == FullDebugInfo {
385387
generics.types.as_slice().iter().enumerate().map(|(i, param)| {
386-
let actual_type = actual_types[i];
388+
let actual_type = normalize_associated_type(cx.tcx(), &actual_types[i]);
387389
let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP);
388390
let name = CString::new(param.name.as_str().as_bytes()).unwrap();
389391
unsafe {

trunk/src/librustc_typeck/coherence/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ 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;
3837
use syntax::codemap::Span;
39-
use syntax::errors::DiagnosticBuilder;
4038
use util::nodemap::{DefIdMap, FnvHashMap};
4139
use rustc::dep_graph::DepNode;
4240
use rustc::hir::map as hir_map;
@@ -517,13 +515,6 @@ fn enforce_trait_manually_implementable(tcx: &TyCtxt, sp: Span, trait_def_id: De
517515
err.emit();
518516
}
519517

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-
527518
pub fn check_coherence(crate_context: &CrateCtxt) {
528519
let _task = crate_context.tcx.dep_graph.in_task(DepNode::Coherence);
529520
let infcx = new_infer_ctxt(crate_context.tcx,

trunk/src/librustc_typeck/collect.rs

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

8685
use rustc_const_math::ConstInt;
8786

8887
use std::cell::RefCell;
8988
use std::collections::HashSet;
89+
use std::collections::hash_map::Entry::{Occupied, Vacant};
9090
use std::rc::Rc;
9191

9292
use syntax::abi;
@@ -746,16 +746,27 @@ 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 = FnvHashSet();
750-
let mut seen_value_items = FnvHashSet();
749+
let mut seen_type_items = FnvHashMap();
750+
let mut seen_value_items = FnvHashMap();
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-
if !seen_items.insert(impl_item.name) {
758-
coherence::report_duplicate_item(tcx, impl_item.span, impl_item.name).emit();
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+
}
759770
}
760771

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

trunk/src/librustc_typeck/diagnostics.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,6 +3405,37 @@ 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+
34083439
E0439: r##"
34093440
The length of the platform-intrinsic function `simd_shuffle`
34103441
wasn't specified. Erroneous code example:
@@ -3755,8 +3786,6 @@ register_diagnostics! {
37553786
// between structures
37563787
E0377, // the trait `CoerceUnsized` may only be implemented for a coercion
37573788
// 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`"
37603789
E0399, // trait items need to be implemented because the associated
37613790
// type `{}` was overridden
37623791
E0436, // functional record update requires a struct

trunk/src/librustdoc/clean/inline.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ 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));
7980
clean::TraitItem(build_external_trait(cx, tcx, did))
8081
}
8182
Def::Fn(did) => {
@@ -247,12 +248,10 @@ pub fn build_impls(cx: &DocContext,
247248
// Primarily, the impls will be used to populate the documentation for this
248249
// type being inlined, but impls can also be used when generating
249250
// documentation for primitives (no way to find those specifically).
250-
if !cx.all_crate_impls.borrow_mut().contains_key(&did.krate) {
251-
let mut impls = Vec::new();
251+
if cx.populated_crate_impls.borrow_mut().insert(did.krate) {
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);
256255

257256
fn populate_impls(cx: &DocContext, tcx: &TyCtxt,
258257
def: cstore::DefLike,
@@ -269,21 +268,7 @@ pub fn build_impls(cx: &DocContext,
269268
}
270269
}
271270

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;
271+
impls
287272
}
288273

289274
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};
41+
use rustc::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
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: cx.map.local_def_id(0),
2391+
def_id: DefId { krate: self.cnum, index: CRATE_DEF_INDEX },
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;
33+
use std::collections::{HashMap, HashSet};
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 all_crate_impls: RefCell<HashMap<ast::CrateNum, Vec<clean::Item>>>,
57+
pub populated_crate_impls: RefCell<HashSet<ast::CrateNum>>,
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-
all_crate_impls: RefCell::new(HashMap::new()),
192+
populated_crate_impls: RefCell::new(HashSet::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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ pub struct Macro {
232232

233233
pub struct ExternCrate {
234234
pub name: Name,
235+
pub cnum: ast::CrateNum,
235236
pub path: Option<String>,
236237
pub vis: hir::Visibility,
237238
pub attrs: hir::HirVec<ast::Attribute>,

trunk/src/librustdoc/html/format.rs

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ 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+
6065
impl<'a> VisSpace<'a> {
6166
pub fn get(self) -> &'a Option<clean::Visibility> {
6267
let VisSpace(v) = self; v
@@ -291,17 +296,19 @@ impl fmt::Display for clean::Path {
291296

292297
pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
293298
let cache = cache();
299+
if !did.is_local() && !cache.access_levels.is_doc_reachable(did) {
300+
return None
301+
}
302+
294303
let loc = CURRENT_LOCATION_KEY.with(|l| l.borrow().clone());
295304
let &(ref fqp, shortty) = match cache.paths.get(&did) {
296305
Some(p) => p,
297306
None => return None,
298307
};
308+
299309
let mut url = if did.is_local() || cache.inlined.contains(&did) {
300310
repeat("../").take(loc.len()).collect::<String>()
301311
} else {
302-
if !cache.access_levels.is_doc_reachable(did) {
303-
return None
304-
}
305312
match cache.extern_locations[&did.krate] {
306313
(_, render::Remote(ref s)) => s.to_string(),
307314
(_, render::Local) => repeat("../").take(loc.len()).collect(),
@@ -361,15 +368,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
361368
}
362369
}
363370
}
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)?;
371+
write!(w, "{}{}", HRef::new(did, &last.name), last.params)?;
373372
Ok(())
374373
}
375374

@@ -435,6 +434,24 @@ fn tybounds(w: &mut fmt::Formatter,
435434
}
436435
}
437436

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+
438455
impl fmt::Display for clean::Type {
439456
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
440457
match *self {

0 commit comments

Comments
 (0)