about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-05-31Rollup merge of #72812 - RalfJung:miri-char-test, r=jonas-schievinkDylan DPC-2/+5
Miri tests: skip parts of test_char_range The new `test_char_range` test takes forever in Miri as it loops over all values of `char`. This makes it skip most of them when being run in Miri.
2020-05-31Rollup merge of #72807 - xiaotianrandom:fix-assoc-type-diagnostics, r=estebankDylan DPC-19/+41
Avoid setting wrong obligation cause span of associated type mismatch Removes code that sets wrong obligation cause span of associated type mismatch. See the linked issue for details. Closes #72806.
2020-05-31Rollup merge of #72691 - GuillaumeGomez:escape-key-handling, r=kinnisonDylan DPC-4/+12
Fix escape key handling Fixes #72647. The problem was that you could have a timeout just after the moment you press "escape", putting back the results. r? @kinnison
2020-05-31Auto merge of #72813 - RalfJung:rollup-4ko6q8j, r=RalfJungbors-144/+136
Rollup of 5 pull requests Successful merges: - #72683 (from_u32_unchecked: check validity, and fix UB in Wtf8) - #72715 (Account for trailing comma when suggesting `where` clauses) - #72745 (generalize Borrow<[T]> for Interned<'tcx, List<T>>) - #72749 (Update stdarch submodule to latest head) - #72781 (Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`) Failed merges: r? @ghost
2020-05-31Put input timeout clearance inside a functionGuillaume Gomez-13/+11
2020-05-31Miri tests: skip parts of test_char_rangeRalf Jung-2/+5
2020-05-31Rollup merge of #72781 - marmeladema:rustdoc-def-id-resolve-str-path-error, ↵Ralf Jung-11/+12
r=petrochenkov Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error` Together with https://github.com/rust-lang/rust/pull/72777 this should remove all uses of `NodeId` in `rustdoc`. cc #50928 r? @petrochenkov
2020-05-31Rollup merge of #72749 - vertexclique:vcq/update-stdarch, r=AmanieuRalf Jung-0/+0
Update stdarch submodule to latest head Includes avx512 work & aarch64 tme.
2020-05-31Rollup merge of #72745 - lcnr:interned-cleanup, r=petrochenkovRalf Jung-48/+2
generalize Borrow<[T]> for Interned<'tcx, List<T>>
2020-05-31Rollup merge of #72715 - estebank:trailing-comma-where, r=petrochenkovRalf Jung-17/+10
Account for trailing comma when suggesting `where` clauses Fix #72693.
2020-05-31Rollup merge of #72683 - RalfJung:char-debug-check, r=Mark-SimulacrumRalf Jung-68/+112
from_u32_unchecked: check validity, and fix UB in Wtf8 Fixes https://github.com/rust-lang/rust/issues/72760
2020-05-31Auto merge of #72759 - alexcrichton:update-compiler-builtins, r=Mark-Simulacrumbors-1/+1
Update compiler-builtins Pulls in a fix for #72758, more details on the linked issue. [Crate changes included here][changes] [changes]: https://github.com/rust-lang/compiler-builtins/compare/0.1.28...0.1.31 Closes #72758
2020-05-31Auto merge of #72743 - lcnr:predicate_f, r=nikomatsakisbors-2/+2
fix EncodeWithShorthand for Predicate r? @nikomatsakis
2020-05-31Fix associate type diagnosticsXIAO Tian-19/+12
2020-05-31Add a test for wrong assoc type diagnosticsXIAO Tian-0/+29
2020-05-31Auto merge of #72116 - petrhosek:fuchsia-ld-flags, r=tmandrybors-0/+7
Update the Fuchsia linker defaults This updates the linker defaults aligning them with Clang. Specifically, we use 4K pages on all platforms, we always use BIND_NOW, we prefer all loadable segments be separate and page aligned, and we support RELR relocations.
2020-05-31Update stdarch submodule to latest headMahmut Bulut-0/+0
2020-05-30Rollup merge of #72777 - ↵Ralf Jung-9/+5
marmeladema:rustdoc-remove-local-def-id-from-node-id, r=petrochenkov rustdoc: remove calls to `local_def_id_from_node_id` rustdoc calls `local_def_id_from_node_id(CRATE_NODE_ID)` when it can just creates a top level `DefId` using `DefId::local(CRATE_DEF_INDEX)`. cc #50928 r? @petrochenkov
2020-05-30Rollup merge of #72773 - Rantanen:is_char_boundary-docs, r=joshtriplettRalf Jung-4/+3
Fix is_char_boundary documentation Given the "start _and/or end_" wording in the original, the way I understood it was that the `str::is_char_boundary` method would also return `true` for the last byte in a UTF-8 code point sequence. (Which would have meant that for a string consisting of nothing but 1 and 2 byte UTF-8 code point sequences, it would return nothing but `true`.) In practice the method returns `true` only for the starting byte of each sequence and the end of the string: [Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e9f5fc4d6bf2f1bf57a75f3c9a180770) I was also somewhat tempted to remove the _The start and end of the string are considered to be boundaries_, since that's implied by the first sentence, but I decided to avoid bikeshedding over it and left it as it was since it's not wrong in relation to how the method behaves.
2020-05-30Rollup merge of #72772 - RalfJung:valid-char, r=petrochenkovRalf Jung-2/+2
miri validation: clarify valid values of 'char' The old text said "expected a valid unicode codepoint", which is not actually correct -- it has to be a scalar value (which is a code point that is not part of a surrogate pair).
2020-05-30Rollup merge of #72757 - petrochenkov:shebang, r=varkorRalf Jung-19/+32
rustc_lexer: Optimize shebang detection slightly Sorry, I just couldn't resist. It shouldn't make any difference in practice. Also, documented a previously unnoticed case with doc comments treated as regular comments during shebang detection.
2020-05-30Rollup merge of #72728 - o01eg:fix-72661, r=Mark-SimulacrumRalf Jung-7/+30
Make bootstrap aware of relative libdir in stage0 compiler Follows up #72692 Fixes #72661
2020-05-30Rollup merge of #72669 - petrochenkov:smclean, r=Mark-SimulacrumRalf Jung-55/+35
rustc_session: Cleanup session creation Noticed while reviewing https://github.com/rust-lang/rust/pull/72618.
2020-05-30Rollup merge of #72668 - ↵Ralf Jung-2/+77
awoimbee:give-fn-parenthetical-notation-parentheses, r=estebank Fix missing parentheses Fn notation error Fixes #72611 Well, fixes the error output, I think E0658 is the right error to throw in this case so I didn't change that
2020-05-30Rollup merge of #72666 - ivanloz:profile_emit_flag, r=matthewjasperRalf Jung-4/+11
Add -Z profile-emit=<path> for Gcov gcda output. Adds a -Z flag to control the file path that the Gcov gcda output is written to during runtime. This flag expects a path and filename, e.g. -Z profile-emit=gcov/out/lib.gcda. This works similar to GCC/Clang's -fprofile-dir flag which allows control over the output path for gcda coverage files.
2020-05-30Rollup merge of #72657 - flip1995:impl_lint_pass-ty, r=matthewjasperRalf Jung-5/+31
Allow types (with lifetimes/generics) in impl_lint_pass cc https://github.com/rust-lang/rust-clippy/pull/5279#discussion_r430790267 This allows to implement `LintPass` for types with lifetimes and/or generics. The only thing, I'm not sure of is the `LintPass::name` function, which now includes the lifetime(s) (which will be `'_` most of the time) in the name returned for the lint pass, if it exists. But I don't think that this should be a problem, since the `LintPass::name` is never used for output for the user (?).
2020-05-30Rollup merge of #72650 - GuillaumeGomez:sort-sidebar-elements, r=kinnisonRalf Jung-32/+31
Sort sidebar elements r? @kinnison
2020-05-30Rollup merge of #72637 - euclio:env-hygiene, r=davidtwcoRalf Jung-0/+9
expand `env!` with def-site context Similar to #66349. Fixes rust-lang/rust-clippy#5619.
2020-05-30Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkovRalf Jung-57/+367
Improve inline asm error diagnostics Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics. The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code. Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate. Fixes #72664 Fixes #71639 r? @petrochenkov ### Old style ```rust #![feature(llvm_asm)] fn main() { unsafe { let _x: i32; llvm_asm!( "mov $0, $1 invalid_instruction $0, $1 mov $0, $1" : "=&r" (_x) : "r" (0) :: "intel" ); } } ``` ``` error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction' invalid_instruction ecx, eax ^~~~~~~~~~~~~~~~~~~ --> src/main.rs:6:9 | 6 | / llvm_asm!( 7 | | "mov $0, $1 8 | | invalid_instruction $0, $1 9 | | mov $0, $1" ... | 12 | | :: "intel" 13 | | ); | |__________^ ``` ### New style ```rust #![feature(asm)] fn main() { unsafe { asm!( "mov {0}, {1} invalid_instruction {0}, {1} mov {0}, {1}", out(reg) _, in(reg) 0i64, ); } } ``` ``` error: invalid instruction mnemonic 'invalid_instruction' --> test.rs:7:14 | 7 | invalid_instruction {0}, {1} | ^ | note: instantiated into assembly here --> <inline asm>:3:14 | 3 | invalid_instruction rax, rcx | ^^^^^^^^^^^^^^^^^^^ ```
2020-05-30Tweak wording and spans of `'static` `dyn Trait`/`impl Trait` requirementsEsteban Küber-156/+91
2020-05-30Consider all possible one letter lifetimes in suggestionEsteban Küber-3/+3
2020-05-30Account for enclosing item when suggesting new lifetime nameEsteban Küber-23/+96
2020-05-30Tweak type parameter errors to reduce verbosityEsteban Küber-374/+78
2020-05-30Update nll testsEsteban Küber-8/+29
2020-05-30review comment: tweak wording and account for span overlapEsteban Küber-25/+38
2020-05-30Account for returned `dyn Trait` evaluating to `'static` lifetimeEsteban Küber-142/+239
Provide a suggestion for `dyn Trait + '_` when possible.
2020-05-30Fix NLL outputEsteban Küber-12/+98
2020-05-30Improve output of argument anonymous borrow missing annotation involving ↵Esteban Küber-76/+37
opaque return type Go from ``` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> file8.rs:22:5 | 22 | / move || { 23 | | *dest = g.get(); 24 | | } | |_____^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1... --> file8.rs:18:1 | 18 | / fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a 19 | | where 20 | | G: Get<T> 21 | | { ... | 24 | | } 25 | | } | |_^ note: ...so that the types are compatible --> file8.rs:22:5 | 22 | / move || { //~ ERROR cannot infer an appropriate lifetime 23 | | *dest = g.get(); 24 | | } | |_____^ = note: expected `&mut T` found `&mut T` note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 18:8... --> file8.rs:18:8 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^ note: ...so that return value is valid for the call --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^^^^^^^^^^^^^^^^^^^^^^ ``` to ``` error[E0621]: explicit lifetime required in the type of `dest` --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required | | | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` ```
2020-05-30Account for missing lifetime in opaque return typeEsteban Küber-69/+359
When encountering an opaque closure return type that needs to bound a lifetime to the function's arguments, including borrows and type params, provide appropriate suggestions that lead to working code. Get the user from ```rust fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() where G: Get<T> { move || { *dest = g.get(); } } ``` to ```rust fn foo<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() +'a where G: Get<T> { move || { *dest = g.get(); } } ```
2020-05-30Test ui suggestion fn trait notationArthur Woimbée-0/+68
2020-05-30Fix missing parentheses Fn notation errorArthur Woimbée-2/+9
2020-05-30encode_utf8_raw is not always valid UTF-8; clarify commentsRalf Jung-8/+13
2020-05-30Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`marmeladema-11/+12
2020-05-30Rollup merge of #72607 - Amanieu:fix-72570, r=oli-obkRalf Jung-34/+54
Eagerly lower asm sub-expressions to HIR even if there is an error Fixes #72570 r? @oli-obk
2020-05-30Rollup merge of #72585 - Aaron1011:feature/opt-item-tokens, r=petrochenkovRalf Jung-7/+18
Only capture tokens for items with outer attributes Suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/43081#issuecomment-633389225
2020-05-30Rollup merge of #72563 - RalfJung:multi-return, r=matthewjasperRalf Jung-1/+2
multiple Return terminators are possible @ecstatic-morse mentioned in https://github.com/rust-lang/rust/issues/72515 that multiple `Return` terminators are possible. Update the docs accordingly. Cc @rust-lang/wg-mir-opt
2020-05-30Rollup merge of #72540 - davidtwco:issue-67552-mono-collector-comparison, ↵Ralf Jung-55/+147
r=varkor mir: adjust conditional in recursion limit check Fixes #67552. This PR adjusts the condition used in the recursion limit check of the monomorphization collector, from `>` to `>=`. In #67552, the test case had infinite indirect recursion, repeating a handful of functions (from the perspective of the monomorphization collector): `rec` -> `identity` -> `Iterator::count` -> `Iterator::fold` -> `Iterator::next` -> `rec`. During this process, `resolve_associated_item` was invoked for `Iterator::fold` (during the construction of an `Instance`), and ICE'd due to substitutions needing inference. However, previous iterations of this recursion would have called this function for `Iterator::fold` - and did! - and succeeded in doing so (trivially checkable from debug logging, `()` is present where `_` is in the substs of the failing execution). The expected outcome of this test case would be a recursion limit error (which is present when the `identity` fn indirection is removed), and the recursion depth of `rec` is increasing (other functions finish collecting their neighbours and thus have their recursion depths reset). When the ICE occurs, the recursion depth of `rec` is 256 (which matches the recursion limit), which suggests perhaps that a different part of the compiler is using a `>=` comparison and returning a different result on this recursion rather than what it returned in every previous recursion, thus stopping the monomorphization collector from reporting an error on the next recursion, where `recursion_depth_of_rec > 256` would have been true. With grep and some educated guesses, we can determine that the recursion limit check at line 818 in `src/librustc_trait_selection/traits/project.rs` is the other check that is using a different comparison. Modifying either comparison to be `>` or `>=` respectively will fix the error, but changing the monomorphization collector produces the nicer error.
2020-05-30Rollup merge of #72521 - Amanieu:fix-72484, r=petrochenkovRalf Jung-4/+48
Properly handle InlineAsmOperand::SymFn when collecting monomorphized items Fixes #72484
2020-05-30Rollup merge of #72499 - mendess:master, r=dtolnayRalf Jung-0/+41
Override Box::<[T]>::clone_from Avoid dropping and reallocating when cloning to an existing box if the lengths are the same. It would be nice if this could also be specialized for `Copy` but I don't know how that works since it's not on stable. Will gladly look into it if it's deemed as a good idea. This is my first PR with code, hope I did everything right :smile:
2020-05-30Rollup merge of #72441 - doctorn:late-bound-lifetime-ice, r=nikomatsakisRalf Jung-131/+241
Fix ICE with explicit late-bound lifetimes Rather than returning an explicit late-bound lifetime as a generic argument count mismatch (which is not necessarily true), this PR propagates the presence of explicit late-bound lifetimes. This avoids an ICE that can occur due to the presence of explicit late-bound lifetimes when building generic substitutions by explicitly ignoring them. r? @varkor cc @davidtwco (this removes a check you introduced in #60892) Resolves #72278