Commit Graph

412 Commits

Author SHA1 Message Date
bors
440ef8b154 Auto merge of #30184 - petrochenkov:ascr, r=nikomatsakis
This PR is a rebase of the original PR by @eddyb https://github.com/rust-lang/rust/pull/21836 with some unrebasable parts manually reapplied, feature gate added + type equality restriction added as described below.

This implementation is partial because the type equality restriction is applied to all type ascription expressions and not only those in lvalue contexts. Thus, all difficulties with detection of these contexts and translation of coercions having effect in runtime are avoided.
So, you can't write things with coercions like `let slice = &[1, 2, 3]: &[u8];`. It obviously makes type ascription less useful than it should be, but it's still much more useful than not having type ascription at all.
In particular, things like `let v = something.iter().collect(): Vec<_>;` and `let u = t.into(): U;` work as expected and I'm pretty happy with these improvements alone.

Part of https://github.com/rust-lang/rust/issues/23416
2015-12-19 02:45:15 +00:00
Vadim Petrochenkov
a745614f44 Use lint instead of warning 2015-12-18 04:14:46 +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
Vadim Petrochenkov
105bd15207 Address the review comments 2015-12-12 21:40:45 +03:00
Vadim Petrochenkov
e3ed7b0501 Implement #[deprecated] attribute (RFC 1270) 2015-12-12 19:39:37 +03:00
Seo Sanghyeon
55ffc33b10 Warn no_mangle on generic functions 2015-12-09 01:48:40 +09:00
Vadim Petrochenkov
eb789de803 Do MTWT resolution during lowering to HIR 2015-12-05 00:40:21 +03: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
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
d45dd9423e make CrateStore a trait object
rustdoc still broken
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
Vadim Petrochenkov
be8ace8cac Remove all uses of #[staged_api] 2015-11-25 21:55:26 +03:00
bors
040a77f772 Auto merge of #29952 - petrochenkov:depr, r=brson
Part of https://github.com/rust-lang/rust/issues/29935

The deprecation lint is still called "deprecated", so people can continue using `#[allow(deprecated)]` and similar things.
2015-11-23 20:08:49 +00:00
Vadim Petrochenkov
a613059e3f Rename #[deprecated] to #[rustc_deprecated] 2015-11-20 16:11:20 +03:00
Vadim Petrochenkov
c1ad5af4a6 Changes to data produced by privacy pass 2015-11-19 14:16:35 +03:00
Niko Matsakis
e4ff9f71db Port a bunch of code new-visitor; all of these ports were
straightforward uses of `visit_all_items`. In some cases I had to remove
empty `visit_item` calls that were just to suppress visiting nested
items.
2015-11-18 19:22:18 -05:00
bors
50b969d3b2 Auto merge of #29882 - devonhollowood:master, r=Manishearth
Implement #14615
2015-11-18 02:02:00 +00:00
Devon Hollowood
5e8225af91 Remove unused imports 2015-11-17 01:19:14 -08:00
Devon Hollowood
07e108f038 Remove 'raw_pointer_derive' lint (#14615) 2015-11-17 01:19:14 -08:00
Oliver Schneider
e36872da5b ImplItem_ -> ImplItemKind rename 2015-11-16 10:35:30 +01:00
Oliver Schneider
eaaa60dbea rename ImplItem_::*ImplItem to ImplItem_::*
[breaking change]
2015-11-16 10:34:45 +01:00
bors
18ff06ecc1 Auto merge of #29402 - sanxiyn:if-let, r=steveklabnik 2015-10-28 09:39:43 +00:00
Simonas Kazlauskas
662082cb7e Update unused_parens lint for placement-in arrow 2015-10-27 21:55:10 +02:00
bors
540fd3aa71 Auto merge of #26848 - oli-obk:const_fn_const_eval, r=pnkfelix
this has the funky side-effect of also allowing constant evaluation of function calls to functions that are not `const fn` as long as `check_const` didn't mark that function `NOT_CONST`

It's still not possible to call a normal function from a `const fn`, but let statements' initialization value can get const evaluated (this caused the fallout in the overflowing tests)

we can now do this:

```rust
const fn add(x: usize, y: usize) -> usize { x + y }
const ARR: [i32; add(1, 2)] = [5, 6, 7];
```

also added a test for destructuring in const fn args
```rust
const fn i((a, b): (u32, u32)) -> u32 { a + b } //~ ERROR: E0022
```

This is a **[breaking change]**, since it turns some runtime panics into compile-time errors. This statement is true for ANY improvement to the const evaluator.
2015-10-27 17:11:13 +00:00
Seo Sanghyeon
fb7e325900 Use if let 2015-10-28 01:08:46 +09:00
Alex Crichton
ff49733274 std: Stabilize library APIs for 1.5
This commit stabilizes and deprecates library APIs whose FCP has closed in the
last cycle, specifically:

Stabilized APIs:

* `fs::canonicalize`
* `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists,
   is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait.
* `Formatter::fill`
* `Formatter::width`
* `Formatter::precision`
* `Formatter::sign_plus`
* `Formatter::sign_minus`
* `Formatter::alternate`
* `Formatter::sign_aware_zero_pad`
* `string::ParseError`
* `Utf8Error::valid_up_to`
* `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}`
* `<[T]>::split_{first,last}{,_mut}`
* `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated
  but will be once 1.5 is released.
* `str::{R,}MatchIndices`
* `str::{r,}match_indices`
* `char::from_u32_unchecked`
* `VecDeque::insert`
* `VecDeque::shrink_to_fit`
* `VecDeque::as_slices`
* `VecDeque::as_mut_slices`
* `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`)
* `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`)
* `Vec::resize`
* `str::slice_mut_unchecked`
* `FileTypeExt`
* `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}`
* `BinaryHeap::from` - `from_vec` deprecated in favor of this
* `BinaryHeap::into_vec` - plus a `Into` impl
* `BinaryHeap::into_sorted_vec`

