Commit Graph

49108 Commits

Author SHA1 Message Date
bors
5dc91a74b1 Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiyn
Fixes #13677
This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers.
Example. Compiling this program:

```rust
macro_rules! foo {
    ($e:expr) => ( $e )
}

fn main() {
    fob!("hello!");
}
```

gives the following error message:

```
/Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!'
/Users/mcp/temp/test.rs:7     fob!("hello!");
                              ^~~
/Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`?
/Users/mcp/temp/test.rs:7     fob!("hello!");
```

I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
2015-11-27 18:41:53 +00:00
Florian Hartwig
4bb7cf11dc Introduce max_suggestion_distance function to avoid duplicating the heuristic 2015-11-27 17:52:29 +01:00
ebadf
797a0bd1c1 Shifted focus of while-let example per review. 2015-11-27 10:23:58 -06:00
bors
ca6365037f Auto merge of #30082 - semarie:execve, r=alexcrichton
under OpenBSD and Bitrig, it is an error to pass an empty argv
argument to execve(2). It results the test fail as execve(2) don't exec
and set errno to EINVAL.

instead, make argv with two arguments (in order to differenciate the
initial call, from the execve call).

r? @alexcrichton
2015-11-27 15:55:05 +00:00
Oliver Schneider
5951418c66 revert test to check runtime evaluation instead of constant evaluation
see https://github.com/rust-lang/rust/pull/26848/files#r43151926
2015-11-27 16:46:11 +01:00
Oliver Schneider
8e64e22ef7 implement calling of const fn-methods in true constants 2015-11-27 16:43:24 +01:00
Sébastien Marie
efc17a598c pass at least one argument to execve
under OpenBSD and Bitrig, it is an error to pass an empty argv
argument to execve(2). It results the test fail as execve(2) don't exec
and set errno to EINVAL.

instead, make argv with two arguments (in order to differenciate the
initial call, from the execve call).
2015-11-27 13:48:07 +01:00
Alex Burka
f542d4aba7 fix docs for compiler builtin macros 2015-11-26 22:45:55 -05:00
bors
e5aa92a0df Auto merge of #30071 - brson:netbsd, r=alexcrichton
Depends on https://github.com/rust-lang/rust/pull/30015 since this branch includes `#[staged_api]` changes.
2015-11-27 01:48:12 +00:00
Brian Anderson
a7cd514d80 Update libc. Fixes netbsd. 2015-11-26 17:47:13 -08:00
bors
1727dee167 Auto merge of #30077 - nrc:save-abs-crate, r=eddyb 2015-11-26 22:04:06 +00:00
Marvin Löbel
49e997406a Extended simple macro test 2015-11-26 21:47:44 +01:00
Marvin Löbel
02a18a659a Rebase fixup for lower.rs 2015-11-26 21:47:44 +01:00
Marvin Löbel
296c3613ca Added stmt_expr_attribute feature gate 2015-11-26 21:47:44 +01:00
Marvin Löbel
c56b47ab8c Some TLC for the MoveMap trait 2015-11-26 21:46:12 +01:00
Marvin Löbel
0608b1d414 Fixed macro expander not folding attributes (though I'm not sure if that is actually neccessary) 2015-11-26 21:46:12 +01:00
Marvin Löbel
f0beba0217 Moved and refactored ThinAttributes 2015-11-26 21:46:12 +01:00
Marvin Löbel
2a8f358de7 Add syntax support for attributes on expressions and all syntax
nodes in statement position.

Extended #[cfg] folder to allow removal of statements, and
of expressions in optional positions like expression lists and trailing
block expressions.

Extended lint checker to recognize lint levels on expressions and
locals.
2015-11-26 21:46:12 +01:00
Kevin Yeh
b4295b9fb0 Fix spans for macros 2015-11-26 14:38:45 -06:00
Jonas Schievink
0c8039f10b ; 2015-11-26 21:10:04 +01:00
bors
8baaf0ad07 Auto merge of #30068 - wthrowe:unsized-pointer-impls, r=alexcrichton
I'm pretty sure this code isn't actually used by the compiler, so this
is effectively a documentation change.
2015-11-26 20:07:05 +00:00
bors
6ef02eff89 Auto merge of #30043 - arielb1:split-metadata, r=nikomatsakis
This improves bootstrap times because of better parallelism - though I need to measure how much - and allows metadata to be modified without triggering a full recompile. This also ensures that metadata handling and the rest of rustc remain decoupled, which is a first step for switching to a new metadata format.

This is a [breaking-change] to all plugin authors because of the following renames:
 * `rustc::plugin` is now `rustc_plugin`
 * `rustc::metadata` is now `rustc_metadata`
 * Most data types from `rustc::metadata`, along with `LOCAL_CRATE`, are now in `rustc::middle::cstore`.
 * The CStore methods were split between the `rustc::middle::CrateStore` trait (and trait object) and the `rustc_metadata::cstore::CStore`, with an `Rc<CrateStore>` stored in the `Session`. The inner `CStore` can be accessed via the inner `Any` bound, but this is deprecated.

r? @nikomatsakis
2015-11-26 18:20:58 +00:00
Jonas Schievink
ce97479a15 rustdoc: only show macro arm's lhs 2015-11-26 19:14:36 +01:00
Ariel Ben-Yehuda
43a6deb95f fix rustc-test 2015-11-26 19:19:54 +02:00
Ariel Ben-Yehuda
4190dce3a7 fix tidy 2015-11-26 18:22:40 +02:00
Ariel Ben-Yehuda
52dd2b4c35 fix tests & rustdoc 2015-11-26 18:22:40 +02:00
Ariel Ben-Yehuda
0a8bb4c509 split the metadata code into rustc_metadata
tests & rustdoc still broken
2015-11-26 18:22:40 +02:00
Ariel Ben-Yehuda
1430a35000 move librustc/plugin to librustc_plugin
this is a [breaking-change] to all plugin authors - sorry
2015-11-26 18:22:39 +02:00
Ariel Ben-Yehuda
26b19206d3 make check works 2015-11-26 18:21:17 +02:00
Ariel Ben-Yehuda
d45dd9423e make CrateStore a trait object
rustdoc still broken
2015-11-26 18:21:17 +02:00
Ariel Ben-Yehuda
11dbb69bd1 remove csearch from the rest of rustc 2015-11-26 18:21:17 +02:00
Ariel Ben-Yehuda
f5fbefa3af remove csearch from resolve and typeck 2015-11-26 18:21:17 +02:00
Ariel Ben-Yehuda
3877664b56 stop using csearch in librustc and librustc_lint 2015-11-26 18:21:17 +02:00
bors
6f3becb18a Auto merge of #30061 - tshepang:doc-time, r=brson 2015-11-26 14:50:36 +00:00
bors
da0444d5d4 Auto merge of #30054 - Ms2ger:TypeOrigin, r=eddyb 2015-11-26 13:07:18 +00:00
Florian Hartwig
9ba657cad5 Add '!' to macro name suggestion, use fileline_help instead of span_help 2015-11-26 11:59:41 +01:00
bors
6d88afe477 Auto merge of #30015 - petrochenkov:staged, r=brson
Closes https://github.com/rust-lang/rust/issues/30008

`#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]`

r? @brson
2015-11-26 10:22:37 +00:00
Ms2ger
f24077f8ce Use the TypeOrigin variants qualified. 2015-11-26 08:53:12 +01:00
William Throwe
7a7d481270 Mark raw pointer Send and Sync impls ?Sized
I'm pretty sure this code isn't actually used by the compiler, so this
is effectively a documentation change.
2015-11-26 00:36:09 -05:00
Nick Cameron
befa29e0dc save-analysis: use absolute paths for file names 2015-11-26 18:05:32 +13:00
Tshepang Lekhonkhobe
cc815d2de0 doc: this is already mentioned in previous paragraph, and is harder to read 2015-11-26 04:43:17 +02:00
ebadf
465a5cb194 Corrections to the while-let example per review. 2015-11-25 20:05:45 -06:00
bors
1805bba399 Auto merge of #30053 - JIghtuse:master, r=steveklabnik 2015-11-26 00:20:37 +00:00
Florian Hartwig
ac0220cf4c Add test for macro suggestions 2015-11-26 00:36:30 +01:00
Florian Hartwig
a5e5c67756 Add suggestion of similar macro names to macro undefined error message 2015-11-26 00:21:38 +01:00
bors
498f08d369 Auto merge of #30060 - jonas-schievink:asparagus, r=nikomatsakis
Fixes #27092
Fixes #30005
2015-11-25 22:31:10 +00:00
Tshepang Lekhonkhobe
05dde0d325 book: miscellaneous improvements to "dining philosophers" example 2015-11-26 00:21:23 +02:00
Vadim Petrochenkov
4b8078424e Consider a crate staged if it has stable or unstable in its root 2015-11-26 00:15:46 +03:00
Tshepang Lekhonkhobe
3dd7e6ed7c doc: fix type name 2015-11-25 22:51:01 +02:00
Tshepang Lekhonkhobe
44665c4e61 doc: add a pause 2015-11-25 22:50:47 +02:00