Commit Graph

39884 Commits

Author SHA1 Message Date
Manish Goregaokar
9eb596ce8f Rollup merge of #22899 - huonw:macro-stability, r=alexcrichton
Unstable items used in a macro expansion will now always trigger
stability warnings, *unless* the unstable items are directly inside a
macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns
unless the span of the unstable item is a subspan of the definition of a
macro marked with that attribute.

E.g.

    #[allow_internal_unstable]
    macro_rules! foo {
        ($e: expr) => {{
            $e;
            unstable(); // no warning
            only_called_by_foo!();
        }}
    }

    macro_rules! only_called_by_foo {
        () => { unstable() } // warning
    }

    foo!(unstable()) // warning

The unstable inside `foo` is fine, due to the attribute. But the
`unstable` inside `only_called_by_foo` is not, since that macro doesn't
have the attribute, and the `unstable` passed into `foo` is also not
fine since it isn't contained in the macro itself (that is, even though
it is only used directly in the macro).

In the process this makes the stability tracking much more precise,
e.g. previously `println!(\"{}\", unstable())` got no warning, but now it
does. As such, this is a bug fix that may cause [breaking-change]s.

The attribute is definitely feature gated, since it explicitly allows
side-stepping the feature gating system.

---

This updates `thread_local!` macro to use the attribute, since it uses
unstable features internally (initialising a struct with unstable
fields).
2015-03-06 08:58:16 +05:30
Manish Goregaokar
e80fc10af1 Rollup merge of #22862 - vhbit:broken-open, r=alexcrichton
According to Apple's [arm64 calling convention](https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html#//apple_ref/doc/uid/TP40013702-SW1) varargs always are passed
through stack. Since `open` is actually a vararg function on Darwin,
it means that older declaration caused permissions to be taken from
stack, while passed through register => it set file permissions
to garbage and it was simply impossible to read/delete files after they
were created.

They way this commit handles it is to preserve compatibility with
existing code - it simply creates a shim unsafe function so all existing
callers continue work as nothing happened.
2015-03-06 08:58:02 +05:30
Lai Jiangshan
ccd83daa41 file permission: remove executable bit from *.rs
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-03-06 10:03:00 +08:00
Wesley Wiser
96b1f0c0be Fix reference to 'librlibc' in libcore docs
Fixes #23059
2015-03-05 20:45:54 -05:00
Brian Anderson
1552f672d4 Remove run-pass/lint-cstack.rs. No longer testing anything. 2015-03-05 17:38:18 -08:00
Carol Nichols
1bda1ff9da Removing unnecessary pub from a test function 2015-03-05 20:37:49 -05:00
Carol Nichols
8f091efa4f Add tests to stable f32 and f64 methods that didn't have any 2015-03-05 20:37:49 -05:00
Carol Nichols
33d8a4efea Rearrange tests to be in the same order as implementation
I was having trouble figuring out which functions had tests and which
didn't. This commit is just moving tests around and does not change
anything.
2015-03-05 20:37:49 -05:00
Brian Anderson
8655e94abf 'ignore-fast' directives do nothing 2015-03-05 17:29:38 -08:00
Alex Crichton
65b4eda5a6 std: Fix peeling ports from addresses
The `rsplitn` call was called with 2 instead of 1 so the iterator would yield 3
items in some cases, not the 2 that it should have.

Closes #23076
2015-03-05 17:20:16 -08:00
Paul Osborne
a08f12954c fix minor grammar mistake in paths documentation 2015-03-05 19:11:59 -06:00
Alex Crichton
73b0b25e32 std: Stabilize the fs module
This commit performs a stabilization pass over the `std::fs` module now that
it's had some time to bake. The change was largely just adding `#[stable]` tags,
but there are a few APIs that remain `#[unstable]`.

The following apis are now marked `#[stable]`:

