Commit Graph

296 Commits

Author SHA1 Message Date
Guillaume Gomez
cd385cbe34 Add E0405 error explanation 2015-07-21 19:28:58 +02:00
Guillaume Gomez
0eb7303c70 Add E0403 error explanation 2015-07-21 19:28:57 +02:00
Alisdair Owens
3ae7b72970 Fix wording nit for E0253 2015-07-20 18:14:12 +01:00
bors
ef04b07239 Auto merge of #27120 - apasel422:associated-item-error, r=arielb1
Previously, these would both be labeled as methods.
2015-07-20 01:46:20 +00:00
Andrew Paseltiner
ce856a55f6 add separate errors for out-of-place associated consts and types
Previously, these would both be labeled as methods.
2015-07-19 15:32:24 -04:00
Alisdair Owens
4ea02b72b7 replace word function with method 2015-07-19 09:59:43 +01:00
Alisdair Owens
44f29fbdbc oops, forgot to fix method name 2015-07-18 20:46:47 +01:00
Alisdair Owens
56b450b291 fix up crate/trait discrepancy, clarify language 2015-07-18 20:26:08 +01:00
Alisdair Owens
6c74779a5c Add diagnostics for E0253 2015-07-18 17:25:29 +01:00
Manish Goregaokar
8638dc7f9a nit 2015-07-18 03:06:35 +05:30
Alisdair Owens
94b1ca8448 Write diagnostics for E0364 and E0365 2015-07-17 21:05:51 +01:00
Manish Goregaokar
1da1a46d56 Rollup merge of #26898 - GuillaumeGomez:fixup, r=eddyb
r? @eddyb

First part of the improvement. I then intend to improve resolve_error as indicated by @eddyb. Do not merge for now (please !).
2015-07-16 14:13:25 +05:30
Guillaume Gomez
60133aa6dd Remove macro, import function and enum 2015-07-14 19:53:09 +02:00
Guillaume Gomez
31262c206e Arguments are now passed directly to the function instead of the enum variants 2015-07-14 16:32:43 +02:00
Guillaume Gomez
c5f7c19cf2 End of error code spanning centralization 2015-07-14 15:37:52 +02:00
Guillaume Gomez
f52a87c44e Centralize error spaning and add an enum to make this treatment easier 2015-07-13 19:32:45 +02:00
Guillaume Gomez
cbf0b1b399 Remove warnings by centralizing error codes usage 2015-07-13 02:05:02 +02:00
Guillaume Gomez
48ee57e656 Update error codes 2015-07-13 00:57:16 +02:00
Guillaume Gomez
f1b231dd71 Remove unused method 2015-07-13 00:45:50 +02:00
Guillaume Gomez
8b731a5cac Add error codes 2015-07-13 00:31:09 +02:00
Simonas Kazlauskas
7a90865db5 Implement RFC 1058 2015-07-12 00:47:56 +03:00
Guillaume Gomez
2e00b31770 We just have to replace error codes but code is good now 2015-07-11 21:46:06 +02:00
Guillaume Gomez
c3fd0e1229 Remove token::get_name when unneeded 2015-07-10 00:00:08 +02:00
Seo Sanghyeon
8d9f1bab75 Remove a FIXME 2015-07-08 23:30:19 +09:00
Eduard Burtescu
84b49b2d35 rustc_resolve: don't require redundant arguments to resolve_crate. 2015-06-19 01:18:42 +03:00
bors
9cc0b22475 Auto merge of #26192 - alexcrichton:features-clean, r=aturon
This commit shards the all-encompassing `core`, `std_misc`, `collections`, and `alloc` features into finer-grained components that are much more easily opted into and tracked. This reflects the effort to push forward current unstable APIs to either stabilization or removal. Keeping track of unstable features on a much more fine-grained basis will enable the library subteam to quickly analyze a feature and help prioritize internally about what APIs should be stabilized.

