about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2015-03-27Rollup merge of #23712 - nikomatsakis:reflect-trait, r=FlaPer87Manish Goregaokar-173/+568
This PR introduces a `Reflect` marker trait which is a supertrait of `Any`. The idea is that `Reflect` is defined for all concrete types, but is not defined for type parameters unless there is a `T:Reflect` bound. This is intended to preserve the parametricity property. This allows the `Any` interface to be stabilized without committing us to unbounded reflection that is not easily detectable by the caller. The implementation of `Reflect` relies on an experimental variant of OIBIT. This variant behaves differently for objects, since it requires that all types exposed as part of the object's *interface* are `Reflect`, but isn't concerned about other types that may be closed over. In other words, you don't have to write `Foo+Reflect` in order for `Foo: Reflect` to hold (where `Foo` is a trait). Given that `Any` is slated to stabilization and hence that we are committed to some form of reflection, the goal of this PR is to leave our options open with respect to parametricity. I see the options for full stabilization as follows (I think an RFC would be an appropriate way to confirm whichever of these three routes we take): 1. We make `Reflect` a lang-item. 2. We stabilize some version of the OIBIT variation I implemented as a general mechanism that may be appropriate for other use cases. 3. We give up on preserving parametricity here and just have `impl<T> Reflect for T` instead. In that case, `Reflect` is a harmless but not especially useful trait going forward. cc @aturon cc @alexcrichton cc @glaebhoerl (this is more-or-less your proposal, as I understood it) cc @reem (this is more-or-less what we discussed on IRC at some point) cc @FlaPer87 (vaguely pertains to OIBIT)
2015-03-27Rollup merge of #23625 - fhahn:issue-23620-ice-unicode-bytestring, ↵Manish Goregaokar-12/+78
r=alexcrichton closes #23620 This PR patches the issue mentioned in #23620, but there is also an ICE for invalid escape sequences in byte literals. This is due to the fact that the `scan_byte` function returns ` token::intern(\"??\") ` for invalid bytes, resulting in an ICE later on. Is there a reason for this behavior? Shouldn't `scan_byte` fail when it encounters an invalid byte? And I noticed a small inconsistency in the documentation. According to the formal byte literal definition in http://doc.rust-lang.org/reference.html#byte-and-byte-string-literals , a byte string literal contains `string_body *`, but according to the text (and the behavior of the lexer) it should not accept unicode escape sequences. Hence it should be replaced by `byte_body *`. If this is valid, I can add this fix to this PR.
2015-03-27Rollup merge of #23419 - murarth:lookup-addr, r=alexcrichtonManish Goregaokar-1/+57
Closes #22608
2015-03-27Rollup merge of #23738 - alexcrichton:snapshots, r=cmrManish Goregaokar-1166/+25
2015-03-27Prevent ICEs when parsing invalid escapes, closes #23620Florian Hahn-12/+78
2015-03-27Auto merge of #22930 - Gankro:entry_3, r=aturonbors-93/+102
RFC pending, but this is the patch that does it. Totally untested. Likely needs some removed imports. std::collections docs should also be updated to provide better examples. Closes #23508
2015-03-27default => or_insert per RFCAlexis Beingessner-34/+31
2015-03-26update everything to use Entry defaultsAlexis-84/+24
2015-03-26entry API v3: replace Entry::get with Entry::default and Entry::default_withAlexis-2/+74
2015-03-26Fix doc tests.Niko Matsakis-0/+1
2015-03-26Add `std::net::lookup_addr` for reverse DNS lookupMurarth-1/+57
Closes #22608
2015-03-26Refactor object-safety test to use def-ids onlyNiko Matsakis-16/+59
2015-03-26Refactor how binders are handled in trait selectionNiko Matsakis-128/+213
2015-03-26Drive-by fix for incorrect variance rule that I noticed.Niko Matsakis-3/+46
2015-03-26Implement `Reflect` trait with a variant on the standard OIBITNiko Matsakis-29/+252
semantics that tests the *interface* of trait objects, rather than what they close over.
2015-03-26Auto merge of #23359 - erickt:quote, r=pnkfelixbors-29/+41
This PR allows the quote macros to unquote trait items, impl items, where clauses, and paths.
2015-03-26Register new snapshotsAlex Crichton-1166/+25
2015-03-26Auto merge of #23680 - erickt:inline, r=cmrbors-0/+113
before: test bench_read_slice ... bench: 68 ns/iter (+/- 56) test bench_read_vec ... bench: 78 ns/iter (+/- 21) test bench_write_slice ... bench: 133 ns/iter (+/- 46) test bench_write_vec ... bench: 308 ns/iter (+/- 69) after: test bench_read_slice ... bench: 32 ns/iter (+/- 10) test bench_read_vec ... bench: 32 ns/iter (+/- 8) test bench_write_slice ... bench: 53 ns/iter (+/- 12) test bench_write_vec ... bench: 247 ns/iter (+/- 172)
2015-03-26Auto merge of #21237 - erickt:derive-assoc-types, r=ericktbors-6/+358
This PR adds support for associated types to the `#[derive(...)]` syntax extension. In order to do this, it switches over to using where predicates to apply the type constraints. So now this: ```rust type Trait { type Type; } #[derive(Clone)] struct Foo<A> where A: Trait { a: A, b: <A as Trait>::Type, } ``` Gets expended into this impl: ```rust impl<A: Clone> Clone for Foo<A> where A: Trait, <A as Trait>::Type: Clone, { fn clone(&self) -> Foo<T> { Foo { a: self.a.clone(), b: self.b.clone(), } } } ```
2015-03-26Auto merge of #23711 - alexcrichton:ip-addr, r=aturonbors-21/+68
This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but without a port. The enumeration is `#[unstable]`. The `lookup_host` function and iterator are also destabilized behind a new feature gate due to questions around the semantics of returning `SocketAddr` values.
2015-03-26Auto merge of #23691 - richo:dedup-typeorigin-mergable, r=eddybbors-29/+40
I've started on refactoring the error handling code to avoid the need to reparse generated errors in `span_*`, but would rather land this incrementally as one monolithic PR (and have un-fond memories of merge conflicts from various other monoliths) r? @eddyb
2015-03-25infer: Drop pointless format! callsRicho Healey-14/+14
2015-03-25infer: Refactor Display implRicho Healey-9/+14
2015-03-25infer: Move TypeOrigin formatting onto it's enumRicho Healey-15/+21
This doesn't actually solve the issue that prompted this, at: https://github.com/rust-lang/rust/blob/master/src/librustc/session/mod.rs#L262-271 But skimming the cfg it appears that all type information has been discarded long before that point.
2015-03-26Auto merge of #23718 - alexcrichton:flaky-test, r=huonwbors-4/+4
It's considered an error to access stdout while a process is being shut down, so tweak this test a bit to actually wait for the child thread to exit. This was discovered with a recent [snap-mac3 failure](http://buildbot.rust-lang.org/builders/snap3-mac/builds/164/steps/test/logs/stdio)
2015-03-25std: Add net::IpAddr, destabilize lookup_hostAlex Crichton-21/+68
This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but without a port. The enumeration is `#[unstable]`. The `lookup_host` function and iterator are also destabilized behind a new feature gate due to questions around the semantics of returning `SocketAddr` values.
2015-03-25test: Make a test less flakyAlex Crichton-4/+4
It's considered an error to access stdout while a process is being shut down, so tweak this test a bit to actually wait for the child thread to exit.
2015-03-25Auto merge of #23695 - sae-bom:mac-android-debuginfo, r=alexcrichtonbors-1/+5
1. when mac-android cross compile and make-check , make it use gdb instead of lldb so as to it passes debuginfo tests. 2. ignore some tests on aarch64
2015-03-25Auto merge of #23434 - alexcrichton:misc-stab, r=aturonbors-3/+4
Now that we check the stability of fields, the fields of this struct should also be stable.
2015-03-25Speed up reading/writing slices with #[inline]Erick Tryzelaar-0/+113
When built with `rustc -O`: before: test bench_read_slice ... bench: 68 ns/iter (+/- 56) test bench_read_vec ... bench: 78 ns/iter (+/- 21) test bench_write_slice ... bench: 133 ns/iter (+/- 46) test bench_write_vec ... bench: 308 ns/iter (+/- 69) after: test bench_read_slice ... bench: 32 ns/iter (+/- 10) test bench_read_vec ... bench: 32 ns/iter (+/- 8) test bench_write_slice ... bench: 53 ns/iter (+/- 12) test bench_write_vec ... bench: 247 ns/iter (+/- 172)
2015-03-25Rollup merge of #23702 - dotdash:match_reass, r=eddybManish Goregaokar-2/+32
The reassignment checker effectively only checks whether the last assignment in a body affects the discriminant, but it should of course check all the assignments. Fixes #23698
2015-03-25Rollup merge of #23693 - semarie:openbsd-pathbuf-new, r=nikomatsakisManish Goregaokar-2/+2
`PathBuf::new` have been changed. Use `PathBuf::from` instead. Apply the same change for freebsd too, while here.
2015-03-25Rollup merge of #23692 - yjh0502:fix/simd-overflow, r=pnkfelixManish Goregaokar-0/+25
Disable overflow checking on SIMD operations, fix #23037
2015-03-25Rollup merge of #23684 - tamird:ios-fallout, r=alexcrichtonManish Goregaokar-1/+1
r? @aturon cc @alexcrichton
2015-03-25Always properly copy values into bindings when mutating the match discriminantBjörn Steinbrink-2/+32
The reassignment checker effectively only checks whether the last assignment in a body affects the discriminant, but it should of course check all the assignments. Fixes #23698
2015-03-25Rollup merge of #23664 - bluss:std-docs, r=steveklabnikManish Goregaokar-66/+57
Main motivation was to update docs for the removal or "demotion" of certain extension traits. The update to the slice docs was larger, since the text was largely outdated.
2015-03-25Rollup merge of #23617 - steveklabnik:gh23564, r=ManishearthManish Goregaokar-0/+2
Fixes #23564
2015-03-25Ignore some tests on aarch64Sae-bom Kim-1/+5
2015-03-25Auto merge of #23670 - cmr:vec-push-slowpath, r=pcwaltonbors-9/+16
Makes Vec::push considerably smaller: 25 instructions, rather than 42, on x86_64.
2015-03-25unbreak bitrig/openbsd build after 8389253dSébastien Marie-2/+2
`PathBuf::new` have been changed. Use `PathBuf::from` instead. Apply the same change for freebsd too, while here.
2015-03-25Fix ICE on SIMD overflow checkingJihyun Yu-0/+25
Disable overflow checking on SIMD operations, fix #23037
2015-03-24[iOS] Fallout from 8389253Tamir Duberstein-1/+1
2015-03-24Test fixes and rebase conflicts, round 2Alex Crichton-11/+17
2015-03-24rollup merge of #23674: nagisa/fallout-1Alex Crichton-7/+7
2015-03-24Test fixes and rebase conflicts, round 1Alex Crichton-0/+2
2015-03-25Fix some fallout in librustdocSimonas Kazlauskas-7/+7
2015-03-24rollup merge of #23671: steveklabnik/doc_std_cloneAlex Crichton-0/+8
2015-03-24rollup merge of #23638: pnkfelix/fsk-reject-specialized-dropsAlex Crichton-63/+465
Reject specialized Drop impls. See Issue #8142 for discussion. This makes it illegal for a Drop impl to be more specialized than the original item. So for example, all of the following are now rejected (when they would have been blindly accepted before): ```rust struct S<A> { ... }; impl Drop for S<i8> { ... } // error: specialized to concrete type struct T<'a> { ... }; impl Drop for T<'static> { ... } // error: specialized to concrete region struct U<A> { ... }; impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement struct V<'a,'b>; impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement ``` Due to examples like the above, this is a [breaking-change]. (The fix is to either remove the specialization from the `Drop` impl, or to transcribe the requirements into the struct/enum definition; examples of both are shown in the PR's fixed to `libstd`.) ---- This is likely to be the last thing blocking the removal of the `#[unsafe_destructor]` attribute. Fix #8142 Fix #23584
2015-03-24rollup merge of #23546: alexcrichton/hyphensAlex Crichton-145/+144
The compiler will now issue a warning for crates that have syntax of the form `extern crate "foo" as bar`, but it will still continue to accept this syntax. Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist in the transition period as well. This patch will land hopefully in tandem with a Cargo patch that will start translating all crate names to have underscores instead of hyphens. cc #23533
2015-03-24rustc: Add support for `extern crate foo as bar`Alex Crichton-145/+144
The compiler will now issue a warning for crates that have syntax of the form `extern crate "foo" as bar`, but it will still continue to accept this syntax. Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist in the transition period as well. This patch will land hopefully in tandem with a Cargo patch that will start translating all crate names to have underscores instead of hyphens. cc #23533