Deprecated APIs

* `slice::ref_slice`
* `slice::mut_ref_slice`
* `iter::{range_inclusive, RangeInclusive}`
* `std::dynamic_lib`

Closes #27706
Closes #27725
cc #27726 (align not stabilized yet)
Closes #27734
Closes #27737
Closes #27742
Closes #27743
Closes #27772
Closes #27774
Closes #27777
Closes #27781
cc #27788 (a few remaining methods though)
Closes #27790
Closes #27793
Closes #27796
Closes #27810
cc #28147 (not all parts stabilized)
2015-10-25 09:36:32 -07:00
Oliver Schneider
b4e30bd2a3 allow constant evaluation of function calls 2015-10-19 13:13:02 +02:00
bors
cd79acf21e Auto merge of #29109 - nxnfufunezn:master, r=Manishearth
Fixes : #19668 

r? @Manishearth
2015-10-17 08:04:32 +00:00
nxnfufunezn
72e0e59574 Updated librustc_lint/builtin.rs to use span_lint_note 2015-10-17 02:14:26 +05:30
bors
747d951e88 Auto merge of #29014 - petrochenkov:stability, r=brson
Stricter checking of stability attributes + enforcement of their invariants at compile time
(+ removed dead file librustc_front/attr.rs)
I intended to enforce use of `reason` for unstable items as well (it normally presents for new items), but it turned out too intrusive, many older unstable items don't have `reason`s.

r? @aturon 
I'm studying how stability works and do some refactoring along the way, so it's probably not the last PR.
2015-10-16 17:47:01 +00:00
Vadim Petrochenkov
46750d0409 Merge VariantData and VariantData_ 2015-10-13 15:19:27 +03:00
Vadim Petrochenkov
40aa09e4c9 Merge struct fields and struct kind 2015-10-13 15:19:25 +03:00
Vadim Petrochenkov
30af54dede Dict -> Struct, StructDef -> VariantData, def -> data 2015-10-13 15:19:24 +03:00
Vadim Petrochenkov
877c35e8a2 Remove now redundant NodeId from Variant 2015-10-13 15:19:18 +03:00
Vadim Petrochenkov
ab671552c3 Refactor attr::Stability
Stricter checking + enforcement of invariants at compile time
2015-10-13 06:01:31 +03:00
Nick Cameron
ba43c228b5 Some cleanup of no longer used AST things 2015-10-09 11:53:42 +13:00
Nick Cameron
08f3752270 hygiene for for loops, if let, while let
and some unrelated test cleanups
2015-10-09 11:53:41 +13:00
bors
88b6a5063d Auto merge of #28779 - alexcrichton:ffi-isize-usize, r=nrc
This lint warning was originally intended to help against misuse of the old Rust
`int` and `uint` types in FFI bindings where the Rust `int` was not equal to the
C `int`. This confusion no longer exists (as Rust's types are now `isize` and
`usize`), and as a result the need for this lint has become much less over time.

Additionally, starting with [the RFC for libc][rfc] it's likely that `isize` and
`usize` will be quite common in FFI bindings (e.g. they're the definition of
`size_t` and `ssize_t` on many platforms).

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

This commit disables these lints to instead consider `isize` and `usize` valid
types to have in FFI signatures.
2015-10-06 01:26:13 +00:00
bors
a004ff5caf Auto merge of #28793 - Ms2ger:AttrStyle, r=alexcrichton 2015-10-02 07:10:43 +00:00
Ms2ger
b093060c2a Stop re-exporting AttrStyle's variants and rename them. 2015-10-01 18:03:34 +02:00
Niko Matsakis
01f32ace03 Convert DefId to use DefIndex, which is an index into a list of
paths, and construct paths for all definitions. Also, stop rewriting
DefIds for closures, and instead just load the closure data from
the original def-id, which may be in another crate.
2015-10-01 10:43:07 -04:00
Niko Matsakis
d7b0eb0f39 build up a set of node-ids that we can construct def-ids from 2015-10-01 10:42:37 -04:00
Niko Matsakis
a0dc2d9a29 Introduce semi-duplicate DefIds into DefLocal/DefUpvar to remove use
of xxx_local.
2015-10-01 10:37:19 -04: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
bd6758a2b5 rustc: Don't lint about isize/usize in FFI
This lint warning was originally intended to help against misuse of the old Rust
`int` and `uint` types in FFI bindings where the Rust `int` was not equal to the
C `int`. This confusion no longer exists (as Rust's types are now `isize` and
`usize`), and as a result the need for this lint has become much less over time.

Additionally, starting with [the RFC for libc][rfc] it's likely that `isize` and
`usize` will be quite common in FFI bindings (e.g. they're the definition of
`size_t` and `ssize_t` on many platforms).

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

This commit disables these lints to instead consider `isize` and `usize` valid
types to have in FFI signatures.
2015-09-30 14:31:01 -07:00
Lee Jeffery
e4d9951984 Add unused_attributes to unused lint group. 2015-09-29 16:44:26 +01:00
Manish Goregaokar
7e6e64b12d Rollup merge of #28681 - arielb1:destructor-fixes, r=eddyb
Fixes #28568 

