Commit Graph

379 Commits

Author SHA1 Message Date
Niko Matsakis
41bca6dd76 Remove contraction. The contraction rules predated the notion of an
empty region, and they complicate region inference to no particular end.
They also lead in some cases to spurious errors like #29048 (though in
some cases these errors are helpful in tracking down missing
constraints).
2015-10-28 18:48:49 -04:00
Niko Matsakis
2d5b8b0f2d Disable MIR on beta/stable until we've resolved #29227 is resolved. 2015-10-26 15:05:35 -04:00
Niko Matsakis
b48b6eaf75 fix bug in hir,identified 2015-10-22 16:58:08 -04:00
Nick Cameron
401c80dab1 save-analysis: don't recompute crate name 2015-10-21 12:04:48 +13:00
Nick Cameron
a62a529eea review comments 2015-10-09 21:44:44 +13:00
Nick Cameron
2b4f28e531 Misc fixups 2015-10-09 11:53:42 +13:00
Nick Cameron
21205f4f9e Cache ids between lowering runs
So that lowering is reproducible
2015-10-09 11:53:42 +13:00
Nick Cameron
20083c1e1f Move for loop desugaring to lowering 2015-10-09 11:53:41 +13:00
Nick Cameron
56713a1684 Add a lowering context 2015-10-09 11:53:41 +13:00
Steve Klabnik
252c3838df Rollup merge of #28872 - iwillspeak:master, r=Manishearth
Currently the explain command line flag requires full error codes, complete with
the leading zeros and the E at the beginning. This commit changes that,
if you don't supply a full error code then the error number is padded
out to the required size and the E is added to the beginning.

This means that where previously you would need to write E0001, you can
now write 0001, 001, 01 or just 1 to refer to the same error.
2015-10-08 13:54:03 -04:00
Will Speak
5d01556183 Make --explain Handle Partial Error Codes
Currently the explain command requires full erorr codes, complete with
the leading zeros and the E at the beginning. This commit changes that,
if you don't supply a full erorr code then the error number is padded
out to the required size and the E is added to the beginning.

This means that where previously you would need to write E0001, you can
now write 0001, 001, 01 or jsut 1 to refer to the same error.
2015-10-07 11:59:51 +01:00
Niko Matsakis
24ee4b1f6c rename dump to mir_map, which seems more suitable 2015-10-06 12:37:43 -04:00
Niko Matsakis
810cf71a3c make mir map available to later passes (currently unused) 2015-10-06 12:35:53 -04:00
Niko Matsakis
dedde0bb5a do MIR construction after pattern evaluation for now to sidestep
various annoying edge cases
2015-10-04 21:08:32 -04:00
bors
ef07d7dd40 Auto merge of #28650 - sanxiyn:attr-usage, r=nrc
This is technically a [breaking-change].

Fix #2809.
Fix #22746.
2015-10-02 19:16:39 +00:00
bors
e650491f20 Auto merge of #28768 - alexcrichton:dep-info++, r=brson
This PR closes out #28716 and #28735 by making two changes to the compiler:

1. The `--emit` flag to the compiler now supports the ability to specify the output file name of a partuclar emit type. For example `--emit dep-info=bar.d,asm=foo.s,link` is now accepted.
2. The dep-info emission now emits a dummy target for all input file names to protect against deleted files.
2015-10-02 16:33:26 +00:00
Alex Crichton
1741962271 rustc: Emit phony targets for inputs in dep-info
This helps protect against files being deleted to ensure that `make` won't emit
errors.

Closes #28735
2015-10-02 09:33:06 -07:00
Seo Sanghyeon
61f5b2b0ca Check attribute usage 2015-10-03 00:01:49 +09:00
Niko Matsakis
5600c6282e move direct accesses of node to go through as_local_node_id, unless
they are being used as an opaque "position identifier"
2015-10-01 10:37:19 -04:00
Niko Matsakis
9ff4f57cd0 move job of creating local-def-ids to ast-map (with a few stragglers) 2015-10-01 10:28:28 -04:00
Alex Crichton
8c963c07a8 rustc: Support output filenames for each emit type
Currently the compiler supports the ability to emit multiple output types as
part of one compilation (e.g. asm, LLVM IR, bytecode, link, dep-info, etc). It
does not, however, support the ability to customize the output filename for each
of these output types. The `-o` flag is ignored if multiple emit types are
specified (and the compiler emits a warning about this).

