Commit Graph

300 Commits

Author SHA1 Message Date
Eduard Burtescu
ad66c215aa rustc: switch most remaining middle::ty functions to methods. 2015-06-26 07:34:57 +03:00
Jared Roesch
81e5c1ff06 Remove the mostly unecessary ParamBounds struct 2015-06-23 00:10:19 -07:00
Eduard Burtescu
dfbc9608ce rustc: replace Repr/UserString impls with Debug/Display ones. 2015-06-19 01:36:20 +03:00
Eli Friedman
33b7386d39 Split TyArray into TyArray and TySlice.
Arrays and slices are closely related, but not that closely; making the
separation more explicit is generally more clear.
2015-06-12 16:50:13 -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
02c33b690b Auto merge of #26077 - SimonSapin:patch-6, r=alexcrichton
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical. Let’s deprecate now and plan to remove in the next cycle. (It’s `#[unstable]`.)

r? @alexcrichton 
CC @nagisa
2015-06-08 20:52:33 +00:00
Simon Sapin
c160192f5f Replace usage of String::from_str with String:from 2015-06-08 16:55:35 +02:00
Oliver 'ker' Schneider
ec078a033b change some statics to constants 2015-06-07 19:50:13 +02:00
bors
f3819f063c Auto merge of #25796 - arielb1:default-assoc, r=eddyb
r? @eddyb

Fixes #19476.
2015-05-27 22:05:09 +00:00
bors
cccc137b88 Auto merge of #25675 - bluss:rustdoc-assoc-types-index, r=alexcrichton
rustdoc: Associated type fixes

The first commit fixes a bug with "dud" items in the search index from
misrepresented `type` items in trait impl blocks.

For a trait *implementation* there are typedefs which are the types for
that particular trait and implementor. Skip these in the search index.

