Commit Graph

51350 Commits

Author SHA1 Message Date
Aaron Turon
4b4c6fd434 Add regression test for duplicate items in overlapping impls. Note that a regression test already exists for *non*overlapping impls. 2016-03-11 10:59:40 -08:00
Aaron Turon
21df87f515 Forbid items with the same name being defined in overlapping inherent
impl blocks.

For example, the following is now correctly illegal:

```rust
struct Foo;

impl Foo {
    fn id() {}
}

impl Foo {
    fn id() {}
}
```

"Overlapping" here is determined the same way it is for traits (and in
fact shares the same code path): roughly, there must be some way of
substituting any generic types to unify the impls, such that none of the
`where` clauses are provably unsatisfiable under such a unification.

Closes #22889
2016-03-11 10:59:39 -08:00
Aaron Turon
9cc3bfcceb Introduce ImplHeader
This commit introduces the idea of an "impl header", which consists of
everything outside the impl body: the Self type, the trait
reference (when applicable), and predicates from `where` clauses. This
type is usable with the type folding machinery, making it possible to
work with impl headers at a higher and more generic level.
2016-03-11 10:36:28 -08:00
Andrey Cherkashin
e2b055c74a Add FreeBSD amd64 snapshot
Snapshot itself: https://github.com/dhuseby/rust-manual-snapshots/pull/3
2016-03-11 10:12:42 -08:00
bors
5807fbbfde Auto merge of #32134 - jseyfried:forbid_type_alias_as_module, r=nikomatsakis
Forbid glob-importing from a type alias