A few assorted APIs were deprecated along the way, but otherwise this change is just changing the feature name associated with each API. Soon we will have a dashboard for keeping track of all the unstable APIs in the standard library, and I'll also start making issues for each unstable API after performing a first-pass for stabilization.
2015-06-18 19:14:52 +00:00
bors
f451812763 Auto merge of #26385 - nham:fix_25396, r=alexcrichton
Currently in the E0252 message, traits and modules are all called types (as in "a type named `Foo` has already been imported", even when `Foo` was a trait or module). This commit changes that to additionally detect when the import in question is a trait or module and report it accordingly.

Fixes #25396.
2015-06-18 16:17:04 +00:00
Nick Hamann
b637f6b1bd Fix the E0252 error message to use better names for things.
Currently in the E0252 message, traits and modules are all called types
(as in "a type named `Foo` has already been imported", even when `Foo` was
a trait or module). This commit changes that to additionally detect when
the import in question is a trait or module and report it accordingly.

Fixes #25396.
2015-06-17 19:41:55 -05:00
Alex Crichton
d444d0c357 collections: Split the collections feature
This commit also deprecates the `as_string` and `as_slice` free functions in the
`string` and `vec` modules.
2015-06-17 09:06:59 -07:00
Alex Crichton
c44f5399e4 alloc: Split apart the global alloc feature 2015-06-17 09:06:59 -07:00
Nick Hamann
0c22cd7906 Fix error message for E0256 in certain cases.
Previously, it said "import `Foo` conflicts with existing submodule" even
when it was a type alias, enum, or trait. The message now says the conflict
is with "type in this module" in the case of the first two, and "trait in
this module" for the last one.

Fixes #24081.
2015-06-16 18:55:52 -05:00
Joshua Landau
d7f5fa4636 Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00
Joshua Landau
ca7418b846 Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
Eduard Burtescu
76eaed44d9 syntax: move ast_map to librustc. 2015-06-10 02:40:45 +03:00
Nick Fitzgerald
93d01eb443 Make the maximum edit distance of typo suggestions a function of the typo'd name's length. 2015-06-07 18:01:33 -07:00
Eduard Burtescu
6e8e4f847c Remove #[cfg(stage0)] items. 2015-05-27 11:19:02 +03:00
Niko Matsakis
df93deab10 Make various fixes:
- add feature gate
- add basic tests
- adjust parser to eliminate conflict between `const fn` and associated
constants
- allow `const fn` in traits/trait-impls, but forbid later in type check
- correct some merge conflicts
2015-05-21 11:47:30 -04:00
Eduard Burtescu
af3795721c syntax: parse const fn for free functions and inherent methods. 2015-05-21 11:47:30 -04:00
bors
0d707d15f6 Auto merge of #25485 - XuefengWu:24968_err_msg_parse_self_type_2, r=nrc
fix #24968
report more friendly error message for Self when fn args
copy from https://github.com/rust-lang/rust/pull/25096
r? @nrc  @arielb1
2015-05-16 20:53:42 +00:00
Xuefeng Wu
5cf6b02571 fix typo for copyright year and trait capitalise 2015-05-16 17:29:48 +08:00
XuefengWu
1e39d9b95d change Self type error message 2015-05-16 17:22:27 +08:00
Xuefeng Wu
8e82c21bf3 more friend error message for in fn arg 2015-05-16 17:21:43 +08:00
Alex Crichton
0e21beb761 libs: Move favicon URLs to HTTPS
Helps prevent mixed content warnings if accessing docs over HTTPS.

Closes #25459
2015-05-15 16:04:01 -07:00
Manish Goregaokar
1109b6dd8d Rollup merge of #25398 - nham:E0066_E0069, r=huonw
Adds explanations for E0053, E0066, E0069, E0251, E0252, E0255, E0256, E0368.

