Skip to content

Commit b9fb124

Browse files
author
Nick Hamann
committed
---
yaml --- r: 210778 b: refs/heads/try c: 809be9b h: refs/heads/master v: v3
1 parent 2189a62 commit b9fb124

File tree

71 files changed

+186
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+186
-256
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: ab4700548203a9a3421e90a0e0d7aadd8f8fb13e
5+
refs/heads/try: 809be9b7f454385e0ba689d73e4327c1621f45a6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/configure

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ probe() {
106106
T=$(command -v $P 2>&1)
107107
if [ $? -eq 0 ]
108108
then
109-
VER0=$($P --version 2>/dev/null \
110-
| grep -o '[vV]\?[0-9][0-9.][a-z0-9.-]*' | head -1 )
109+
VER0=$($P --version 2>/dev/null | head -1 \
110+
| sed -e 's/[^0-9]*\([vV]\?[0-9.]\+[^ ]*\).*/\1/' )
111111
if [ $? -eq 0 -a "x${VER0}" != "x" ]
112112
then
113113
VER="($VER0)"
@@ -711,20 +711,6 @@ else
711711
probe_need CFG_GIT git
712712
fi
713713

714-
# Use `md5sum` on GNU platforms, or `md5 -q` on BSD
715-
probe CFG_MD5 md5
716-
probe CFG_MD5SUM md5sum
717-
if [ -n "$CFG_MD5" ]
718-
then
719-
CFG_HASH_COMMAND="$CFG_MD5 -q | head -c 8"
720-
elif [ -n "$CFG_MD5SUM" ]
721-
then
722-
CFG_HASH_COMMAND="$CFG_MD5SUM | head -c 8"
723-
else
724-
err 'could not find one of: md5 md5sum'
725-
fi
726-
putvar CFG_HASH_COMMAND
727-
728714
probe CFG_CLANG clang++
729715
probe CFG_CCACHE ccache
730716
probe CFG_GCC gcc

branches/try/mk/main.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ CFG_RELEASE_NUM=1.1.0
2020
# versions (section 9)
2121
CFG_PRERELEASE_VERSION=.1
2222

23-
# Append a version-dependent hash to each library, so we can install different
24-
# versions in the same place
25-
CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE) | $(CFG_HASH_COMMAND))
23+
CFG_FILENAME_EXTRA=4e7c5e5c
2624

2725
ifeq ($(CFG_RELEASE_CHANNEL),stable)
2826
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"

branches/try/src/doc/reference.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3529,7 +3529,9 @@ The actual implementation for each vtable entry can vary on an object-by-object
35293529
basis.
35303530

35313531
Note that for a trait object to be instantiated, the trait must be
3532-
_object-safe_. Object safety rules are defined in [RFC 255][rfc255].
3532+
_object-safe_. Object safety rules are defined in [RFC 255].
3533+
3534+
[RFC 255]: https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md
35333535

35343536
Given a pointer-typed expression `E` of type `&T` or `Box<T>`, where `T`
35353537
implements trait `R`, casting `E` to the corresponding pointer type `&R` or

branches/try/src/librustc_back/archive.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -306,21 +306,6 @@ impl<'a> ArchiveBuilder<'a> {
306306
if filename.contains(".SYMDEF") { continue }
307307
if skip(filename) { continue }
308308

309-
// Archives on unix systems typically do not have slashes in
310-
// filenames as the `ar` utility generally only uses the last
311-
// component of a path for the filename list in the archive. On
312-
// Windows, however, archives assembled with `lib.exe` will preserve
313-
// the full path to the file that was placed in the archive,
314-
// including path separators.
315-
//
316-
// The code below is munging paths so it'll go wrong pretty quickly
317-
// if there's some unexpected slashes in the filename, so here we
318-
// just chop off everything but the filename component. Note that
319-
// this can cause duplicate filenames, but that's also handled below
320-
// as well.
321-
let filename = Path::new(filename).file_name().unwrap()
322-
.to_str().unwrap();
323-
324309
// An archive can contain files of the same name multiple times, so
325310
// we need to be sure to not have them overwrite one another when we
326311
// extract them. Consequently we need to find a truly unique file

branches/try/src/librustc_resolve/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,18 +2528,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
25282528
// If anything ends up here entirely resolved,
25292529
// it's an error. If anything ends up here
25302530
// partially resolved, that's OK, because it may
2531-
// be a `T::CONST` that typeck will resolve.
2531+
// be a `T::CONST` that typeck will resolve to
2532+
// an inherent impl.
25322533
if path_res.depth == 0 {
25332534
self.resolve_error(
25342535
path.span,
25352536
&format!("`{}` is not an enum variant, struct or const",
25362537
token::get_ident(
25372538
path.segments.last().unwrap().identifier)));
25382539
} else {
2539-
let const_name = path.segments.last().unwrap()
2540-
.identifier.name;
2541-
let traits = self.get_traits_containing_item(const_name);
2542-
self.trait_map.insert(pattern.id, traits);
25432540
self.record_def(pattern.id, path_res);
25442541
}
25452542
}