r? @eddyb
2015-09-27 15:05:17 +05:30
Ariel Ben-Yehuda
f9b703e7ab remove the destructors table 2015-09-26 23:11:52 +03:00
bors
2e88c36ebc Auto merge of #28642 - petrochenkov:name3, r=nrc
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup
In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky.

Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it:
- `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions.
- Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons.
- Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts.

r? @nrc
2015-09-26 14:48:56 +00: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
Eduard Burtescu
f293ea28b4 Remove the deprecated box(PLACE) syntax. 2015-09-24 18:00:08 +03:00
Vadim Petrochenkov
40ce80484c Remove random Idents outside of libsyntax 2015-09-23 20:04:49 +03:00
bors
cefe5f25b2 Auto merge of #28580 - wesleywiser:split_out_type_lints, r=alexcrichton
Move out the `TypeLimits` and `ImproperCTypes` lints into a separate module. 

Part of #22206
2015-09-23 02:11:18 +00:00
Vadim Petrochenkov
0af8e47546 Fix rebase 2015-09-22 20:46:23 +03:00
Vadim Petrochenkov
2a779062d8 Use Names in the remaining HIR structures with exception of...
PathSegment, PatIdent, ExprWhile, ExprLoop, ExprBreak and ExprAgain - they need Idents for resolve
2015-09-22 19:58:29 +03:00
Vadim Petrochenkov
a4af958786 Use Names in HIR Items 2015-09-22 19:53:52 +03:00
Vadim Petrochenkov
ae77dbb835 Use Names in HIR visitors and folders 2015-09-22 19:52:53 +03:00
bors
e9d2587766 Auto merge of #28364 - petrochenkov:usegate, r=alexcrichton
Closes https://github.com/rust-lang/rust/issues/28075
Closes https://github.com/rust-lang/rust/issues/28388

r? @eddyb 
cc @brson
2015-09-22 01:12:26 +00:00
Wesley Wiser
b0bcde4b47 Split out the type lints into a new module
Part of #22206
2015-09-21 20:58:57 -04:00
Wesley Wiser
974dfe8e31 Split out the UNUSED_* lints into a new module
Part of #22206
2015-09-19 17:35:18 -04:00
Wesley Wiser
ed77fcc8a6 Split out the bad_style lints into a new module
Part of #22206
2015-09-19 17:35:18 -04:00
Simonas Kazlauskas
5104a93a0d Revert "Convert negate_unsigned feature gate to a warning"
This reverts commit 0ca8e4994e and fixes the code to work with
current rustc.

Fixes #27141
2015-09-18 20:22:16 +03:00
Vadim Petrochenkov
50e42ea9f7 Correctly walk import lists in AST visitors 2015-09-17 14:13:12 +03: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
d21bfff78c Remove hir::ExprParen 2015-09-17 12:16:46 +12:00
Nick Cameron
70c6fb9193 Change the unused parens lint to operate on the AST 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
5a95acb8ab split ty::util and ty::adjustment 2015-09-14 14:55:56 +03: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
bors
8f28c9b01e Auto merge of #28007 - Ms2ger:FnKind, r=nrc
There is no longer a need for that pattern, since enums are now qualified.
2015-08-31 01:09:40 +00:00
Jonas Schievink
4b571b055d Handle gateage of built-in attributes seperately
This allows marking attributes as whitelisted/crate-only independent of
their feature gate status.

Closes #24213
2015-08-29 11:37:40 +02:00
Ms2ger
2076cddcf2 Rename FnKind variants and stop re-exporting them from the visit module.
There is no longer a need for that pattern, since enums are now qualified.
2015-08-26 12:02:58 +02:00
Ariel Ben-Yehuda
277eeb95c3 move destructors_for_type into AdtDef 2015-08-25 21:52:15 +03:00
bors
797d0ba59c Auto merge of #27857 - Manishearth:improve-fnkind, r=pnkfelix
Since enums are namespaced now, should we also remove the `Fk` prefixes from `FnKind` and remove the reexport? (The reexport must be removed because otherwise it clashes with glob imports containing `ItemFn`). IMO writing `FnKind::Method` is much clearer than `FkMethod`.
2015-08-24 12:47:57 +00:00
Niko Matsakis
c0de23de81 convert to use is_local instead of == LOCAL_CRATE 2015-08-24 05:35:34 -04:00
Niko Matsakis
e91bef2e05 fallout from moving def-id 2015-08-24 05:35:34 -04:00
Huon Wilson
717da9513f Create "platform-intrinsic" ABI for SIMD/platform intrinsics.
This is purposely separate to the "rust-intrinsic" ABI, because these
intrinsics are theoretically going to become stable, and should be fine
to be independent of the compiler/language internals since they're
intimately to the platform.
2015-08-17 14:41:38 -07:00
Manish Goregaokar
c03bf18b84 FnFnBlock -> FkClosure 2015-08-16 18:23:58 +05:30
Alex Crichton
2972b77134 Add issue for the rustc_private feature everywhere 2015-08-15 18:09:17 -07:00
Alex Crichton
8d90d3f368 Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.
2015-08-12 14:55:17 -07:00
Alex Crichton
737397c584 rollup merge of #27622: eefriedman/https-url
Also fixes a few outdated links.
2015-08-11 22:11:25 -07:00
bors
91c618f133 Auto merge of #27575 - brson:lint, r=alexcrichton
This reverts commit 9191a78955.

This was reverted previously until the `--cap-lints` option was implemented.
2015-08-11 14:42:23 +00: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
Ariel Ben-Yehuda
eedb1cc576 rename ADTDef to AdtDef etc. 2015-08-07 15:03:09 +03:00
Brian Anderson
e0d7497fb8 Revert "Revert "Fix missing_docs lint for const and static.""
This reverts commit 9191a78955.
2015-08-06 16:36:44 -07:00
Ariel Ben-Yehuda
5f3c1412ad use VariantDef instead of struct_fields 2015-08-06 16:54:40 +03:00
Ariel Ben-Yehuda
764310e7bb introduce an ADTDef struct for struct/enum definitions 2015-08-06 14:16:56 +03:00
Eduard Burtescu
585f0e928b rustc_lint: handle more method calls in unconditional_recursion. 2015-08-04 01:17:56 +03:00
Oliver Schneider
00a5e66f81 remove get_ident and get_name, make as_str sound 2015-07-28 18:07:20 +02:00
Eli Friedman
21b514ff30 In improper-ctypes lint, handle functions which explicitly return ().
Fixes issue #27302.
2015-07-26 19:21:53 -07:00
Eli Friedman
6fa17b43d3 Rewrite the improper_ctypes lint.
Makes the lint a bit more accurate, and improves the quality of the diagnostic
messages by explicitly returning an error message.

The new lint is also a little more aggressive: specifically, it now
rejects tuples, and it recurses into function pointers.
2015-07-23 17:03:04 -07:00
bors
d4d4206e56 Auto merge of #26683 - eefriedman:const-eval-hint, r=pnkfelix
The "hint" mechanism is essentially used as a workaround to compute
types for expressions which have not yet been type-checked. This
commit clarifies that usage, and limits the effects to the places
where it is currently necessary.

Fixes #26210.
2015-07-22 12:49:06 +00:00
bors
2afe47d168 Auto merge of #27160 - brson:revdoc, r=huonw
This reverts commit 00130cff99.

As mentioned in a regression report[1], this caused a notable amount
of breakage. Because there's a plan to mitigate[2] this type of
breakage, I'm reverting this until then.

[1]: https://internals.rust-lang.org/t/new-crater-reports-1-1-stable-vs-beta-2015-07-10-and-nightly-2015-07-10/2358
[2]: https://github.com/rust-lang/rfcs/pull/1193
2015-07-21 11:32:54 +00:00
Brian Anderson
9191a78955 Revert "Fix missing_docs lint for const and static."
This reverts commit 00130cff99.

As mentioned in a regression report[1], this caused a notable amount
of breakage.  Because there's a plan to mitigate[2] this type of
breakage, I'm reverting this until then.

[1]: https://internals.rust-lang.org/t/new-crater-reports-1-1-stable-vs-beta-2015-07-10-and-nightly-2015-07-10/2358
[2]: https://github.com/rust-lang/rfcs/pull/1193
2015-07-20 10:44:46 -07:00
Simonas Kazlauskas
0ca8e4994e Convert negate_unsigned feature gate to a warning 2015-07-20 12:24:16 +03:00
Eli Friedman
6bdfb05347 Clarify the usage of "hints" in const_eval.
The "hint" mechanism is essentially used as a workaround to compute
types for expressions which have not yet been type-checked. This
commit clarifies that usage, and limits the effects to the places
where it is currently necessary.

Fixes #26210.
2015-07-17 18:29:34 -07:00
Simonas Kazlauskas
22502154e6 Implement lint deprecation/removal…
and deprecate/remove unsigned_negation lint.

This is useful to avoid causing breaking changes in case #![deny(unknown_lints)]
is used and lint is removed.
2015-07-15 20:16:58 +03:00
Simonas Kazlauskas
0c9e3dc75c Fix negate_unsigned feature gate check
This commit fixes the negate_unsigned feature gate to appropriately
account for infered variables.

This is technically a [breaking-change].
2015-07-14 21:48:43 +03:00
Wesley Wiser
93ddee6cee Change some instances of .connect() to .join() 2015-07-10 19:40:46 -04:00
bors
5d3b0f1f6b Auto merge of #26473 - Eljay:missing_docs, r=alexcrichton
Fixes #24249

I've tagged all items that were missing docs to allow them to compile for now, the ones in core/num should probably be documented at least.

This is also a breaking change for any crates using `#[deny(missing_docs)]` that have undocumented constants, not sure there is any way to avoid this without making it a separate lint?
2015-07-05 20:37:26 +00:00
Eduard Burtescu
d256eb1c5d rustc: remove MethodOrigin and use the container to distinguish inherent methods. 2015-07-04 17:51:31 +03:00
Eduard Burtescu
5620a58791 rustc_lint: use traits::select for methods in unconditional_recursion. 2015-07-04 06:21:00 +03:00
Eduard Burtescu
70365ed911 rustc: simplify ty::MethodOrigin and avoid trait item indices. 2015-07-04 06:21:00 +03:00
Eduard Burtescu
fe354e58bd rustc: remove unused MethodStaticClosure variant of MethodOrigin. 2015-07-04 06:21:00 +03:00
bors
560b1dab15 Auto merge of #26677 - jroesch:fulfillment-context-refactor, r=nrc
This patch implements the next chunk of flattening out the type checking context. In a series of patches I moved around the necessary state and logic in order to delete the `Typer` and `ClosureTyper` traits. My next goal is to clean the interfaces and start to move the normalization code behind them.