cc #24407
2015-05-14 19:33:10 +05:30
Nick Hamann
d636b5cf65 Improve examples in the E0255/E0256 error explanations. 2015-05-14 02:54:50 -05:00
Nick Hamann
06aef339f1 Add error explanations for E0053, E0251, E0252, E0255, E0256, E0368. 2015-05-14 02:04:51 -05:00
bors
1b5b6390ba Auto merge of #25065 - quantheory:fix_associated_const_ambiguity_message, r=nikomatsakis
This fixes #24922 and #25017, and reduces the number of error messages that talk about "methods" when associated constants rather than methods are involved.

I will admit that I haven't thought very carefully about the error messages. My goal has been to make more of the messages technically correct in all situations, and to avoid ICEs. But in some cases we could probably talk specifically about "methods" rather than "items".
2015-05-14 03:36:37 +00:00
Sean Patrick Santos
4774d5d9a1 Allow T::C syntax in match patterns to refer to trait-assosociated constants. 2015-05-13 17:39:16 -06:00
Ricardo Martins
06b084fc9f Markdown formatting for error explanations. 2015-05-13 12:12:19 +01:00
Manish Goregaokar
bb15c4762d Rollup merge of #25267 - meqif:explain_e0317, r=alexcrichton
Add diagnostic message for E0317, E0154, E0259 and E0260; part of #24407.

About E0317, I was unsure if I should add an example of what could be wrong, such as `struct i64`, `enum char { A, B }` or `type isize = i64`. I decided against it, since the diagnostic message looks clear enough to me.

What do you think?
2015-05-12 22:57:52 +05:30
bors
0ad202671f Auto merge of #25171 - quantheory:associated_time_long_paths, r=nikomatsakis
It is currently broken to use syntax such as `<T as Foo>::U::static_method()` where `<T as Foo>::U` is an associated type. I was able to fix this and simplify the parser a bit at the same time.

