Commit Graph

52148 Commits

Author SHA1 Message Date
Aaron Turon
736603424e Fix existing comment typo. 2016-03-14 15:04:33 -07:00
Alex Crichton
158b854fb7 linkchecker: Fix path checks on Windows 2016-03-14 14:56:49 -07:00
Alex Crichton
8cd1c17d90 rustbuild: Refactor stage arguments away
The facet of a stage is rarely relevant when running a tool or building
something, it's all a question of what stage the *compiler* is built in. We've
already got a nice handy `Compiler` structure to carry this information, so
let's use it!

This refactors the signature of the `Build::cargo` function two ways:

1. The `stage` argument is removed, this was just duplicated with the `compiler`
   argument's stage field.
2. The `target` argument is now required. This was a bug where if the `--target`
   flag isn't passed then the snapshot stage0 compiler is always used, so we
   won't pick up any changes.

Much of the other changes in this commit are just propagating these decisions
outwards. For example many of the `Step` variants no longer have a stage
argument as they're baked into the compiler.
2016-03-14 14:56:49 -07:00
Alex Crichton
4a917e050d rustbuild: Use tool_cmd() instead of tool()
This sets up the dynamic loader path for dylibs required, so should fix the MSVC
build right now.
2016-03-14 14:56:49 -07:00
Alex Crichton
6ccf03c843 rustbuild: Fix 32-bit Windows build
Unfortunately on i686-pc-windows-gnu LLVM's answer to `--host-target` is
`x86_64-pc-windows-gnu` even though we're building in a 32-bit shell as well as
compiling 32-bit libraries. For now use Cargo's `HOST` environment variable to
determine whether we're doing a cross compilation or not.
2016-03-14 14:56:48 -07:00
bors
6d215fe04c Auto merge of #32169 - mitaa:anon-tip, r=nrc
Allow custom filenames for anonymous inputs

This came out of #29253 but doesn't fix it.