There were lots of dud items in the search index due to this (search for
Item, Iterator's associated type).

Add a boolean to clean::TypedefItem so that it tracks whether the it is
a type alias on its own, or if it's a `type` item in a trait impl.

The second commit fixes a bug that made signatures and where bounds
using associated types (if they were not on `Self`) incorrect.

The third commit fixes so that where clauses in type alias definititons
are shown.

Fixes #22442
Fixes #24417
Fixes #25769
2015-05-26 21:36:57 +00:00
Ariel Ben-Yehuda
ae10e478eb Implement defaults for associated types 2015-05-26 17:22:29 +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
Ulrik Sverdrup
d1cd689b48 rustdoc: Fix associated types in signatures
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not
render correctly and displayed `I` instead of `I::Item`. Same thing
with `I::Item` appearing in where bounds.

This fixes the bug by using paths for generics.

Fixes #24417
2015-05-25 19:06:58 +02: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
Ulrik Sverdrup
093e18d184 rustdoc: Skip types in impls in search index
For a trait *implementation* there are typedefs which are the types for
that particular trait and implementor. Skip these in the search index.

There were lots of dud items in the search index due to this (search for
Item, Iterator's associated type).

Add a boolean to clean::TypedefItem so that it tracks whether the it is
a type alias on its own, or if it's a `type` item in a trait impl.

Fixes #22442
2015-05-21 14:17:37 +02:00
bors
67dfc177f3 Auto merge of #25323 - eddyb:coherent-coherence, r=pnkfelix
The loop to load all the known impls from external crates seems to have been used because `ty::populate_implementations_for_trait_if_necessary` wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait.

Coherence for `librustc` was reduced from 18.310s to 0.610s, from stage1 to stage2.
Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements.

On a smaller scale, `fn main() {}` now spends 0.003s in coherence instead of 0.368s, which fixes #22068.
It also peaks at only 1.2MB, instead of 16MB of heap usage.
2015-05-12 10:46:14 +00:00
Eduard Burtescu
aeb92bab5d rustc: rename ty::populate_implementations_for_type_if_necessary to make it clear that it only populates inherent impls. 2015-05-12 07:51:15 +03:00
bors
7334518579 Auto merge of #25085 - carols10cents:remove-old-tilde, r=steveklabnik
There were still some mentions of `~[T]` and `~T`, mostly in comments and debugging statements. I tried to do my best to preserve meaning, but I might have gotten some wrong-- I'm happy to fix anything :)
2015-05-11 04:46:41 +00:00
Tshepang Lekhonkhobe
8227db86eb fix typos caught by codespell 2015-05-06 03:00:13 +02:00
Carol Nichols
7ec8172225 Update old uses of ~ in comments and debugging statements 2015-05-03 20:16:02 -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
Niko Matsakis
5368070228 Fix some missing cases 2015-04-17 10:05:33 -04:00
Alex Crichton
71c1b5b704 rustdoc: Inline methods inhereted through Deref
Whenever a type implements Deref, rustdoc will now add a section to the "methods
available" sections for "Methods from Deref<Target=Foo>", listing all the
inherent methods of the type `Foo`.

Closes #19190
2015-04-16 13:28:15 -07:00
Alex Crichton
8fb31f75c9 rustdoc: Fix cross-crate macro source links
The source filename for cross crate macros isn't quite right so the normal
generated links are invalid.

Closes #21311
2015-04-16 09:44:33 -07:00
Alex Crichton
0a46933c4d rustdoc: Overhaul stability displays
This commit is an overhaul to how rustdoc deals with stability of the standard
library. The handling has all been revisited with respect to Rust's current
approach to stability in terms of implementation as well as the state of the
standard library today. The high level changes made were:

* Stable items now have no marker by default
* Color-based small stability markers have been removed
* Module listings now fade out unstable/deprecated items slightly
* Trait methods have a separate background color based on stability and also
  list the reason that they are unstable.
* `impl` blocks with stability no longer render at all. This may be re-added
  once the compiler recognizes stability on `impl` blocks.
* `impl` blocks no longer have stability of the methods implemente indicated
* The stability summary has been removed

Closes #15468
Closes #21674
Closes #24201
2015-04-16 09:44:33 -07: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
Alex Crichton
77d164d809 rustdoc: Index inherent methods on primitives
The set of types which can have an inherent impl changed slightly and rustdoc
just needed to catch up to understand what it means to see a `impl str`!

Closes #23511
2015-04-07 17:54:35 -07:00
Alex Crichton
61d0365aac rustdoc: Handle duplicate reexports listed
This ends up causing duplicate output in rustdoc. The source of these duplicates
is that the item is defined in both resolve namespaces, so it's listed twice.

Closes #23207
2015-04-07 17:54:35 -07:00
Alex Crichton
2b9076ee19 rustdoc: Encode ABI in all methods
This commit ensures that the ABI of functions is propagated all the way through
to the documentation.

Closes #22038
2015-04-07 17:54:34 -07:00
Alex Crichton
6950f68870 rustdoc: Simplify predicates with paren notation
This change is aimed at improving cross-crate (inlined) notation of generic
closures. The change modifies `simplify::where_predicates` to handle
parenthesized notation as well as starting to handle supertrait bounds as well.
This was necessary because all output constraints of closures are bound to
`FnOnce` but most trait bounds are that of `FnMut`.

Close #21801
2015-04-07 17:54:34 -07:00
Alex Crichton
d7fcee8347 rustdoc: Detect provided methods on inlined traits
Closes #23864
2015-04-07 17:54:34 -07:00
Alex Crichton
75ef0832ae rustdoc: Improve handling inlined associated types
* All bounds are now discovered through the trait to be inlined.
* The `?Sized` bound now renders correctly for inlined associated types.
* All `QPath`s (`<A as B>::C`) instances are rendered as `A::C` where `C` is a
  hyperlink to the trait `B`. This should improve at least how the docs look at
  least.
* Supertrait bounds are now separated and display as the source lists them.

Closes #20727
Closes #21145
2015-04-07 17:54:34 -07:00
Alex Crichton
11f26f9995 rustdoc: Simplify cross-crate where clauses
Add a custom module to rustdoc which simplifies the output of `middle::ty` into
a more readable form which tends to be written down anyway!

Closes #20646
2015-04-07 17:54:34 -07:00
Alex Crichton
179719d450 rustdoc: Allowing specifying attrs for doctests
This adds support in rustdoc to blanket apply crate attributes to all doc tests
for a crate at once. The syntax for doing this is:

    #![doc(test(attr(...)))]

Each meta item in `...` will be applied to each doctest as a crate attribute.

cc #18199
2015-04-07 17:54:34 -07:00
Alex Crichton
9ad133b4a1 rustdoc: Add a primitive page for raw pointers
Closes #15318
2015-04-07 17:54:33 -07:00
Alex Crichton
458102eefa rustdoc: Run external traits through filters
This ensures that all external traits are run through the same filters that the
rest of the AST goes through, stripping hidden function as necessary.

Closes #13698
2015-04-07 17:54:33 -07:00
Alex Crichton
0304e15e5c Test fixes and rebase conflicts, round 1 2015-04-01 15:38:59 -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
19510ac70b rollup merge of #23633: tomjakubowski/rustdoc-array-prim
Previously, impls for `[T; n]` were collected in the same place as impls for `[T]` and `&[T]`. This splits them out into their own primitive page in both core and std.
2015-03-23 15:11:06 -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
Tom Jakubowski
2df8830642 rustdoc: Support for "array" primitive
Impls on `clean::Type::FixedVector` are now collected in the array
primitive page instead of the slice primitive page.

Also add a primitive docs for arrays to `std`.
2015-03-23 14:02:34 -07:00
Alex Crichton
4e25765aa2 rustdoc: Fix ICE with cross-crate default impls
This adds a special code path for impls which are listed as default impls to
ensure that they're loaded correctly.
2015-03-12 21:01:49 -07: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