about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-02-16Auto merge of #81611 - cjgillot:meowner, r=estebankbors-186/+166
Only store a LocalDefId in some HIR nodes Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef. As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`. This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16Auto merge of #82192 - GuillaumeGomez:rollup-gi1639b, r=GuillaumeGomezbors-20/+54
Rollup of 6 pull requests Successful merges: - #82145 (Fix ES5 errors (IE11)) - #82160 (Fix typo in rustc_infer::infer::UndoLog) - #82161 (Add long explanation for E0545) - #82163 (avoid full-slicing slices) - #82175 (validation: fix invalid-fn-ptr error message) - #82184 ([Minor] Update discriminant_value docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-16Rollup merge of #82175 - RalfJung:invalid-fn-ptr, r=oli-obkGuillaume Gomez-10/+37
validation: fix invalid-fn-ptr error message https://github.com/rust-lang/rust/pull/82061 changed the code here to print an `ImmTy` instead of a `ScalarMaybeUninit`; that was an accident. So go back to printing a `ScalarMaybeUninit`. r? ```@oli-obk```
2021-02-16Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514Guillaume Gomez-3/+3
avoid full-slicing slices If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-16Rollup merge of #82161 - jesusprubio:add-long-explanation-e0545, ↵Guillaume Gomez-1/+2
r=GuillaumeGomez Add long explanation for E0545 Helps with #61137
2021-02-16Rollup merge of #82145 - GuillaumeGomez:es5-checks, r=Nemo157Guillaume Gomez-6/+12
Fix ES5 errors (IE11) rustdoc is supposed to run on IE11 but someone reported me that it wasn't. I just confirmed it by using `es-check` with the `es5` option like this: ``` $ es-check es5 src/librustdoc/html/static/*.js ``` The PR fixes those issues and add CI checks to prevent regressions. `@Mark-Simulacrum:` I added checks in the CI, but not sure if it's the correct way to do it. Any help on that side would be very appreciated! r? `@Nemo157`
2021-02-16update MiriRalf Jung-8/+9
2021-02-16add testRalf Jung-10/+37
2021-02-16Auto merge of #81734 - richkadel:fixfordash, r=pnkfelixbors-39/+21
Ensures `make` tests run under /bin/dash (if available), like CI, and fixes a Makefile Note: This cherrypicks #81688 (`@pnkfelix)` Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI uses `dash` but other environments (including developer local machines) may default to `bash`. Replaces bash-specific shell command in one Makefile with a dash-compatible alternative, and re-enables the affected Makefile test. Removes apparently redundant definition of `UNAME`. Also see: [zulip discussion thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/how.20to.20run.2Fbless.20src.2Ftest.2Frun-make-fulldeps.2Fcoverage.20.3F) r? `@pnkfelix` FYI: `@wesleywiser` `@tmandry`
2021-02-16avoid full-slicing slicesMatthias Krüger-3/+3
If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-15Trait impls are Items, therefore HIR owners.Camille GILLOT-2/+2
2021-02-15Only store a LocalDefId in hir::MacroDef.Camille GILLOT-4/+4
2021-02-15Index Modules using their LocalDefId.Camille GILLOT-3/+2
2021-02-15Only store a LocalDefId in hir::ForeignItem.Camille GILLOT-6/+12
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-52/+47
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-23/+25
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-84/+62
Items are guaranteed to be HIR owner.
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-12/+12
2021-02-15Add long explanation for E0545Jesus Rubio-1/+2
2021-02-15Rollup merge of #82147 - lnicola:rust-analyzer-2021-02-15, r=jonas-schievinkJonas Schievink-17/+18
:arrow_up: rust-analyzer
2021-02-15Rollup merge of #82141 - jrvanwhy:issue-82052, r=sanxiynJonas Schievink-0/+9
32-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output register. On 32-bit ARM platforms, the register `r14` has the alias `lr`. When used as an output register in `asm!`, rustc canonicalizes the name to `r14`. LLVM only knows the register by the name `lr`, and rejects it. This changes rustc's LLVM code generation to output `lr` instead. closes #82052 r? ``@nagisa``
2021-02-15Rollup merge of #82133 - ehuss:extern-prelude-link, r=jyn514Jonas Schievink-1/+1
Update link for extern prelude. There was some reorganization in the reference as part of https://github.com/rust-lang/reference/pull/937.
2021-02-15Rollup merge of #82106 - jyn514:cleanup-bootstrap, r=Mark-SimulacrumJonas Schievink-5/+4
Remove unnecessary `Option` in `default_doc` Previously, there were two different ways to encode the same info: `None` or `Some(&[])`. Now there is only one way, `&[]`.
2021-02-15Rollup merge of #82096 - TaKO8Ki:fix-typo, r=GuillaumeGomezJonas Schievink-1/+1
Fix a typo This pull request fixes a typo.
2021-02-15Rollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obkJonas Schievink-0/+24
const_generics: Fix incorrect ty::ParamEnv::empty() usage Fixes #80561 Not sure if I should keep the `debug!(..)`s or not but its the second time I've needed them so they sure seem useful lol cc ``@lcnr`` r? ``@oli-obk``
2021-02-15Rollup merge of #82061 - RalfJung:ctfe-read-pointer-as-bytes, r=oli-obkJonas Schievink-1/+1
CTFE validation: catch ReadPointerAsBytes and better error r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/79690 Cc https://github.com/rust-lang/miri/issues/1706
2021-02-15Rollup merge of #82009 - BoxyUwU:idontknooow, r=varkorJonas Schievink-0/+35
const_generics: Dont evaluate array length const when handling errors Fixes #79518 Fixes #78246 cc ````@lcnr```` This was ICE'ing because we dont pass in the correct ``ParamEnv`` which meant that there was no ``Self: Foo`` predicate to make ``Self::Assoc`` well formed which caused an ICE when trying to normalize ``Self::Assoc`` in the mir interpreter r? ````@varkor````
2021-02-15Rollup merge of #81897 - ↵Jonas Schievink-0/+29
vandenheuvel:match_exhaustive_diagnostics_regression_test, r=Mark-Simulacrum Add match pattern diagnostics regression test Closes #72377 by adding a regression test. This test case fails on stable but now works on beta and nightly. It *should* have worked already for years, the crucial point whether it is mentioned that some uncovered patterns are not explicitly mentioned.
2021-02-15Rollup merge of #81503 - henryboisdequin:fix-const-fn-arr-err-msg, r=estebankJonas Schievink-0/+23
Suggest to create a new `const` item if the `fn` in the array is a `const fn` Fixes #73734. If the `fn` in the array repeat expression is a `const fn`, suggest creating a new `const` item. On nightly, suggest creating an inline `const` block. This PR also removes the `suggest_const_in_array_repeat_expressions` as it is no longer necessary. Example: ```rust fn main() { // Should not compile but hint to create a new const item (stable) or an inline const block (nightly) let strings: [String; 5] = [String::new(); 5]; println!("{:?}", strings); } ``` Gives this error: ``` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:3:32 | 2 | let strings: [String; 5] = [String::new(); 5]; | ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `String` | = note: the `Copy` trait is required because the repeated element will be copied ``` With this change, this is the error message: ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:3:32 | LL | let strings: [String; 5] = [String::new(); 5]; | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | = help: moving the function call to a new `const` item will resolve the error ```
2021-02-15:arrow_up: rust-analyzerLaurențiu Nicola-17/+18
2021-02-15Fix ES5 errors (IE11)Guillaume Gomez-6/+12
2021-02-1432-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output ↵Johnathan Van Why-0/+9
register. On 32-bit ARM platforms, the register `r14` has the alias `lr`. When used as an output register in `asm!`, rustc canonicalizes the name to `r14`. LLVM only knows the register by the name `lr`, and rejects it. This changes rustc's LLVM code generation to output `lr` instead.
2021-02-14Update link for extern prelude.Eric Huss-1/+1
2021-02-14Remove unnecessary `Option` in `default_doc`Joshua Nelson-5/+4
Previously, there two different ways to encode the same info: `None` or `Some(&[])`. Now there is only one way, `&[]`.
2021-02-14Rollup merge of #82056 - b-naber:mut_for_loop_bug, r=oli-obkDylan DPC-0/+30
fix ice (#82032) Fixes https://github.com/rust-lang/rust/issues/82032
2021-02-14Rollup merge of #81927 - vandenheuvel:issue_32498, r=Mark-SimulacrumDylan DPC-0/+16
Add a regression test for #32498 [This](https://github.com/rust-lang/rust/issues/32498#issuecomment-613626968) test mentioned at issue #32498 now passes. This PR adds this regression test.
2021-02-14Rollup merge of #81914 - kper:fixing-81885, r=estebankDylan DPC-8/+27
Fixing bad suggestion for `_` in `const` type when a function #81885 Closes #81885 ``` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:13:22 | LL | const TEST4: fn() -> _ = 42; | ^ | | | not allowed in type signatures | help: use type parameters instead: `T` ``` Do not show the suggestion `help: use type parameters instead: T` when `fn`
2021-02-14Rollup merge of #81912 - sexxi-goose:Migrations2_review, r=nikomatsakisDylan DPC-0/+232
Implement the precise analysis pass for lint `disjoint_capture_drop_reorder` The precision pass for the lint prevents the lint from triggering for a variable (that was previously entirely captured by the closure) if all paths that need Drop starting at root variable have been captured by the closure. r? `@nikomatsakis`
2021-02-14Rollup merge of #81891 - CraftSpider:fn-header, r=jyn514Dylan DPC-17/+95
[rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent Bumps version number and adds tests, this is a breaking change. I can split this into two (`is_unsafe` -> `header` and `header: Vec<Modifiers>`) if desired. Rationale: Modifiers are individual notes on a function, it makes more sense for them to be a list of an independent enum over a String which is inconsistently exposing the HIR representation (prefix_str vs custom literals). Function pointers currently only support `unsafe`, but there has been talk on and off about allowing them to also support `const`, and this makes handling their modifiers consistent with handling those of a function, allowing better shared code. `@rustbot` modify labels: +A-rustdoc-json +T-rustdoc CC: `@HeroicKatora` r? `@jyn514`
2021-02-14Rollup merge of #81720 - klensy:smallvec-update, r=Mark-SimulacrumDylan DPC-3/+3
Updated smallvec version due to RUSTSEC-2021-0003 Hi. Updated Cargo.toml's for smallvec due to RUSTSEC-2021-0003 and Cargo.toml in separate commit. Affected function `SmallVec::insert_many` looks like don't was used directly in rust, but can be somewhere in deps. There should be some mechanism to not to do this kind of things manually, like dependabot. Actually, dependabot supports rust and can check security articles (at least that noted in description).
2021-02-14Rollup merge of #80920 - rylev:check_attr-refactor, r=davidtwcoDylan DPC-6/+31
Visit more targets when validating attributes This begins to address #80048, allowing for additional validation of attributes. There are more refactorings that can be done, though I think they should be tackled in additional PRs: * ICE when a builtin attribute is encountered that is not checked * Move some of the attr checking done `ast_validation` into `rustc_passes` * note that this requires a bit of additional refactoring, especially of extern items which currently parse attributes (and thus are a part of the AST) but do not possess attributes in their HIR representation. * Rename `Target` to `AttributeTarget` * Refactor attribute validation completely to go through `Visitor::visit_attribute`. * This would require at a minimum passing `Target` into this method which might be too big of a refactoring to be worth it. * It's also likely not possible to do all the validation this way as some validation requires knowing what other attributes a target has. r? `@davidtwco`
2021-02-14bumped smallvec depsklensy-3/+3
2021-02-14fix typoTakayuki Maeda-1/+1
2021-02-14update messageHenry Boisdequin-2/+5
2021-02-13Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-sebors-31/+28
directly expose copy and copy_nonoverlapping intrinsics This effectively un-does https://github.com/rust-lang/rust/pull/57997. That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163. Cc `@bjorn3` `@therealprof`
2021-02-13a wild test has appeared uwuEllen-0/+24
2021-02-13Fix clippy's path to the copy intrinsics.Mara Bos-2/+2
2021-02-13Heat up the ICE-y error reportingEllen-0/+35
rest in peace match bool <3
2021-02-13CTFE validation: catch ReadPointerAsBytes and better errorRalf Jung-1/+1
2021-02-13Auto merge of #81666 - hyd-dev:miri-windows-test-fail, r=Mark-Simulacrumbors-14/+17
Don't release Miri if its tests only failed on Windows Extends #66053 to Windows, so the released Miri won't be broken if its tests only fail on Windows. Relevant Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Miri.20is.20still.20available.20in.20rustup.20today.3F