Commit Graph

29975 Commits

Author SHA1 Message Date
Steve Klabnik
e16a87513a Remove the cheat sheet.
Rust by Example is far better.

Fixes #14380.
2014-06-24 17:22:39 -07:00
Edward Wang
bf61bb6b7f Add tests for #12470 and #14285
The #14869 removed `TraitStore` from `ty_trait` and represented trait
reference as regular `ty_rptr`. An old bug of the missing constraint
upon lifetime parameter of trait reference then is fixed as a side
effect. Adds tests for affected bugs and closes them.

Closes #12470.
Closes #14285.
2014-06-24 17:19:19 -07:00
Steve Klabnik
d58412bfa1 Add more description to c_str::unwrap().
It's unclear what you are supposed to do with this memory.
Let's make that more clear.
2014-06-24 17:19:17 -07:00
Niko Matsakis
9e3d0b002a librustc: Remove the fallback to int from typechecking.
This breaks a fair amount of code. The typical patterns are:

* `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`;

* `println!("{}", 3)`: change to `println!("{}", 3i)`;

* `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`.

RFC #30. Closes #6023.

[breaking-change]
2014-06-24 17:18:48 -07:00
Alex Crichton
f7f95c8f5a std: Bring back half of Add on String
This adds an implementation of Add for String where the rhs is <S: Str>. The
other half of adding strings is where the lhs is <S: Str>, but coherence and
the libcore separation currently prevent that.
2014-06-24 17:17:09 -07:00
bors
05ca9f747d auto merge of #15024 : kmcallister/rust/lint, r=alexcrichton
This is a rebase of #14804 with two new commits on top to implement and test lint plugins.

r? @alexcrichton @huonw: Can you take a look at the new commits, and also weigh in about any issues from the old PR that you feel are still unresolved? I'm leaving the old branch alone to preserve discussion history.
2014-06-24 22:06:48 +00:00
bors
87f3741fdf auto merge of #15118 : stepancheg/rust/concat, r=alexcrichton
(And in other extensions implemented with `get_exprs_from_tts` function).
2014-06-24 19:36:47 +00:00
Keegan McAllister
7e694e7115 More upstream lint changes 2014-06-24 11:36:28 -07:00
Keegan McAllister
7dc724bf88 Test lint plugins 2014-06-24 11:36:28 -07:00
Keegan McAllister
2f274d11ba Implement lint plugins 2014-06-24 11:36:28 -07:00
Keegan McAllister
51d438e568 Incorporate upstream changes to old lint code 2014-06-24 11:36:28 -07:00
Keegan McAllister
e67e6e678d List builtin lints one per line for better diffs 2014-06-24 11:36:28 -07:00
Keegan McAllister
c747626ced Reindent function call continuations, and other style fixes 2014-06-24 11:36:27 -07:00
Keegan McAllister
ba1c0c4232 Drop the ExportedItems argument from LintPass::check_crate
None of the builtin lints use this, and it's now available through the Context.
2014-06-24 11:36:27 -07:00
Keegan McAllister
6fede93475 Make the crate and its exported items available in the lint context 2014-06-24 11:36:27 -07:00
Keegan McAllister
a813a3779b Rework lint attr parsing and use it in middle::dead 2014-06-24 11:36:27 -07:00
Keegan McAllister
b5542f7f5b Convert builtin lints to uppercase names for style consistency 2014-06-24 11:36:27 -07:00
Keegan McAllister
21e7b936d3 Use names in Lint structs in an ASCII-case-insensitive way
In preparation for the next commit.
2014-06-24 11:36:27 -07:00
Keegan McAllister
609552e195 Run lint passes using the Option dance instead of RefCells 2014-06-24 11:36:27 -07:00
Keegan McAllister
c1898b9acb Stop using Default for initializing builtin lints
It wasn't a very appropriate use of the trait. Instead, just enumerate
unit structs and those with a `fn new()` separately.
2014-06-24 11:36:27 -07:00
Keegan McAllister
c7af6060dd Clean up and document the public lint API
Also change some code formatting.

lint::builtin becomes a sibling of lint::context in order to ensure that lints
implemented there use the same public API as lint plugins.
2014-06-24 11:36:27 -07:00
Keegan McAllister
819f76ca82 Store the registered lints in the Session 2014-06-24 11:36:27 -07:00
Keegan McAllister
442fbc473e Replace enum LintId with an extensible alternative 2014-06-24 10:25:15 -07:00
Keegan McAllister
69b6bc5eee Convert lints to a trait-based infrastructure
The immediate benefits are

* moving the state specific to a single lint out of Context, and
* replacing the soup of function calls in the Visitor impl with
  more structured control flow

But this is also a step towards loadable lints.
2014-06-24 10:24:03 -07:00
Keegan McAllister
5d4c96a8f2 Rename lint::Lint to lint::LintId 2014-06-24 10:24:03 -07:00
Keegan McAllister
3144614f0b Move lint infrastructure and individual lints into separate files 2014-06-24 10:24:03 -07:00
Keegan McAllister
75bfedaef5 Move lint.rs out of middle
We're going to have more modules under lint, and the paths get unwieldy. We
also plan to have lints run at multiple points in the compilation pipeline.
2014-06-24 10:22:49 -07:00
bors
719ffc2484 auto merge of #15114 : ben0x539/rust/run-make-libpath, r=alexcrichton
It was accidentally removed in #15006 and that somehow got past the
build bots, causing `src/test/run-make/c-dynamic-dylib` to fail on at
least my linux system.