I thought it might be worth merging on its own nonetheless.
2016-03-14 14:44:55 -07:00
ggomez
b2fd882972 Add E0522 long error explanation 2016-03-14 22:29:57 +01:00
ggomez
a2e4ab2ab2 Forbid creation of lang item from user code 2016-03-15 15:49:08 +01:00
Alex Burka
8355389e3e derive: improve hygiene for type parameters (see #2810)
When deriving Hash, RustcEncodable and RustcDecodable, the syntax extension
needs a type parameter to use in the inner method. They used to use __H, __S
and __D respectively. If this conflicts with a type parameter already declared
for the item, bad times result (see the test). There is no hygiene for type
parameters, but this commit introduces a better heuristic by concatenating the
names of all extant type parameters (and prepending __H).
2016-03-14 16:59:55 -04:00
Alex Burka
fd4fa62885 derive: remove most __ strings FIXME(#2810)
This changes local variable names in all derives to remove leading
double-underscores. As far as I can tell, this doesn't break anything
because there is no user code in these generated functions except for
struct, field and type parameter names, and this doesn't cause shadowing
of those. But I am still a bit nervous.
2016-03-14 16:49:18 -04:00
Alex Burka
4982f91346 fix FIXME(#6449) in #[derive(PartialOrd, Ord)]
This replaces some `if`s with `match`es. This was originally not possible
because using a global path in a match statement caused a "non-constant
path in constant expr" ICE. The issue is long since closed, though you still
hit it (as an error now, not an ICE) if you try to generate match patterns
using pat_lit(expr_path). But it works when constructing the patterns more
carefully.
2016-03-14 16:49:12 -04:00
Alex Burka
a09a41928f derive: emit intrinsics::unreachable for impls on empty enums
fixes #31574
2016-03-14 16:47:04 -04:00
Alex Burka
c433b703ea refactor derive-no-std test, add empty struct/enum 2016-03-14 16:46:54 -04:00
Stu Black
2f454be47a Expose the key of Entry variants for HashMap and BTreeMap. 2016-03-14 16:35:08 -04:00
mitaa
ea7cf904b0 Allow custom filenames for anonymous inputs 2016-03-14 20:03:43 +01:00
Corey Farwell
8f008ba4ee Clean up cloning logic in compiletest.rs. 2016-03-14 14:43:16 -04:00
bors
01118928fc Auto merge of #30587 - oli-obk:eager_const_eval2, r=nikomatsakis
typestrong const integers

~~It would be great if someone could run crater on this PR, as this has a high danger of breaking valid code~~ Crater ran. Good to go.

----

So this PR does a few things:

1. ~~const eval array values when const evaluating an array expression~~
2. ~~const eval repeat value when const evaluating a repeat expression~~
3. ~~const eval all struct and tuple fields when evaluating a struct/tuple expression~~
4. remove the `ConstVal::Int` and `ConstVal::Uint` variants and replace them with a single enum (`ConstInt`) which has variants for all integral types
  * `usize`/`isize` are also enums with variants for 32 and 64 bit. At creation and various usage steps there are assertions in place checking if the target bitwidth matches with the chosen enum variant
5. enum discriminants (`ty::Disr`) are now `ConstInt`
6. trans has its own `Disr` type now (newtype around `u64`)

This obviously can't be done without breaking changes (the ones that are noticable in stable)
We could probably write lints that find those situations and error on it for a cycle or two. But then again, those situations are rare and really bugs imo anyway:

```rust
let v10 = 10 as i8;
let v4 = 4 as isize;
assert_eq!(v10 << v4 as usize, 160 as i8);
 ```

stops compiling because 160 is not a valid i8

```rust
struct S<T, S> {
    a: T,
    b: u8,
    c: S
}
let s = S { a: 0xff_ff_ff_ffu32, b: 1, c: 0xaa_aa_aa_aa as i32 };
```

stops compiling because `0xaa_aa_aa_aa` is not a valid i32

----

cc @eddyb @pnkfelix

related: https://github.com/rust-lang/rfcs/issues/1071
2016-03-14 11:38:23 -07:00
bors
d19f1b6299 Auto merge of #32233 - Amanieu:volatile_store, r=eddyb
Fix LLVM assert with write_volatile

Fixes #29663
2016-03-14 08:32:45 -07:00
bors
af8f85cc39 Auto merge of #32232 - jonas-schievink:issue31511, r=eddyb
Give a more accurate error on thin-to-fat ptr cast

Fixes #31511
2016-03-14 05:44:24 -07:00
Oliver Schneider
f665c399a0 rustbuild 2016-03-14 09:29:18 +01:00
bors
170f4708bb Auto merge of #32231 - ruud-v-a:avx-cmp-blend, r=alexcrichton
Define AVX compare and blend intrinsics

This defines the following intrinsics:

 * `_mm256_blendv_pd`
 * `_mm256_blendv_ps`
 * `_mm256_cmp_pd`
 * `_mm256_cmp_ps`

I verified these locally.
2016-03-14 00:30:53 -07:00
Abhishek Chanda
aa22b4e7c8 Add is_documentation for IPv6
This function returns true if the given IPv6 is reserved for
documentation. Also, reject this block in the is_global check
2016-03-13 18:56:20 -07:00
bors
211296ddab Auto merge of #32226 - andoriyu:patch-2, r=alexcrichton
Fix. FreeBSD snapshot

Previous snapshot was complied with avx2 instructions by accident.

Actual file: http://people.freebsd.org/~davide/rust/rust-stage0-2016-02-17-4d3eebf-freebsd-x86_64-f38991fbb81c1cd8d0bbda396f98f13a55b42804.tar.bz2

/cc @alexcrichton @dcci
2016-03-13 18:46:59 -07:00
bors
74b886ab14 Auto merge of #32211 - achanda:ipv6-global, r=alexcrichton
Reject unspecified IP from global

Also fixed the test
2016-03-13 16:53:09 -07:00
Jonas Schievink
be2698cb58 Fix test fallout 2016-03-13 20:35:04 +01:00
bors
d5880fff99 Auto merge of #32227 - jseyfried:fix_import_resolution_bug, r=alexcrichton
Fix import resolution bug

This fixes #32222, which was introduced in #31726.
2016-03-13 12:24:42 -07:00
Amanieu d'Antras
86fd5a02e7 Fix LLVM assert with write_volatile 2016-03-13 19:01:35 +01:00
bors
ce943eb369 Auto merge of #32184 - ollie27:win_stdout, r=alexcrichton
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-13 09:27:17 -07:00
Jonas Schievink
298b51e982 Give a more accurate error on thin-to-fat ptr cast
Fixes #31511
2016-03-13 17:03:31 +01:00
bors
1c8b245928 Auto merge of #32229 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #32164, #32179, #32212, #32218
- Failed merges:
2016-03-13 07:30:14 -07:00
Ruud van Asseldonk
a394d50490 Regenerate x86 platform intrinsics
The exact command used was:

    $ cd src/etc/platform-intrinsics/x86
    $ python2 ../generator.py --format compiler-defs -i info.json   \
      sse.json sse2.json sse3.json ssse3.json sse41.json sse42.json \
      avx.json avx2.json fma.json                                   \
      > ../../../librustc_platform_intrinsics/x86.rs
2016-03-13 15:09:46 +01:00
Ruud van Asseldonk
e1489caf0b Define AVX blend intrinsics
This defines the `_mm256_blendv_pd` and `_mm256_blendv_ps` intrinsics.
The `_mm256_blend_pd` and `_mm256_blend_ps` intrinsics are not available
as LLVM intrinsics. In Clang they are implemented using the
shufflevector builtin.

Intel reference: https://software.intel.com/en-us/node/524070.
2016-03-13 15:04:14 +01:00
Ruud van Asseldonk
ddfe9b6d7d Define AVX comparison intrinsics
This defines `_mm256_cmp_pd` and `_mm256_cmp_ps`.

Intel reference: https://software.intel.com/en-us/node/524075.
2016-03-13 15:04:14 +01:00
Manish Goregaokar
2e21ff1a9d Rollup merge of #32218 - cantino:minor_book_typo_fixes, r=steveklabnik
Fix minor typos in doc.rust-lang.org/book

I've made a few typo and grammar fixes as I've been working through the book.
2016-03-13 19:33:27 +05:30
Manish Goregaokar
d7f7ab9646 Rollup merge of #32212 - Manishearth:ice-cu, r=eddyb
Don't allow values for codegen-units less than 1

r? @eddyb

fixes #32191
2016-03-13 19:33:27 +05:30
Manish Goregaokar
07b9e89c5a Rollup merge of #32179 - srinivasreddy:remove_int_suffix, r=steveklabnik
Removed integer suffixes in libsyntax crate
2016-03-13 19:33:27 +05:30
Manish Goregaokar
511cb30619 Rollup merge of #32164 - nikomatsakis:fewer-errors, r=eddyb
Do not report errors from regionck if other errors were already reported

Do not report errors from regionck if other errors were already reported during the lifetime of this inferencer. Fixes #30580.

r? @arielb1
2016-03-13 19:33:27 +05:30
bors
c21644ad16 Auto merge of #31916 - nagisa:mir-passmgr-2, r=arielb1
Add Pass manager for MIR

A new PR, since rebasing the original one (https://github.com/rust-lang/rust/pull/31448) properly was a pain. Since then there has been several changes most notable of which:

1. Removed the pretty-printing with `#[rustc_mir(graphviz/pretty)]`, mostly because we now have `--unpretty=mir`, IMHO that’s the direction we should expand this functionality into;
2. Reverted the infercx change done for typeck, because typeck can make an infercx for itself by being a `MirMapPass`

r? @nikomatsakis
2016-03-13 05:33:28 -07:00
Jeffrey Seyfried
d1020143b6 Add regression test for #32222 2016-03-13 10:46:33 +00:00
Jeffrey Seyfried
9ca3ff16ad Fixes #32222 2016-03-13 10:46:19 +00:00
Jeffrey Seyfried
fa18403a2f Refactor out methods NameResolution::increment_outstanding_references and
`NameResolution::decrement_outstanding_references`.
2016-03-13 10:45:08 +00:00
bors
db6dd8e4fe Auto merge of #32182 - bluss:string-from-is-str-owned, r=alexcrichton
Call str::to_owned in String::from and uninline it

Call str::to_owned in String::from and uninline it

These methods were already effectively equal, but now one calls
the other, and neither is marked inline.
String::from does not need to be inlined, it can be without it just like
str::to_owned and String::clone are.

Fixes #32163
2016-03-13 03:40:14 -07:00
Ulrik Sverdrup
ec39a76a3e Call str::to_owned in String::from and uninline it
String::from does not need to be inlined, it can be without it just like
str::to_owned and String::clone are.
2016-03-13 09:36:02 +01:00
Andrey Cherkashin
4e4c0d7b5a Fix. FreeBSD snapshot
Previous snapshot was complied with avx2 instructions by accident.

Actual file: http://people.freebsd.org/~davide/rust/rust-stage0-2016-02-17-4d3eebf-freebsd-x86_64-f38991fbb81c1cd8d0bbda396f98f13a55b42804.tar.bz2
2016-03-12 22:02:39 -08:00
bors
06074ac004 Auto merge of #32141 - jseyfried:fix_resolution_in_lexical_scopes, r=nikomatsakis
Fix name resolution in lexical scopes

Currently, `resolve_item_in_lexical_scope` does not check the "ribs" (type parameters and local variables). This can allow items that should be shadowed by type parameters to be named.

For example,
```rust
struct T { i: i32 }
fn f<T>() {
    let t = T { i: 0 }; // This use of `T` resolves to the struct, not the type parameter
}

mod Foo {
    pub fn f() {}
}
fn g<Foo>() {
    Foo::f(); // This use of `Foo` resolves to the module, not the type parameter
}
```

This PR changes `resolve_item_in_lexical_scope` so that it fails when the item is shadowed by a rib (fixes #32120).
This is a [breaking-change], but it looks unlikely to cause breakage in practice.

r? @nikomatsakis
2016-03-12 21:55:14 -08:00
bors
3e05371c13 Auto merge of #32217 - alexcrichton:fix-make-dist, r=brson
mk: Fix `make dist`

With the movement of the erro-index-generator and rustbook, need to update the
rules in `make dist`.
2016-03-12 18:58:15 -08:00
bors
531b928ea6 Auto merge of #32140 - ruud-v-a:avx-intrinsics, r=alexcrichton
Add AVX broadcast and conversion intrinsics

This adds the following intrinsics:

 * `_mm256_broadcast_pd`
 * `_mm256_broadcast_ps`
 * `_mm256_cvtepi32_pd`
 * `_mm256_cvtepi32_ps`
 * `_mm256_cvtpd_epi32`
 * `_mm256_cvtpd_ps`
 * `_mm256_cvtps_epi32`
 * `_mm256_cvtps_pd`
 * `_mm256_cvttpd_epi32`
 * `_mm256_cvttps_epi32`

The "avx" codegen feature must be enabled to use these.
2016-03-12 16:18:34 -08:00
Abhishek Chanda
534bd19d25 Reject unspecified and loopback IP from global 2016-03-12 14:51:45 -08:00
bors
a2c56de764 Auto merge of #32112 - alexcrichton:fix-issues, r=aturon
std: Fix tracking issues and clean deprecated APIs

This PR fixes up a number of discrepancies found with tracking issues (some closed, some needed new ones, etc), and also cleans out all pre-1.8 deprecated APIs. The big beast here was dealing with `std::dynamic_lib`, and via many applications of a large hammer it's now out of the standard library.
2016-03-12 13:21:06 -08:00
Andrew Cantino
56ab2a1cde Fix minor typos in doc.rust-lang.org/book 2016-03-12 12:35:34 -08:00