This PR forbids glob-importing from a type alias or trait (fixes #30560):
```rust
type Alias = ();
use Alias::*; // This is currently allowed but shouldn't be
```

This is a [breaking-change]. Since the disallowed glob imports don't actually import anything, any breakage can be fixed by removing the offending glob import.

r? @alexcrichton
2016-03-11 09:26:47 -08:00
bors
aeb85a9533 Auto merge of #32133 - alexcrichton:linkchecker, r=brson
Add a link validator to rustbuild

This commit was originally targeted at just adding a link checking script to the rustbuild system. This ended up snowballing a bit to extend rustbuild to be amenable to various tools we have as part of the build system in general.

There's a new `src/tools` directory which has a number of scripts/programs that are purely intended to be used as part of the build system and CI of this repository. This is currently inhabited by rustbook, the error index generator, and a new linkchecker script added as part of this PR. I suspect that more tools like compiletest, tidy scripts, snapshot scripts, etc will migrate their way into this directory over time.

The commit which adds the error index generator shows the steps necessary to add new tools to the build system, namely:

1. New steps are defined for building the tool and running the tool
2. The dependencies are configured
3. The steps are implemented

In terms of the link checker, these commits do a few things:

* A new `src/tools/linkchecker` script is added. This will read an entire documentation tree looking for broken relative links (HTTP links aren't followed yet).
* A large number of broken links throughout the documentation were fixed. Many of these were just broken when viewed from core as opposed to std, but were easily fixed.
* A few rustdoc bugs here and there were fixed
2016-03-11 04:38:04 -08:00
Oliver Schneider
08c448a7d3 undo changes to run-pass tests that aren't errors anymore 2016-03-11 09:44:11 +01:00
bors
40c85cd8ae Auto merge of #32034 - alexcrichton:old-x86-msvc, r=aturon
rustc: Add an i586-pc-windows-msvc target

Similarly to #31629 where an i586-unknown-linux-gnu target was added, there is
sometimes a desire to compile for x86 Windows as well where SSE2 is disabled.
This commit mirrors the i586-unknown-linux-gnu target and simply adds a variant
for Windows as well.

This is motivated by a recent [Gecko bug][ff] where crashes were seen on 32-bit
Windows due to users having CPUs that don't support SSE2 instructions. It was
requested that we could have non-SSE2 builds of the standard library available
so they could continue to use vanilla releases and nightlies.

[ff]: https://bugzilla.mozilla.org/show_bug.cgi?id=1253202
2016-03-10 22:47:49 -08:00
bors
2b9438a4ec Auto merge of #32121 - GuillaumeGomez:help_e0514, r=cmr
Add help for E0514

I fixed #30622.

r? @arielb1
2016-03-10 20:37:04 -08:00
srinivasreddy
e1cc628549 cleanup int suffixes in libcoretest 2016-03-11 08:42:56 +05:30
bors
c6a6053112 Auto merge of #32102 - alexcrichton:assert-safe-closures, r=aturon
std: Add impl of FnOnce to AssertRecoverSafe

This was originally intended, but forgot to land by accident!

cc #27719
2016-03-10 17:52:12 -08:00
Oliver Middleton
6993939242 Simplify Windows stdout/stderr 2016-03-10 23:59:28 +00:00
bors
c9629d61c6 Auto merge of #32117 - mitaa:patch-3, r=alexcrichton
rustdoc: correct src-link url

It would have been nice for htmldocck to catch this, especially since there are rustdoc tests specifically for checking src-links.

fixes #32113
2016-03-10 14:57:31 -08:00
Oliver Middleton
8427efaab3 Fixup stout/stderr on Windows
WriteConsoleW can fail if called with a large buffer so we need to slice
any stdout/stderr output.
However the current slicing has a few problems:
 1. It slices by byte but still expects valid UTF-8.
 2. The slicing happens even when not outputting to a console.
 3. panic! output is not sliced.

This fixes these issues by moving the slice to right before
WriteConsoleW and slicing on a char boundary.
2016-03-10 21:15:23 +00:00
Ulrik Sverdrup
bfffe6d9d2 Clarify doc for slice slicing (Index impls)
This is a follow up for PR #32099 and #32057
2016-03-10 21:36:43 +01:00
srinivasreddy
fe541b168e removed suffixes for librustc_front 2016-03-11 01:32:03 +05:30
bors
c1fb50f5d3 Auto merge of #32107 - Stebalien:partial-write, r=alexcrichton
Never return an error after a partial write

If LineWriter fails to flush, return the number of bytes written instead
of an error.

Fixes #32085
2016-03-10 11:56:29 -08:00
srinivasreddy
266c417071 removed integer constants in librustc_typeck 2016-03-11 00:41:25 +05:30
Noah
4d476693f0 Update getting-started.md
In `rustc 1.7.0` the message that is displayed is now `Rust is ready to roll.`
2016-03-10 11:34:42 -06:00
bors
4b87655e69 Auto merge of #32101 - SimonSapin:patch-11, r=alexcrichton
Add info in `rustdoc --passes list`

CC @mitaa, https://github.com/rust-lang/rust/pull/32055/files#r55205006
2016-03-10 07:05:05 -08:00
Oliver Schneider
fcee002edf break enum variant discriminant inference in case of 32-bit
`assert_eq!(-9223372036854775808isize as u64, 0x8000000000000000);`

fails on 32 bit and succeeds on 64 bit. These commits don't change that behavior.

The following worked before my changes, because the discriminant was
always processed as `u64`.
Now it fails, because the discriminant of `Bu64` is now `0` instead of `-9223372036854775808`. This is more in line with the above assertion's code, since
`-9223372036854775808isize as u64` on 32 bit yielded `0`.

```rust
enum Eu64 {
    Au64 = 0,
    Bu64 = 0x8000_0000_0000_0000
}
```
2016-03-10 14:20:53 +01:00
bors
6d6ae1ffe6 Auto merge of #32173 - steveklabnik:rollup, r=steveklabnik
Rollup of 8 pull requests

- Successful merges: #31830, #32091, #32125, #32136, #32147, #32148, #32149, #32150
- Failed merges:
2016-03-10 05:01:03 -08:00
Craig M. Brandenburg
3d16321870 Spell fixes for std::ffi doc comments 2016-03-10 05:14:00 -07:00
Oliver Schneider
d4d6260ef1 don't be a breaking change, even in presence of overflowing literals 2016-03-10 12:50:13 +01:00
Oliver Schneider
7003ed3fa7 fix rustdoc 2016-03-10 12:50:13 +01:00
Oliver Schneider
6992280f00 simplify const path lookup for constants and associated constants 2016-03-10 12:50:13 +01:00
Oliver Schneider
a48bd17183 prefer the (associated) const's type over the type hint 2016-03-10 12:50:13 +01:00
Oliver Schneider
bba1596c71 also print the expected type in the error message 2016-03-10 12:50:13 +01:00
Oliver Schneider
54b15c7160 the type hint given during a cast operation is just a soft hint 2016-03-10 12:50:13 +01:00
Oliver Schneider
6ee60037f9 infer integral types in presence of a type hint 2016-03-10 12:50:13 +01:00
Oliver Schneider
41f11d95c7 don't guess const fn argument types 2016-03-10 12:50:12 +01:00
Oliver 'ker' Schneider
0d13231a4c const eval failures aren't fatal, simply return a dummy instead 2016-03-10 12:50:12 +01:00
Oliver Schneider
7bde56e149 typestrong constant integers 2016-03-10 12:50:12 +01:00
Nathan Kleyn
da4fda44e7 Remove unnecessary mut in docs causing test failures. 2016-03-10 11:40:31 +00:00
Steve Klabnik
4f8d0291f3 Rollup merge of #32150 - steveklabnik:gh20213, r=bluss
Remove inaccurate claim about inline assembly

It's not like GCC's.

Fixes #20213
2016-03-10 14:01:54 +03:00
Steve Klabnik
fc9bc7ac3b Rollup merge of #32149 - steveklabnik:gh31628, r=bluss
Add other primitive types to the reference

Fixes #31628
2016-03-10 14:01:54 +03:00
Steve Klabnik
c5ec055d1f Rollup merge of #32148 - steveklabnik:gh31912, r=apasel422
Small grammar fix in Guessing Game

When it was Option.expect(), there was an .ok().expect(), but now that it uses Result.expect(), there's only one method, not two.

Fixes #31912
2016-03-10 14:01:54 +03:00
Steve Klabnik
76bcf6430f Rollup merge of #32147 - steveklabnik:gh31950, r=bluss
Clarify that try_unwrap needs exactly one

Fixes #31950
2016-03-10 14:01:54 +03:00
Steve Klabnik
d6c4b53df1 Rollup merge of #32136 - nathankleyn:improve-docs-for-btreeset, r=steveklabnik
Add missing documentation examples for BTreeSet.

As part of the ongoing effort to document all methods with examples,
this commit adds the missing examples for the `BTreeSet` collection
type.

This is part of issue #29348.

r? @steveklabnik
2016-03-10 14:01:53 +03:00
Steve Klabnik
3820d38e90 Rollup merge of #32125 - pyfisch:patch-2, r=steveklabnik
Remove final note from testing chapter.

The information that documentation tests cannot be run in binary crates is already given at the beginning of the section.
2016-03-10 14:01:53 +03:00
Steve Klabnik
3e764efef7 Rollup merge of #32091 - dirk:dirk/siphasher-docs-clarification, r=alexcrichton
Clarify documentation of hash::SipHasher

The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links.

Fixes #32043.

r? @sfackler
2016-03-10 14:01:53 +03:00
Steve Klabnik
09e08bac93 Rollup merge of #31830 - frewsxcv:assoc-func, r=steveklabnik
Prefer 'associated function' over 'static method' in msg.

TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.
2016-03-10 14:01:53 +03:00
bors
25a23271f4 Auto merge of #32100 - SimonSapin:patch-6, r=alexcrichton
"can be built on Ref::map"… how?

Now that `std::cell::Ref::filter_map` and `RefMut::filter_map` are deprecated, using them gives a warning like:
```
script/dom/element.rs:754:9: 754:24 warning: use of deprecated item: can be built on Ref::map, #[warn(deprecated)] on by default
```

But it’s not at all obvious *how* the functionality can be built on `Ref::map`. This PR adds to the warning message a crates.io URL for a crate that does.
2016-03-10 02:45:14 -08:00
Niko Matsakis
0ddc17d5bb Add comment explaining purpose of test 2016-03-10 05:21:00 -05:00
Corey Farwell
410333be64 Differentiate "line" and "line number" variable names. 2016-03-09 23:36:39 -08:00
Corey Farwell
e1048b5ab6 Prefer Option::expect over explicit unwrapping. 2016-03-09 23:24:50 -08:00
bors
3ac4076ac0 Auto merge of #32097 - jseyfried:fix_resolution_regression, r=nikomatsakis
Fix a regression in import resolution

This fixes #32089 (caused by #31726) by deducing that name resolution has failed (as opposed to being determinate) in more cases.

r? @nikomatsakis
2016-03-09 22:41:48 -08:00
Corey Farwell
d9dba7699f Prefer 'associated function' over 'static method' in msg.
TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.
2016-03-09 21:29:39 -08:00
bors
bcda58f491 Auto merge of #31710 - eddyb:reify, r=nikomatsakis
Distinguish fn item types to allow reification from nothing to fn pointers.

The first commit is a rebase of #26284, except for files that have moved since.

This is a [breaking-change], due to:
* each FFI function has a distinct type, like all other functions currently do
* all generic parameters on functions are recorded in their item types, e.g.:
`size_of::<u8>` & `size_of::<i8>`'s types differ despite their identical signature.
* function items are zero-sized, which will stop transmutes from working on them

The first two cases are handled in most cases with the new coerce-unify logic,
which will combine incompatible function item types into function pointers,
at the outer-most level of if-else chains, match arms and array literals.

The last case is specially handled during type-checking such that transmutes
from a function item type to a pointer or integer type will continue to work for
another release cycle, but are being linted against. To get rid of warnings and
ensure your code will continue to compile, cast to a pointer before transmuting.
2016-03-09 20:16:20 -08:00
mitaa
7c983991d9 Remove feature(globs) since they are stable 2016-03-10 03:29:55 +01:00