Normally this doesn't matter too much, but in the case of `dep-info` it can lead
to a number of problems (e.g. see #28716). By allowing customization of the
output filename for each emit type we're able to solve the problems in that
issue.

This commit adds support for the `--emit` option to the compiler to look like:

    rustc foo.rs --emit dep-info=.deps/foo.d,link

This indicates that the `dep-info` output type will be placed at `.deps/foo.d`
and the `link` output type will otherwise be determined via the `--out-dir` and
`-o` flags.

Closes #28716
2015-09-30 11:12:30 -07:00
Vadim Petrochenkov
f284cbc7af Cleanup interfaces of Name, SyntaxContext and Ident
Make sure Name, SyntaxContext and Ident are passed by value
Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-09-24 23:05:02 +03:00
Vadim Petrochenkov
40ce80484c Remove random Idents outside of libsyntax 2015-09-23 20:04:49 +03:00
Vadim Petrochenkov
a4af958786 Use Names in HIR Items 2015-09-22 19:53:52 +03:00
bors
d3fc6e1858 Auto merge of #28454 - GSam:master, r=nrc
This is so that the resolution results can be used after analysis, potentially for tool support
2015-09-17 08:28:33 +00:00
Garming Sam
61cb1baab1 Add compiler option to keep mtwt tables
This is so that the resolution results can be used after analysis, potentially for tool support
2015-09-17 13:09:55 +12:00
Nick Cameron
a642d853aa Change to a multi-trait approach
[breaking-change] for lint authors

You must now implement LateLintPass or EarlyLintPass as well as LintPass and use either register_late_lint_pass or register_early_lint_pass, rather than register_lint_pass.
2015-09-17 12:16:46 +12:00
Nick Cameron
c1084a3ada Changes to tests 2015-09-17 12:16:46 +12:00
Nick Cameron
76856e19ff Add an early lint pass for lints that operate on the AST
There is a minor [breaking-change] for lint authors - some functions which were previously defined on `lint::Context` have moved to a trait - `LintContext`, you may need to import that trait to avoid name resolution errors.
2015-09-17 12:16:46 +12:00
Nick Cameron
e9f1b06329 Use ast attributes every where (remove HIR attributes).
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-16 10:57:06 +12:00
Ariel Ben-Yehuda
caa10c3bde move middle::ty and related modules to middle/ty/ 2015-09-14 10:56:13 +03:00
Niko Matsakis
faa9ec81b5 add MIR crate and link it into the driver 2015-09-06 07:27:23 -04:00
Manish Goregaokar
7732ad85df Move lints to HIR 2015-09-03 20:58:07 +05:30
Nick Cameron
facdf2ebb1 Add an intital HIR and lowering step 2015-09-03 10:02:36 +12:00
Barosl Lee
71f39c1a2f Respect --color when printing early errors
Currently, `early_error` and `early_warn` in `librustc::session` always
use `ColorConfig::Auto`. Modify them to follow the color configuration
set by the `--color` option.

As colored output is also printed during the early stage, parsing the
`--color` option should be done as early as possible. However, there are
still some cases when the output needs to be colored before knowing the
exact color settings. In these cases, it will be defaulted to
`ColorConfig::Auto`, which is the same as before.

Fixes #27879.
2015-08-25 18:08:57 +09:00
Ariel Ben-Yehuda
06563fe0b7 fix other test 2015-08-24 23:41:02 +03:00
Ariel Ben-Yehuda
fc304384e6 Use a Vec instead of an HashMap for the scope hierarchy
This increases regionck performance greatly - type-checking on
librustc decreased from 9.1s to 8.1s. Because of Amdahl's law,
total performance is improved only by about 1.5% (LLVM wizards,
this is your opportunity to shine!).

before:
576.91user 4.26system 7:42.36elapsed 125%CPU (0avgtext+0avgdata 1142192maxresident)k
after:
566.50user 4.84system 7:36.84elapsed 125%CPU (0avgtext+0avgdata 1124304maxresident)k

I am somewhat worried really need to find out why we have this Red Queen's
Race going on here. Originally I suspected it may be a problem from RFC1214's
warnings, but it seems to be an effect from other changes.

However, the increase seems to be mostly in LLVM's time, so I guess
it's the LLVM wizards' problem.
2015-08-24 20:24:38 +03:00
Richard Diamond
8b70e1e008 Add a allow_asm option so virtual ISA based targets (JS/PNaCl/WAsm) can disallow the asm! macro. 2015-08-21 17:50:39 -05:00
Huon Wilson
4f4425840d Add some SIMD target_feature cfg's when appropriate.
NB. this may not be 100% perfect.
2015-08-17 14:41:37 -07:00
Huon Wilson
e364f0eb5a feature gate cfg(target_feature).
This is theoretically a breaking change, but GitHub search turns up no
uses of it, and most non-built-in cfg's are passed via cargo features,
which look like `feature = "..."`, and hence can't overlap.
2015-08-17 14:41:37 -07:00
Alex Crichton
2972b77134 Add issue for the rustc_private feature everywhere 2015-08-15 18:09:17 -07:00
Alex Crichton
45bf1ed1a1 rustc: Allow changing the default allocator
This commit is an implementation of [RFC 1183][rfc] which allows swapping out
the default allocator on nightly Rust. No new stable surface area should be
added as a part of this commit.

[rfc]: https://github.com/rust-lang/rfcs/pull/1183

Two new attributes have been added to the compiler:

* `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to
  indicate that it requires an allocator crate to be in scope.
* `#![allocator]` - this is a indicator that the crate is an allocator which can
  satisfy the `needs_allocator` attribute above.

The ABI of the allocator crate is defined to be a set of symbols that implement
the standard Rust allocation/deallocation functions. The symbols are not
currently checked for exhaustiveness or typechecked. There are also a number of
restrictions on these crates:

* An allocator crate cannot transitively depend on a crate that is flagged as
  needing an allocator (e.g. allocator crates can't depend on liballoc).
* There can only be one explicitly linked allocator in a final image.
* If no allocator is explicitly requested one will be injected on behalf of the
  compiler. Binaries and Rust dylibs will use jemalloc by default where
  available and staticlibs/other dylibs will use the system allocator by
  default.

Two allocators are provided by the distribution by default, `alloc_system` and
`alloc_jemalloc` which operate as advertised.

Closes #27389
2015-08-14 15:13:10 -07:00
Eli Friedman
bbbfed2f93 Use https URLs to refer to rust-lang.org where appropriate.
Also fixes a few outdated links.
2015-08-09 14:28:46 -07:00
bors
0dc2910c9c Auto merge of #27458 - mitaa:local_cpath, r=nikomatsakis
This changes the current behaviour for two cases (that I know of)
```rust
mod foo {
    extern crate bar;
}
// `bar::` changes to `foo::bar::`
```

```rust
extern crate bar as quux;
// `bar::` changes to `quux::`
```
For example:
```rust
mod foo {
    extern crate core;
}

fn assert_clone<T>() where T : Clone { }

fn main() {
    assert_clone::<foo::core::atomic::AtomicBool>();
    // error: the trait `core::clone::Clone` is not implemented for the type `core::atomic::AtomicBool` [E0277]
    // changes to
    // error: the trait `foo::core::clone::Clone` is not implemented for the type `foo::core::atomic::AtomicBool` [E0277]
}
```

Notably the following test case broke:
```rust
 #[bench]
 fn bar(x: isize) { }
 //~^ ERROR mismatched types
 //~| expected `fn(&mut test::Bencher)`
 // changed to
 //~| expected `fn(&mut __test::test::Bencher)`
```
If a crate is linked multiple times the path with the least segments is stored.
Partially addresses #1920. (this doesn't solve the issue raised about re-exports)

r? @nikomatsakis
2015-08-05 10:30:41 +00:00
Alex Crichton
5cccf3cd25 syntax: Implement #![no_core]
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-03 17:23:01 -07:00
mitaa
a98fd11228 Split off LocalCrateReader from CrateReader 2015-08-01 05:51:51 +02:00
Felix S. Klock II
e050fc21b9 Rename the unstable option --xpretty to --unpretty
(Inspired by discussion with Gankro.)
2015-07-30 01:33:38 +02:00
Manish Goregaokar
30ac7e78e2 Fixup #27046 with pattern bindings 2015-07-16 16:37:40 +05:30
Manish Goregaokar
2a74fa3582 Rollup merge of #27046 - nrc:driver-defaults, r=alexcrichton 2015-07-16 16:37:40 +05:30
Nick Cameron
441b1c6103 Some more default implementations for the compiler driver callbacks. 2015-07-15 11:38:24 +12:00