Commit Graph

51867 Commits

Author SHA1 Message Date
Michael Woerister
32a2e9a8e1 Compute a salt from arguments passed via -Cmetadata. 2016-03-25 14:07:17 -04:00
Michael Woerister
c7e54d7279 Make library paths passed by compiletest tool absolute.
Otherwise, changing the current working directory can mess up runtime linking.
2016-03-25 14:07:17 -04:00
Michael Woerister
606c985a50 Make CrateStore::crate_name() return an InternedString to avoid unnecessary allocations. 2016-03-25 14:07:17 -04:00
Michael Woerister
5027a79279 Add missing entries for enum variants in trans::CrateContext::external_srcs. 2016-03-25 14:07:17 -04:00
Michael Woerister
6fdeecf62f CrateStore: Allow for custom def_id_to_string mappings in encode_type(). 2016-03-25 14:07:17 -04:00
bors
cf9274b727 Auto merge of #32407 - alexcrichton:netbsd-gcc-s-link, r=aturon
std: Link to gcc_s on NetBSD

Currently the nightlies we're producing fail when linking some C code into a
Rust application with the error message:

    libgcc_s.so.1: error adding symbols: DSO missing from command line

By linking `gcc_s` instead of `gcc` this error goes away. I haven't tested this
on NetBSD itself, but should help get the Linux cross-compile image moreso up
and working!
2016-03-25 11:00:01 -07:00
Brian Anderson
c7049f6450 Fix the name of the 'check-cargotest' step 2016-03-25 17:33:10 +00:00
Niko Matsakis
e539b74f54 use new visitor to erase regions 2016-03-25 13:10:45 -04:00
Alejandro Wainzinger
6ce63fb3f1 Add note on str being an unsized type in strings section of book. 2016-03-25 23:25:40 +09:00
Niko Matsakis
93e44432e1 check for both partialeq and eq 2016-03-25 10:02:56 -04:00
bors
64a13a4660 Auto merge of #31908 - jseyfried:disallow_shadowed_traits, r=nikomatsakis
Disallow methods from traits that are not in scope