* `std::fs` (the name)
* `File`
* `Metadata`
* `ReadDir`
* `DirEntry`
* `OpenOptions`
* `Permissions`
* `File::{open, create}`
* `File::{sync_all, sync_data}`
* `File::set_len`
* `File::metadata`
* Trait implementations for `File` and `&File`
* `OpenOptions::new`
* `OpenOptions::{read, write, append, truncate, create}`
* `OpenOptions::open` - this function was modified, however, to not attempt to
  reject cross-platform openings of directories. This means that some platforms
  will succeed in opening a directory and others will fail.
* `Metadata::{is_dir, is_file, len, permissions}`
* `Permissions::{readonly, set_readonly}`
* `Iterator for ReadDir`
* `DirEntry::path`
* `remove_file` - like with `OpenOptions::open`, the extra windows code to
  remove a readonly file has been removed. This means that removing a readonly
  file will succeed on some platforms but fail on others.
* `metadata`
* `rename`
* `copy`
* `hard_link`
* `soft_link`
* `read_link`
* `create_dir`
* `create_dir_all`
* `remove_dir`
* `remove_dir_all`
* `read_dir`

The following apis remain `#[unstable]`.

* `WalkDir` and `walk` - there are many methods by which a directory walk can be
  constructed, and it's unclear whether the current semantics are the right
  ones. For example symlinks are not handled super well currently. This is now
  behind a new `fs_walk` feature.
* `File::path` - this is an extra abstraction which the standard library
  provides on top of what the system offers and it's unclear whether we should
  be doing so. This is now behind a new `file_path` feature.
* `Metadata::{accessed, modified}` - we do not currently have a good
  abstraction for a moment in time which is what these APIs should likely be
  returning, so these remain `#[unstable]` for now. These are now behind a new
  `fs_time` feature
* `set_file_times` - like with `Metadata::accessed`, we do not currently have
  the appropriate abstraction for the arguments here so this API remains
  unstable behind the `fs_time` feature gate.
* `PathExt` - the precise set of methods on this trait may change over time and
  some methods may be removed. This API remains unstable behind the `path_ext`
  feature gate.
* `set_permissions` - we may wish to expose a more granular ability to set the
  permissions on a file instead of just a blanket "set all permissions" method.
  This function remains behind the `fs` feature.

The following apis are now `#[deprecated]`

* The `TempDir` type is now entirely deprecated and is [located on
  crates.io][tempdir] as the `tempdir` crate with [its source][github] at
  rust-lang/tempdir.

[tempdir]: https://crates.io/crates/tempdir
[github]: https://github.com/rust-lang/tempdir

The stability of some of these APIs has been questioned over the past few weeks
in using these APIs, and it is intentional that the majority of APIs here are
marked `#[stable]`. The `std::fs` module has a lot of room to grow and the
material is [being tracked in a RFC issue][rfc-issue].

[rfc-issue]: https://github.com/rust-lang/rfcs/issues/939

[breaking-change]
2015-03-05 16:49:41 -08:00
Stepan Koltsov
d3e7700de4 std: net: enable bind_error test on all platforms
Bind on non-local IP address is essentially the same test, and it works
same way on all platforms.

Fixes #11530
2015-03-06 02:33:24 +03:00
Brian Anderson
614853734e mk: Once again rename the beta channel artifacts as 'beta'
No more alphas, please.
2015-03-05 15:29:10 -08:00
Alex Crichton
628f5d29c3 std: Stabilize the ffi module
The two main sub-modules, `c_str` and `os_str`, have now had some time to bake
in the standard library. This commits performs a sweep over the modules adding
various stability tags.

The following APIs are now marked `#[stable]`

* `OsString`
* `OsStr`
* `OsString::from_string`
* `OsString::from_str`
* `OsString::new`
* `OsString::into_string`
* `OsString::push` (renamed from `push_os_str`, added an `AsOsStr` bound)
* various trait implementations for `OsString`
* `OsStr::from_str`
* `OsStr::to_str`
* `OsStr::to_string_lossy`
* `OsStr::to_os_string`
* various trait implementations for `OsStr`
* `CString`
* `CStr`
* `NulError`
* `CString::new` - this API's implementation may change as a result of
  rust-lang/rfcs#912 but the usage of `CString::new(thing)` looks like it is
  unlikely to change. Additionally, the `IntoBytes` bound is also likely to
  change but the set of implementors for the trait will not change (despite the
  trait perhaps being renamed).
