about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2019-01-25Suggestion moving types before associated types.David Wood-15/+147
This commit extends existing suggestions to move lifetimes before types in generic arguments to also suggest moving types behind associated type bindings.
2019-01-25Add a compile-fail test for `Drop` in constants in the presence of `Option`sOliver Scherer-2/+34
2019-01-25Auto merge of #57881 - matthiaskrgr:clippy_submodule_upd, r=oli-obkbors-6/+8
submodules: update clippy from 280069dd to f1753522 Changes: ```` Rustup allow assertions_on_constants for collapsible_if and missing_test_files Improving comments. Added rustfix to the test. Improve span shortening. Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool". Fixed potential mistakes with nesting. Added tests. Fix automatic suggestion on `use_self`. run ./util/dev update_lints add assert(true/false, some message) tests change assert_checks to assertions_on_constants run ./util/dev update_lints Add unreachable!() as option Add assert(true) and assert(false) lints ```` Fixes clippy toolstate r? @oli-obk
2019-01-25Fix wording in diagnostics pagePär Karlsson-1/+1
2019-01-25Rollup merge of #57865 - Aaron1011:fix/debug-ice, r=estebankMazdak Farrokhzad-30/+44
Don't ICE when logging unusual types MonoItemExt#to_string is used for both debug logging and LLVM symbol name generation. When debugging, we want to print out any type we encounter, even if it's something weird like GeneratorWitness. However, during codegen, we still want to error if we encounter an unexpected type when generating a name. To resolve this issue, this commit introduces a new 'debug' parameter to the relevant methods. When set to 'true', it allows any type to be printed - when set to 'false', it 'bug!'s when encountering an unexpected type. This prevents an ICE when enabling debug logging (via RUST_LOG) while running rustc on generator-related code.
2019-01-25Rollup merge of #57802 - davidtwco:issue-56943, r=estebankMazdak Farrokhzad-14/+37
Print visible name for types as well as modules. Fixes #56943 and fixes #57713. This commit extends previous work in #55007 where the name from the visible parent was used for modules. Now, we also print the name from the visible parent for types. r? @estebank
2019-01-25Rollup merge of #57652 - mark-i-m:remove-old, r=nikomatsakisMazdak Farrokhzad-864/+93
Update/remove some old readmes r? @nikomatsakis cc #48478 There are a bunch of READMEs with content that I would like to see a final decision made on: - https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query - https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph - https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints - https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked - https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve - https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/borrowck It's not clear how useful or obsolete any of these are. I would really appreciate if the appropriate domain experts for each of these could respond with one of (a) delete it, (b) wait for system to be remove, or (c) move it to rustc-guide. @nikomatsakis do you know who to ping for any of these (sorry, I suspect many of them are you)?
2019-01-25Rollup merge of #57294 - estebank:point-copy-less, r=nikomatsakisMazdak Farrokhzad-226/+668
When using value after move, point at span of local When trying to use a value after move, instead of using a note, point at the local declaration that has a type that doesn't implement `Copy` trait. ``` error[E0382]: use of moved value: `x` --> $DIR/issue-34721.rs:27:9 | LL | pub fn baz<T: Foo>(x: T) -> T { | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait | | | consider adding a `Copy` constraint to this type argument LL | if 0 == 1 { LL | bar::bar(x.zero()) | - value moved here LL | } else { LL | x.zero() | - value moved here LL | }; LL | x.zero() | ^ value used here after move ``` Fix #34721.
2019-01-25Rollup merge of #56217 - frewsxcv:frewsxcv-float-parse, r=QuietMisdreavusMazdak Farrokhzad-1/+25
Add grammar in docs for {f32,f64}::from_str, mention known bug. - Original bug about documenting grammar - https://github.com/rust-lang/rust/issues/32243 - Known bug with parsing - https://github.com/rust-lang/rust/issues/31407
2019-01-24Instead of adding a paragraph mentioning std::mem::transmute and ↵Johnathan Van Why-4/+1
core::mem::transmute, create documentation pages for them. This renders them discoverable via search. I removed the mention of the exports in the transmute documentation, but can re-add it if desired.
2019-01-25Update minifier versionGuillaume Gomez-3/+4
2019-01-24submodules: update clippy from 280069dd to f1753522Matthias Krüger-6/+8
Changes: ```` Rustup allow assertions_on_constants for collapsible_if and missing_test_files Improving comments. Added rustfix to the test. Improve span shortening. Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool". Fixed potential mistakes with nesting. Added tests. Fix automatic suggestion on `use_self`. run ./util/dev update_lints add assert(true/false, some message) tests change assert_checks to assertions_on_constants run ./util/dev update_lints Add unreachable!() as option Add assert(true) and assert(false) lints ````
2019-01-24Auto merge of #57879 - Centril:rollup, r=Centrilbors-172/+432
Rollup of 9 pull requests Successful merges: - #57380 (Fix Instant/Duration math precision & associativity on Windows) - #57606 (Get rid of the fake stack frame for reading from constants) - #57803 (Several changes to libunwind for SGX target) - #57846 (rustdoc: fix ICE from loading proc-macro stubs) - #57860 (Add os::fortanix_sgx::ffi module) - #57861 (Don't export table by default in wasm) - #57863 (Add suggestion for incorrect field syntax.) - #57867 (Fix std::future::from_generator documentation) - #57873 (Stabilize no_panic_pow) Failed merges: r? @ghost
2019-01-24Fix --compare-mode=nll testsEsteban Küber-139/+493
2019-01-24review commentsEsteban Küber-19/+11
2019-01-24Point at type argument suggesting adding `Copy` constraintEsteban Küber-1/+16
2019-01-24break eagerly from loopEsteban Küber-0/+1
2019-01-24Add test for #34721Esteban Küber-0/+52
2019-01-24When using value after move, point at span of localEsteban Küber-88/+116
When trying to use a value after move, instead of using a note, point at the local declaration that has a type that doesn't implement `Copy` trait.
2019-01-24Add a feature gate test for #[optimize]Simonas Kazlauskas-0/+68
2019-01-24Support revisions for codegen testsSimonas Kazlauskas-49/+115
`compile-flags: -Copt-level` will avoid adding -O. Similarly for -g and -Cdebuglevel.
2019-01-24Add an idealistic test for optimize attributeSimonas Kazlauskas-0/+49
Alas it does not currently work, because of limitations in compiletest…
2019-01-24Implement optimize(size) and optimize(speed)Simonas Kazlauskas-107/+259
2019-01-24Rollup merge of #57873 - milesand:master, r=CentrilMazdak Farrokhzad-16/+8
Stabilize no_panic_pow This would close #48320. I'm not sure if I've done this right, I've just changed attribute name to stable and set `since` to two minor versions above current stable since that seemed like what others were doing.
2019-01-24Rollup merge of #57867 - Aaron1011:fix/gen-future-doc, r=CentrilMazdak Farrokhzad-1/+1
Fix std::future::from_generator documentation This function takes a generator and wraps it in a future, not vice-versa.
2019-01-24Rollup merge of #57863 - davidtwco:issue-57684, r=estebankMazdak Farrokhzad-1/+109
Add suggestion for incorrect field syntax. Fixes #57684. This commit adds a suggestion when a `=` character is used when specifying the value of a field in a struct constructor incorrectly instead of a `:` character. r? @estebank
2019-01-24Rollup merge of #57861 - pepyakin:wasm-dont-export-table, r=alexcrichtonMazdak Farrokhzad-3/+0
Don't export table by default in wasm Revert of https://github.com/rust-lang/rust/pull/53237 As per discussion here https://github.com/rustwasm/team/issues/251
2019-01-24Rollup merge of #57860 - jethrogb:jb/sgx-os-ffi, r=joshtriplettMazdak Farrokhzad-1/+111
Add os::fortanix_sgx::ffi module This uses the same byte slice accessors that Unix has. The [ABI specifies](https://docs.rs/fortanix-sgx-abi/0.3.2/fortanix_sgx_abi/struct.ByteBuffer.html) byte slices.
2019-01-24Rollup merge of #57846 - QuietMisdreavus:proc-macro-links, r=GuillaumeGomezMazdak Farrokhzad-2/+11
rustdoc: fix ICE from loading proc-macro stubs Fixes https://github.com/rust-lang/rust/issues/55399 When trying to resolve a macro, rustdoc first tries to load it from the resolver to see whether it's a Macros 2.0 macro, so it can return that Def before looking for any other kind of macro. However, this becomes a problem when you try to load proc-macros: since you can't use a proc-macro inside its own crate, this lookup also fails when attempting to link to it. However, we have a hint that this lookup will fail: Macros which are actually `ProcMacroStub`s will fail the lookup, so we can use that information to skip loading the macro. Rustdoc will then happily check `resolve.all_macros`, which will return a usable Def that we can link to.
2019-01-24Rollup merge of #57803 - jethrogb:jb/sgx-unwind-version, r=alexcrichtonMazdak Farrokhzad-1/+16
Several changes to libunwind for SGX target Two fixes: * #34978 bites again! * __rust_alloc are actually private symbols. Add new public versions. Also, these ones are `extern "C"`. Upstream changes (https://github.com/fortanix/llvm-project/pull/2, https://github.com/fortanix/llvm-project/pull/3): * b7357de Avoid too new relocation types being emitted * 0feefe5 Use new symbol names to call Rust allocator Fixes https://github.com/fortanix/rust-sgx/issues/65
2019-01-24Rollup merge of #57606 - oli-obk:shrink, r=RalfJungMazdak Farrokhzad-103/+93
Get rid of the fake stack frame for reading from constants r? @RalfJung fixes the ice in https://github.com/rust-lang/rust/issues/53708 but still keeps around the wrong "non-exhaustive match" error cc @varkor
2019-01-24Rollup merge of #57380 - bearcage:master, r=alexcrichtonMazdak Farrokhzad-44/+83
Fix Instant/Duration math precision & associativity on Windows **tl;dr** Addition and subtraction on Duration/Instant are not associative on windows because we use the perfcounter frequency in every calculation instead of just when we measure time. This is my first contrib (PR or Issue) to Rust, so please lmk if I've done this wrong. I followed CONTRIBUTING to the extent I could given my system doesn't seem to be able to build the compiler with changes in the source tree. I also asked about this issue in #rust-beginners a week or so ago, before digging through libstd -- I'm unsure if there's a good way to follow up on that, but I'd be happy to update the docs on the timing structs if this fixes the problem. ## Issue The `Duration` type keeps seconds in the upper-64 and nanoseconds in the lower-32 bits. In theory doing math on these ought to be basically the same as doing math on any other 64 or 32 bit integral number. On windows (and I think macos too), however, our math gets messy because the Instant type stores the current point in time in units of HPET Performance Counter counts, not nanoseconds, and does unit conversions on every math operation, rather than just when we measure the time from the system clock. I tried this code: ``` use std::time::{Duration, Instant}; fn main() { let now = Instant::now(); let offset = Duration::from_millis(5); assert_eq!((now + offset) - now, (now - now) + offset); } ``` On UNIX machines (linux and macos) it behaves as you'd expect -- [no crash](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cf2206c0b7e07d8ecc7767a512364094). On Windows hosts, however, it blows up because of a precision problem in the Instant +/- Duration math: ``` C:\Users\aberg\work\timetest (master -> origin) λ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.02s Running `target\debug\timetest.exe` thread 'main' panicked at 'assertion failed: `(left == right)` left: `4.999914ms`, right: `5ms`', src\main.rs:6:5 note: Run with `RUST_BACKTRACE=1` for a backtrace. error: process didn't exit successfully: `target\debug\timetest.exe` (exit code: 101) C:\Users\aberg\work\timetest (master -> origin) λ cat src\main.rs use std::time::{Duration, Instant}; fn main() { let now = Instant::now(); let offset = Duration::from_millis(5); assert_eq!((now + offset) - now, (now - now) + offset); } ``` On windows I think this is a consequence of doing the HPET-PerfCounter-Unit conversion on each math operation. I suspect the reason it works on macs is that (from what I could find online) most apple machines report timing in nanoseconds anyway. For anyone interested, the equivalent functions on macos, with a little work to fish out the numerator/denominator from a timebase struct: * `QueryPerformanceCounter()` -> `mach_absolute_time()` * `QueryPerformanceFrequency()` -> `mach_timebase_info()` If this PR ends up working as I expect it to when CI runs the tests, I can make the same changes to the macos implementation. ## Potential Fix We ought to be able to sort this out by storing nanoseconds, rather than PerfCounter units, that way intermediate math is done in the most precise units we support and we're only doing unit conversions when we actually measure the system clock (and it might even translate to a small perf gain for people doing tons of Instant/Duration math). I believe this will address the underlying cause of #56034, and make the guessed epsilon constant from #56059 unnecessary. If it's of interest, I can write up how these timing types work on the tier 1 platforms to address #32626 as well, since I'm already in here figuring it out. ## This Patch To that end, I've got this patch, which I think should fix it on windows, but I'm having trouble testing it -- any time I change anything in libstd I start getting this error, which no amount of clean building seems to resolve: ``` C:\Users\aberg\work\rust (master -> origin) λ python x.py test --stage 0 --no-doc src/libstd Updating only changed submodules Submodules updated in 0.27 seconds Finished dev [unoptimized] target(s) in 2.41s Building stage0 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc) Finished release [optimized] target(s) in 6.78s Copying stage0 std from stage0 (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc / x86_64-pc-windows-msvc) Building stage0 test artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc) Compiling test v0.0.0 (C:\Users\aberg\work\rust\src\libtest) error[E0460]: found possibly newer version of crate `std` which `getopts` depends on --> src\libtest\lib.rs:36:1 | 36 | extern crate getopts; | ^^^^^^^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? = note: the following crate versions were found: crate `std`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-sysroot\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-d7a80ca2ae113c97.rlib crate `std`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-sysroot\lib\rustlib\x86_64-pc-windows-msvc\lib\std-d7a80ca2ae113c97.dll crate `getopts`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-test\x86_64-pc-windows-msvc\release\deps\libgetopts-ae40a96de5f5d144.rlib error: aborting due to previous error For more information about this error, try `rustc --explain E0460`. error: Could not compile `test`. To learn more, run the command again with --verbose. command did not execute successfully: "C:\\Users\\aberg\\work\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\cargo.exe" "build" "--target" "x86_64-pc-windows-msvc" "-j" "12" "--release" "--manifest-path" "C:\\Users\\aberg\\work\\rust\\src/libtest/Cargo.toml" "--message-format" "json" expected success, got: exit code: 101 failed to run: C:\Users\aberg\work\rust\build\bootstrap\debug\bootstrap test --stage 0 --no-doc src/libstd Build completed unsuccessfully in 0:00:20 ``` --- Since you wrote the linked PRs and might remember looking at related problems: r? @alexcrichton
2019-01-24Auto merge of #51285 - Mark-Simulacrum:remove-quote_apis, r=Manishearthbors-2219/+57
Remove quote_*! macros This deletes a considerable amount of test cases, some of which we may want to keep. I'm not entirely certain what the primary intent of many of them was; if we should keep them I can attempt to edit each case to continue compiling without the quote_*! macros involved. Fixes #46849. Fixes #12265. Fixes #12266. Fixes #26994. r? @Manishearth
2019-01-24Remove quote_*! macros and associated APIsMark Simulacrum-2219/+57
2019-01-24Auto merge of #57269 - gnzlbg:simd_bitmask, r=rkruppebors-0/+288
Add intrinsic to create an integer bitmask from a vector mask This PR adds a new simd intrinsic: `simd_bitmask(vector) -> unsigned integer` that creates an integer bitmask from a vector mask by extracting one bit of each vector lane. This is required to implement: https://github.com/rust-lang-nursery/packed_simd/issues/166 . EDIT: the reason we need an intrinsics for this is that we have to truncate the vector lanes to an `<i1 x N>` vector, and then bitcast that to an `iN` integer (while making sure that we only materialize `i8`, ... , `i64` - that is, no `i1`, `i2`, `i4`, types), and we can't do any of that in a Rust library. r? @rkruppe
2019-01-24Enable Clang-based tests on x86_64-gnu-debug builder.Michael Woerister-1/+8
2019-01-24Auto merge of #57066 - Zoxc:graph-race, r=michaelwoeristerbors-21/+63
Fix race condition when emitting stored diagnostics r? @michaelwoerister
2019-01-24Stabilize no_panic_powJewoo Lee-16/+8
2019-01-23Add a comment on the meaning of Instant t: DurationAlex Berghage-0/+2
2019-01-24Rollup merge of #57844 - euclio:keyserver-port, r=alexcrichtonMazdak Farrokhzad-1/+1
use port 80 for retrieving GPG key This works around firewalls blocking port 11371. See https://unix.stackexchange.com/questions/75892/keyserver-timed-out-when-trying-to-add-a-gpg-public-key.
2019-01-24Rollup merge of #57840 - tromey:fix-issue-57762, r=nikicMazdak Farrokhzad-1/+4
Fix issue 57762 against a stock LLVM 7. LLVM 7 was released without a necessary fix for a bug in the DWARF discriminant code. This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7. Closes #57762
2019-01-24Rollup merge of #57836 - oli-obk:existential_crisis, r=estebankMazdak Farrokhzad-2/+66
Fix some cross crate existential type ICEs fixes #53443
2019-01-24Rollup merge of #57834 - SimonSapin:type_id, r=CentrilMazdak Farrokhzad-12/+7
Stabilize Any::get_type_id and rename to type_id FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749 Closes https://github.com/rust-lang/rust/issues/27745.
2019-01-24Rollup merge of #57817 - davidtwco:issue-54521, r=estebankMazdak Farrokhzad-1/+303
Add error for trailing angle brackets. Fixes #54521. This PR adds a error (and accompanying machine applicable suggestion) for trailing angle brackets on function calls with a turbofish. r? @estebank
2019-01-24Rollup merge of #57795 - estebank:did-you-mean, r=zackmdavisMazdak Farrokhzad-41/+44
Use structured suggestion in stead of notes
2019-01-24Rollup merge of #57793 - estebank:impl-trait-resolve, r=oli-obkMazdak Farrokhzad-58/+78
Explain type mismatch cause pointing to return type when it is `impl Trait` Fix #57743.
2019-01-24Rollup merge of #57779 - estebank:recover-struct-fields, r=davidtwcoMazdak Farrokhzad-44/+225
Recover from parse errors in literal struct fields and incorrect float literals Fix #52496.
2019-01-24Rollup merge of #57730 - Zoxc:combined-ast-validator, r=cramertjMazdak Farrokhzad-144/+106
Merge visitors in AST validation Cuts runtime for AST validation on `syntex_syntax` from 31.5 ms to 17 ms.
2019-01-24Rollup merge of #57179 - Xaeroxe:patch-1, r=QuietMisdreavusMazdak Farrokhzad-6/+2
Update std/lib.rs docs to reflect Rust 2018 usage Fixes #56544 This paragraph was written for Rust 2015. Since 2018 has been stable for a while I think we can update it.
2019-01-23Add suggestion for incorrect field syntax.David Wood-1/+109
This commit adds a suggestion when a `=` character is used when specifying the value of a field in a struct constructor incorrectly instead of a `:` character.