Commit Graph

48987 Commits

Author SHA1 Message Date
Nick Cameron
6309b0f5bb move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*
Also split out emitters into their own module.
2015-12-17 09:35:50 +13:00
bors
38da1a4064 Auto merge of #29962 - aturon:coherence-errors, r=nmatsakis
Currently, a coherence error based on overlapping impls simply mentions
the trait, and points to the two conflicting impls:

```
error: conflicting implementations for trait `Foo`
```

With this commit, the error will include all input types to the
trait (including the `Self` type) after unification between the
overlapping impls. In other words, the error message will provide
feedback with full type details, like:

```
error: conflicting implementations of trait `Foo<u32>` for type `u8`:
```

When the `Self` type for the two impls unify to an inference variable,
it is elided in the output, since "for type `_`" is just noise in that
case.

Closes #23980

r? @nikomatsakis
2015-12-16 20:22:07 +00:00
Felix S. Klock II
694699503a unit test for new error help. 2015-12-16 21:13:10 +01:00
Guillaume Gomez
86f5275e49 Add note when item accessed from module via m.i rather than m::i. 2015-12-16 21:13:03 +01:00
Jake Goulding
936149fc25 Remove rogue I 2015-12-16 13:25:46 -05:00
Aaron Turon
bc33dd7ac4 Provide overlapping types for coherence errors
Currently, a coherence error based on overlapping impls simply mentions
the trait, and points to the two conflicting impls:

```
error: conflicting implementations for trait `Foo`
```

With this commit, the error will include all input types to the
trait (including the `Self` type) after unification between the
overlapping impls. In other words, the error message will provide
feedback with full type details, like:

```
error: conflicting implementations of trait `Foo<u32>` for type `u8`:
```

When the `Self` type for the two impls unify to an inference variable,
it is elided in the output, since "for type `_`" is just noise in that
case.

Closes #23980
2015-12-16 09:47:23 -08:00
Steve Klabnik
bf14d8f0e8 Remove incorrect words about libcore's stability 2015-12-16 11:42:18 -05:00
bors
073b0f9b85 Auto merge of #30337 - wesleywiser:mir_switch, r=nikomatsakis
Fixes #29574
2015-12-16 16:10:26 +00:00
Alex Crichton
04f9a3f8fe mk: Use the right llvmdeps.rs file for cross build
It looks like #27937 accidentally switched the llvmdeps file from the target to
the host by accident, so be sure to use the right llvmdeps file which is built
for the target when building rustc_llvm
2015-12-16 08:06:27 -08:00
Vadim Petrochenkov
0cc69f0ea3 rustc: Remove def::DefUse 2015-12-16 18:19:11 +03:00
Vadim Petrochenkov
e0ceef5a9e Add ExprType to HIR and make everything compile
+ Apply parser changes manually
+ Add feature gate
2015-12-16 17:13:16 +03:00
bors
d4ffaf6f83 Auto merge of #30269 - sanxiyn:no-mangle-generic, r=Aatch
Fix #15844.

Should the default be Deny instead?
2015-12-16 14:12:43 +00:00
Eduard Burtescu
b8157cc67f Implement type ascription. 2015-12-16 17:12:35 +03:00
bors
785a8a6681 Auto merge of #30410 - Manishearth:rollup, r=Manishearth
- Successful merges: #30320, #30368, #30372, #30376, #30388, #30392
- Failed merges: #30354, #30389
2015-12-16 12:16:43 +00:00
Manish Goregaokar
f0361a0502 Rollup merge of #30392 - Ms2ger:RestrictionResult, r=alexcrichton 2015-12-16 17:46:30 +05:30
Manish Goregaokar
b0b9a556df Rollup merge of #30388 - DanielJCampbell:macro-ident-spans, r=nrc
r? @nrc
2015-12-16 17:46:29 +05:30
Manish Goregaokar
7aabc66a85 Rollup merge of #30376 - salty-horse:btree_links, r=alexcrichton
The BtreeSet main description mentions `BTreeMap`, `Ord`, `Cell`, `RefCell`.