This PR only allows a trait method to be used if the trait is in scope (fixes #31379).
This is a [breaking-change]. For example, the following would break:
```rust
mod foo {
    pub trait T { fn f(&self) {} }
    impl T for () {}
}

mod bar { pub use foo::T; }

fn main() {
    pub use bar::*;
    struct T; // This shadows the trait `T`,
    ().f() // making this an error.
}
```
r? @nikomatsakis
2016-03-25 05:03:13 -07:00
Niko Matsakis
7f661ec417 new tests for RFC #1445 2016-03-25 06:45:43 -04:00
Niko Matsakis
56ebf2b046 fallout in existing tests 2016-03-25 06:45:42 -04:00
Niko Matsakis
73b4f06b83 suppress duplicate lints 2016-03-25 06:45:42 -04:00
Niko Matsakis
f69eb8efbe issue a future-compat lint for constants of invalid type
This is a [breaking-change]: according to RFC #1445, constants used as
patterns must be of a type that *derives* `Eq`. If you encounter a
problem, you are most likely using a constant in an expression where the
type of the constant is some struct that does not currently implement
`Eq`. Something like the following:

```rust
struct SomeType { ... }
const SOME_CONST: SomeType = ...;

match foo {
    SOME_CONST => ...
}
```

The easiest and most future compatible fix is to annotate the type in
question with `#[derive(Eq)]` (note that merely *implementing* `Eq` is
not enough, it must be *derived*):

```rust
struct SomeType { ... }
const SOME_CONST: SomeType = ...;

match foo {
    SOME_CONST => ...
}
```

Another good option is to rewrite the match arm to use an `if`
condition (this is also particularly good for floating point types,
which implement `PartialEq` but not `Eq`):

```rust
match foo {
    c if c == SOME_CONST => ...
}
```

Finally, a third alternative is to tag the type with
`#[structural_match]`; but this is not recommended, as the attribute is
never expected to be stabilized. Please see RFC #1445 for more details.
2016-03-25 06:45:42 -04:00
Niko Matsakis
05baf645e4 do not overwrite spans as eagerly
this was required to preserve the span from
the #[structural_match] attribute -- but honestly
I am not 100% sure if it makes sense.
2016-03-25 06:44:14 -04:00
Niko Matsakis
99c2a6b335 modify #[deriving(Eq)] to emit #[structural_match]
to careful use of the span from deriving, we
can permit it in stable code if it derives from
deriving (not-even-a-pun intended)
2016-03-25 06:44:14 -04:00
Niko Matsakis
5bc2868060 make const_expr_to_pat fallible (but never have it actually fail) 2016-03-25 06:44:14 -04:00
bors
f1578d37dc Auto merge of #32428 - nikomatsakis:scopes-in-mir, r=nagisa
Scopes in mir

This PR adds scopes to MIR. There is a tree of scopes (each represented by a `ScopeId`). Every statement, variable, and terminator now has an associated scope and span.  It also adds a `-Z dump-mir` switch one can use to conveniently examine the MIR as optimizations proceed.

The intention is two-fold. First, to support MIR debug-info. This PR does not attempt to modify trans to make use of the scope information, however.

Second, in a more temporary capacity, to support the goal of moving regionck and borowck into the MIR. To that end, the PR also constructs a "scope auxiliary" table storing the extent of each span (this is kept separate from the main MIR, since it contains node-ids) and the dom/post-dom of the region in the graph where the scope occurs. When we move to non-lexical lifetimes, I expect this auxiliary information to be discarded, but that is still some ways in the future (requires, at minimum, an RFC, and there are some thorny details to work out -- though I've got an in-progress draft).

Right now, I'm just dropping this auxiliary information after it is constructed. I was debating for some time whether to add some sort of sanity tests, but decided to just open this PR instead, because I couldn't figure out what such a test would look like (and we don't have independent tests for this today beyond the regionck and borrowck tests).

I'd prefer not to store the auxiliary data into any kind of "per-fn" map. Rather, I'd prefer that we do regionck/borrowck/whatever-else immediately after construction -- that is, we build the MIR for fn X and immediately thereafter do extended correctness checking on it. This will reduce peak memory usage and also ensure that the auxiliary data doesn't exist once optimizations begin. It also clarifies the transition point where static checks are complete and MIR can be more freely optimized.

cc @rust-lang/compiler @nagisa
2016-03-24 23:12:57 -07:00
David Henningsson
78495d5082 Fix unsound behaviour with null characters in thread names (issue #32475)
Previously, the thread name (&str) was converted to a CString in the
new thread, but outside unwind::try, causing a panic to continue into FFI.

This patch changes that behaviour, so that the panic instead happens
in the parent thread (where panic infrastructure is properly set up),
not the new thread.

This could potentially be a breaking change for architectures who don't
support thread names.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-03-25 06:14:03 +01:00
bors
40deb279a8 Auto merge of #32396 - nodakai:range-contains, r=alexcrichton
Add core::ops::Range*::contains() as per rust-lang/rust#32311
2016-03-24 19:38:43 -07:00
Vadim Petrochenkov
b418cd2306 Cleanup
+ Fix a comment and add a test based on it
2016-03-25 00:41:09 +03:00
Vadim Petrochenkov
77f033bac1 Lift the restriction on reusing names of primitive types 2016-03-25 00:41:09 +03:00
Vadim Petrochenkov
8d4b1d1cf3 Introduce name resolution fallback for primitive types 2016-03-25 00:41:09 +03:00
Steve Klabnik
7124ea4f18 remove broken config
Fixes #32412
2016-03-24 17:27:15 -04:00
bors
d7a71687ef Auto merge of #32346 - nikomatsakis:no-erased-regions, r=eddyb
Remove `ErasedRegions` from substs

This commit removes the `ErasedRegions` enum from `Substs`. Instead, in trans, we just generate a vector of `ReStatic` of suitable length. The goal is both general cleanup and to help pave the way for a glorious future where erasure is used in type check.

r? @eddyb

One concern: might be nice to do some profiling. Not sure the best way to do that. Perhaps I'll investigate running nrc's test suite locally.
2016-03-24 14:22:26 -07:00
Niko Matsakis
13877ac442 make available monomorphizations shared by CGU
The current setup means that all generics are local to a codegen-unit,
which means massive duplication.
2016-03-24 14:56:02 -04:00
Doug Goldstein
ed28247926 configure: update required LLVM version
Rust 1.7.0 and newer appears to require LLVM 3.6.0 or newer when
building against a version that's out of the tree with the --llvm-root
flag.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-03-24 13:11:08 -05:00
Niko Matsakis
c5d74be4ed remove empty_substs_for_node_id 2016-03-24 14:01:28 -04:00
Niko Matsakis
f3ac50927a remove ErasedRegions from substitutions
This hack has long since outlived its usefulness; the transition to
trans passing around full substitutions is basically done. Instead of
`ErasedRegions`, just supply substitutions with a suitable number of
`'static` entries, and invoke `erase_regions` when needed (the latter of
which we already do).
2016-03-24 14:01:28 -04:00
Niko Matsakis
c74339052d rewrite foreign types lint not to trawl the HIR
It no longer reads from `ast_ty_to_ty_cache`, which was very wrong. It
also correctly handles higher-ranked regions.
2016-03-24 14:01:28 -04:00
Tshepang Lekhonkhobe
2c48214a1b doc: remove needless bindings 2016-03-24 19:58:43 +02:00
bors
dcfb8d72e9 Auto merge of #32465 - steveklabnik:rollup, r=steveklabnik
Rollup of 6 pull requests

- Successful merges: #32276, #32416, #32452, #32459, #32462, #32464
- Failed merges:
2016-03-24 09:25:02 -07:00
Steve Klabnik
b2dfb7c0a2 Rollup merge of #32464 - GuillaumeGomez:patch-6, r=steveklabnik
Improve some Option code example

Part of #29366.

r? @steveklabnik
2016-03-24 10:37:24 -04:00
Steve Klabnik
bce02a207a Rollup merge of #32462 - tclfs:patch-1, r=steveklabnik
Docs: some tiny corrections

TNT->`tnt`
firecracker->`firecracker`
2016-03-24 10:37:24 -04:00
Steve Klabnik
38c6593592 Rollup merge of #32459 - nrc:json-err-text, r=nikomatsakis
Include source text in JSON errors
2016-03-24 10:37:24 -04:00
Steve Klabnik
a3b9b42d44 Rollup merge of #32452 - GuillaumeGomez:patch-5, r=steveklabnik
Add code examples for libstd/time

Fixes #29379.

r? @steveklabnik
2016-03-24 10:37:24 -04:00
Steve Klabnik
7a38ac8e87 Rollup merge of #32416 - GuillaumeGomez:patch-3, r=steveklabnik
Add doc example to clone trait

Fixes #29346.

r? @steveklabnik
2016-03-24 10:37:23 -04:00
Steve Klabnik
87aee45988 Rollup merge of #32276 - brson:doc, r=alexcrichton
doc: Stdin is not writable
2016-03-24 10:37:23 -04:00
Niko Matsakis
091a00797e pacify the merciless tidy 2016-03-24 09:23:15 -04:00
Guillaume Gomez
b922d1a405 Improve some Option code example 2016-03-24 13:24:39 +01:00
Niko Matsakis
ed7c30b888 rework MIR visitor
We now visit more things (e.g., types) and also follow a deliberate
style designed to reduce omissions.
2016-03-24 06:23:59 -04:00
Tang Chenglong
ceaf5dfdc1 Docs: some tiny corrections
TNT->`tnt`
firecracker->`firecracker`
2016-03-24 14:49:40 +08:00
bors
dc1f6831eb Auto merge of #32219 - brson:lints, r=alexcrichton
Make warnings of renamed and removed lints themselves lints

This adds the `renamed_and_removed_lints` warning, defaulting
to the warning level.

Fixes #31141
2016-03-23 23:09:47 -07:00
Alex Burka
861644f2af address nits 2016-03-24 01:42:23 -04:00
Alex Burka
9f899a6659 error during parsing for malformed inclusive range
Now it is impossible for `...` or `a...` to reach HIR lowering
without a rogue syntax extension in play.
2016-03-24 01:42:23 -04:00
Alex Burka
9799cacba3 fatal error instead of ICE for impossible range during HIR lowering
End-less ranges (`a...`) don't parse but bad syntax extensions could
conceivably produce them. Unbounded ranges (`...`) do parse and are
caught here.

The other panics in HIR lowering are all for unexpanded macros, which
cannot be constructed by bad syntax extensions.
2016-03-24 01:33:31 -04:00
Alex Burka
cd80c1bb55 test errors for malformed inclusive ranges 2016-03-24 01:33:31 -04:00
Nick Cameron
180d6b55ca Tests 2016-03-24 15:54:22 +13:00
Nick Cameron
9757516f12 Include source text in JSON errors 2016-03-24 15:32:42 +13:00