r? @nrc I hope my PR is coherent, doing this too late at night ;)
2015-07-02 03:10:25 +00:00
bors
8a599c8cef Auto merge of #26034 - Gankro:deprecate-bits, r=alexcrichton
I've mirrored them out to crates (bit-vec and bit-set) that build on stable.

(not sure if this actually correctly deprecates them in std)
2015-07-01 17:55:20 +00:00
Alexis Beingessner
7850c8d0aa fallout of bitvec/bitset deprecation 2015-07-01 10:30:14 -07:00
bors
fdf219dd42 Auto merge of #26663 - Eljay:fix-repr-attribute, r=sanxiyn
Fixes #26646.

Loops over all `#[repr(..)]` attributes instead of stopping at the first one to make sure they are all marked as used. Previously it stopped after the first `#[repr(C)]` was found causing all other attributes to be skipped by the linter.
2015-06-30 20:07:18 +00:00
Jared Roesch
9faae6a5ca Remove Typer and ClosureTyper
This commit finalizes the work of the past commits by fully moving the fulfillment context into
the InferCtxt, cleaning up related context interfaces, removing the Typer and ClosureTyper
traits and cleaning up related intefaces
2015-06-30 02:41:40 -07:00
Jared Roesch
e2d7e904ca Remove Typer + ClosureTyper impls for ParameterEnv 2015-06-30 02:40:17 -07:00
Huon Wilson
900af2c6d9 lint: default methods must be called on Self to unconditionally recur.
This catches the case when a trait defines a default method that calls
itself, but on a type that isn't necessarily `Self`, e.g. there's no
reason that `T = Self` in the following, so the call isn't necessarily
recursive (`T` may override the call).

    trait Bar {
        fn method<T: Bar>(&self, x: &T) {
            x.method(x)
        }
    }