This resolves #15103 (thanks to @alexcrichton!).
2014-06-24 17:16:48 +00:00
bors
c38125987f auto merge of #15071 : tomjakubowski/rust/fix-15052, r=alexcrichton
Fix #15052
2014-06-24 15:32:29 +00:00
bors
82ec1aef29 auto merge of #14963 : w3ln4/rust/master, r=alexcrichton
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
2014-06-24 13:46:54 +00:00
Tom Jakubowski
0af4985332 librustc: Remove outdated reference to ~ and @
Fix #15052
2014-06-24 05:02:53 -07:00
bors
71fe44def9 auto merge of #15113 : pnkfelix/rust/fsk-add-regression-test-for-ice-from-10846, r=alexcrichton
Includes a bit more comments than usual for a regression test; I felt like documenting Niko's diagnosis of the original problem here. 

Fix #15111 

r? anyone.
2014-06-24 12:01:50 +00:00
bors
58bf8b2155 auto merge of #15107 : ipetkov/rust/tutorial-update, r=alexcrichton 2014-06-24 10:16:49 +00:00
Pawel Olzacki
34a384a128 Added Mipsel architecture support 2014-06-24 11:12:10 +02:00
bors
d9611da4e6 auto merge of #15066 : pcwalton/rust/lang-and-intrinsic-feature-gate, r=alexcrichton
If you define lang items in your crate, add `#[feature(lang_items)]`.

If you define intrinsics (`extern "rust-intrinsic"`), add
`#[feature(intrinsics)]`.

Closes #12858.

[breaking-change]

r? @brson
2014-06-24 07:56:51 +00:00
Patrick Walton
5466d13d43 librustc: Feature gate lang items and intrinsics.
If you define lang items in your crate, add `#[feature(lang_items)]`.

If you define intrinsics (`extern "rust-intrinsic"`), add
`#[feature(intrinsics)]`.

Closes #12858.

[breaking-change]
2014-06-23 23:28:28 -07:00
bors
e8c12d32a2 auto merge of #15079 : nikomatsakis/rust/issue-5527-unify-refactor, r=pnkfelix
This is just a cleanup of the code. Doesn't really change anything deep about the way we operate. This is a prelude to implementing a good solution for one-way matching for #5527.

r? @pnkfelix (we were just crawling about this code, after all)
2014-06-24 06:06:52 +00:00
bors
7689213713 auto merge of #14952 : alexcrichton/rust/const-unsafe-pointers, r=brson
This does not yet change the compiler and libraries from `*T` to `*const T` as
it will require a snapshot to do so.

cc #7362

---

Note that the corresponding RFC, https://github.com/rust-lang/rfcs/pull/68, has not yet been accepted. It was [discussed at the last meeting](https://github.com/rust-lang/rust/wiki/Meeting-weekly-2014-06-10#rfc-pr-68-unsafe-pointers-rename-t-to-const-t) and decided to be accepted, however. I figured I'd get started on the preliminary work for the RFC that will be required regardless.
2014-06-24 04:16:53 +00:00
bors
10b12bc123 auto merge of #15105 : alexcrichton/rust/snapshots, r=luqmana 2014-06-24 02:31:55 +00:00
bors
e07cec6f9a auto merge of #14885 : pcwalton/rust/struct-literal-tightening, r=alexcrichton
`for...in`.

Closes #14803.

If you used a structure literal after one of these keywords, surround it
in parentheses.

[breaking-change]

r? @nick29581
2014-06-24 00:36:54 +00:00
Patrick Walton
654d6444fe libsyntax: Disallow struct literals after if, while, match, and
`for...in`.

Closes #14803.

If you used a structure literal after one of these keywords, surround it
in parentheses.

[breaking-change]
2014-06-23 15:39:29 -07:00
Ivan Petkov
39efe3c82b Docs: tutorial: Remove a couple references to ~T 2014-06-23 14:51:03 -07:00
bors
d6c1b85246 auto merge of #14974 : Ryman/rust/non_trait_method, r=alexcrichton
Closes #3973.
2014-06-23 21:46:46 +00:00
Kevin Butler
ab24d29f0d rustc: catch impl X for Y where X is not a trait in resolve. 2014-06-23 17:38:32 +01:00
Kevin Butler
579a139215 rustc: catch non-trait methods before typeck.
Closes #3973.
2014-06-23 17:38:32 +01:00
bors
575710f6ce auto merge of #15106 : Sawyer47/rust/rm-duplicated-tests, r=alexcrichton
Even if they used to test different things in the past, they are
now identical to other files.

Closes #11496
2014-06-23 16:16:37 +00:00
Stepan Koltsov
85467b6b41 Allow trailing comma in concat!
(And in other extensions implemented with `get_exprs_from_tts` function).
2014-06-23 15:51:40 +00:00
bors
d77cb22bb6 auto merge of #15100 : rapha/rust/master, r=alexcrichton
/usr/bin/env appears to be more portable.
2014-06-23 14:31:39 +00:00
bors
baa72085f4 auto merge of #15098 : ben0x539/rust/nullary-tuple-struct, r=pcwalton
Reject `struct Foo();` to fix #15095.
2014-06-23 12:46:33 +00:00
Felix S. Klock II
7be2019428 Add regression test for ICE from issue 10846. 2014-06-23 14:17:18 +02:00