branches/try/src/librustc_typeck/check/method/mod.rs

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ use middle::def;
1616
use middle::privacy::{AllPublic, DependsOn, LastPrivate, LastMod};
1717
use middle::subst;
1818
use middle::traits;
19-
use middle::ty::{self, AsPredicate, ToPolyTraitRef};
19+
use middle::ty::*;
20+
use middle::ty;
2021
use middle::infer;
2122
use util::ppaux::Repr;
2223

24+
use std::rc::Rc;
2325
use syntax::ast::DefId;
2426
use syntax::ast;
2527
use syntax::codemap::Span;
@@ -37,7 +39,7 @@ pub enum MethodError {
3739
// Did not find an applicable method, but we did find various
3840
// static methods that may apply, as well as a list of
3941
// not-in-scope traits which may work.
40-
NoMatch(Vec<CandidateSource>, Vec<ast::DefId>, probe::Mode),
42+
NoMatch(Vec<CandidateSource>, Vec<ast::DefId>),
4143

4244
// Multiple methods might apply.
4345
Ambiguity(Vec<CandidateSource>),
@@ -60,7 +62,7 @@ type ItemIndex = usize; // just for doc purposes
6062
pub fn exists<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
6163
span: Span,
6264
method_name: ast::Name,
63-
self_ty: ty::Ty<'tcx>,
65+
self_ty: Ty<'tcx>,
6466
call_expr_id: ast::NodeId)
6567
-> bool
6668
{
@@ -90,11 +92,11 @@ pub fn exists<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
9092
pub fn lookup<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
9193
span: Span,
9294
method_name: ast::Name,
93-
self_ty: ty::Ty<'tcx>,
94-
supplied_method_types: Vec<ty::Ty<'tcx>>,
95+
self_ty: Ty<'tcx>,
96+
supplied_method_types: Vec<Ty<'tcx>>,
9597
call_expr: &'tcx ast::Expr,
9698
self_expr: &'tcx ast::Expr)
97-
-> Result<ty::MethodCallee<'tcx>, MethodError>
99+
-> Result<MethodCallee<'tcx>, MethodError>
98100
{
99101
debug!("lookup(method_name={}, self_ty={}, call_expr={}, self_expr={})",
100102
method_name.repr(fcx.tcx()),
@@ -113,9 +115,9 @@ pub fn lookup_in_trait<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
113115
self_expr: Option<&ast::Expr>,
114116
m_name: ast::Name,
115117
trait_def_id: DefId,
116-
self_ty: ty::Ty<'tcx>,
117-
opt_input_types: Option<Vec<ty::Ty<'tcx>>>)
118-
-> Option<ty::MethodCallee<'tcx>>
118+
self_ty: Ty<'tcx>,
119+
opt_input_types: Option<Vec<Ty<'tcx>>>)
120+
-> Option<MethodCallee<'tcx>>
119121
{
120122
lookup_in_trait_adjusted(fcx, span, self_expr, m_name, trait_def_id,
121123
0, false, self_ty, opt_input_types)
@@ -137,9 +139,9 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
137139
trait_def_id: DefId,
138140
autoderefs: usize,
139141
unsize: bool,
140-
self_ty: ty::Ty<'tcx>,
141-
opt_input_types: Option<Vec<ty::Ty<'tcx>>>)
142-
-> Option<ty::MethodCallee<'tcx>>
142+
self_ty: Ty<'tcx>,
143+
opt_input_types: Option<Vec<Ty<'tcx>>>)
144+
-> Option<MethodCallee<'tcx>>
143145
{
144146
debug!("lookup_in_trait_adjusted(self_ty={}, self_expr={}, m_name={}, trait_def_id={})",
145147
self_ty.repr(fcx.tcx()),
@@ -184,9 +186,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
184186
// Trait must have a method named `m_name` and it should not have
185187
// type parameters or early-bound regions.
186188
let tcx = fcx.tcx();
187-
let (method_num, method_ty) = trait_item(tcx, trait_def_id, m_name)
188-
.and_then(|(idx, item)| item.as_opt_method().map(|m| (idx, m)))
189-
.unwrap();
189+
let (method_num, method_ty) = trait_method(tcx, trait_def_id, m_name).unwrap();
190190
assert_eq!(method_ty.generics.types.len(subst::FnSpace), 0);
191191
assert_eq!(method_ty.generics.regions.len(subst::FnSpace), 0);
192192

@@ -288,10 +288,10 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
288288
}
289289
}
290290

291-
let callee = ty::MethodCallee {
292-
origin: ty::MethodTypeParam(ty::MethodParam{trait_ref: trait_ref.clone(),
293-
method_num: method_num,
294-
impl_def_id: None}),
291+
let callee = MethodCallee {
292+
origin: MethodTypeParam(MethodParam{trait_ref: trait_ref.clone(),
293+
method_num: method_num,
294+
impl_def_id: None}),
295295
ty: fty,
296296
substs: trait_ref.substs.clone()
297297
};
@@ -304,7 +304,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
304304
pub fn resolve_ufcs<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
305305
span: Span,
306306
method_name: ast::Name,
307-
self_ty: ty::Ty<'tcx>,
307+
self_ty: Ty<'tcx>,
308308
expr_id: ast::NodeId)
309309
-> Result<(def::Def, LastPrivate), MethodError>
310310
{
@@ -322,40 +322,41 @@ pub fn resolve_ufcs<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
322322
_ => def::FromTrait(pick.item.container().id())
323323
};
324324
let def_result = match pick.item {
325-
ty::ImplOrTraitItem::MethodTraitItem(..) => def::DefMethod(def_id, provenance),
326-
ty::ImplOrTraitItem::ConstTraitItem(..) => def::DefAssociatedConst(def_id, provenance),
327-
ty::ImplOrTraitItem::TypeTraitItem(..) => {
325+
ImplOrTraitItem::MethodTraitItem(..) => def::DefMethod(def_id, provenance),
326+
ImplOrTraitItem::ConstTraitItem(..) => def::DefAssociatedConst(def_id, provenance),
327+
ImplOrTraitItem::TypeTraitItem(..) => {
328328
fcx.tcx().sess.span_bug(span, "resolve_ufcs: probe picked associated type");
329329
}
330330
};
331331
Ok((def_result, lp))
332332
}
333333

334334

335-
/// Find item with name `item_name` defined in `trait_def_id` and return it, along with its
336-
/// index (or `None`, if no such item).
337-
fn trait_item<'tcx>(tcx: &ty::ctxt<'tcx>,
338-
trait_def_id: ast::DefId,
339-
item_name: ast::Name)
340-
-> Option<(usize, ty::ImplOrTraitItem<'tcx>)>
335+
/// Find method with name `method_name` defined in `trait_def_id` and return it, along with its
336+
/// index (or `None`, if no such method).
337+
fn trait_method<'tcx>(tcx: &ty::ctxt<'tcx>,
338+
trait_def_id: ast::DefId,
339+
method_name: ast::Name)
340+
-> Option<(usize, Rc<ty::Method<'tcx>>)>
341341
{
342342
let trait_items = ty::trait_items(tcx, trait_def_id);
343343
trait_items
344344
.iter()
345345
.enumerate()
346-
.find(|&(_, ref item)| item.name() == item_name)
347-
.map(|(num, item)| (num, (*item).clone()))
346+
.find(|&(_, ref item)| item.name() == method_name)
347+
.and_then(|(idx, item)| item.as_opt_method().map(|m| (idx, m)))
348348
}
349349

350-
fn impl_item<'tcx>(tcx: &ty::ctxt<'tcx>,
351-
impl_def_id: ast::DefId,
352-
item_name: ast::Name)
353-
-> Option<ty::ImplOrTraitItem<'tcx>>
350+
fn impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
351+
impl_def_id: ast::DefId,
352+
method_name: ast::Name)
353+
-> Option<Rc<ty::Method<'tcx>>>
354354
{
355355
let impl_items = tcx.impl_items.borrow();
356356
let impl_items = impl_items.get(&impl_def_id).unwrap();
357357
impl_items
358358
.iter()
359359
.map(|&did| ty::impl_or_trait_item(tcx, did.def_id()))
360-
.find(|m| m.name() == item_name)
360+
.find(|m| m.name() == method_name)
361+
.and_then(|item| item.as_opt_method())
361362
}

branches/try/src/librustc_typeck/check/method/probe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn probe<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
136136
let steps = if mode == Mode::MethodCall {
137137
match create_steps(fcx, span, self_ty) {
138138
Some(steps) => steps,
139-
None => return Err(MethodError::NoMatch(Vec::new(), Vec::new(), mode)),
139+
None => return Err(MethodError::NoMatch(Vec::new(), Vec::new())),
140140
}
141141
} else {
142142
vec![CandidateStep {
@@ -866,7 +866,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
866866
}
867867
}
868868
}).collect(),
869-
Some(Err(MethodError::NoMatch(_, others, _))) => {
869+
Some(Err(MethodError::NoMatch(_, others))) => {
870870
assert!(others.is_empty());
871871
vec![]
872872
}
@@ -877,7 +877,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
877877
None => vec![],
878878
};
879879

880-
Err(MethodError::NoMatch(static_candidates, out_of_scope_traits, self.mode))
880+
Err(MethodError::NoMatch(static_candidates, out_of_scope_traits))
881881
}
882882

883883
fn pick_core(&mut self) -> Option<PickResult<'tcx>> {

0 commit comments

Comments
 (0)