about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-01-27Fix rustc sysroot in systems using CASRamon de C Valle-7/+45
Change filesearch::get_or_default_sysroot() to check if sysroot is found using env::args().next() if rustc in argv[0] is a symlink; otherwise, or if it is not found, use env::current_exe() to imply sysroot. This makes the rustc binary able to locate Rust libraries in systems using content-addressable storage (CAS).
2020-11-20Auto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrumbors-13/+71
Arena: use specialization to avoid copying data In several cases, a `Vec` or `SmallVec` is passed to `Arena::alloc_from_iter` directly. This PR makes sure those cases don't copy their data unnecessarily, by specializing the `alloc_from_iter` implementation.
2020-11-20Use specialization to avoid copyingDániel Buga-13/+71
2020-11-20Auto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrumbors-176/+168
BTreeMap: replace Root with NodeRef<Owned, ...> `NodeRef<marker::Owned, …>` already exists as a representation of root nodes, and it makes more sense to alias `Root` to that than to reuse the space-efficient `BoxedNode` that is oblivious to height, where height is required. r? `@Mark-Simulacrum`
2020-11-20Auto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-sebors-0/+1
Extend meta parameters to all generated code in compat_fn. Fixes https://github.com/rust-lang/rust/issues/79203. This addresses a regression from 7e2032390cf34f3ffa726b7bd890141e2684ba63 for UWP targets.
2020-11-20Auto merge of #78646 - tgnottingham:packed_fingerprints, r=nnethercotebors-7/+76
Use PackedFingerprint in DepNode to reduce memory consumption
2020-11-20Set unaligned_references lint to deny in rustc_data_structuresTyson Nottingham-0/+1
To detect misuse of private packed field in `PackedFingerprint`.
2020-11-20Auto merge of #79196 - RalfJung:syscall, r=m-ou-sebors-1/+1
unix/weak: pass arguments to syscall at the given type Given that we know the type the argument should have, it seems a bit strange not to use that information. r? `@m-ou-se` `@cuviper`
2020-11-20Auto merge of #79192 - tmiasko:naked-noinline, r=oli-obkbors-4/+45
Never inline naked functions The `#[naked]` attribute disabled prologue / epilogue emission for the function and it is responsibility of a developer to provide them. The compiler is no position to inline such functions correctly. Disable inlining of naked functions at LLVM and MIR level. Closes #60919.
2020-11-20Auto merge of #78088 - fusion-engineering-forks:panic-fmt-lint, r=estebankbors-165/+362
Add lint for panic!("{}") This adds a lint that warns about `panic!("{}")`. `panic!(msg)` invocations with a single argument use their argument as panic payload literally, without using it as a format string. The same holds for `assert!(expr, msg)`. This lints checks if `msg` is a string literal (after expansion), and warns in case it contained braces. It suggests to insert `"{}", ` to use the message literally, or to add arguments to use it as a format string. ![image](https://user-images.githubusercontent.com/783247/96643867-79eb1080-1328-11eb-8d4e-a5586837c70a.png) This lint is also a good starting point for adding warnings about `panic!(not_a_string)` later, once [`panic_any()`](https://github.com/rust-lang/rust/pull/74622) becomes a stable alternative.
2020-11-20Auto merge of #79220 - Dylan-DPC:rollup-5bpbygd, r=Dylan-DPCbors-736/+633
Rollup of 11 pull requests Successful merges: - #79119 (Clarify availability of atomic operations) - #79123 (Add u128 and i128 integer tests) - #79177 (Test drop order for (destructuring) assignments) - #79181 (rustdoc: add [src] links to methods on a trait's page) - #79183 (Make compiletest testing use the local sysroot) - #79185 (expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute") - #79193 (Revert #78969 "Normalize function type during validation") - #79194 (Make as{_mut,}_slice on array::IntoIter public) - #79204 (Add jyn514 email alias to mailmap) - #79212 (Move `rustc_ty` -> `rustc_ty_utils`) - #79217 (Add the "memcpy" doc alias to slice::copy_from_slice) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-20Never inline naked functionsTomasz Miąsko-4/+45
The `#[naked]` attribute disabled prologue / epilogue emission for the function and it is responsibility of a developer to provide them. The compiler is no position to inline such functions correctly. Disable inlining of naked functions at LLVM and MIR level.
2020-11-20unix/weak: pass arguments to syscall at the given typeRalf Jung-1/+1
2020-11-19Rollup merge of #79217 - yoshuawuyts:copy_from_slice-alias, r=Mark-SimulacrumDylan DPC-0/+1
Add the "memcpy" doc alias to slice::copy_from_slice [RFC1419](https://github.com/rust-lang/rfcs/pull/1419) describes `slice::copy_from_slice` as a "safe memcpy". This enables people searching for `memcpy` to find the `slice::copy_from_slice` method. Thanks! ## Screenshots This is currently the output when searching for "memcpy" -- `copy_from_slice` is safe, and should be part of this list. ![Screenshot_2020-11-19 Results for memcpy - Rust](https://user-images.githubusercontent.com/2467194/99722964-c9e8fe80-2ab1-11eb-82a5-4afe703a0eea.png)
2020-11-19Rollup merge of #79212 - LeSeulArtichaut:rustc-ty, r=jonas-schievinkDylan DPC-7/+7
Move `rustc_ty` -> `rustc_ty_utils` Implements MCP rust-lang/compiler-team#387. r? `@jonas-schievink`
2020-11-19Rollup merge of #79204 - pickfire:patch-3, r=jyn514Dylan DPC-0/+1
Add jyn514 email alias to mailmap r? ```@jyn514```
2020-11-19Rollup merge of #79194 - est31:array_into_iter_slice, r=scottmcmDylan DPC-2/+4
Make as{_mut,}_slice on array::IntoIter public The functions are useful in cases where you want to move data out of the IntoIter in bulk, by transmute_copy'ing the slice and then forgetting the IntoIter. In the compiler, this is useful for providing a sped up IntoIter implementation. One can alternatively provide a separate allocate_array function but one can avoid duplicating some logic by passing everything through the generic iterator using interface. As per suggestion in https://github.com/rust-lang/rust/pull/78569/files#r526506964
2020-11-19Rollup merge of #79193 - tmiasko:revert-78969-normalize, r=davidtwcoDylan DPC-21/+16
Revert #78969 "Normalize function type during validation" Closes #79066. Reopens #78442.
2020-11-19Rollup merge of #79185 - petrochenkov:derattr2, r=Aaron1011Dylan DPC-654/+481
expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute" Miscellaneous refactorings and error reporting changes extracted from https://github.com/rust-lang/rust/pull/79078. Unlike https://github.com/rust-lang/rust/pull/79078 this PR doesn't make any observable changes to the language or library. r? ```@Aaron1011```
2020-11-19Rollup merge of #79183 - cuviper:compiletest-test-sysroot, r=Mark-SimulacrumDylan DPC-1/+4
Make compiletest testing use the local sysroot We already set `compiletest` to use the local sysroot in #68019, but that missed the configuration for testing `compiletest` itself.
2020-11-19Rollup merge of #79181 - aDotInTheVoid:provided-method-source-link, ↵Dylan DPC-42/+55
r=jyn514,GuillaumeGomez rustdoc: add [src] links to methods on a trait's page Closes #45150 ![image](https://user-images.githubusercontent.com/28781354/99565541-aba4d500-29c3-11eb-99c7-11c1f91584e9.png) ### Caveats - The way I've implemented it, links are also provided for required methods, that just link to the signature in the code. I'm not sure if this is the desired behaviour. ![image](https://user-images.githubusercontent.com/28781354/99566222-849ad300-29c4-11eb-9897-08cc5842954f.png) - I'm not sure if the css changes are correct. I inspected them visualy on firefox on desktop, and they seem to be fine. - I can't tell how `src/librustdoc/html/render/mod.rs` is structured, so I probably
2020-11-19Rollup merge of #79177 - fanzier:drop-order-test, r=RalfJungDylan DPC-0/+44
Test drop order for (destructuring) assignments Add a test that checks whether the drop order of `let` bindings is consistent with the drop order of the corresponding destructuring assignments. Thanks to ```@RalfJung``` for the suggesting this test ([here](https://github.com/rust-lang/rust/pull/79016#issuecomment-727608732)) and an implementation! r? ```@RalfJung```
2020-11-19Rollup merge of #79123 - CDirkx:128-bits, r=Mark-SimulacrumDylan DPC-6/+10
Add u128 and i128 integer tests Add the missing integer tests for u128 and i128 for completeness with the other integer types.
2020-11-19Rollup merge of #79119 - jamesmunns:patch-1, r=Mark-SimulacrumDylan DPC-3/+10
Clarify availability of atomic operations This was noticed while we were updating the embedded rust book: https://github.com/rust-embedded/book/pull/273/files These targets do natively have atomic load/stores, but do not support CAS operations.
2020-11-19Auto merge of #79060 - dtolnay:symlinkarg, r=Mark-Simulacrumbors-60/+67
Disambiguate symlink argument names The current argument naming in the following standard library functions is horribly ambiguous. - std::os::unix::fs::symlink: https://doc.rust-lang.org/1.47.0/std/os/unix/fs/fn.symlink.html - std::os::windows::fs::symlink_file: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_file.html - std::os::windows::fs::symlink_dir: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_dir.html **Notice that Swift uses one of the same names we do (`dst`) to refer to the opposite thing.** <br> | | the&nbsp;one&nbsp;that&nbsp;exists | the&nbsp;one&nbsp;that&nbsp;is<br>being&nbsp;created | reference | | --- | --- | --- | --- | | Rust | `src` | `dst` | | | Swift | `withDestinationPath`<br>`destPath` | `atPath`<br>`path` | <sub>https://developer.apple.com/documentation/foundation/filemanager/1411007-createsymboliclink</sub> | | D | `original` | `link` | <sub>https://dlang.org/library/std/file/symlink.html</sub> | | Go | `oldname` | `newname` | <sub>https://golang.org/pkg/os/#Symlink</sub> | | C++| `target` | `link` | <sub>https://en.cppreference.com/w/cpp/filesystem/create_symlink</sub> | | POSIX | `path1` | `path2` | <sub>https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html</sub> | | Linux | `target` | `linkpath` | <sub>https://man7.org/linux/man-pages/man2/symlink.2.html</sub> | Out of these I happen to like D's argument names and am proposing that we adopt them.
2020-11-19Move `rustc_ty` -> `rustc_ty_utils`LeSeulArtichaut-7/+7
2020-11-19Add the "memcpy" doc alias to slice::copy_from_sliceYoshua Wuyts-0/+1
2020-11-19Clippy: Match on assert!() expansions without an inner block.Mara Bos-2/+5
2020-11-19Remove the clippy::panic-params lint.Mara Bos-134/+4
Rustc itself now warns for all cases that triggered this lint.
2020-11-19Auto merge of #79200 - Dylan-DPC:rollup-su689pq, r=Dylan-DPCbors-729/+632
Rollup of 14 pull requests Successful merges: - #78961 (Make bad "rust-call" arguments no longer ICE) - #79082 (Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.) - #79090 (libary: Forward compiler-builtins "asm" and "mangled-names" feature) - #79094 (Add //ignore-macos to pretty-std-collections.rs) - #79101 (Don't special case constant operands when lowering intrinsics) - #79102 (Add two regression tests) - #79110 (Remove redundant notes in E0275) - #79116 (compiletest: Fix a warning in debuginfo tests on windows-gnu) - #79117 (add optimization fuel checks to some mir passes) - #79147 (Highlight MIR as Rust on GitHub) - #79149 (Move capture lowering from THIR to MIR) - #79155 (fix handling the default config for profiler and sanitizers) - #79156 (Allow using `download-ci-llvm` from directories other than the root) - #79164 (Permit standalone generic parameters as const generic arguments in macros) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-19Extend meta parameters to all generated code in compat_fn.Josh Matthews-0/+1
2020-11-19expand: Mark some dead code in derive expansion as unreachableVadim Petrochenkov-54/+5
2020-11-19expand: Stop derive expansion un unexpected targets earlyVadim Petrochenkov-88/+41
Collect derive placeholders using `collect` instead of `push`
2020-11-19expand: Cleanup attribute collection in invocation collectorVadim Petrochenkov-141/+39
2020-11-19resolve/expand: Misc cleanupVadim Petrochenkov-16/+10
2020-11-19resolve: Centralize some error reporting for unexpected macro resolutionsVadim Petrochenkov-253/+278
2020-11-19resolve: Introduce a separate `NonMacroAttrKind` for legacy derive helpersVadim Petrochenkov-20/+21
2020-11-19expand: Move `fully_configure` to `config.rs`Vadim Petrochenkov-42/+45
2020-11-19expand: Tell built-in macros whether we are currently in forced expansion modeVadim Petrochenkov-40/+42
2020-11-20Add jyn514 email alias to mailmapIvan Tham-0/+1
2020-11-19Rollup merge of #79164 - varkor:unbraced-single-segment-const-arguments, ↵Dylan DPC-24/+51
r=petrochenkov Permit standalone generic parameters as const generic arguments in macros Fixes https://github.com/rust-lang/rust/issues/79127. r? ```@petrochenkov```
2020-11-19Rollup merge of #79156 - jyn514:relative-llvm, r=Mark-SimulacrumDylan DPC-2/+5
Allow using `download-ci-llvm` from directories other than the root Previously, bootstrap.py would attempt to find the LLVM commit from `src/llvm-project`. However, it assumed it was always being run from the top-level directory, which isn't always the case. Before: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz curl: (22) The requested URL returned error: 404 failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz Build completed unsuccessfully in 0:00:02 ``` After: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ###################################################################################################################################################################### 100.0% extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ``` r? ```@Mark-Simulacrum``` cc ```@pnkfelix```
2020-11-19Rollup merge of #79155 - 12101111:fix-profiler-config, r=Mark-SimulacrumDylan DPC-8/+8
fix handling the default config for profiler and sanitizers #78354 don't handle the case that user don't add any target-specific config in `[target.*]` of `config.toml`: ```toml changelog-seen = 2 [llvm] link-shared = true [build] sanitizers = true profiler = true [install] [rust] [dist] ``` The previes code handle the default config in `Config::prase()`: ```rust target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default()); target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default()); config.target_config.insert(TargetSelection::from_user(&triple), target); ``` In this case, `toml.target` don't contain any target, so the above code won't execute. Instead, a default `Target` is insert in https://github.com/rust-lang/rust/blob/c919f490bbcd2b29b74016101f7ec71aaa24bdbb/src/bootstrap/sanity.rs#L162-L166 The default value for `bool` is false, hence the issue in #79124 This fix change the type of `sanitizers` and `profiler` to `Option<bool>`, so the default value is `None`, and fallback config is handled in `Config::sanitizers_enabled` and `Config::profiler_enabled` fix #79124 cc `@Mark-Simulacrum` `@richkadel`
2020-11-19Rollup merge of #79149 - sexxi-goose:upvar_ref, r=nikomatsakisDylan DPC-124/+108
Move capture lowering from THIR to MIR This allows us to: - Handle precise Places captured by a closure directly in MIR. Handling captures in MIR is easier since we can rely on/ tweak PlaceBuilder to generate `mir::Place`s that resemble how we store captures (`hir::Place`). - Handle `let _ = x` case when feature `capture_disjoint_fields` is enabled directly in MIR. This is required to be done in MIR since patterns are desugared in MIR. Closes: rust-lang/project-rfc-2229#25 r? ```@nikomatsakis```
2020-11-19Rollup merge of #79147 - camelid:mir-gitattributes, r=oli-obkDylan DPC-0/+1
Highlight MIR as Rust on GitHub
2020-11-19Rollup merge of #79117 - cjkenn:mir-fuel, r=oli-obkDylan DPC-13/+61
add optimization fuel checks to some mir passes Fixes #77402 Inserts a bunch of calls to `consider_optimizing`. Note that `consider_optimizing` is the method that actually decrements the fuel count, so the point at which it's called is when the optimization takes place, from a fuel perspective. This means that where we call it has some thought behind it: 1. We probably don't want to decrement the fuel count before other simple checks, otherwise we count an optimization as being performed even if nothing was mutated (ie. it returned early). 2. In cases like `InstCombine`, where we gather optimizations in a pass and then mutate values, we probably would rather skip the gathering pass for performance reasons rather than skip the mutations afterwards.
2020-11-19Rollup merge of #79116 - petrochenkov:gdbwarn, r=Mark-SimulacrumDylan DPC-1/+2
compiletest: Fix a warning in debuginfo tests on windows-gnu The warning looked like this for me: ``` Warning: C:msys64homewerust./src/etc: No such file or directory. ``` It didn't affect actual testing because we don't currently emit gdb pretty-printer information into executables on windows-gnu.
2020-11-19Rollup merge of #79110 - estebank:issue-58964, r=oli-obkDylan DPC-512/+133
Remove redundant notes in E0275 Fix #58964.
2020-11-19Rollup merge of #79102 - Alexendoo:ice-regression-tests, r=Mark-SimulacrumDylan DPC-0/+90
Add two regression tests For #78721 and #78722
2020-11-19Rollup merge of #79101 - tmiasko:lower-func-type, r=jonas-schievinkDylan DPC-8/+42
Don't special case constant operands when lowering intrinsics