* `CString::from_vec_unchecked`
* `CString::as_bytes`
* `CString::as_bytes_with_nul`
* `NulError::nul_position`
* `NulError::into_vec`
* `CStr::from_ptr`
* `CStr::as_ptr`
* `CStr::to_bytes`
* `CStr::to_bytes_with_nul`
* various trait implementations for `CStr`

The following APIs remain `#[unstable]`

* `OsStr*Ext` traits remain unstable as the organization of `os::platform` is
  uncertain still and the traits may change location.
* `AsOsStr` remains unstable as generic conversion traits are likely to be
  rethought soon.

The following APIs were deprecated

* `OsString::push_os_str` is now called `push` and takes `T: AsOsStr` instead (a
  superset of the previous functionality).
2015-03-05 14:57:01 -08:00
Alex Crichton
d5d834551c rustc: Add a debug_assertions #[cfg] directive
This commit is an implementation of [RFC 563][rfc] which adds a new
`cfg(debug_assertions)` directive which is specially recognized and calculated
by the compiler. The flag is turned off at any optimization level greater than 1
and may also be explicitly controlled through the `-C debug-assertions`
flag.

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

The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of
the `ndebug` variable and `ndebug` no longer holds any meaning to the standard
library.

Code which was previously relying on `not(ndebug)` to gate expensive code should
be updated to rely on `debug_assertions` instead.

Closes #22492
[breaking-change]
2015-03-05 14:51:38 -08:00
Alex Crichton
93192524fb rustc: Don't emit dep-info for imported files
Closes #23089
2015-03-05 14:49:58 -08:00
Jorge Aparicio
f0897aa17f OIBIT: for PhantomData<T> check T rather than the struct itself 2015-03-05 17:10:59 -05:00
bors
b0746ff19b Auto merge of #23031 - Manishearth:rollup, r=Manishearth 2015-03-05 21:03:10 +00:00
Pascal Hertleif
1eb37bf457 Fix Playpen Links Containing Multiple Examples
Fixes #22615.
2015-03-05 20:53:53 +01:00
Alex Crichton
7ed418c3b4 std: Deprecate the old_io::process module
This module is now superseded by the `std::process` module. This module still
has some room to expand to get quite back up to parity with the `old_io`
version, and there is a [tracking issue][issue] for feature requests as well as
known room for expansion.

[issue]: https://github.com/rust-lang/rfcs/issues/941
[breaking-change]
2015-03-05 10:41:42 -08:00
bors
f0c74f85f3 Auto merge of #23026 - nikomatsakis:issue-20220-supertrait, r=nikomatsakis
The main gist of this PR is commit 1077efb which removes the list of supertraits from the `TraitDef` and pulls them into a separate table, which is accessed via `lookup_super_predicates`. This is analogous to `lookup_predicates`, which gets the complete where clause. This allows us to create the `TraitDef`, which contains the list generics and so forth, without fully knowing the list of supertraits. This in turn allows the *supertrait listing* to contain references to associated types like `<Self as Foo>::Item`, which were previously impossible because conversion required having the `TraitDef` for `Foo`.

We do not yet support `Self::Item` in a supertrait listing. This doesn't work because to convert that, it attempts to expand out the full set of supertraits, which are in the process of being created. This could potentially be worked out by having the expansion of supertraits proceed in a lazy fashion, but we'd have to define shadowing rules for associated types which we don't currently have.

Along the way (in 9de9ec5) I also removed the restriction against duplicate bounds and generalized the code so that it can handle having the same supertrait multiple times with different arguments, e.g. `Foo : Bar<i32> + Bar<u32>`. This restriction was serving no particular purpose, since the same trait could be extended multiple times indirectly, and in the era of multidispatch it is actively harmful.

