about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2016-03-08Add help for E0514ggomez-8/+10
2016-03-08Auto merge of #31954 - japaric:rfc243, r=nikomatsakisbors-16/+369
implement the `?` operator The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining: `File::open("foo")?.metadata()?.is_dir()`. `?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`, `(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`. cc #31436 --- cc @aturon @eddyb
2016-03-07Auto merge of #31606 - Ms2ger:ClosureKind, r=eddybbors-57/+56
Rename ClosureKind variants and stop re-exporting them.
2016-03-07Auto merge of #29734 - Ryman:whitespace_consistency, r=Aatchbors-63/+110
libsyntax: be more accepting of whitespace in lexer Fixes #29590. Perhaps this may need more thorough testing? r? @Aatch
2016-03-07update error messages in parse-fail testsJorge Aparicio-14/+14
2016-03-08Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichtonbors-8/+232
Fix building libstd on emscripten targets. The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. This commit also depends needs https://github.com/ashleysommer/rust/commit/f1575cff2d631e977038fdba3fa3422ba5f8f2fe applied in order to successfully build libstd with emscripten target.
2016-03-07implement the `?` operatorJorge Aparicio-2/+355
The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining: `File::open("foo")?.metadata()?.is_dir()`. `?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`, `(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`. cc #31436
2016-03-07Auto merge of #32081 - cmbrandenburg:spell_fix, r=apasel422bors-1/+1
2016-03-07Auto merge of #32078 - japaric:rustbuild-i686-musl, r=alexcrichtonbors-5/+24
- make sure we copy the third party objects (crt*.o) to the target stage directory. - apply the x86_64-musl logic also to the i686-musl target. --- r? @alexcrichton
2016-03-07Auto merge of #31664 - nodakai:reference-negation, r=steveklabnikbors-1/+7
It would be great if someone could check my English.
2016-03-07Fix building libstd on on emscripten targets.ashleysommer-8/+232
Squashed 10 commits: 1) The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. 2) Update previous commit to comply with rust formatting standards. Removed tab characters, remove trailing whitespaces. 3) Move emscripten changes into their own file under libstd/os/emscripten Put libstd/os/linux/fs back to the way it was. 4) Cannot use stat.st_ctim on emscripten to get created time. 5) Remove compile-time conditionals for target_env = musl, it looks like musl builds compile fine already. 6) Undone some formatting changes that are no longer needed, Removed some more target_env="musl" compilation checks that I missed from my previous commit. 7) upgrade to liblibc e19309c, it fixes the differences in the musl stat and stat64 definitions. 8) Undo the compile-time checks to check for emscripten (or musl targets) in the FileAttr struct. No longer needed after updating liblibc to e19309c. 9) Change the MetadataExt implementation of emscripten fs.rs module to match the changes in new liblibc. 10) remove a stray return statement, should have been removed in the previous commit.
2016-03-07Auto merge of #32051 - steveklabnik:gh9447, r=blussbors-15/+15
Fixes #9447
2016-03-07Auto merge of #32066 - ruud-v-a:fma, r=alexcrichtonbors-3/+170
This adds support for fused multiply-add and multiply-subtract vector intrinsics for 128 and 256-bit vectors of `f32` and `f64`. These correspond to the intrinsics [listed here](https://software.intel.com/en-us/node/523929) except for the `_ss` and `_sd` variants. The intrinsics added are: * `fmadd` * `fmaddsub` * `fmsub` * `fmsubadd` * `fnmadd` * `fnmsub` The “fma” target feature must be enabled by passing `-C target-feature=+fma` to rustc when using these, otherwise LLVM will complain. I verified locally that the `x86_mm256_fmadd_ps` and `x86_mm256_fmsub_ps` work.
2016-03-07Auto merge of #32064 - bluss:str-slice-panic, r=alexcrichtonbors-3/+41
Fix panic on string slicing error to truncate the string The string may be arbitrarily long, but we want to limit the panic message to a reasonable length. Truncate the string if it is too long (simply to char boundary). Also add details to the start <= end message. I think it's ok to flesh out the code here, since it's in a cold function. Fixes #32063
2016-03-07reference.md: clarify negation.NODA, Kai-1/+7
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-03-06update the src/liblibc submoduleJorge Aparicio-0/+0
2016-03-06Auto merge of #32056 - nikomatsakis:rustfmt-data-structures, r=alexcrichtonbors-370/+453
2016-03-06Auto merge of #32055 - mitaa:rdoc-strip-priv-imports, r=alexcrichtonbors-8/+51
fixes #27104 r? @alexcrichton
2016-03-06Spelling fix for "because"Craig M. Brandenburg-1/+1
2016-03-06Auto merge of #32048 - bluss:overloaded-assign-op, r=eddybbors-6/+78
Do not trigger unused_assignments for overloaded AssignOps If `v` were a type with some kind of indirection, so that `v += 1` would have an effect even if `v` were not used anymore, the unused_assignments lint would mark a false positive. This exempts overloaded (non-primitive) assign ops from being treated as assignments (they are method calls). The previous compile-fail tests that ensure x += 1 can trigger for primitive types continue to pass. Added a representative test for the "view" indirection. Fixes #31895
2016-03-06rustbuild: fix cross compilation of libstd to i686-unknown-linux-muslJorge Aparicio-5/+24
- make sure we copy the third party objects (crt*.o) to the target stage directory. - apply the x86_64-musl logic also to the i686-musl target.
2016-03-06Auto merge of #32041 - arielb1:multiply-inexhaustive, r=eddybbors-4/+21
the assert was invalidated by PR #31020 Fixes #31561 r? @eddyb
2016-03-06Auto merge of #32020 - alexcrichton:stabilize-into-ascii, r=brsonbors-8/+4
These were intended to land in stable 1.8 but were just waiting for the implementation PR, so now they're landing. Specifically this PR stabilizes: * `AsciiExt::into_ascii_uppercase` * `AsciiExt::into_ascii_lowercase` * `AsciiExt for Vec<u8>` * `AsciiExt for String`
2016-03-06Auto merge of #31967 - mitaa:rdoc-refactor, r=alexcrichtonbors-542/+356
This is mostly cleanup of individual code bits and code reuse for `clean::Attribute` handling. The only change in behaviour should be that emitted sources are now being recorded and queried when trying to create src-links to local source-files. r? @alexcrichton
2016-03-06Split out rustdoc pass to strip private importsmitaa-8/+51
2016-03-06Auto merge of #30884 - durka:inclusive-ranges, r=aturonbors-390/+983
This PR implements [RFC 1192](https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md), which is triple-dot syntax for inclusive range expressions. The new stuff is behind two feature gates (one for the syntax and one for the std::ops types). This replaces the deprecated functionality in std::iter. Along the way I simplified the desugaring for all ranges. This is my first contribution to rust which changes more than one character outside of a test or comment, so please review carefully! Some of the individual commit messages have more of my notes. Also thanks for putting up with my dumb questions in #rust-internals. - For implementing `std::ops::RangeInclusive`, I took @Stebalien's suggestion from https://github.com/rust-lang/rfcs/pull/1192#issuecomment-137864421. It seemed to me to make the implementation easier and increase type safety. If that stands, the RFC should be amended to avoid confusion. - I also kind of like @glaebhoerl's [idea](https://github.com/rust-lang/rfcs/pull/1254#issuecomment-147815299), which is unified inclusive/exclusive range syntax something like `x>..=y`. We can experiment with this while everything is behind a feature gate. - There are a couple of FIXMEs left (see the last commit). I didn't know what to do about `RangeArgument` and I haven't added `Index` impls yet. Those should be discussed/finished before merging. cc @Gankro since you [complained](https://www.reddit.com/r/rust/comments/3xkfro/what_happened_to_inclusive_ranges/cy5j0yq) cc #27777 #30877 rust-lang/rust#1192 rust-lang/rfcs#1254 relevant to #28237 (tracking issue)
2016-03-06Auto merge of #31920 - jseyfried:fix_spurious_privacy_error, r=nikomatsakisbors-73/+67
This PR allows using methods from traits that are visible but are defined in an inaccessible module (fixes #18241). For example, ```rust mod foo { pub use foo::bar::Tr; mod bar { // This module is inaccessible from `g` pub trait Tr { fn f(&self) {} } } } fn g<T: foo::Tr>(t: T) { t.f(); // Currently, this is a privacy error even though `foo::Tr` is visible } ``` After this PR, it will continue to be a privacy error to use a method from a trait that is not visible. This can happen when a public trait inherits from a private trait (in violation of the `public_in_private` lint) -- see @petrochenkov's example in #28504. r? @nikomatsakis
2016-03-05Auto merge of #31889 - alexcrichton:update-jemalloc-again, r=nikomatsakisbors-36/+28
Now that https://github.com/jemalloc/jemalloc/commit/767d85061a6fb88ec977bbcd9b429a43aff391e6 is upstream, the relevant deadlocking issue which prompted our downgrade has been resolved. As a result, there's no known issue to *not* upgrade! This also re-enables jemalloc for the pc-windows-gnu target as known issues with that have also been fixed. Closes #31030
2016-03-05Auto merge of #31726 - jseyfried:improve_import_resolution, r=nikomatsakisbors-305/+388
This PR improves the import resolution algorithm. First, it records that an import succeeded or failed for one namespace (by calling `decrement_outstanding_references_for` and `try_define_child` if successful) even if it is still indeterminate in the other namespace, fixing #31444. Second, it starts importing bindings from globs as soon as the glob path is determined. It maintains links from imported modules to their importers so that when a resolution becomes successful in an imported module, a corresponding binding will be added to the importer module. It also maintains links from importer modules to imported modules so that we can determine if an undefined name is indeterminate or failing by recursively checking this in the imported modules. This allows, for example: ```rust mod foo { pub mod baz {} pub use bar::baz::*; } mod bar { pub use foo::*; } ``` It also allows cycles of pub glob imports, although by to the current shadowing rules, the only way for such a cycle to compile is if each participating module defines no names. Incidentally, this PR lays the groundwork for more permissive feature-gated shadowing rules. Finally, this PR encapsulates almost all implementation details of import resolution in `resolve_imports` (some of which used to be in `lib.rs`) and refactors reexport recording, shadowed trait collecting, some duplicate checking, and the `private_in_public` lint out of the core import resolution algorithm and into a post-processing pass in `resolve_imports`. r? @nrc
2016-03-05Fix panic on string slicing error to truncate the stringUlrik Sverdrup-3/+41
The string may be arbitrarily long, but we want to limit the panic message to a reasonable length. Truncate the string if it is too long (simply to char boundary). Also add details to the start <= end message. I think it's ok to flesh out the code here, since it's in a cold function.
2016-03-05Auto merge of #31700 - oli-obk:skip_double_ended, r=alexcrichtonbors-0/+49
[Playground Example](https://play.rust-lang.org/?gist=66fdb4fe1cf4d8aa2ad4&version=stable)
2016-03-05Regenerate x86 platform intrinsicsRuud van Asseldonk-0/+120
The exact command used was: $ cd src/etc/platform-intrinsics/x86 $ python2 ../generator.py --format compiler-defs -i info.json \ sse.json sse2.json sse3.json ssse3.json sse41.json sse42.json \ avx.json avx2.json fma.json \ > ../../../librustc_platform_intrinsics/x86.rs
2016-03-05Update platform intrinsic generator scriptRuud van Asseldonk-3/+3
The file it generates had been modified, but instead the generator should have been modified, and the file regenerated. This merges the modifications into the template in the generator.
2016-03-05Define x86 fused multiply-add intrinsicsRuud van Asseldonk-0/+47
This defines the following intrinsics for 128 and 256 bit vectors of f32 and f64: * `fmadd` * `fmaddsub` * `fmsub` * `fmsubadd` * `fnmadd` * `fnmsub` The `_sd` and `_ss` variants are not included yet. Intel intrinsic reference: https://software.intel.com/en-us/node/523929 The intrinsics there are listed under AVX2, but in the Intel Intrinsic Guide they are part of the "FMA" technology, and LLVM puts them under FMA, not AVX2.
2016-03-05adopt new header style to sidestep rust-lang-nursery/rustfmt#836Niko Matsakis-15/+9
2016-03-05apply rustfmt to librustc_data_structures, correcting ↵Niko Matsakis-355/+444
rust-lang-nursery/rustfmt#836
2016-03-04remove under/overflow from next_back/nextAlex Burka-6/+10
2016-03-04add underflow/overflow testsAlex Burka-0/+8
2016-03-04add more unstable annotationsAlex Burka-0/+15
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-15/+15
Fixes #9447
2016-03-04Do not trigger unused_variables lint for variable modified through AddAssignUlrik Sverdrup-5/+30
Visit an overloaded += like a method call and not like an assignment.
2016-03-04Auto merge of #32046 - steveklabnik:rollup, r=steveklabnikbors-5/+34
- Successful merges: #32002, #32017, #32027, #32035, #32036 - Failed merges:
2016-03-04Finish encapsulating the details of import resolution in resolve_importsJeffrey Seyfried-79/+31
2016-03-04Refactor away defineJeffrey Seyfried-12/+6
2016-03-04Start importing bindings from globs as soon as the glob path is known.Jeffrey Seyfried-128/+232
2016-03-04Add a field in Module for the ResolverArenasJeffrey Seyfried-27/+39
2016-03-04Add an arena for import directivesJeffrey Seyfried-9/+18
2016-03-04Record that an import succeeded or failed in one namespace even while it is ↵Jeffrey Seyfried-74/+86
indeterminate in the other namespace (fixes #31444)
2016-03-04Add liveness test for unused_assignments for tricky lhsUlrik Sverdrup-0/+27
2016-03-04Do not trigger unused_assignments for overloaded AssignOpsUlrik Sverdrup-1/+21
If `v` were a type with some kind of indirection, so that `v += 1` would have an effect even if `v` were not used anymore, the unused_assignments lint would mark a false positive. This exempts overloaded (non-primitive) assign ops from being treated as assignments (they are method calls). The previous compile-fail tests that ensure x += 1 can trigger for primitive types continue to pass. Added a representative test for the "view" indirection.