Fixes #26333.
2015-06-29 16:00:54 -07:00
Huon Wilson
b1931e48a0 lint: only consider actual calls as unconditional recursion.
Specifically, just mentioning the function name as a value is fine, as
long as it isn't called, e.g. `fn main() { let _ = main; }`.

Closes #21705.
2015-06-29 15:59:37 -07:00
Lee Jeffery
b676e99b60 Fix incorrect warning about unused repr attributes. 2015-06-29 20:40:18 +01:00
Jared Roesch
79d02895ff Begin refactor type checking state
This first patch starts by moving around pieces of state related to
type checking. The goal is to slowly unify the type checking state
into a single typing context. This initial patch moves the
ParameterEnvironment into the InferCtxt and moves shared tables
from Inherited and ty::ctxt into their own struct Tables. This
is the foundational work to refactoring the type checker to
enable future evolution of the language and tooling.
2015-06-27 13:43:20 -07:00
Eduard Burtescu
ad66c215aa rustc: switch most remaining middle::ty functions to methods. 2015-06-26 07:34:57 +03:00
Eduard Burtescu
6db5126240 rustc: make ty::mk_* constructors into methods on ty::ctxt. 2015-06-26 07:34:56 +03:00
Oliver Schneider
88b03f349e change const_val enum and its variants to camel-case 2015-06-23 10:31:32 +02:00
Eljay
00130cff99 Fix missing_docs lint for const and static. 2015-06-21 16:02:05 +01:00
bors
74a7e8b03e Auto merge of #26417 - brson:feature-err, r=steveklabnik
It now says '#[feature] may not be used on the stable release channel'.

I had to convert this error from a lint to a normal compiler error.

I left the lint previously-used for this in place since removing it is
a breaking change. It will just go unused until the end of time.

Fixes #24125
2015-06-20 14:24:19 +00:00
Brian Anderson
f14a0e2de4 Make a better error message for using #[feature] on stable rust
It now says '#[feature] may not be used on the stable release channel'.

I had to convert this error from a lint to a normal compiler error.

I left the lint previously-used for this in place since removing it is
a breaking change. It will just go unused until the end of time.

Fixes #24125
2015-06-18 17:38:38 -07:00
Eduard Burtescu
0b58fdf925 rustc: remove Repr and UserString. 2015-06-19 01:39:26 +03:00
Eduard Burtescu
a3727559c6 rustc: use the TLS type context in Repr and UserString. 2015-06-19 01:32:44 +03:00
Eduard Burtescu
96ad4a4863 rustc: use Repr and UserString instead of ppaux::ty_to_string. 2015-06-19 01:18:43 +03:00
Alex Crichton
ce1a965cf5 Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07: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
c14d86fd3f core: Split apart the global core feature
This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.

A few minor APIs were deprecated along the way:

