Commit Graph

41065 Commits

Author SHA1 Message Date
Manish Goregaokar
72dc6fcbe7 Rollup merge of #24347 - xamgore:master, r=huonw
Docs meant that ParseIntError is returned though the function returns ParseFloatError.
2015-04-13 02:21:02 +05:30
Manish Goregaokar
4d38b497ce Rollup merge of #24341 - beefsack:traits-doc-dead-link, r=huonw
The "static and dynamic dispatch" chapter seems to no longer exist but there is a dead link from the Traits chapter pointing to it.

Have changed the link to point to "Trait Objects" which covers static and dynamic dispatch.
2015-04-12 19:09:53 +05:30
Manish Goregaokar
882185ecd5 Rollup merge of #24321 - lstat:16602-needstest, r=pnkfelix
Closes #16602
2015-04-12 18:46:14 +05:30
Manish Goregaokar
60add53545 Rollup merge of #24233 - frewsxcv:cleanup-fuse-iterator, r=Gankro 2015-04-12 18:46:14 +05:30
Manish Goregaokar
4ebc16c1ed Rollup merge of #24072 - ebfull:explain_closure_type_err, r=pnkfelix
Also fixed bug calling .note() instead of .help()

See #24036
2015-04-12 18:46:14 +05:30
Igor Strebezhev
11c1846168 mod.rs documentary fix
Docs meant that Option is returned though the function returns Result.
2015-04-12 14:48:19 +04:00
bors
a1e3c25a26 Auto merge of #24248 - nrc:macro-span, r=sfackler 2015-04-12 09:03:04 +00:00
bors
feeb23d42e Auto merge of #24003 - rprichard:span-fixes, r=huonw
* In `noop_fold_expr`, call `new_span` in these cases:
    - `ExprMethodCall`'s identifier
    - `ExprField`'s identifier
    - `ExprTupField`'s integer

   Calling `new_span` for `ExprMethodCall`'s identifier is necessary to print
   an acceptable diagnostic for `write!(&2, "")`. We see this error:
   ```
   <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt`
   <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   With this change, we also see a macro expansion backtrace leading to
   the `write!(&2, "")` call site.

 * After fully expanding a macro, we replace the expansion expression's
   span with the original span. Call `fld.new_span` to add a backtrace to
   this span. (Note that I'm call `new_span` after `bt.pop()`, so the macro
   just expanded isn't on the backtrace.)

   The motivating example for this change is `println!("{}")`. The format
   string literal is `concat!($fmt, "arg")` and is inside the libstd macro.
   We need to see the backtrace to find the `println!` call site.

 * Add a backtrace to the `format_args!` format expression span.

r?  alexcrichton

Addresses #23459
2015-04-12 06:48:28 +00:00
Corey Farwell
5c80b7aabb Simplify iterator logic for Fuse 2015-04-11 22:40:47 -07:00
bors
03f563a0e0 Auto merge of #24109 - sanxiyn:diverging-closure, r=pnkfelix
Fix #23896.
2015-04-12 04:33:40 +00:00
Michael Alexander
91ca622cdf Updated dead link in Traits chapter of book to point to Trait Objects chapter. 2015-04-12 10:42:05 +08:00
Nick Cameron
b9fa6c67fb Fix spans for macros 2015-04-12 13:28:17 +12:00
bors
5afa2704a6 Auto merge of #23011 - nagisa:the-war-of-symbol-and-symbol, r=pnkfelix
We provide tools to tell what exact symbols to emit for any fn or static, but
don’t quite check if that won’t cause any issues later on. Some of the issues
include LLVM mangling our names again and our names pointing to wrong locations,
us generating dumb foreign call wrappers, linker errors, extern functions
resolving to different symbols altogether (`extern {fn fail();} fail();` in some
cases calling `fail1()`), etc.

Before the commit we had a function called `note_unique_llvm_symbol`, so it is
clear somebody was aware of the issue at some point, but the function was barely
used, mostly in irrelevant locations.

Along with working on it I took liberty to start refactoring trans/base into
a few smaller modules. The refactoring is incomplete and I hope I will find some
motivation to carry on with it.

This is possibly a [breaking-change] because it makes dumbly written code
properly invalid.

This fixes all those issues about incorrect use of #[no_mangle] being not reported/misreported/ICEd by the compiler.

NB. This PR does not attempt to tackle the parallel codegen issue that was mentioned in https://github.com/rust-lang/rust/pull/22811, but I believe it should be very straightforward in a follow up PR by modifying `trans::declare::get_defined_value` to look at all the contexts.

cc @alexcrichton @huonw @nrc because you commented on the original RFC issue.

EDIT: wow, this became much bigger than I initially intended.
2015-04-12 01:26:53 +00:00
Ryan Prichard
ddbdf51f39 Remove the vestigial ExtCtxt::print_backtrace function.
It was added in 2011-08-05 and reduced to a no-op ten days later.
2015-04-11 16:48:52 -07:00
Ryan Prichard
fab3295cba Suppress the macro backtrace for fileline_note and fileline_help. 2015-04-11 16:48:31 -07:00
Ryan Prichard
5a8f102bf6 Add compile-file/macro-backtrace-{invalid-internals,nested,println} tests 2015-04-11 16:00:58 -07:00
Ryan Prichard
a893c646d0 Expand internal-unstable to handle named field accesses and method calls. 2015-04-11 16:00:58 -07:00
Ryan Prichard
0f46e4f1f2 Propagate macro backtraces more often, improve formatting diagnostics
* In noop_fold_expr, call new_span in these cases:
    - ExprMethodCall's identifier
    - ExprField's identifier
    - ExprTupField's integer

   Calling new_span for ExprMethodCall's identifier is necessary to print
   an acceptable diagnostic for write!(&2, ""). We see this error:

       <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt`
       <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   With this change, we also see a macro expansion backtrace leading to
   the write!(&2, "") call site.

 * After fully expanding a macro, we replace the expansion expression's
   span with the original span. Call fld.new_span to add a backtrace to
   this span. (Note that I'm call new_span after bt.pop(), so the macro
   just expanded isn't on the backtrace.)

   The motivating example for this change is println!("{}"). The format
   string literal is concat!($fmt, "arg") and is inside the libstd macro.
   We need to see the backtrace to find the println! call site.

 * Add a backtrace to the format_args! format expression span.

Addresses #23459
2015-04-11 16:00:58 -07:00
bors
6790b0e519 Auto merge of #24328 - Manishearth:rollup, r=Manishearth 2015-04-11 18:31:59 +00:00
Manish Goregaokar
0a2885ad94 Fix readme doctest (fixup #24239) 2015-04-11 21:09:36 +05:30
bors
67a8f61730 Auto merge of #24269 - benashford:formatting-fix, r=alexcrichton
This fixes the bug described in issue #23150.  This affected formatting any floating point number into a string in a formatting pattern that: a) required rounding up, and b) required an extra digit on the front.

So `format!("{:.0}", 9.9)` would fail, but `format!("{:.0}", 8.9)` would succeed.  This was due to a negative integer being cast to a `usize` resulting in an 'arithmetic operation overflowed' panic.

The fix was to change the order of operations so that the number is zero before casting.
2015-04-11 15:34:24 +00:00
Manish Goregaokar
859c5ed4d6 Rollup merge of #24309 - tshepang:doc-avoid-x-confusion, r=Manishearth 2015-04-11 19:06:01 +05:30
Manish Goregaokar
aa5eb33b9f Rollup merge of #24304 - ihrwein:fix-some-typos, r=alexcrichton
Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2015-04-11 19:05:52 +05:30
Manish Goregaokar
b140ad1194 Rollup merge of #24298 - White-Oak:master, r=alexcrichton
Fixes 'fn from_str_radix' documentation where docs meant that Option is returned, though the function returns Result.
2015-04-11 19:05:43 +05:30
Manish Goregaokar
9e2e62077e Rollup merge of #24291 - xamgore:patch-1, r=steveklabnik
From [here](http://doc.rust-lang.org/nightly/std/primitive.i8.html):

> `fn rotate_right(self, n: u32) -> i8`
> Shifts the bits to the right by a specified __amount amount__, n, wrapping the truncated bits to the beginning of the resulting integer.
2015-04-11 19:05:34 +05:30
Manish Goregaokar
f52682630e Rollup merge of #24283 - apasel422:patch-2, r=alexcrichton 2015-04-11 19:05:26 +05:30
Manish Goregaokar
1e3fd25b6b Rollup merge of #24282 - SimonSapin:patch-6, r=pnkfelix
https://botbot.me/mozilla/rust-internals/2015-04-10/?msg=36316959&page=6
2015-04-11 19:05:17 +05:30
Manish Goregaokar
df8360f4fc Rollup merge of #24281 - steveklabnik:lol_editing, r=alexcrichton
more more more
2015-04-11 19:05:09 +05:30
Manish Goregaokar
87660562a6 Rollup merge of #24279 - libfud:vec_insertion_docs, r=steveklabnik
...to be less confusing. Since 0 is the smallest number possible for usize, it doesn't make sense to mention it if it's already included, and it should be more clear that the length of the vector is a valid index with the new wording.

r? @steveklabnik
2015-04-11 19:05:00 +05:30
Manish Goregaokar
46f3bdf5ab Rollup merge of #24274 - steveklabnik:fix_pow_docs, r=nikomatsakis
This is very confusing now that these are inherent methods.
2015-04-11 19:04:51 +05:30
Manish Goregaokar
b6cb73b534 Rollup merge of #24259 - lstat:needstest, r=alexcrichton
Closes #20772
Closes #20939
Closes #21950
Closes #22034
2015-04-11 19:04:43 +05:30
Manish Goregaokar
dbbedb5a8b Rollup merge of #24253 - steveklabnik:doc_primitive_types, r=alexcrichton
A brief introduction to each type, with pointers to the primitive pages
for more info.
2015-04-11 19:04:37 +05:30
Manish Goregaokar
0f1723b2b7 Rollup merge of #24247 - steveklabnik:update_variable_bindings, r=huonw
keeping on with the edits
2015-04-11 19:04:30 +05:30
Manish Goregaokar
83093a2c98 Rollup merge of #24245 - nikomatsakis:issue-24241-coherence-failure, r=pnkfelix
Don't use skolemized parameters but rather fresh variables in coherence. Skolemized parameters wind up preventing unification. Surprised we had no test for this! Fixes #24241.

r? @pnkfelix
2015-04-11 19:04:22 +05:30
Manish Goregaokar
8c20c20ef4 Rollup merge of #24244 - steveklabnik:more_editing, r=steveklabnik
Fill out blank section headers. Copy edit the entire first section.
2015-04-11 19:04:15 +05:30
Manish Goregaokar
c34077539e Rollup merge of #24243 - frewsxcv:patch-13, r=steveklabnik 2015-04-11 19:04:08 +05:30
Manish Goregaokar
5bbe386a5c Rollup merge of #24242 - nikomatsakis:escaping-closure-error-message, r=brson
Example showing sample inputs, old message, new message:

https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba

Also adds infrastructure for reporting suggestions \"in situ\" and does some (minor) cleanups to `CodeMap`.

r? @brson
2015-04-11 19:04:03 +05:30
Manish Goregaokar
b3c9331c25 Rollup merge of #24240 - apasel422:patch-1, r=aturon 2015-04-11 19:03:56 +05:30
Manish Goregaokar
55610d64d1 Rollup merge of #24239 - steveklabnik:editing_pass, r=steveklabnik
Now that the new TOC has landed, I've started doing an editing pass to get the old content into the right shape. I felt this introduction was significant enough to send as its own PR, though, as it's the introduction.

It's possible that we may just want to replace 'the intro' with this directly, but this PR doesn't do that.
2015-04-11 19:03:50 +05:30
Manish Goregaokar
f99341a8e0 Rollup merge of #24236 - aturon:issue-19097, r=alexcrichton
Closes #19097
2015-04-11 19:03:43 +05:30
Manish Goregaokar
f5d6cae3fc Rollup merge of #24234 - thiagooak:academic-research, r=steveklabnik
#24004

Something like this?
2015-04-11 19:03:36 +05:30
Manish Goregaokar
c4a7d9b15c Rollup merge of #24121 - steveklabnik:gh24107, r=steveklabnik 2015-04-11 19:03:29 +05:30
Manish Goregaokar
719ad518ff Rollup merge of #24285 - brson:rustup, r=alexcrichton
Now lives at https://github.com/rust-lang/rustup

r? @alexcrichton
2015-04-11 19:03:20 +05:30
Manish Goregaokar
872de9c71f Rollup merge of #24269 - benashford:formatting-fix, r=alexcrichton
This fixes the bug described in issue #23150.  This affected formatting any floating point number into a string in a formatting pattern that: a) required rounding up, and b) required an extra digit on the front.

So `format!(\"{:.0}\", 9.9)` would fail, but `format!(\"{:.0}\", 8.9)` would succeed.  This was due to a negative integer being cast to a `usize` resulting in an 'arithmetic operation overflowed' panic.

The fix was to change the order of operations so that the number is zero before casting.
2015-04-11 19:03:13 +05:30
Manish Goregaokar
1737957e19 Rollup merge of #24268 - pnkfelix:regression-tests, r=alexcrichton
A pair of regression tests for issues that seem to have been fixed since they were originally filed.
2015-04-11 19:03:04 +05:30
bors
acb3e5136c Auto merge of #24268 - pnkfelix:regression-tests, r=alexcrichton
A pair of regression tests for issues that seem to have been fixed since they were originally filed.
2015-04-11 11:06:14 +00:00
bors
0be4e0ec50 Auto merge of #24155 - chris-chambers:stmt_macros, r=sfackler
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement.

This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present.

See:
- `src/test/run-pass/macro-stmt_macro_in_expr_macro.rs`
- `src/test/run-pass/macro-nested_stmt_macro.rs`

This changes the interface of the MacResult trait.  make_stmt has become make_stmts and now returns a vector, rather than a single item.  Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt.

See:
- `src/libsyntax/ext/base.rs`

This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros.

See:
- `src/test/compile-fail/macro-incomplete-parse.rs`
2015-04-11 08:07:34 +00:00
Luke Gallagher
117512348b Add tests for #16602
Closes #16602
2015-04-11 17:13:24 +10:00
Christopher Chambers
77627ea8dd Moves expand_stmt's bt_pop so that it balances correctly. 2015-04-11 00:59:00 -05:00
bors
3a8275397a Auto merge of #24254 - aturon:join-handle-debug, r=alexcrichton
Make `Box<Any + Send>` implement `Debug`.

Fixes #21291
2015-04-11 05:57:55 +00:00