Commit Graph

41913 Commits

Author SHA1 Message Date
bors
f55e66aaed Auto merge of #24198 - alexcrichton:windows-readlink, r=aturon
The current implementation of using GetFinalPathNameByHandle actually reads all
intermediate links instead of just looking at the current link. This commit
alters the behavior of the function to use a different API which correctly reads
only one level of the soft link.

[breaking-change]
2015-04-13 17:39:14 +00:00
Ariel Ben-Yehuda
39543e91f5 Don't try to suggest fields of an enum
Fixes #24365
2015-04-13 19:29:23 +03:00
Sean Bowe
c660609190 Leave error message intact 2015-04-13 09:01:55 -06:00
bors
588d37c653 Auto merge of #24362 - alexcrichton:issue-24334, r=huonw
Make sure the unstable `scoped` modules isn't named the same as the `scoped`
function.

cc #24334
2015-04-13 14:57:13 +00:00
pez
883bb6568d remove duplicated linux sysconf mod 2015-04-13 15:17:45 +01:00
Manuel Hoffmann
4abade50d7 Added a help span which informs the user about the escaping of curly braces in a format string if a wrongly escaped one is detected in a string. 2015-04-13 15:56:10 +02:00
pez
6f54ce9aa5 added _SC_NPROCESSORS_ONLN constants for linux and macos for fix #24374 2015-04-13 14:24:47 +01:00
bors
b9ed9e2a32 Auto merge of #24351 - michaelwoerister:named-tuple-fields, r=alexcrichton
This PR makes `rustc` emit field names for tuple fields in DWARF. Formerly there was no way of directly accessing the fields of a tuple in GDB and LLDB since there is no C/C++ equivalent to this. Now, the debugger sees the name `__{field-index}` for tuple fields. So you can type for example `some_tuple_val.__2` to get the third tuple component.
When pretty printers are used (e.g. via `rust-gdb` or `rust-lldb`) these artificial field names will not clutter tuple rendering (which was the main motivation for not doing this in the past).

Solves #21948.
2015-04-13 12:39:49 +00:00
Björn Steinbrink
e891f29b95 Fix ICE when returning a variable whose declaration is unreachable
Fixes #24353
2015-04-13 13:07:41 +02:00
bors
3cac76bcf2 Auto merge of #24344 - gfxmonk:update-libbacktrace, r=pnkfelix
On linux, certain crashes can cause rust's backtrace generation code to consume huge amounts of memory (multiple gigabytes) when trying to generate a backtrace (e.g. servo/servo#5340).

I tracked this down to a bug in libbacktrace's allocation strategy when processing large binaries, and thankfully it's already been fixed upstream.

The change which fixes this specific issue is r210256, and is discussed here:
https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00547.html

I assume we'd prefer to update libbacktrace wholesale, rather than cherry-picking individual patches, so this PR updates libbacktrace to the latest code from svn://gcc.gnu.org/svn/gcc/trunk/libbacktrace (r220112).

I've copied the upstream code and reapplied the parts of the following commits which touch src/libbacktrace:

 - cd8f31759f
 - fcb30a0b67

I have not reapplied f5765793b6 or d51047ded0, as those are both cosmetic cleanups applied to the entire codebase. For this directory, it seems worthwhile diverging as little as possible from upstream, to reduce the effort of future updates. But I can add them as well if preferred.
2015-04-13 10:23:58 +00:00
kgv
c3c83bfda4 Arity link has moved to primitive-types.md. 2015-04-13 12:11:37 +03:00
bors
524547551c Auto merge of #24339 - lfairy:remove-regex-data, r=alexcrichton
The regex crate keeps its own tables now (rust-lang/regex#41) so we
don't need them here.

[breaking-change]
2015-04-13 08:08:23 +00:00
Sean Bowe
49225b8fbc Delay specific span_bug() call until abort_if_errors()
An actual typeck error is the cause of many failed compilations but an
unrelated bug is being reported instead. It is triggered because a typeck
error is presumably not yet identified during compiler execution, which
would normally bypass an invariant in the presence of other errors. In
this particular situation, we delay the reporting of the bug until
abort_if_errors().

Closes #23827, closes #24356, closes #23041, closes #22897, closes #23966,
closes #24013, and closes #23729
2015-04-13 01:16:51 -06:00
bors
49798c597f Auto merge of #24323 - rprichard:panic-line-type, r=alexcrichton
There are syntax extensions that call `std::rt::begin_unwind` passing it a `usize`.  I updated the syntax extension to instead pass `u32`, but for bootstrapping reasons, I needed to create a `#[cfg(stage0)]` version of `std::rt::begin_unwind` and therefore also `panic!`.
2015-04-13 05:55:50 +00:00
Ryan Prichard
861556390e Remove pretty-expanded from tests that use format_args!
Now that the internals of `format_args!` are unstable, tests that use it
don't compile after pretty-printing (unless they also declare the necessary
feature).
2015-04-12 22:01:55 -07:00
Ryan Prichard
9cdc9e9c61 Destabilize format_args! internals.
Arguments, Formatters, and the various format traits remain stable. The
format_args! macro uses #[allow_internal_unstable] to allow it access to
the unstable things in core::fmt.

