about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-07-22Add a regression testOli Scherer-0/+24
2021-07-22Make mir borrowck's use of opaque types independent of the typeck query's resultOli Scherer-174/+96
2021-07-22Auto merge of #87265 - Aaron1011:hir-wf-fn, r=estebankbors-44/+68
Support HIR wf checking for function signatures During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-22Auto merge of #87250 - robojumper:87199-sized-relaxation, r=nikomatsakisbors-0/+56
Fix implicit Sized relaxation when attempting to relax other, unsupported trait Fixes #87199. Do note that this bug fix causes code like the `ref_arg::<[i32]>(&[5]);` line in the test case in combination with an affected function to no longer compile.
2021-07-22Auto merge of #87246 - rust-lang:placeholder-pretty, r=nikomatsakisbors-10/+10
When pretty printing, name placeholders as bound regions Split from #85499 When we see a placeholder that we are going to print, treat it as a bound var (and add it to a `for<...>`
2021-07-21Rollup merge of #87346 - rylev:rename-force-warn, r=nikomatsakisEric Huss-37/+37
Rename force-warns to force-warn The renames the `--force-warns` option to `--force-warn`. This mirrors other lint options like `--warn` and `--deny` which are in the singular. r? `@nikomatsakis` cc `@ehuss` - this option is being used by Cargo. How do we make sure the transition to using the new name is as smooth as possible?
2021-07-21Rollup merge of #87326 - ehuss:update-cargo, r=ehussEric Huss-0/+0
Update cargo 6 commits in 27277d966b3cfa454d6dea7f724cb961c036251c..4e143fd131e0c16cefd008456e974236ca54e62e 2021-07-16 00:50:39 +0000 to 2021-07-20 21:55:45 +0000 - Named profile updates (rust-lang/cargo#9685) - Inform build scripts of rustc compiler context (rust-lang/cargo#9601) - Factor version preferences into a struct (rust-lang/cargo#9703) - docs: Fix sentence & update link for GitLab CI docs (rust-lang/cargo#9704) - Deduplicate compiler diagnostics. (rust-lang/cargo#9675) - Re-enable future-incompatible tests. (rust-lang/cargo#9698)
2021-07-21Rollup merge of #87278 - lnicola:rust-analyzer-2021-07-19, r=lnicolaEric Huss-16/+15
:arrow_up: rust-analyzer
2021-07-21Rollup merge of #87024 - weihanglo:issue-85494, r=ManishearthEric Huss-19/+72
rustdoc: show count of item contents when hidden Resolves #85494
2021-07-21Rollup merge of #87342 - midgleyc:add-E0757-long, r=GuillaumeGomezGuillaume Gomez-0/+1
Add long explanation for E0757 Helps with #61137
2021-07-21Rollup merge of #87321 - midgleyc:add-E0722-long, r=GuillaumeGomezGuillaume Gomez-1/+2
Add long explanation for E0722 Helps with #61137
2021-07-21Rollup merge of #87311 - oli-obk:nll_suggestion_span, r=estebankGuillaume Gomez-8/+8
Get back the more precise suggestion spans of old regionck I noticed that when you turn on nll, the structured suggestion replaces a snippet instead of appending a snippet. It seems clearer to the user to only highlight the newly added characters instead of the entire `impl Trait` (and old regionck already does it this way). r? ``@estebank``
2021-07-21Rollup merge of #87301 - chinmaydd:chinmaydd-patch-1-1, r=jyn514Guillaume Gomez-1/+1
Fix typo in compile.rs
2021-07-21Rollup merge of #87273 - fee1-dead:impl-const-impl-bounds, r=oli-obkGuillaume Gomez-0/+15
Recognize bounds on impls as const bounds r? ```@oli-obk```
2021-07-21Rollup merge of #87230 - GuillaumeGomez:docblock-table-overflow, r=notriddleGuillaume Gomez-11/+23
Fix docblock <table> overflow Before: ![Screenshot from 2021-07-18 00-05-23](https://user-images.githubusercontent.com/3050060/126050272-ce08bc5f-74ff-4135-bc12-d708d87470cc.png) After: ![Screenshot from 2021-07-18 00-03-55](https://user-images.githubusercontent.com/3050060/126050273-42f41b4d-ad57-4a87-91de-18e63f8504ec.png) cc `@SergioBenitez` r? `@notriddle`
2021-07-21Rollup merge of #87187 - oxalica:fix-nixos-detect, r=nagisaGuillaume Gomez-1/+7
Fix NixOS detection Use `/etc/os-release` instead of `/etc/NIXOS` for detection. The latter one does not exist on NixOS when using tmpfs as root.
2021-07-21Rename force-warns to force-warnRyan Levick-37/+37
2021-07-21Add long explanation for E0757Chris Midgley-0/+1
2021-07-21Auto merge of #82653 - jyn514:submodules-on-demand, r=Mark-Simulacrumbors-113/+173
Update all submodules that rustbuild doesn't depend on lazily This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules to rustbuild and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. Helps with https://github.com/rust-lang/rust/issues/76653. Builds on https://github.com/rust-lang/rust/pull/86015 and should not be merged before (only the last commit is relevant).
2021-07-20Update all submodules that rustbuild doesn't depend on lazilyJoshua Nelson-113/+173
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
2021-07-20Update cargoEric Huss-0/+0
2021-07-20Add long explanation for E0722Chris Midgley-1/+2
2021-07-20Auto merge of #87312 - ehuss:update-books, r=ehussbors-0/+0
Update books ## reference 6 commits in ab60513a3a5a0591e237fddff5d027a982648392..82d75cf423e4a7824fb36e73ccb18519d6900610 2021-07-05 08:27:31 -0700 to 2021-07-15 06:49:08 -0700 - fix wording/punctuation in "Lifetime bounds" (rust-lang/reference#1062) - mention implicit `Sized` bound in more places (rust-lang/reference#1053) - (rust-lang/reference#1060) - Remove inner attributes from non-block expressions. (rust-lang/reference#1051) - Add note about the sign of the remainder (rust-lang/reference#1073) - Clarify closure capture modes slightly (rust-lang/reference#1064) ## book 21 commits in a90f07f1e9a7fc75dc9105a6c6f16d5c13edceb0..eac55314210519238652f12b30fec9daea61f7fe 2021-07-05 14:43:12 -0400 to 2021-07-19 11:08:01 -0400 - (rust-lang/book#2791) - Add Deref trait to overload the deref operator in appendix table - Revise linker installation instructions. Fixes rust-lang/book#2151. - Clarify number literal type suffixes. Fixes rust-lang/book#1979. - Add a note that lifetimes are coming up but aren't required - Zip creates an iterator, not a vector. Fixes rust-lang/book#2762. - Add Thai translation to the appendix. Connects to rust-lang/book#2636 - Derive Copy and Clone for Point to match stdlib docs example; fixes rust-lang/book#2657 - Make the definition of Option match the stdlib's, fixes rust-lang/book#2634 - Explain double quote backslash; closes rust-lang/book#2597 - Don't use the term 'anonymous struct' to fix rust-lang/book#2584 - Reword a sentence to fix rust-lang/book#2525 - Add Hindi translation. Connects to rust-lang/book#2496 - Remove unsafe Ferris designations from code. Fixes rust-lang/book#2555 - Add Traditional Chinese translation. Connects to rust-lang/book#2470 - Remove some more references to the authors field - Make Appendix E be a link - fix line wrapping - remove description about the authors field - remove the authors field - remove the authors field ## rust-by-example 6 commits in 028f93a61500fe8f746ee7cc6b204ea6c9f42935..1db6bb483cc87ad3b424d9aba764fe622960a1be 2021-07-06 06:28:53 -0300 to 2021-07-15 06:17:42 -0300 - Updated the file destructure_tuple.md (rust-lang/rust-by-example#1452) - Fix nomenclature around methods (rust-lang/rust-by-example#1450) - std_misc/path.md: update `Show` to `Display` (rust-lang/rust-by-example#1449) - Fix up github action (rust-lang/rust-by-example#1451) - Remove github pages - Support GitHub Actions (rust-lang/rust-by-example#1330) ## rustc-dev-guide 2 commits in 60e282559104035985331645907c3d9f842312c5..93422c21baca585dc88357ec886a48f6ddc7d665 2021-07-05 11:21:03 -0400 to 2021-07-13 12:45:58 -0400 - Update for merge of CrateDisambiguator into StableCrateId - Minor capitalization fix (rust-lang/rustc-dev-guide#1170) ## edition-guide 8 commits in 5d57b3832f8d308a9f478ce0a69799548f27ad4d..af696ce8ea526445590ae0ca66a8128d2a95a69a 2021-07-05 10:33:32 +0200 to 2021-07-20 11:38:03 -0400 - Add migration section for panic-macro-consistency (rust-lang/edition-guide#258) - Update transitioning chapter. (rust-lang/edition-guide#255) - Add details on migrating the Cargo feature resolver. (rust-lang/edition-guide#259) - Improve panic macro consistency summary (rust-lang/edition-guide#256) - Add migration details to or-patterns guide (rust-lang/edition-guide#252) - Add migration section to into-iterator (rust-lang/edition-guide#253) - Add Rust 2021 prelude migration details (rust-lang/edition-guide#251) - Provide more information about disjoint capture in closures and migration instructions (rust-lang/edition-guide#246) ## embedded-book 1 commits in 506840eb73b0749336e1d5274e16d6393892ee82..09986cd352404eb4659db44613b27cac9aa652fc 2021-06-24 00:01:32 +0000 to 2021-07-18 19:26:46 +0000 - Stop referring to the alloc crate as unstable (rust-embedded/book#297)
2021-07-21Fix NixOS detectionoxalica-1/+7
Use `/etc/os-release` instead of `/etc/NIXOS`. The latter one does not exist on NixOS when using tmpfs as root.
2021-07-20Update booksEric Huss-0/+0
2021-07-20Support HIR wf checking for function signaturesAaron Hill-44/+68
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-20Get back the more precise suggestion spans of old regionckOli Scherer-8/+8
2021-07-20Auto merge of #87310 - spastorino:update_miri, r=RalfJungbors-12/+8
Update MIRI Fixes #87306 r? `@RalfJung`
2021-07-20Update MIRISantiago Pastorino-12/+8
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-7/+150
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-20Auto merge of #87224 - RalfJung:miri-ptr-oob, r=oli-obkbors-10/+25
miri: better ptr-out-of-bounds errors For offsets larger than `isize::MAX`, display them as negative offsets. r? `@oli-obk`
2021-07-20Auto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obkbors-1637/+475
Remove impl trait in bindings Closes #86729 r? `@oli-obk`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-7/+102
2021-07-19Fix typo in compile.rsChinmay Deshpande-1/+1
2021-07-20Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebankbors-2/+12
Suggest lint groups Fixes rust-lang/rust-clippy#6986
2021-07-19Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkovbors-0/+19
Remove special case for `ExprKind::Paren` in `MutVisitor` The special case breaks several useful invariants (`ExpnId`s are globally unique, and never change). This special case was added back in 2016 in https://github.com/rust-lang/rust/pull/34355 r? `@petrochenkov`
2021-07-19Remove special case for `ExprKind::Paren` in `MutVisitor`Aaron Hill-0/+19
The special case breaks several useful invariants (`ExpnId`s are globally unique, and never change). This special case was added back in 2016 in https://github.com/rust-lang/rust/pull/34355
2021-07-19Better diagnostics when mismatched types due to implict static lifetimejackh726-8/+56
2021-07-19Auto merge of #87153 - ↵bors-37/+41
michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser [debuginfo] Emit associated type bindings in trait object type names. This PR updates debuginfo type name generation for trait objects to include associated type bindings and auto trait bounds -- so that, for example, the debuginfo type name of `&dyn Iterator<Item=Foo>` and `&dyn Iterator<Item=Bar>` don't both map to just `&dyn Iterator` anymore. The following table shows examples of debuginfo type names before and after the PR: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `&dyn Iterator` | `&dyn Iterator<Item=u32>` | | `&(dyn Iterator<Item=u32>> + Sync)` | `&dyn Iterator` | `&(dyn Iterator<Item=u32> + Sync)` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `&dyn SomeTrait<bool, i8>` | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | For targets that need C++-like type names, we use `assoc$<Item,u32>` instead of `Item=u32`: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> > > >` | | `&(dyn Iterator<Item=u32>> + Sync)` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> >,Sync> >` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `ref$<dyn$<SomeTrait<bool, i8> > >` | `ref$<dyn$<SomeTrait<bool,i8,assoc$<Bar,u32> > >,Send> >` | The PR also adds self-profiling measurements for debuginfo type name generation (re. https://github.com/rust-lang/rust/issues/86431). It looks like the compiler spends up to 0.5% of its time in that task, so the potential for optimizing it via caching seems limited. However, the perf run also shows [the biggest regression](https://perf.rust-lang.org/detailed-query.html?commit=585e91c718b0b2c5319e1fffd0ff1e62aaf7ccc2&base_commit=b9197978a90be6f7570741eabe2da175fec75375&benchmark=tokio-webpush-simple-debug&run_name=incr-unchanged) in a test case that does not even invoke the code in question. This suggests that the length of the names we generate here can affect performance by influencing how much data the linker has to copy around. Fixes https://github.com/rust-lang/rust/issues/86134.
2021-07-19Auto merge of #87225 - estebank:cleanup, r=oli-obkbors-370/+1422
Various diagnostics clean ups/tweaks * Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-19Auto merge of #87271 - flip1995:clippyup, r=Manishearthbors-298/+468
Update Clippy This is an out-of-cycle Clippy update, to fix 3 ICEs before the release (This should be merged before beta is branched): rust-lang/rust-clippy#7470 rust-lang/rust-clippy#7471 rust-lang/rust-clippy#7473 cc `@jackh726` `@JohnTitor` rust-lang/rust-clippy#7470 was caused by #86867. I saw the same ICE in the last rustup for Clippy though, so this might be a more general problem. Is there something we should check before calling `layout_of`? Should we always check for `ty.has_escaping_bound_vars()` before calling `layout_of`? Or is this overkill? r? `@Manishearth`
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-370/+1422
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-19:arrow_up: rust-analyzerLaurențiu Nicola-16/+15
2021-07-19[debuginfo] Adapt CDB tests after changes to whitespace usage in debuginfo ↵Michael Woerister-12/+12
type names.
2021-07-19Improve impl trait disallowed context error textSantiago Pastorino-99/+99
2021-07-19Auto merge of #86970 - inquisitivecrystal:force-warn, r=davidtwcobors-1/+73
Make `--force-warns` a normal lint level option Now that `ForceWarn` is a lint level, there's no reason `--force-warns` should be treated differently from other options that set lint levels. This merges the `ForceWarn` handling in with the other lint level command line options. It also unifies all of the relevant selection logic in `compiler/rustc_lint/src/levels.rs`, rather than having some of it weirdly elsewhere. Fixes #86958, which arose from the special-cased handling of `ForceWarn` having had an error in it.
2021-07-19Recognize bounds on impls as const boundsDeadbeef-0/+15
2021-07-19Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyupflip1995-298/+468
2021-07-19Rollup merge of #87256 - Aaron1011:hir-wf-assoc-default, r=oli-obkGuillaume Gomez-6/+6
Extend HIR-based WF checking to associated type defaults Previously, we would only look at associated types in `impl` blocks.
2021-07-19Rollup merge of #87251 - GuillaumeGomez:item-info-width, r=notriddleGuillaume Gomez-0/+13
Fix "item info" width Fixes #87202. It now looks again like this: ![Screenshot from 2021-07-18 12-33-27](https://user-images.githubusercontent.com/3050060/126064005-013acabc-7f17-4436-8dfc-cb6b9bc24413.png) cc `@jyn514` r? `@notriddle`