This is technically a [breaking-change] because it affects the definition of a super-trait. Anything in a where clause that looks like `where Self : Foo` is now considered a supertrait. Because cycles are disallowed in supertraits, that could lead to some errors. This has not been observed in any existing code.

r? @nrc
2015-03-05 17:52:21 +00:00
awlnx
951ef9d1f1 fix for new attributes failing. issue #22964 2015-03-05 11:53:51 -05:00
Michael Woerister
215d287982 debuginfo: Add test case for extern "C" functions. 2015-03-05 16:41:10 +01:00
Kang Seonghoon
4a6fb45ee1 rustdoc: Reworded comments to give the rationale for JS. 2015-03-05 23:10:15 +09:00
Michael Woerister
e316c662f8 debuginfo: Add debuginfo::with_source_location_override() function...
... and use it to fix a debug-location issue with constants.
2015-03-05 15:00:25 +01:00
Huon Wilson
b5c6ab20b7 Run feature-gating on the final AST passed to the compiler.
This ensures we catch everything; previously, an unknown attribute
inserted by #[cfg_attr(...)] in a macro expansion would not be detected.
2015-03-06 00:18:29 +11:00
Huon Wilson
10426f69da Add more debugging to syntax::feature_gate. 2015-03-06 00:18:29 +11:00
Huon Wilson
ab7ef7402b Use #[allow_internal_unstable] for thread_local!
This destabilises all the implementation details of `thread_local!`,
since they do not *need* to be stable with the new attribute.
2015-03-06 00:18:29 +11:00
Huon Wilson
84b060ce29 Add #[allow_internal_unstable] to track stability for macros better.
Unstable items used in a macro expansion will now always trigger
stability warnings, *unless* the unstable items are directly inside a
macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns
unless the span of the unstable item is a subspan of the definition of a
macro marked with that attribute.

E.g.

    #[allow_internal_unstable]
    macro_rules! foo {
        ($e: expr) => {{
            $e;
            unstable(); // no warning
            only_called_by_foo!();
        }}
    }

    macro_rules! only_called_by_foo {
        () => { unstable() } // warning
    }

    foo!(unstable()) // warning

The unstable inside `foo` is fine, due to the attribute. But the
`unstable` inside `only_called_by_foo` is not, since that macro doesn't
have the attribute, and the `unstable` passed into `foo` is also not
fine since it isn't contained in the macro itself (that is, even though
it is only used directly in the macro).

In the process this makes the stability tracking much more precise,
e.g. previously `println!("{}", unstable())` got no warning, but now it
does. As such, this is a bug fix that may cause [breaking-change]s.