This also fixes the corresponding issue with associated types (#22139), but that's somewhat irrelevant because #22519 is still open, so this syntax still causes an error in type checking.

Similarly, although this fix applies to associated consts, #25046 forbids associated constants from using type parameters or `Self`, while #19559 means that associated types have to always have one of those two. Therefore, I think that you can't use an associated const from an associated type anyway.
2015-05-12 13:04:14 +00:00
bors
feac9f1c7b Auto merge of #24818 - tbelaire:double-import, r=nrc
This isn't quite right, but it's interesting.
2015-05-12 08:54:40 +00:00
Ricardo Martins
aa529ef52e Add missing keyword in extern crate declarations. 2015-05-11 09:10:49 +01:00
Ricardo Martins
ef030555c6 Improve wording in error explanation. 2015-05-11 09:10:19 +01:00
Ricardo Martins
60ec4ab220 Add error explanation for E0260. 2015-05-10 12:27:06 +01:00
Ricardo Martins
e7fa00a3e2 Add error explanation for E0259. 2015-05-10 12:27:06 +01:00
Ricardo Martins
f3a3684614 Add error explanation for E0154. 2015-05-10 12:27:06 +01:00
Ricardo Martins
c0412bcad6 Fix documentation URL in diagnostic message. 2015-05-10 12:16:33 +01:00
Ricardo Martins
7d9e605b93 Add error explanation for E0317. 2015-05-10 10:50:45 +01:00
Sean Patrick Santos
efb3872a49 Fix use of UFCS syntax to call methods on associated types. 2015-05-07 01:57:54 -06:00
Theo Belaire
db9d018424 Fixed some nits 2015-05-01 11:37:38 -04:00
bors
ac5f595d0a Auto merge of #24884 - michaelsproul:extended-errors, r=nrc
I've been working on improving the diagnostic registration system so that it can:

* Check uniqueness of error codes *across the whole compiler*. The current method using `errorck.py` is prone to failure as it relies on simple text search - I found that it breaks when referencing an error's ident within a string (e.g. `"See also E0303"`).
* Provide JSON output of error metadata, to eventually facilitate HTML output, as well as tracking of which errors need descriptions. The current schema is:

```
<error code>: {
    "description": <long description>,
    "use_site": {
        "filename": <filename where error is used>,
        "line": <line in file where error is used>
    }
}
```

[Here's][metadata-dump] a pretty-printed sample dump for `librustc`.

One thing to note is that I had to move the diagnostics arrays out of the diagnostics modules. I really wanted to be able to capture error usage information, which only becomes available as a crate is compiled. Hence all invocations of `__build_diagnostics_array!` have been moved to the ends of their respective `lib.rs` files. I tried to avoid moving the array by making a plugin that expands to nothing but couldn't invoke it in item position and gave up on hackily generating a fake item. I also briefly considered using a lint, but it seemed like it would impossible to get access to the data stored in the thread-local storage.

The next step will be to generate a web page that lists each error with its rendered description and use site. Simple mapping and filtering of the metadata files also allows us to work out which error numbers are absent, which errors are unused and which need descriptions.

[metadata-dump]: https://gist.github.com/michaelsproul/3246846ff1bea71bd049
2015-04-30 02:03:27 +00:00
Michael Sproul
d27230bb6d Add metadata output to the diagnostics system.
Diagnostic errors are now checked for uniqueness across the compiler and
error metadata is written to JSON files.
2015-04-30 08:59:53 +10:00
Tamir Duberstein
8c58fe1739 Fallout 2015-04-29 08:55:31 -07:00
Theo Belaire
5c05278fec Fixed types, and slimmed down code
I don't this we need to print the definition of the
imported value too, though it's quite possible.
2015-04-25 15:45:29 -04:00
Theo Belaire
69a5c379df Maybe it works
Still compiling, but I think I have it!
2015-04-25 15:11:56 -04:00
Theo Belaire
168615f869 Now passing in the ImportResolver to check_conflict...
It compiles, yay.
2015-04-25 14:35:47 -04:00
Theo Belaire
74648b5d64 First attempt at fixing #20591
This isn't quite right, but it's interesting.
2015-04-25 14:09:41 -04:00
Sean Patrick Santos
29eb550ee6 Get associated consts working in match patterns. 2015-04-23 21:02:29 -06:00
Sean Patrick Santos
7129e8815e Functional changes for associated constants. Cross-crate usage of associated constants is not yet working. 2015-04-23 21:02:26 -06:00
Sean Patrick Santos
b5499775d6 Structural changes for associated constants
Introduces new variants and types in syntax::ast, middle::ty, and middle::def.
2015-04-23 21:02:25 -06:00
P1start
7d2231aa22 Change a few error messages to give code suggestions
PR #24242 added the ability to the compiler to directly give suggestions about
how to modify code to fix an error. The new errors look like this:

    foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`,
                                not `&'static Copy` [E0178]
    foobar.rs:5     let x: &'static Copy + 'static;
                           ^~~~~~~~~~~~~
    foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438):
    foobar.rs:      let x: &'static (Copy + 'static);

    foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy`
    foobar.rs:2     let x = &1 as Copy;
                            ^~~~~~~~~~
    foobar.rs:2:19: 2:23 help: try casting to a reference instead:
    foobar.rs:      let x = &1 as &Copy;

    foobar.rs:7:24: 7:25 error: expected expression, found `;`
    foobar.rs:7     let x = box (1 + 1);
                                       ^
    foobar.rs:7:13: 7:16 help: try using `box()` instead:
    foobar.rs:      let x = box() (1 + 1);

This also modifies compiletest to give the ability to directly test suggestions
given by error messages.
2015-04-21 21:13:42 +12:00
Tamir Duberstein
10f15e72e6 Negative case of len() -> is_empty()
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14 20:26:03 -07:00
Tamir Duberstein
29ac04402d Positive case of len() -> is_empty()
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14 20:26:03 -07:00
Nick Cameron
01678acf50 Expose visibility for fns in syntax::visit 2015-04-14 09:54:58 +12:00
Nick Cameron
63b36ea7c2 Work with assoc types in a super trait.
And fix a bug with type param visibility though the Self rib.
2015-04-07 18:03:07 +12:00
Nick Cameron
dc8a8e9beb Check uses of Self in impls in the compiler rather than during expansion
Closes #23909
2015-04-03 22:47:53 +13:00
Alex Crichton
f92e7abefd rollup merge of #23860: nikomatsakis/copy-requires-clone
Conflicts:
	src/test/compile-fail/coherence-impls-copy.rs
2015-04-01 18:37:54 -07:00
Niko Matsakis
d9530c01a7 Fallout out rustc 2015-04-01 11:22:39 -04:00
Nick Cameron
0dd0925f57 Tidying up and reformatting 2015-04-01 14:07:19 +13:00
Manish Goregaokar
5eb4be4c56 Rollup merge of #23803 - richo:unused-braces, r=Manishearth
Pretty much what it says on the tin.
2015-03-28 18:12:06 +05:30
Richo Healey
cbce6bfbdb cleanup: Remove unused braces in use statements 2015-03-28 02:23:20 -07:00
Alex Crichton
01560112b8 Test fixes and rebase conflicts, round 1 2015-03-27 11:29:36 -07:00
Alex Crichton
28a6b16130 rollup merge of #23741: alexcrichton/remove-int-uint
Conflicts:
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/adt.rs
	src/librustc_typeck/check/mod.rs
	src/libserialize/json.rs
	src/test/run-pass/spawn-fn.rs
2015-03-27 10:10:05 -07:00
Alexis Beingessner
1b98f6da7a default => or_insert per RFC 2015-03-27 07:42:03 -04:00
Alex Crichton
43bfaa4a33 Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
2015-03-26 12:10:22 -07:00
Alex Crichton
54f16b818b rustc: Remove support for int/uint
This commit removes all parsing, resolve, and compiler support for the old and
long-deprecated int/uint types.
2015-03-25 16:39:00 -07:00
Aaron Turon
5fe0bb743a Future-proof indexing on maps: remove IndexMut
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in
order to future-proof the API against the eventual inclusion of an
`IndexSet` trait.

Ideally, we would eventually be able to support:

```rust
map[owned_key] = val;
map[borrowed_key].mutating_method(arguments);
&mut map[borrowed_key];
```

but to keep the design space as unconstrained as possible, we do not
currently want to support `IndexMut`, in case some other strategy will
eventually be needed.

Code currently using mutating index notation can use `get_mut` instead.

[breaking-change]

Closes #23448
2015-03-20 10:46:31 -07:00
Nick Cameron
46aa621452 Fix private module loophole in the 'private type in public item' check 2015-03-18 16:47:24 +13:00
Nick Cameron
1fd38c181a Reviewer changes 2015-03-16 17:01:12 +13:00
Nick Cameron
2df1ceb001 resolve: factor out resolve imports to its own module 2015-03-16 11:03:54 +13:00
Nick Cameron
170ccd615f Error if pub use references a private item.
[breaking-change]

Closes #23266
2015-03-16 11:03:54 +13:00
Nick Cameron
73afbef3aa Misc tidy ups in resolve 2015-03-16 11:03:54 +13:00
Eduard Burtescu
9da918548d syntax: move MethMac to MacImplItem and combine {Provided,Required}Method into MethodTraitItem. 2015-03-11 23:39:16 +02:00
Eduard Burtescu
ce10fa8d12 syntax: rename TypeMethod to MethodSig and use it in MethDecl. 2015-03-11 23:39:16 +02:00
Eduard Burtescu
f98b176314 syntax: gather common fields of impl & trait items into their respective types. 2015-03-11 23:39:16 +02:00
Eduard Burtescu
98491827b9 syntax: move indirection around {Trait,Impl}Item, from within. 2015-03-11 23:39:15 +02:00
Manish Goregaokar
2fcdd824ef Rollup merge of #23056 - awlnx:master, r=nrc 2015-03-06 22:22:33 +05:30
awlnx
951ef9d1f1 fix for new attributes failing. issue #22964 2015-03-05 11:53:51 -05:00
Ivan Radanov Ivanov
7496539a00 Change span_help calls to fileline_help where appropriate 2015-03-03 15:18:33 +02:00