* Iterator::reverse_in_place
* marker::NoCopy
2015-06-17 09:06:59 -07:00
Eli Friedman
3c69db4c3c Cleanup: rename middle::ty::sty and its variants.
Use camel-case naming, and use names which actually make sense in modern Rust.
2015-06-12 11:07:16 -07: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
bors
d8a9570154 Auto merge of #26141 - eddyb:ast_map, r=nikomatsakis
Gets libsyntax one step closer to running on stable (see #24518).
Closes #24757, erickt's previous attempt at this.
2015-06-10 11:38:04 +00:00
Eduard Burtescu
76eaed44d9 syntax: move ast_map to librustc. 2015-06-10 02:40:45 +03:00
Simon Sapin
c57a4124ff Address a review comment and fix a bootstrapping issue 2015-06-08 19:50:28 +02:00
bors
c654a07d29 Auto merge of #25785 - arielb1:cleanup-201505, r=eddyb
The caching essentially eliminates "stability checking" time (my attempt to clean-up junk got tangled up with stability, so I added the caching while I was at it).

r? @eddyb
2015-05-26 12:15:30 +00:00
Ariel Ben-Yehuda
0ec3183df8 Remove ObjectCastMap 2015-05-26 12:33:53 +03:00
Ariel Ben-Yehuda
c7711002bb Make caching in stability work. This improves stability check performance
by 90%.
2015-05-26 11:38:56 +03:00
econoplas
43502adf07 - Fix regression of literal out of range check for negative i64 values which was introduced by commit 7b1916d253.
- Add missing test cases to test/compile-fail/lint-type-overflow.rs which would have detected the regression.
2015-05-25 07:42:16 -06:00
bors
ba0e1cd814 Auto merge of #25609 - nikomatsakis:const-fn, r=pnkfelix
This is a port of @eddyb's `const-fn` branch. I rebased it, tweaked a few things, and added tests as well as a feature gate. The set of tests is still pretty rudimentary, I'd appreciate suggestions on new tests to write. Also, a double-check that the feature-gate covers all necessary cases.

One question: currently, the feature-gate allows the *use* of const functions from stable code, just not the definition. This seems to fit our usual strategy, and implies that we might (perhaps) allow some constant functions in libstd someday, even before stabilizing const-fn, if we were willing to commit to the existence of const fns but found some details of their impl unsatisfactory.

r? @pnkfelix
2015-05-24 11:12:34 +00:00
bors
cc56c20ba4 Auto merge of #25168 - Manishearth:register_attr, r=eddyb
This lets plugin authors opt attributes out of the `custom_attribute`
and `unused_attribute` checks.


cc @thepowersgang
2015-05-24 09:38:26 +00: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
9ee4eadb6f Auto merge of #25612 - petrochenkov:lintabs, r=@alexcrichton
Reported here https://github.com/rust-lang/rust/pull/25441#issuecomment-103513930
2015-05-21 00:52:27 +00:00
bors
d7185dcff1 Auto merge of #25571 - hirschenberger:master, r=nrc
It is hard to find the actual unstable feature which caused the error when using a list of stable and unstable features as the span marks the whole line

```
src/k8055.rs:22:1: 22:64 error: unstable feature
src/k8055.rs:22 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

This PR spawns an error for each unstable feature in the list:

```
est.rs:1:12: 1:26 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                     ^~~~~~~~~~~~~~
test.rs:1:28: 1:41 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                                     ^~~~~~~~~~~~~
test.rs:1:43: 1:47 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                                                    ^~~~
test.rs:1:49: 1:56 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                                                          ^~~~~~~
test.rs:1:58: 1:62 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
                                                                   ^~~~
```
2015-05-20 18:08:40 +00:00
petrochenkov
7b1916d253 Fix panic in lint for out of range literals 2015-05-20 13:03:18 +03:00
Ariel Ben-Yehuda
e7e1fd20de Fix rebase conflicts 2015-05-19 22:54:44 +03:00
Falco Hirschenberger
70db73a330 Show the span of feature that is unstable when using a feature-list. 2015-05-18 16:37:05 +02: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
22b720a920 address more review comments 2015-05-13 12:40:12 +05:30
Manish Goregaokar
96e1cf3b06 address review comments 2015-05-07 15:31:20 +05:30
Manish Goregaokar
8dc6e16933 Add support for registering attributes with rustc in plugins
This lets plugin authors opt attributes out of the `custom_attribute`
and `unused_attribute` checks.
2015-05-07 13:41:20 +05:30
Sean McArthur
d131f33557 lint: deny transmuting from immutable to mutable, since it's undefined behavior
[breaking-change] Technically breaking, since code that had been using
these transmutes before will no longer compile. However, it was
undefined behavior, so really, it's a good thing. Fixing your code would
require some re-working to use an UnsafeCell instead.

Closes #13146
2015-05-05 22:26:23 -07:00
Ariel Ben-Yehuda
7ae4a8e9f3 Use hash-tables in trait selection
Puts implementations in bins hashed by the fast-reject key, and
only looks up the relevant impls, reducing O(n^2)-ishness

Before: 688.92user 5.08system 8:56.70elapsed 129%CPU (0avgtext+0avgdata 1208164maxresident)k, LLVM 379.142s
After: 637.78user 5.11system 8:17.48elapsed 129%CPU (0avgtext+0avgdata 1201448maxresident)k LLVM 375.552s

Performance increase is +7%-ish
2015-04-30 15:10:52 +03:00
Felix S. Klock II
78130a4690 lint for mixing #[repr(C)] with an impl of Drop. 2015-04-29 23:05:09 +02:00
Tamir Duberstein
69abc12b00 Register new snapshots 2015-04-28 17:23:45 -07: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
Tshepang Lekhonkhobe
298a6e6657 lint: explain the non-obvious need for a negative test 2015-04-20 23:11:58 +02:00
P1start
c163f89310 Lint non-snake-case crate names
Passing a non-snake-case name to #![crate_name] or --crate-name will now yield a
warning from the `non_snake_case` lint.
2015-04-19 20:31:18 +12:00
Niko Matsakis
7ab0d1ab67 Port to using the newer graph, which offers iterators instead of the
older `each` method, but is otherwise identical.
2015-04-17 10:12:55 -04: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
Alex Crichton
d7ff4f5195 rollup merge of #24391: nrc/visit-vis 2015-04-14 10:55:55 -07:00
Eduard Burtescu
4e8e64140f eddyb's refactoring of coercions/adjustments 2015-04-14 21:55:42 +12:00
Nick Cameron
01678acf50 Expose visibility for fns in syntax::visit 2015-04-14 09:54:58 +12: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
Felix S. Klock II
98dd376f9c fallout when bootstrapping rustc. 2015-04-01 22:35:50 +02:00
Niko Matsakis
d9530c01a7 Fallout out rustc 2015-04-01 11:22:39 -04:00
bors
80bf31dd51 Auto merge of #23549 - aturon:stab-num, r=alexcrichton
This commit stabilizes the `std::num` module:

* The `Int` and `Float` traits are deprecated in favor of (1) the
  newly-added inherent methods and (2) the generic traits available in
  rust-lang/num.

* The `Zero` and `One` traits are reintroduced in `std::num`, which
  together with various other traits allow you to recover the most
  common forms of generic programming.

* The `FromStrRadix` trait, and associated free function, is deprecated
  in favor of inherent implementations.

* A wide range of methods and constants for both integers and floating
  point numbers are now `#[stable]`, having been adjusted for integer
  guidelines.

* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
  `is_sign_negative`, in order to address #22985

* The `Wrapping` type is moved to `std::num` and stabilized;
  `WrappingOps` is deprecated in favor of inherent methods on the
  integer types, and direct implementation of operations on
  `Wrapping<X>` for each concrete integer type `X`.

Closes #22985
Closes #21069

[breaking-change]

r? @alexcrichton
2015-03-31 14:50:46 +00:00
Aaron Turon
232424d995 Stabilize std::num
This commit stabilizes the `std::num` module:

* The `Int` and `Float` traits are deprecated in favor of (1) the
  newly-added inherent methods and (2) the generic traits available in
  rust-lang/num.

* The `Zero` and `One` traits are reintroduced in `std::num`, which
  together with various other traits allow you to recover the most
  common forms of generic programming.

* The `FromStrRadix` trait, and associated free function, is deprecated
  in favor of inherent implementations.

* A wide range of methods and constants for both integers and floating
  point numbers are now `#[stable]`, having been adjusted for integer
  guidelines.

* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
  `is_sign_negative`, in order to address #22985

* The `Wrapping` type is moved to `std::num` and stabilized;
  `WrappingOps` is deprecated in favor of inherent methods on the
  integer types, and direct implementation of operations on
  `Wrapping<X>` for each concrete integer type `X`.

Closes #22985
Closes #21069

[breaking-change]
2015-03-31 07:50:25 -07:00
Manish Goregaokar
2c0329cfa8 Rollup merge of #23852 - cmr:missing_doc, r=Manishearth
Due to a long-standing conservative approach to trait exports, all traits are
considered exported. However, the missing_docs lint uses the export map to
determine if something is public and ought to have documentation. This commit
modifies the lint to check if traits are private before emitting the warning.

Closes #11592
2015-03-31 09:04:37 +05:30
Corey Richardson
31a5285200 lint: handle private traits better
Due to a long-standing conservative approach to trait exports, all traits are
considered exported. However, the missing_docs lint uses the export map to
determine if something is public and ought to have documentation. This commit
modifies the lint to check if traits are private before emitting the warning.

Closes #11592
2015-03-30 18:16:25 -04: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
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
Nick Cameron
e7122a5a09 Change lint names to plurals 2015-03-25 10:06:13 +13:00
Nick Cameron
088cd566ea Remove the UnusedCasts lint 2015-03-25 10:06:13 +13:00
Nick Cameron
95602a759d Add trivial cast lints.
This permits all coercions to be performed in casts, but adds lints to warn in those cases.

Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.

[breaking change]

* Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
* The unused casts lint has gone.
* Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
- You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
- Casts do not influence inference of integer types. E.g., the following used to type check:

```
let x = 42;
let y = &x as *const u32;
```

Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:

```
let x: u32 = 42;
let y = &x as *const u32;
```
2015-03-25 10:03:57 +13:00
Alex Crichton
29b54387b8 Test fixes and rebase conflicts, round 2 2015-03-23 17:10:19 -07:00
Alex Crichton
753efb5042 rollup merge of #23601: nikomatsakis/by-value-index
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`.

r? @japaric
cc @aturon @Gankro
2015-03-23 15:10:50 -07:00
Aaron Turon
8389253df0 Add generic conversion traits
This commit:

* Introduces `std::convert`, providing an implementation of
RFC 529.

* Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all
in favor of the corresponding generic conversion traits.

  Consequently, various IO APIs now take `AsRef<Path>` rather than
`AsPath`, and so on. Since the types provided by `std` implement both
traits, this should cause relatively little breakage.

* Deprecates many `from_foo` constructors in favor of `from`.

* Changes `PathBuf::new` to take no argument (creating an empty buffer,
  as per convention). The previous behavior is now available as
  `PathBuf::from`.

* De-stabilizes `IntoCow`. It's not clear whether we need this separate trait.

Closes #22751
Closes #14433

[breaking-change]
2015-03-23 15:01:45 -07:00
Niko Matsakis
8e58af4004 Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses of
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about
how to use `[]`.
2015-03-23 16:55:45 -04:00
Alex Crichton
aa88da6317 std: Tweak some unstable features of str
This commit clarifies some of the unstable features in the `str` module by
moving them out of the blanket `core` and `collections` features.

The following methods were moved to the `str_char` feature which generally
encompasses decoding specific characters from a `str` and dealing with the
result. It is unclear if any of these methods need to be stabilized for 1.0 and
the most conservative route for now is to continue providing them but to leave
them as unstable under a more specific name.

* `is_char_boundary`
* `char_at`
* `char_range_at`
* `char_at_reverse`
* `char_range_at_reverse`
* `slice_shift_char`

The following methods were moved into the generic `unicode` feature as they are
specifically enabled by the `unicode` crate itself.

* `nfd_chars`
* `nfkd_chars`
* `nfc_chars`
* `graphemes`
* `grapheme_indices`
* `width`
2015-03-17 18:03:03 -07:00
York Xiang
60aa751620 Improve camelcase suggestion 2015-03-14 13:40:33 +08: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
bors
cfea8ec416 Auto merge of #23126 - alexcrichton:char-third-pass, r=aturon
This commit performs another pass over the `std::char` module for stabilization.
Some minor cleanup is performed such as migrating documentation from libcore to
libunicode (where the `std`-facing trait resides) as well as a slight
reorganiation in libunicode itself. Otherwise, the stability modifications made
are:

* `char::from_digit` is now stable
* `CharExt::is_digit` is now stable
* `CharExt::to_digit` is now stable
* `CharExt::to_{lower,upper}case` are now stable after being modified to return
  an iterator over characters. While the implementation today has not changed
  this should allow us to implement the full set of case conversions in unicode
  where some characters can map to multiple when doing an upper or lower case
  mapping.
* `StrExt::to_{lower,upper}case` was added as unstable for a convenience of not
  having to worry about characters expanding to more characters when you just
  want the whole string to get into upper or lower case.

This is a breaking change due to the change in the signatures of the
`CharExt::to_{upper,lower}case` methods. Code can be updated to use functions
like `flat_map` or `collect` to handle the difference.

[breaking-change]

Closes #20333
2015-03-10 22:45:10 +00:00
Alex Crichton
0f6a0b58f9 std: Stabilize more of the char module
This commit performs another pass over the `std::char` module for stabilization.
Some minor cleanup is performed such as migrating documentation from libcore to
libunicode (where the `std`-facing trait resides) as well as a slight
reorganiation in libunicode itself. Otherwise, the stability modifications made
are:

* `char::from_digit` is now stable
* `CharExt::is_digit` is now stable
* `CharExt::to_digit` is now stable
* `CharExt::to_{lower,upper}case` are now stable after being modified to return
  an iterator over characters. While the implementation today has not changed
  this should allow us to implement the full set of case conversions in unicode
  where some characters can map to multiple when doing an upper or lower case
  mapping.
* `StrExt::to_{lower,upper}case` was added as unstable for a convenience of not
  having to worry about characters expanding to more characters when you just
  want the whole string to get into upper or lower case.

This is a breaking change due to the change in the signatures of the
`CharExt::to_{upper,lower}case` methods. Code can be updated to use functions
like `flat_map` or `collect` to handle the difference.

[breaking-change]
2015-03-10 15:08:31 -07:00
Richo Healey
061d84399e remove uses of as_slice where deref coercions can be used 2015-03-09 07:54:19 -07:00
Manish Goregaokar
2fcdd824ef Rollup merge of #23056 - awlnx:master, r=nrc 2015-03-06 22:22:33 +05:30
bors
b0746ff19b Auto merge of #23031 - Manishearth:rollup, r=Manishearth 2015-03-05 21:03:10 +00:00
awlnx
951ef9d1f1 fix for new attributes failing. issue #22964 2015-03-05 11:53:51 -05:00
Manish Goregaokar
c8c4d85b50 Rollup merge of #22764 - ivanradanov:fileline_help, r=huonw
When warnings and errors occur, the associated help message should not print the same code snippet.
https://github.com/rust-lang/rust/issues/21938
2015-03-05 12:38:32 +05:30
Niko Matsakis
bc9ae36dba Separate supertrait collection from processing a TraitDef. This allows
us to construct trait-references and do other things without forcing a
full evaluation of the supertraits. One downside of this scheme is that
we must invoke `ensure_super_predicates` before using any construct that
might require knowing about the super-predicates.
2015-03-04 15:06:33 -05:00
Ivan Radanov Ivanov
7496539a00 Change span_help calls to fileline_help where appropriate 2015-03-03 15:18:33 +02:00
Florian Zeitz
f35f973cb7 Use consts instead of statics where appropriate
This changes the type of some public constants/statics in libunicode.
Notably some `&'static &'static [(char, char)]` have changed
to `&'static [(char, char)]`. The regexp crate seems to be the
sole user of these, yet this is technically a [breaking-change]
2015-03-02 17:11:51 +01:00
Manish Goregaokar
fb28214dcc Rollup merge of #22893 - Ms2ger:lints, r=huonw 2015-03-02 03:54:00 +05:30
Ivan Petkov
2fc6224411 Rename LintPass::check_trait_method to check_trait_item
Traits can have associated types and not just methods. This
clarification reflects the the type of the input the method accepts.

[breaking-change]
2015-02-28 13:56:37 -08:00
Ms2ger
fe2e0976de Use if-let for UnusedImportBraces. 2015-02-28 13:32:34 +01:00
Ms2ger
8a7b6b3ee6 Collapse nested matches in method_context. 2015-02-28 13:32:18 +01:00
Ms2ger
f38b83b360 Avoid unnecessary mutability for UnusedResults. 2015-02-28 13:31:55 +01:00
Ms2ger
2a37f7f07c Add a comment to code that confused me. 2015-02-28 13:31:27 +01:00
Ms2ger
57e0248d34 Various formatting cleanup. 2015-02-28 13:31:14 +01:00
Ms2ger
4dad9077cc Qualify uses of MethodContext variants. 2015-02-28 12:17:11 +01:00
Huon Wilson
39092530a4 Update docs for rustc_lint crateification. 2015-02-28 15:34:00 +11:00
Huon Wilson
532cd5f85a Separate most of rustc::lint::builtin into a separate crate.
This pulls out the implementations of most built-in lints into a
separate crate, to reduce edit-compile-test iteration times with
librustc_lint and increase parallelism. This should enable lints to be
refactored, added and deleted much more easily as it slashes the
edit-compile cycle to get a minimal working compiler to test with (`make
rustc-stage1`) from

    librustc -> librustc_typeck -> ... -> librustc_driver ->
        libcore -> ... -> libstd

to

    librustc_lint -> librustc_driver -> libcore -> ... libstd

which is significantly faster, mainly due to avoiding the librustc build
itself.

The intention would be to move as much as possible of the infrastructure
into the crate too, but the plumbing is deeply intertwined with librustc
itself at the moment. Also, there are lints for which diagnostics are
registered directly in the compiler code, not in their own crate
traversal, and their definitions have to remain in librustc.

This is a [breaking-change] for direct users of the compiler APIs:
callers of `rustc::session::build_session` or
`rustc::session::build_session_` need to manually call
`rustc_lint::register_builtins` on their return value.

This should make #22206 easier.
2015-02-28 15:33:59 +11:00