Destabilized things include a "v1" in their name:
 * core::fmt::rt
 * core::fmt::rt::v1 (the module and all contents)
 * core::fmt::ArgumentV1
 * core::fmt::ArgumentV1::new
 * core::fmt::ArgumentV1::from_usize
 * core::fmt::Arguments::new_v1
 * core::fmt::Arguments::new_v1_formatted

The unstable message was copied from that of std::io::_print.
2015-04-12 22:01:55 -07:00
Ryan Prichard
bd26307411 Use the ecx.call_site() span for generating refs to format_args! internals
`format_args!` uses `#[allow_internal_unstable]` to access internal
functions and structs that are marked unstable. For this to work, the
spans on AST nodes referencing unstable internals must be equal (same
lo/hi values) to the `format_args!` call site, so that the stability
checker can recognize that the AST node was generated by the macro.
2015-04-12 22:01:55 -07:00
Alex Crichton
dc1f216227 std: Work around a stability bug in thread
Make sure the unstable `scoped` modules isn't named the same as the `scoped`
function.

cc #24334
2015-04-12 21:43:25 -07:00
bors
0cf99c3e06 Auto merge of #24315 - richo:make-debug-helper, r=pnkfelix
Also add docs because not being able to discover these things is the pits.

This was lifted from http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html , and solves a problem I've solved myself a *lot* of times, often in massively inferior ways.

Super open to documenting it somewhere other than nitty-gritty, which isn't immediately obvious.
2015-04-13 02:50:13 +00:00
Barosl Lee
cef96b95f2 rustdoc: Prevent '/' from showing the help dialog
Only '?' should do that.

Fixes #24289.
2015-04-13 10:33:50 +09:00
bors
47def3ef27 Auto merge of #23849 - bcoopers:master, r=pnkfelix
Right now, if the user requests to increase the vector size via reserve() or push_back() and the request brings the attempted memory above usize::MAX, we panic.

With this change there is only a panic if the minimum requested memory that could meet the requirement is above usize::MAX- otherwise it simply requests its largest capacity possible, usize::MAX.
2015-04-13 00:34:21 +00:00
Chris Wong
5308ac939a Remove regex module from libunicode
The regex crate keeps its own tables now (rust-lang/regex#41) so we
don't need them here.

[breaking-change]
2015-04-13 10:30:10 +12:00
Robin Kruppe
219f61bdd8 Make Debug include the - in -0.0 2015-04-12 23:39:03 +02:00
bors
c3947061d6 Auto merge of #24349 - Manishearth:rollup, r=Manishearth
- Successful merges: #24072, #24233, #24321, #24339, #24341, #24342, #24347
- Failed merges:
2015-04-12 20:50:19 +00:00
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
Michael Woerister
03f9269496 Add a name for tuple fields in debuginfo so that they can be accessed in debuggers. 2015-04-12 20:44:25 +02:00
bcoopers
ac617b6288 The panic! macro can't be called with a variable declared
with "let" when building on stage0. So change the error
message to a static const.
2015-04-12 13:47:10 -04:00
bors
37cb1d455e Auto merge of #24072 - ebfull:explain_closure_type_err, r=pnkfelix
Also fixed bug calling .note() instead of .help()

See #24036
2015-04-12 16:37:29 +00:00
Theo Belaire
12d21bf99c References to CString::from_vec changed to new
It looks like `from_vec` was subsumed by new at some point,
but the documentation still refers to it as `from_vec`.

This updates the documentation for `from_vec_unchecked`
so that it properly says that it's the unchecked version of `new`.

Also, from_vec_unchecked requires a actual Vec<u8> while
new can take anything that is Into<Vec<u8>>, so I also
mention that in the documentation.
2015-04-12 10:55:26 -04:00
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
Theo Belaire
912a872d3c Fixed with_extension documentation bug
It was mistakenly calling it with "foo.txt" instead of "txt".
I've also added an assert.
2015-04-12 01:26:05 -04: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