Skip to content

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

mibac138 and others added 30 commits May 20, 2020 20:42
When parsing `let x: i8 += 1` the compiler interprets `i8` as a trait which makes it more complicated to do error recovery. More advanced error recovery is not implemented in this commit.
Do not suggest new type param when encountering a missing type in an ADT field with generic parameters. Fix rust-lang#72640.
re rust-lang#72380 (comment) Given the toy code ```rust fn is_positive(n: usize) { n > -1_isize; } ``` We currently get a type mismatch error like the following: ``` error[E0308]: mismatched types --> src/main.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ expected `usize`, found `isize` | help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit | 2 | n > (-1_isize).try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` But clearly, `-1` can never fit into a `usize`, so the suggestion will always panic. A more useful message would tell the user that the value can never fit in the expected type: ``` error[E0308]: mismatched types --> test.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ expected `usize`, found `isize` | note: `-1_isize` can never fit into `usize` --> test.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ ``` Which is what this commit implements. I only added this check for negative literals because - Currently we can only perform such a check for literals (constant value propagation is outside the scope of the typechecker at this point) - A lint error for out-of-range numeric literals is already emitted IMO it makes more sense to put this check in librustc_lint, but as far as I can tell the typecheck pass happens before the lint pass, so I've added it here. r? @estebank
`crt-static` is a rust specific target feature that's absent from llvm feature table, adding it there.
…epmaster Add tests for 'impl Default for [T; N]' Related: rust-lang#71690. This pull request adds two tests: - Even it T::default() panics, no leaks occur. - [T; 0] is Default even if T is not. I believe at some moment `Default` impl for arrays will be rewritten to use const generics instead of macros, and these tests will help to prevent behavior changes.
Added io forwarding methods to the stdio structs Added methods to forward the `io::Read` and `io::Write` methods of the myriad wrapper structs in `stdio.rs` to their underlying readers / writers. This is especially important for the structs on the outside of a locking boundary, to ensure that the lock isn't being dropped and re-acquired in a loop.
…, r=nikomatsakis Further tweak lifetime errors involving `dyn Trait` and `impl Trait` in return position * Suggest substituting `'static` lifetime in impl/dyn `Trait + 'static` instead of `Trait + 'static + '_` * When `'static` is explicit, also suggest constraining argument with it * Reduce verbosity of suggestion message and mention lifetime in label * Tweak output for overlapping required/captured spans * Give these errors an error code Follow up to rust-lang#72543. r? @nikomatsakis
…i-obk remove visit_terminator_kind from MIR visitor For some reason, we had both `visit_terminator` and `visit_terminator_kind`. In contrast, for `Statement` we just have `visit_statement`. So this cleans things up by removing `visit_terminator_kind` and porting its users to `visit_terminator`.
…ies, r=shepmaster Complete the std::time documentation to warn about the inconsistencies between OS Fixes rust-lang#48980. I put the new documentation in `src/libstd/time.rs` at the module-level because it affects all types, even the one that are not directly system dependents if they are used with affected types, but there may be a better place for it.
…llaumeGomez Only highlight doc search results via mouseover if mouse has moved ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Put your mouse cursor somewhere in the middle where search results will appear and then don't move the mouse - Press 's' to focus the search box - Type a query that brings up enough search results to go under where your mouse cursor is - Press the down arrow - The search result that is one below where your mouse cursor is will be highlighted. ## What I expected When not currently using the mouse, I expect doing a search and then pressing the down arrow to always highlight the first search result immediately below the search box. ## The fix This feels a bit hacky to me; I'm open to other solutions. This introduces a global JS var that keeps track of whether the person searching has moved their mouse after doing a search or not, and only uses the mouse position to highlight search results if the person HAS moved the mouse AFTER doing a search.
…matthewjasper Export `#[inline]` fns with extern indicators In ancient history (rust-lang#36280) we stopped `#[inline]` fns being codegened if they weren't used. However, - rust-lang#72944 - rust-lang#72463 observe that when writing something like ```rust #![crate_type = "cdylib"] #[no_mangle] #[inline] pub extern "C" fn foo() { // ... } ``` we really _do_ want `foo` to be codegened. This change makes this the case. Resolves rust-lang#72944, resolves rust-lang#72463 (and maybe some more)
…, r=kinnison Clean up some weird command strings r? @kinnison
…vidtwco Make new type param suggestion more targetted Do not suggest new type param when encountering a missing type in an ADT field with generic parameters. Fix rust-lang#72640.
…r=estebank Note numeric literals that can never fit in an expected type re rust-lang#72380 (comment) Given the toy code ```rust fn is_positive(n: usize) { n > -1_isize; } ``` We currently get a type mismatch error like the following: ``` error[E0308]: mismatched types --> src/main.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ expected `usize`, found `isize` | help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit | 2 | n > (-1_isize).try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` But clearly, `-1` can never fit into a `usize`, so the suggestion will always panic. A more useful message would tell the user that the value can never fit in the expected type: ``` error[E0308]: mismatched types --> test.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ expected `usize`, found `isize` | note: `-1_isize` can never fit into `usize` --> test.rs:2:9 | 2 | n > -1_isize; | ^^^^^^^^ ``` Which is what this commit implements. I only added this check for negative literals because - Currently we can only perform such a check for literals (constant value propagation is outside the scope of the typechecker at this point) - A lint error for out-of-range numeric literals is already emitted IMO it makes more sense to put this check in librustc_lint, but as far as I can tell the typecheck pass happens before the lint pass, so I've added it here. r? @estebank
Add rust specific features to print target features Fixes rust-lang#71583 `crt-static` is a rust specific target feature that's absent from llvm feature table, adding it there so that it shows under `rustc --print target-features`. Probably the most native implementation I could think of, would love to get feedback.
… r=jonas-schievink Document format correction Minor amendments to the document. r? @steveklabnik
@Manishearth
Copy link
Member Author

@bors r+ p=10

@bors
Copy link
Collaborator

bors commented Jun 18, 2020

📌 Commit 67d5f65 has been approved by Manishearth

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 18, 2020
@Manishearth
Copy link
Member Author

@bors force retry

@bors
Copy link
Collaborator

bors commented Jun 18, 2020

⌛ Testing commit 67d5f65 with merge f4cb4ac0a7113d0ce0f25febbaf5446ef50c13c8...

@Manishearth
Copy link
Member Author

@bors retry

@bors
Copy link
Collaborator

bors commented Jun 18, 2020

⌛ Testing commit 67d5f65 with merge 8e7009063593822dd0184a5b710646a961fc0f37...

@bors
Copy link
Collaborator

bors commented Jun 18, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 18, 2020
@marmeladema
Copy link
Contributor

marmeladema commented Jun 18, 2020

error[E0599]: no method named `write_all_vectored` found for struct `sys::wasi::stdio::Stdout` in the current scope --> src/libstd/io/stdio.rs:136:16 | 136 | self.0.write_all_vectored(bufs) | ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `write_vectored` | ::: src/libstd/sys/wasi/stdio.rs:6:1 | 6 | pub struct Stdout; | ------------------ method `write_all_vectored` not found for this | = help: items from traits can only be used if the trait is implemented and in scope note: `io::Write` defines an item `write_all_vectored`, perhaps you need to implement it --> src/libstd/io/mod.rs:1264:1 | 1264 | pub trait Write { | ^^^^^^^^^^^^^^^ error[E0599]: no method named `write_fmt` found for struct `sys::wasi::stdio::Stdout` in the current scope --> src/libstd/io/stdio.rs:140:16 | 140 | self.0.write_fmt(fmt) | ^^^^^^^^^ method not found in `sys::wasi::stdio::Stdout` | ::: src/libstd/sys/wasi/stdio.rs:6:1 | 6 | pub struct Stdout; | ------------------ method `write_fmt` not found for this | = help: items from traits can only be used if the trait is implemented and in scope = note: the following traits define an item `write_fmt`, perhaps you need to implement one of them: candidate #1: `io::Write` candidate #2: `core::fmt::Write` error: aborting due to 6 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0599`. [RUSTC-TIMING] std test:false 2.411 error: could not compile `std`. 
@marmeladema
Copy link
Contributor

#72705 is most likely the culprit of the failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.