about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-06-08Rollup merge of #73138 - eggyal:macos-linker-strip, r=petrochenkovDylan DPC-2/+4
Use shorthand linker strip arguments in order to support MacOS Per discussion from https://github.com/rust-lang/rust/issues/72110#issuecomment-636609419 onward, the current `-Z strip` options aren't supported by the MacOS linker, but I think only because it doesn't support the longhand arguments `--strip-debug` and `--strip-all`. This PR switches to using the shorthand arguments `-s` and `-S` instead, which (I believe) are supported by all GCC linkers.
2020-06-08Rollup merge of #73124 - ayushmishra2005:correction_in_explanation_of_E0207, ↵Dylan DPC-2/+2
r=petrochenkov Removed lifetime parameters from Explanation of E0207 Removed lifetime parameters from Explanation of E0207 Fixes #62144
2020-06-08Rollup merge of #73118 - alamb:alamb/doc-drop-typo, r=shepmasterDylan DPC-1/+1
Improve the wording in documentation of std::mem::drop I thought the original phrasing was somewhat awkward compared to rest of the (very well written) documentation, so figured I would propose a change to improve it.
2020-06-08Rollup merge of #73090 - marmeladema:resolver-outputs-local-def-id, ↵Dylan DPC-37/+27
r=petrochenkov Use `LocalDefId` directly in `Resolver::export_map` This is to avoid the final conversion from `NodeId` to `HirId` during call to `(clone|into)_outputs` This brings down the post-lowering uses of `NodeId` down to 2 calls to convert the `trait_map`. cc #50928 r? @petrochenkov
2020-06-08Rollup merge of #72912 - GuillaumeGomez:add-e0755, r=estebankDylan DPC-1/+50
Add new E0758 error code
2020-06-08Rollup merge of #71842 - tspiteri:doc-impl-const, r=GuillaumeGomezDylan DPC-1/+3
doc: make impl block collapsible if it has an associated constant Fixes #71822.
2020-06-08Use shorthand linker strip arguments in order to support MacOSAlan Egerton-2/+4
2020-06-08Removed lifetime parameters from Explanation of E0207 #62144Ayush Kumar Mishra-2/+2
2020-06-08Fix small typo in docs for std::mem::dropalamb-1/+1
2020-06-08Rollup merge of #73092 - GuillaumeGomez:cleanup-e0646, r=Dylan-DPCRalf Jung-0/+1
Clean up E0646 r? @Dylan-DPC
2020-06-08Rollup merge of #73075 - jyn514:comment-module, r=Dylan-DPCRalf Jung-0/+6
Add comments to `Resolve::get_module` r? @Manishearth
2020-06-08Rollup merge of #73001 - ilya-bobyr:master, r=dtolnayRalf Jung-1/+99
Free `default()` forwarding to `Default::default()` It feels a bit redundant to have to say `Default::default()` every time I need a new value of a type that has a `Default` instance. Especially so, compared to Haskell, where the same functionality is called `def`. Providing a free `default()` function that forwards to `Default::default()` seems to improve the situation. The trait is still there, so if someone wants to be explicit and to say `Default::default()` - it still works, but if imported as `std::default::default;`, then the free function reduces typing and visual noise.
2020-06-08Rollup merge of #72963 - poliorcetics:cstring-from-raw, r=dtolnayRalf Jung-0/+11
Cstring `from_raw` and `into_raw` safety precisions Fixes #48525. Fixes #68456. This issue had two points: - The one about `from_raw` has been addressed (I hope). - The other one, about `into_raw`, has only been partially fixed. About `into_raw`: the idea was to: > steer users away from using the pattern of CString::{into_raw,from_raw} when interfacing with C APIs that may change the effective length of the string by writing interior NULs or erasing the final NUL I tried making a `Vec<c_char>` like suggested but my current solution feels very unsafe and *hacky* to me (most notably the type cast), I included it here to make it available for discussion: ```rust fn main() { use std::os::raw::c_char; let v = String::from("abc") .bytes() // From u8 to i8, // I feel like it will be a problem for values of u8 > 255 .map(|c| c as c_char) .collect::<Vec<_>>(); dbg!(v); } ```
2020-06-08Rollup merge of #72811 - pickfire:liballoc-impl, r=AmanieuRalf Jung-42/+40
Liballoc impl Mainly code rearrangements
2020-06-08Rollup merge of #72799 - Aaron1011:feature/span-debug, r=petrochenkovRalf Jung-1/+220
Add `-Z span-debug` to allow for easier debugging of proc macros Currently, the `Debug` impl for `proc_macro::Span` just prints out the byte range. This can make debugging proc macros (either as a crate author or as a compiler developer) very frustrating, since neither the actual filename nor the `SyntaxContext` is displayed. This commit adds a perma-unstable flag `-Z span-debug`. When enabled, the `Debug` impl for `proc_macro::Span` simply forwards directly to `rustc_span::Span`. Once #72618 is merged, this will start displaying actual line numbers. While `Debug` impls are not subject to Rust's normal stability guarnatees, we probably shouldn't expose any additional information on stable until `#![feature(proc_macro_span)]` is stabilized. Otherwise, we would be providing a 'backdoor' way to access information that's supposed be behind unstable APIs.
2020-06-08Rollup merge of #72761 - poliorcetics:use-keyword-doc, r=Dylan-DPCRalf Jung-2/+54
Added the documentation for the 'use' keyword This is a partial fix of #34601. I heavily inspired myself from the Reference on the `use` keyword. I checked the links when compiling the documentation, they should be ok. I also added an example for the wildcard `*` in the case of types, because it's behaviour is not *import everything* like one might think at first.
2020-06-08Rollup merge of #72615 - jschwe:fix-Zprofile-documentation, r=steveklabnikRalf Jung-1/+7
Fix documentation example for gcov profiling closes #72546 Improves the documentation for the unstable Rustflag `-Zprofile` by: - stating that Incremental compilation must be turned off. - Adding the other `RUSTFLAGS` that should/need to be turned on (taken from [grcov documentation](https://github.com/mozilla/grcov#example-how-to-generate-gcda-files-for-a-rust-project)) - Mentioning `RUSTC_WRAPPER` to prevent everything getting instrumented. r? @steveklabnik
2020-06-08Rollup merge of #72583 - CAD97:vec-iter-asref-slice, r=dtolnayRalf Jung-0/+7
impl AsRef<[T]> for vec::IntoIter<T> Adds `impl<T> AsRef<[T]> for vec::IntoIter<T>`. This mirrors the same trait impl for [`slice::Iter`](https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html). Both types already offer `fn as_slice(&self) -> &[T]`, this just adds the trait impl for `vec::IntoIter`. If/when `fn as_slice(&self) -> &[T]` stabilizes for `vec::Drain` and `slice::IterMut`, they should get `AsRef<[T]>` impls as well. As thus, tangentially related to #58957. My ultimate goal here: being able to use `for<T, I: Iterator<Item=T> + AsRef<[T]>> I` to refer to `vec::IntoIter`, `vec::Drain`, and eventually `array::IntoIter`, as an approximation of the set of by-value iterators that can be "previewed" as by-ref iterators. (Actually expressing that as a trait requires GAT.)
2020-06-08Rollup merge of #72026 - botika:master, r=estebankRalf Jung-125/+201
Update annotate-snippets-rs to 0.8.0 #59346 I made major changes to this library. In the previous version we worked with owned while in the current one with borrowed. I have adapted it without changing the behavior. I have modified the coverage since the previous one did not return correctly the index of the character in the line.
2020-06-08Auto merge of #73046 - marmeladema:save-analysis-fix-path, r=Xanewokbors-6/+39
save_analysis: fix some ICEs Fixes #73020 Fixes #73022 Fixes #73041
2020-06-07Auto merge of #72904 - shepmaster:reduce-abi-symbol-hash-churn, ↵bors-16/+24
r=jonas-schievink,RalfJung Order the Rust and C ABIs first to reduce test churn
2020-06-07Use `LocalDefId` directly in `Resolver::export_map` and `module_exports` querymarmeladema-37/+27
This is to avoid the final conversion from `NodeId` to `HirId` during call to `Resolver::(clone|into)_outputs`.
2020-06-07Auto merge of #73099 - Dylan-DPC:rollup-7u8f3m4, r=Dylan-DPCbors-41/+140
Rollup of 2 pull requests Successful merges: - #72952 (run-make regression test for issue #70924.) - #72977 (Fix codegen tests for RISC-V) Failed merges: r? @ghost
2020-06-07Rollup merge of #72977 - tblah:riscv-codegen-llvm10, r=nikomatsakisDylan DPC-41/+93
Fix codegen tests for RISC-V Some codegen tests didn't seem relevant (e.g. unsupported annotations). The RISC-V abi tests were broken by LLVM 10, c872dcf fixes that (cc: @msizanoen1) I'm not sure about skipping catch-unwind.rs and included that change here mostly as a request for comment - I can't tell if that's a bug.
2020-06-07Rollup merge of #72952 - pnkfelix:regression-test-for-issue-70924, ↵Dylan DPC-0/+47
r=nikomatsakis run-make regression test for issue #70924. Sometime after my PR #72767 (to fix issue #70924) landed, I realized that I *could* make a local regression test, thanks to `rustc --print sysroot`: I can make a fresh "copy" (really mostly symlinks) of the sysroot, and then modify it to recreate the terms of this bug.
2020-06-07Rollup merge of #73063 - pickfire:liballoc-elide, r=kennytmDylan DPC-1/+1
Elide type on liballoc vec
2020-06-07Rollup merge of #72998 - poliorcetics:atomic-availability-doc, r=AmanieuDylan DPC-0/+87
Mention that some atomic operations may not be available on some platforms fixes #54250 This simply adds a line saying the type/function/method may not be available on some platforms, depending on said platform capabilities. I *think* I got them all.
2020-06-07Rollup merge of #72970 - OddCoincidence:feature-gated-lints, r=petrochenkovDylan DPC-21/+29
Properly handle feature-gated lints Closes #72694
2020-06-07Rollup merge of #72908 - RalfJung:false-edge, r=matthewjasperDylan DPC-66/+66
rename FalseEdges -> FalseEdge There's just a single false edge in this terminator, not multiple of them. r? @matthewjasper @jonas-schievink
2020-06-07Rollup merge of #72764 - jonas-schievink:mind-the-tyerr, r=estebankDylan DPC-28/+51
Be more careful around ty::Error in generators cc https://github.com/rust-lang/rust/issues/72685 (doesn't close it because it's missing a reproduction to use as a test case) r? @estebank
2020-06-07Clean up E0646Guillaume Gomez-0/+1
2020-06-07Add tests for E0758Guillaume Gomez-0/+20
2020-06-07Create new error code E0758 for unterminated multi-line commentsGuillaume Gomez-1/+30
2020-06-07unstable book: default_free_fnIlya Bobyr-0/+45
2020-06-07Free `default()` forwarding to `Default::default()`Ilya Bobyr-1/+54
When creating default values a trait method needs to be called with an explicit trait name. `Default::default()` seems redundant. A free function on the other hand, when imported directly, seems to be a better API, as it is just `default()`. When implementing the trait, a method is still required.
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-66/+66
2020-06-07Auto merge of #73072 - arcnmx:lld-noload, r=nikicbors-0/+0
Update LLVM submodule to include lld NOLOAD fix > Rust nightly 2020-05-22 and later ships lld with a regression related to linker scripts: NOLOAD sections incorrectly generate sections filled with 0s. This causes gdb and other elf loaders to write to reserved or otherwise invalid addresses (gdb also seems confused by the resulting ELF files and spits out a warning about the sections). This is particularly a problem for embedded rust projects that use lld by default and have affected linker scripts (cortex-m-rt based projects for instance). https://github.com/rust-lang/llvm-project/pull/64 Note that this also pulls in llvm changes from #72937
2020-06-06Order the Rust and C ABIs first to reduce test churnJake Goulding-16/+24
2020-06-07Rollup merge of #73059 - lcnr:outdated-comment, r=matthewjasperDylan DPC-4/+0
remove outdated comment r? @matthewjasper
2020-06-07Rollup merge of #73057 - GuillaumeGomez:cleanup-e0644, r=Dylan-DPCDylan DPC-1/+1
Clean up E0644 explanation r? @Dylan-DPC
2020-06-07Rollup merge of #72993 - cuviper:beta-number, r=Mark-SimulacrumDylan DPC-18/+4
Count the beta prerelease number just from master We were computing a merge-base between the remote beta and master branches, but this was giving incorrect answers for the first beta if the remote hadn't been pushed yet. For instance, `1.45.0-beta.3359` corresponds to the number of merges since the 1.44 beta, but we really want just `.1` for the sole 1.45 beta promotion merge. We don't really need to query the remote beta at all -- `master..HEAD` suffices if we assume that we're on the intended beta branch already.
2020-06-07Rollup merge of #72989 - pnkfelix:revert-pr-71840, r=matthewjasperDylan DPC-1638/+1768
Revert pr 71840 Revert7 PR #71840 to fix issue #72470 This will need a backport to beta if we do not want #72470 to hit stable.
2020-06-07Rollup merge of #72810 - RalfJung:mir-terminate-sanity, r=jonas-schievinkDylan DPC-16/+127
validate basic sanity for TerminatorKind r? @jonas-schievink This mainly checks that all `BasicBlock` actually exist. On top of that, it checks that `Call` actually calls something of `FnPtr`/`FnDef` type, and `Assert` has to work on a `bool`. Also `SwitchInt` cannot have an empty target list.
2020-06-06save_analysis: fix panic in `write_sub_paths_truncated`marmeladema-3/+19
2020-06-06Add comments to `Resolve::get_module`Joshua Nelson-0/+6
2020-06-06Only mention `u8` and not booleansPoliorcetics-1/+1
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2020-06-06Rollup merge of #72708 - petrochenkov:linkhack, r=cuviperRalf Jung-8/+62
linker: Add a linker rerun hack for gcc versions not supporting -static-pie Which mirrors the existing `-no-pie` linker rerun hack, but the logic is a bit more elaborated in this case. If the linker (gcc or clang) errors on `-static-pie` we rerun in with `-static` instead. We must also replace CRT objects corresponding to `-static-pie` with ones corresponding to `-static` in this case. (One sanity check for CRT objects in target specs is also added as a drive-by fix.) To do in the future: refactor all linker rerun hacks into separate functions and share more code with `add_(pre,post)_link_objects`. This PR accompanies https://github.com/rust-lang/rust/pull/71804 and unblocks https://github.com/rust-lang/rust/pull/70740.
2020-06-06Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakisRalf Jung-25/+45
Make `PolyTraitRef::self_ty` return `Binder<Ty>` This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
2020-06-06Rollup merge of #71796 - RalfJung:from-secs, r=nikomatsakisRalf Jung-1/+0
de-promote Duration::from_secs In https://github.com/rust-lang/rust/pull/67531, we removed the `rustc_promotable` attribute from a bunch of `Duration` methods, but not from `Duration::from_secs`. This makes the current list of promotable functions the following (courtesy of @ecstatic-morse): * `INT::min_value`, `INT::max_value` * `std::mem::size_of`, `std::mem::align_of` * `RangeInclusive::new` (backing `x..=y`) * `std::ptr::null`, `std::ptr::null_mut` * `RawWaker::new`, `RawWakerVTable::new` ??? * `Duration::from_secs` I feel like the last one stands out a bit here -- the rest are all very core language primitives, and `RawWaker` has a strong motivation for getting a `'static` vtable. But a `&'static Duration`? That seems unlikely. So I propose we no longer promote calls to `Duration::from_secs`, which is what this PR does. https://github.com/rust-lang/rust/pull/67531 saw zero regressions and I am not aware of anyone complaining that this broke their (non-cratered) code, so I consider it likely the same will be true here, but of course we'd do a crater run. See [this document](https://github.com/rust-lang/const-eval/blob/master/promotion.md) for some more background on promotion and https://github.com/rust-lang/const-eval/issues/19 for some of the concerns around promoting function calls.
2020-06-06Elide type on liballoc vecIvan Tham-1/+1