The attribute is definitely feature gated, since it explicitly allows
side-stepping the feature gating system.
2015-03-06 00:18:28 +11:00
Oliver Schneider
18f1e40eaa doc example does nothing 2015-03-05 13:30:30 +01:00
Huon Wilson
7bcf7fb500 Use more associated types in core::iter.
This concretely improves type inference of some cases (see included
test). I assume the compiler struggles to reason about multiple layers
of generic type parameters (even with associated-type equalities) but
*can* understand pure associated types, since they are always directly
computable from the input types.
2015-03-05 22:50:09 +11:00
Manish Goregaokar
340d1cc7d7 Fix tag align tests for 32bit linux (fixes #7340) 2015-03-05 17:09:12 +05:30
Niko Matsakis
9b332ff2c7 Address nits by @nrc. 2015-03-05 05:46:12 -05:00
Valerii Hiora
3f4181a6e5 iOS: open file on aarch64 breaks permissions
According to Apple arm64 calling convention varargs always are passed
through stack. Since `open` is actually a vararg function on Darwin's,
it means that older declaration caused permissions to be taken from
stack, while passed through register => it set file permissions
to garbage and it was simply impossible to read/delete files after they
were created.

They way this commit handles it is to preserve compatibility with
existing code - it simply creates a shim unsafe function so all existing
callers continue work as nothing happened.
2015-03-05 12:41:59 +02:00
Kang Seonghoon
9e28156551 rustdoc: Move sidebar items into shared JavaScript.
It had been a source of huge bloat in rustdoc outputs. Of course,
we can simply disable compiler docs (as `rustc` generates over 90M
of HTML) but this approach fares better even after such decision.

Each directory now has `sidebar-items.js`, which immediately calls
`initSidebarItems` with a JSON sidebar data. This file is shared
throughout every item in the sidebar. The current item is
highlighted via a separate JS snippet (`window.sidebarCurrent`).
The JS file is designed to be loaded asynchronously, as the sidebar
is rendered before the content and slow sidebar loading blocks
the entire rendering. For the minimal accessibility without JS,
links to the parent items are left in HTML.

In the future, it might also be possible to integrate crates data
with the same fashion: `sidebar-items.js` at the root path will do
that. (Currently rustdoc skips writing JS in that case.)

This has a huge impact on the size of rustdoc outputs. Originally
it was 326MB uncompressed (37.7MB gzipped, 6.1MB xz compressed);
it is 169MB uncompressed (11.9MB gzipped, 5.9MB xz compressed) now.
The sidebar JS only takes 10MB uncompressed & 0.3MB gzipped.
2015-03-05 16:35:43 +09:00
Manish Goregaokar
455aa62e4d Rollup merge of #23033 - pelmers:patch-3, r=steveklabnik
I came across a couple of grammar mistakes when refreshing myself on enums.
2015-03-05 12:39:07 +05:30
Manish Goregaokar
8a55fce389 Rollup merge of #23029 - vhbit:ios-env-stab, r=alexcrichton
"body": null,
2015-03-05 12:39:07 +05:30
Manish Goregaokar
acd9554fd6 Rollup merge of #23027 - fenhl:patch-1, r=sfackler
The docs for `std::time::duration::Duration::weeks` were formatted incorrectly.
2015-03-05 12:39:06 +05:30
Manish Goregaokar
4c2bd63d17 Rollup merge of #23006 - dhuseby:master, r=alexcrichton
as the subject says.
2015-03-05 12:39:06 +05:30
Manish Goregaokar
44f8ac0b4d Rollup merge of #22947 - ic:master, r=steveklabnik
Changed guaranteed for \"quaranteed\", and
Made failing/working examples look alike.

r? @steveklabnik
2015-03-05 12:39:06 +05:30
Manish Goregaokar
eab5d0d0ae Rollup merge of #22937 - MDCox:str-docs, r=steveklabnik
Fixes #22902
r? @steveklabnik
2015-03-05 12:39:06 +05:30
Manish Goregaokar
faca553a01 Rollup merge of #22994 - eddyb:unsuffix-ints-good, r=alexcrichton
Automatic has-same-types testing methodology can be found in #22501.
Because most of them don't work with `--pretty=typed`, compile-fail tests were manually audited.

r? @aturon
2015-03-05 12:39:05 +05:30
Manish Goregaokar
931c55ab00 Move span in error (fixup #22764) 2015-03-05 12:38:36 +05:30
Manish Goregaokar
3d3ccfff9e Rollup merge of #23006 - dhuseby:master, r=alexcrichton
as the subject says.
2015-03-05 12:38:36 +05:30
Dave Huseby
13720b5571 updating llvm-auto-clean-trigger too 2015-03-05 12:38:35 +05:30
Dave Huseby
07e51ec7e0 adding bitrig snapshot to snapshots file 2015-03-05 12:38:35 +05:30
Dave Huseby
4ca07af526 bumping again to get the updated configure 2015-03-05 12:38:35 +05:30
Dave Huseby
a73fc0fe83 bumping the jemalloc revision to include the bitrig changes 2015-03-05 12:38:35 +05:30
Manish Goregaokar
ca13fd2a07 Rollup merge of #22973 - djmally:coll_docs, r=Gankro 2015-03-05 12:38:34 +05:30