This patch adds links to their documentation.
2015-12-16 17:46:29 +05:30
Manish Goregaokar
d91c344637 Rollup merge of #30372 - sanxiyn:rustdoc-cfg, r=alexcrichton
Fix #30252.
2015-12-16 17:46:29 +05:30
Manish Goregaokar
b20f427391 Rollup merge of #30368 - arielb1:region-unification-2, r=nikomatsakis
Turns out that calling `resolve_type_variables_if_possible` in a O(n^2)
loop is a bad idea. Now we just resolve each copy of the region variable
to its lowest name each time (we resolve the region variable to its lowest
name, rather than to its unify-table name to avoid the risk of
the unify-table name changing infinitely many times. That may be
not a problem in practice, but I am not sure of it).
2015-12-16 17:46:29 +05:30
Manish Goregaokar
ee24bddfc5 Rollup merge of #30320 - nrc:err-names, r=@nikomatsakis
We can now handle name resolution errors and get past type checking (if we're a bit lucky). This is the first step towards doing code completion for partial programs (we need error recovery in the parser and early access to save-analysis).
2015-12-16 17:46:29 +05:30
Ravi Shankar
51ff171948 Modify the Levenshtein-based suggestions to include imports 2015-12-16 16:33:24 +05:30
bors
ce7bc51933 Auto merge of #30300 - sanxiyn:syntax-ext, r=nikomatsakis
This reduces iteration time (`make rustc-stage1`) for moved syntax extensions from 11 minutes to 3 minutes on my machine.

Because of the signature change, this is a [breaking-change] for people directly calling `expand_crate`. I think it is rare: from GitHub search, only case I found is [glassful](https://github.com/kmcallister/glassful).
2015-12-16 10:09:36 +00:00
bors
ac2c5ff024 Auto merge of #30206 - petrochenkov:newdepr, r=brson
Closes https://github.com/rust-lang/rust/issues/29935

The attributes `deprecated` and `rustc_deprecated` are completely independent in this implementation and it leads to some noticeable code duplication. Representing `deprecated` as
```
Stability {
    level: Stable { since: "" },
    feature: "",
    depr: Some(Deprecation),
}
```
or, contrariwise, splitting rustc_deprecation from stability makes most of the duplication go away.
I can do this refactoring, but before doing it I must be sure, that further divergence of `deprecated` and `rustc_deprecated` is certainly not a goal.

cc @llogiq
2015-12-16 08:15:23 +00:00
bors
9ace0a46de Auto merge of #30141 - oli-obk:fix/30117, r=arielb1
r? @arielb1
2015-12-16 05:40:41 +00:00
Geoffrey Thomas
cec2d144a1 Pass --enable-new-dtags to GNU ld
This causes the linker to emit DT_RUNPATH instead of DT_RPATH, which
fixes #30378.
2015-12-15 21:20:44 -05:00
Alex Burka
d91b256fe5 change macro ambiguity example from ty to ident
The previous example had no chance of compiling in either form, due to the restrictive follow set for `ty`. This one has the desired behavior: http://is.gd/kYdw4g (well, I don't exactly desire this behavior at all, but it's true at least :p )
2015-12-15 20:48:25 -05:00
fbergr
b9005dd472 Book: Fix link anchor in Syntax Index 2015-12-15 21:47:21 +02:00
Jake Worth
2a1efca2f3 Fix typo 2015-12-15 12:51:08 -06:00
Ms2ger
9a0ab50ac0 Stop re-exporting RestrictionResult variants. 2015-12-15 16:15:59 +01:00
Felix S. Klock II
5299441954 Regression tests for Issue 29793. 2015-12-15 15:18:45 +01:00
Felix S. Klock II
c00574848b Ensure borrows of fn/closure params do not outlive invocations.
resolve_lifetime.rs: Switch from BlockScope to FnScope in ScopeChain
construction. Lifetimes introduced by a fn signature are scoped to the
call-site for that fn. (Note `add_scope_and_walk_fn` must only add
FnScope for the walk of body, *not* of the fn signature.)

region.rs: Introduce new CodeExtentData::CallSiteScope variant. Use
CodeExtentData as the cx.parent, rather than just a NodeId.  Change
DestructionScopeData to CallSiteScopeData.

regionck.rs: Thread call_site_scope via Rcx; constrain fn return
values.

(update; incorporated review feedback from niko.)
2015-12-15 15:18:40 +01:00
Simonas Kazlauskas
b3720ea933 Implement translation for ConstVal::{Array,Repeat} 2015-12-15 12:25:09 +02:00
Simonas Kazlauskas
a5e7a61c49 Implement references to functions and constants 2015-12-15 12:25:05 +02:00
Simonas Kazlauskas
59e6b20cf2 Const-eval more constants during MIR building 2015-12-15 12:23:37 +02:00
Seo Sanghyeon
eb25721063 Use --cfg when running doctests
Previously passed --cfg was used only when collecting doctests.
2015-12-15 18:03:55 +09:00
Seo Sanghyeon
0883f10550 Mark libsyntax_ext unstable 2015-12-15 16:23:18 +09:00
Seo Sanghyeon
9410bfa0cd Fix custom deriving tests 2015-12-15 15:04:47 +09:00
Seo Sanghyeon
bb21b6738a Fix expansion tests 2015-12-15 15:04:47 +09:00
Seo Sanghyeon
f9ba107824 Move built-in syntax extensions to a separate crate 2015-12-15 15:04:46 +09:00
Daniel Campbell
2dcd791d46 Generated code spans now point to callsite parameters (where applicable) 2015-12-15 17:41:03 +13:00
bors
9e63cecb10 Auto merge of #30233 - retep998:where-in-the-world-is-windows-sdk, r=alexcrichton
What I've done here is try to make the code match what vcvars does much more closely. It now chooses which SDK to find based on the version of MSVC that it found. It also bases the decision of whether to find all the things on whether `VCINSTALLDIR` has been set, which is more likely to have only been set by an invocation of vcvars, unlike previously where it would do some things only if `LIB` wasn't set even though there was a valid use case for libraries to add themselves to `LIB` without having invoked vcvars.

There are still some debug `println!`s so people can test the PR and make sure it works correctly on various setups.

It supports VS 2015, 2013, and 2012. People who want to use versions of VS older (or newer) than that will have to manually invoke the appropriate vcvars bat file to set the proper environment variables themselves.

Do not merge yet.

Fixes https://github.com/rust-lang/rust/issues/30229
2015-12-15 04:21:53 +00:00
bors
8f031bf962 Auto merge of #30105 - faineance:master, r=nrc
Issue: #30058
Updated for:
 - Stmt
 - BinOp_
 - UnOp
 - UintTy, IntTy and FloatTy
 - Lit
 - Generics

A possible inconsistancy?
The `Stmt` methods are on the spanned varient:
```rust
pub type Stmt = Spanned<Stmt_>;

impl Stmt {
    pub fn id(s: &Stmt) -> Option<NodeId> {
        match s.node {
          StmtDecl(_, id) => Some(id),
          StmtExpr(_, id) => Some(id),
          StmtSemi(_, id) => Some(id),
          StmtMac(..) => None,
      }
  }
}
```
Whilst the methods for BinOp are on the non spanned version.
````rust
impl BinOp_ {
    pub fn to_string(op: BinOp_) -> &'static str { ... }
    pub fn lazy(b: BinOp_) -> bool { ... }

    pub fn is_shift(b: BinOp_) -> bool { ... }
    pub fn is_comparison(b: BinOp_) -> bool { ... }
    /// Returns `true` if the binary operator takes its arguments by value
    pub fn is_by_value(b: BinOp_) -> bool { ... }

}
pub type BinOp = Spanned<BinOp_>;
````
r? @Manishearth
2015-12-15 01:18:01 +00:00
Wesley Wiser
2b15361298 Implement trans for the MIR Switch terminator
Fixes #29574
2015-12-14 19:00:10 -05:00
Peter Atashian
915cb376e9 Overhaul MSVC linker and Windows SDK detection code
Fixes https://github.com/rust-lang/rust/issues/30229

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-12-14 18:04:35 -05:00
Alex Burka
e0a526015d evade unused_variables lint in for-loop desugaring 2015-12-14 17:51:52 -05:00
Alex Burka
4c0c4e5546 add failing run-pass test for #30371 2015-12-14 17:51:52 -05:00
Ori Avtalion
37b8e22c68 Add links in BTreeSet docs 2015-12-14 23:15:21 +02:00
faineance
ec8ea22c7f [breaking-change] move ast_util functions to methods 2015-12-14 21:15:01 +00:00
bors
44d9601ad3 Auto merge of #30328 - sanxiyn:include-type-name, r=alexcrichton
Fix #30260.
2015-12-14 21:08:13 +00:00
bors
f150c178ea Auto merge of #27937 - DiamondLovesYou:llvm-root-and-shared, r=alexcrichton
This handles cases when the LLVM used isn't configured will the 'usual' targets. Also, cases where LLVM is shared are also handled (ie with `LD_LIBRARY_PATH` etc).
2015-12-14 19:14:37 +00:00