Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #101220

Merged
merged 85 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
1883d1f
activate assoc item test
kartva Aug 7, 2022
196f389
try adding diagnostrics for AssocItems
kartva Aug 8, 2022
c1eae3d
make diagnostic function public
kartva Aug 8, 2022
ad7a1ed
fix: Fix panics on GATs involving const generics
N3xed Aug 16, 2022
87b7797
make impl and trait inactive diagnostics work
kartva Aug 20, 2022
8f87fcb
remove push_diagnostic methods
kartva Aug 20, 2022
23c00ed
fix: formatting
kartva Aug 20, 2022
76e5d88
Fix hover and focus display for search results on ayu theme
GuillaumeGomez Aug 20, 2022
f7cce2f
Extend GUI test for search results colors
GuillaumeGomez Aug 20, 2022
ac8cb8c
Expect the test to panic by catching the unwind
N3xed Aug 21, 2022
2c0d2e7
internal: remove unnecessary stream writer try_clone in lsp-server
pymongo Aug 22, 2022
f27f4a9
Auto merge of #13078 - pymongo:master, r=Veykril
bors Aug 22, 2022
dea1639
Auto merge of #12965 - DesmondWillowbrook:assoc-method-dimming, r=Vey…
bors Aug 22, 2022
f9d1b26
Replace crossbeam with std's scoped threads
Veykril Aug 11, 2022
c2310a0
Auto merge of #13001 - Veykril:scoped, r=Veykril
bors Aug 22, 2022
fdc28b4
Auto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold
bors Aug 22, 2022
b19f78b
Remove auto-config patching from the VSCode client
Veykril Aug 22, 2022
2abb78d
Pop an error notification when flycheck can't be restarted
Veykril Aug 22, 2022
6711ded
Auto merge of #13088 - Veykril:flycheck-failure, r=Veykril
bors Aug 22, 2022
50ecb09
feat: emit SCIP via rust-analyzer
tjdevries Jun 11, 2022
2efe6b0
Add `AsFd` implementations for stdio types on WASI.
sunfishcode Aug 22, 2022
148bdf8
Do not substitute `Self` when in same impl block
ice1000 Aug 23, 2022
b2bf37c
Auto merge of #12976 - tjdevries:scip, r=Veykril
bors Aug 23, 2022
6627b47
Auto merge of #13090 - ice1k:master, r=Veykril
bors Aug 23, 2022
16315ed
Make punctuation highlighting configurable, disable it by default
Veykril Aug 22, 2022
afc8cfb
Make operator highlighting configurable, disable it by default
Veykril Aug 22, 2022
9a20187
Move highlight configuration from protocol into the feature
Veykril Aug 22, 2022
9700c95
Make doc comment highlight injection configurable
Veykril Aug 22, 2022
b26733f
Change attribute semantic token type to decorator
Veykril Aug 22, 2022
f6f0516
Add config for macro bang token highlighting, disable by default
Veykril Aug 22, 2022
eadc267
Regen docs
Veykril Aug 22, 2022
31fb917
Remove unused default semantic modifiers
Veykril Aug 22, 2022
2a26b05
Use lsp-types DECORATOR token type
Veykril Aug 23, 2022
6c5d158
fix: Fix reference autocompletions using incorrect offsets in macro i…
Veykril Aug 23, 2022
631ed2a
Auto merge of #13092 - Veykril:ref-match-completion, r=Veykril
bors Aug 23, 2022
f045f14
Auto merge of #13084 - Veykril:highlight-config, r=Veykril
bors Aug 23, 2022
16a0eb1
Avoid error popup when using in Live Share
Aug 23, 2022
dcbbb7f
ForGoT tO RuN prEttIeR¿
Aug 23, 2022
8969655
Allow leading `|` in more pattern positions
Aug 23, 2022
e73b7a9
Auto merge of #13096 - jonas-schievink:parse-more-or-pats, r=jonas-sc…
bors Aug 23, 2022
0cc1a89
Add a short blurb about VS Code Live Share to the manual
Aug 23, 2022
27e17ff
Auto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink
bors Aug 23, 2022
5804412
Register decorator token type to avoid panic
Aug 23, 2022
8dcf4c7
Auto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-s…
bors Aug 23, 2022
322e706
Resolve doc links on impl blocks
Aug 23, 2022
1456b80
Auto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-sch…
bors Aug 23, 2022
715e3fc
Re-export standard semantic token types and mods
Veykril Aug 23, 2022
e3dc5a5
Auto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink
bors Aug 23, 2022
71c15f2
add test
kartva Aug 25, 2022
9480b38
extract const generic in ArrayType
kartva Aug 25, 2022
0d7ba13
style: run tidy tests
kartva Aug 25, 2022
1061793
Remove unused UpdatesChannel type
lnicola Aug 25, 2022
d025c5d
Make use of NoHash hashing for FileId and CrateId
Veykril Aug 25, 2022
0c9375b
Remove u/i128 hashing overloads from NoHashHasher::Hasher impl
Veykril Aug 25, 2022
6eb7689
Auto merge of #13118 - lnicola:cleanup, r=lnicola
bors Aug 25, 2022
5b6aefe
Update test fixtures
Veykril Aug 25, 2022
ca8093e
Auto merge of #13116 - Veykril:nohash, r=Veykril
bors Aug 25, 2022
5c52e05
Auto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink
bors Aug 26, 2022
55bf51d
Auto merge of #13087 - Veykril:config-update, r=Veykril
bors Aug 26, 2022
78a7a81
minor: Simplify
Veykril Aug 26, 2022
ca4e10b
Auto merge of #13123 - Veykril:simplify, r=Veykril
bors Aug 26, 2022
6bea872
Auto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas…
bors Aug 26, 2022
1dd47b0
Set DebuginfoKind::Pdb in msvc_base
nicholasbishop Aug 27, 2022
9ad0a8c
Move empty diagnostics workaround back into the server
Veykril Aug 28, 2022
e8e598f
Auto merge of #13133 - Veykril:diag-hack, r=Veykril
bors Aug 28, 2022
4d95035
add tracking issue number to const_slice_split_at_not_mut
tspiteri Aug 29, 2022
f6252a4
remove path string
TaKO8Ki Aug 30, 2022
2f9bd1a
Avoid zeroing large stack buffers in stdio on Windows
thomcc Aug 30, 2022
367f2ad
:arrow_up: rust-analyzer
lnicola Aug 30, 2022
5663bb3
Add test for issue #85872
nikic Aug 30, 2022
1b8b2dc
Avoid `MaybeUninit::uninit_array()`
thomcc Aug 30, 2022
10a42df
Adding new Fuchsia rustup docs... reworking walkthrough
andrewpollack Aug 23, 2022
18340bd
Update src/doc/rustc/src/platform-support/fuchsia.md
andrewpollack Aug 30, 2022
c52d99f
Update src/doc/rustc/src/platform-support/fuchsia.md
andrewpollack Aug 30, 2022
437879f
Update books
ehuss Aug 30, 2022
6826442
Rollup merge of #100804 - GuillaumeGomez:search-results-color-ayu, r=…
JohnTitor Aug 30, 2022
3a764e9
Rollup merge of #100892 - sunfishcode:wasi-stdio-asfd, r=joshtriplett
JohnTitor Aug 30, 2022
3de558d
Rollup merge of #100927 - andrewpollack:fuchsia-docs-rustup, r=tmandry
JohnTitor Aug 30, 2022
9642e48
Rollup merge of #101088 - nicholasbishop:bishop-uefi-pdb, r=davidtwco
JohnTitor Aug 30, 2022
60e8550
Rollup merge of #101159 - tspiteri:track-const-slice-split_at, r=Mark…
JohnTitor Aug 30, 2022
42a1901
Rollup merge of #101192 - TaKO8Ki:remove-path-string, r=compiler-errors
JohnTitor Aug 30, 2022
f19783d
Rollup merge of #101193 - thomcc:win-stdio-nozero, r=ChrisDenton
JohnTitor Aug 30, 2022
804029e
Rollup merge of #101197 - lnicola:rust-analyzer-2022-08-30, r=lnicola
JohnTitor Aug 30, 2022
d7ba1f8
Rollup merge of #101200 - nikic:issue-85872, r=compiler-errors
JohnTitor Aug 30, 2022
0cbc589
Rollup merge of #101219 - ehuss:update-books, r=ehuss
JohnTitor Aug 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2055,22 +2055,22 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
(exp_found.expected.kind(), exp_found.found.kind())
{
if let ty::Adt(found_def, found_substs) = *found_ty.kind() {
let path_str = format!("{:?}", exp_def);
if exp_def == &found_def {
let opt_msg = "you can convert from `&Option<T>` to `Option<&T>` using \
`.as_ref()`";
let result_msg = "you can convert from `&Result<T, E>` to \
`Result<&T, &E>` using `.as_ref()`";
let have_as_ref = &[
("std::option::Option", opt_msg),
("core::option::Option", opt_msg),
("std::result::Result", result_msg),
("core::result::Result", result_msg),
(
sym::Option,
"you can convert from `&Option<T>` to `Option<&T>` using \
`.as_ref()`",
),
(
sym::Result,
"you can convert from `&Result<T, E>` to \
`Result<&T, &E>` using `.as_ref()`",
),
];
if let Some(msg) = have_as_ref
.iter()
.find_map(|(path, msg)| (&path_str == path).then_some(msg))
{
if let Some(msg) = have_as_ref.iter().find_map(|(name, msg)| {
self.tcx.is_diagnostic_item(*name, exp_def.did()).then_some(msg)
}) {
let mut show_suggestion = true;
for (exp_ty, found_ty) in
iter::zip(exp_substs.types(), found_substs.types())
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/spec/msvc_base.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, LldFlavor, SplitDebuginfo, TargetOptions};
use crate::spec::{DebuginfoKind, LinkerFlavor, LldFlavor, SplitDebuginfo, TargetOptions};
use std::borrow::Cow;

pub fn opts() -> TargetOptions {
Expand All @@ -20,6 +20,7 @@ pub fn opts() -> TargetOptions {
// where `*.pdb` files show up next to the final artifact.
split_debuginfo: SplitDebuginfo::Packed,
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Packed]),
debuginfo_kind: DebuginfoKind::Pdb,

..Default::default()
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_target/src/spec/windows_msvc_base.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{cvs, DebuginfoKind, TargetOptions};
use crate::spec::{cvs, TargetOptions};

pub fn opts() -> TargetOptions {
let base = super::msvc_base::opts();
Expand Down Expand Up @@ -28,7 +28,6 @@ pub fn opts() -> TargetOptions {
// not ever be possible for us to pass this flag.
no_default_libraries: false,
has_thread_local: true,
debuginfo_kind: DebuginfoKind::Pdb,

..base
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ impl<T> [T] {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_split_at_not_mut", issue = "none")]
#[rustc_const_unstable(feature = "const_slice_split_at_not_mut", issue = "101158")]
#[inline]
#[track_caller]
#[must_use]
Expand Down
23 changes: 22 additions & 1 deletion library/std/src/sys/wasi/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::fd::WasiFd;
use crate::io::{self, IoSlice, IoSliceMut};
use crate::mem::ManuallyDrop;
use crate::os::raw;
use crate::os::wasi::io::{AsRawFd, FromRawFd};
use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd};

pub struct Stdin;
pub struct Stdout;
Expand All @@ -23,6 +23,13 @@ impl AsRawFd for Stdin {
}
}

impl AsFd for Stdin {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(0) }
}
}

impl io::Read for Stdin {
fn read(&mut self, data: &mut [u8]) -> io::Result<usize> {
self.read_vectored(&mut [IoSliceMut::new(data)])
Expand Down Expand Up @@ -51,6 +58,13 @@ impl AsRawFd for Stdout {
}
}

impl AsFd for Stdout {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(1) }
}
}

impl io::Write for Stdout {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
self.write_vectored(&[IoSlice::new(data)])
Expand Down Expand Up @@ -82,6 +96,13 @@ impl AsRawFd for Stderr {
}
}

impl AsFd for Stderr {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(2) }
}
}

impl io::Write for Stderr {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
self.write_vectored(&[IoSlice::new(data)])
Expand Down
41 changes: 27 additions & 14 deletions library/std/src/sys/windows/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::char::decode_utf16;
use crate::cmp;
use crate::io;
use crate::mem::MaybeUninit;
use crate::os::windows::io::{FromRawHandle, IntoRawHandle};
use crate::ptr;
use crate::str;
Expand Down Expand Up @@ -169,13 +170,14 @@ fn write(
}

fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usize> {
let mut utf16 = [0u16; MAX_BUFFER_SIZE / 2];
let mut utf16 = [MaybeUninit::<u16>::uninit(); MAX_BUFFER_SIZE / 2];
let mut len_utf16 = 0;
for (chr, dest) in utf8.encode_utf16().zip(utf16.iter_mut()) {
*dest = chr;
*dest = MaybeUninit::new(chr);
len_utf16 += 1;
}
let utf16 = &utf16[..len_utf16];
// Safety: We've initialized `len_utf16` values.
let utf16: &[u16] = unsafe { MaybeUninit::slice_assume_init_ref(&utf16[..len_utf16]) };

let mut written = write_u16s(handle, &utf16)?;

Expand Down Expand Up @@ -250,27 +252,33 @@ impl io::Read for Stdin {
return Ok(bytes_copied);
} else if buf.len() - bytes_copied < 4 {
// Not enough space to get a UTF-8 byte. We will use the incomplete UTF8.
let mut utf16_buf = [0u16; 1];
let mut utf16_buf = [MaybeUninit::new(0); 1];
// Read one u16 character.
let read = read_u16s_fixup_surrogates(handle, &mut utf16_buf, 1, &mut self.surrogate)?;
// Read bytes, using the (now-empty) self.incomplete_utf8 as extra space.
let read_bytes = utf16_to_utf8(&utf16_buf[..read], &mut self.incomplete_utf8.bytes)?;
let read_bytes = utf16_to_utf8(
unsafe { MaybeUninit::slice_assume_init_ref(&utf16_buf[..read]) },
&mut self.incomplete_utf8.bytes,
)?;

// Read in the bytes from incomplete_utf8 until the buffer is full.
self.incomplete_utf8.len = read_bytes as u8;
// No-op if no bytes.
bytes_copied += self.incomplete_utf8.read(&mut buf[bytes_copied..]);
Ok(bytes_copied)
} else {
let mut utf16_buf = [0u16; MAX_BUFFER_SIZE / 2];
let mut utf16_buf = [MaybeUninit::<u16>::uninit(); MAX_BUFFER_SIZE / 2];

// In the worst case, a UTF-8 string can take 3 bytes for every `u16` of a UTF-16. So
// we can read at most a third of `buf.len()` chars and uphold the guarantee no data gets
// lost.
let amount = cmp::min(buf.len() / 3, utf16_buf.len());
let read =
read_u16s_fixup_surrogates(handle, &mut utf16_buf, amount, &mut self.surrogate)?;

match utf16_to_utf8(&utf16_buf[..read], buf) {
// Safety `read_u16s_fixup_surrogates` returns the number of items
// initialized.
let utf16s = unsafe { MaybeUninit::slice_assume_init_ref(&utf16_buf[..read]) };
match utf16_to_utf8(utf16s, buf) {
Ok(value) => return Ok(bytes_copied + value),
Err(e) => return Err(e),
}
Expand All @@ -283,14 +291,14 @@ impl io::Read for Stdin {
// This is a best effort, and might not work if we are not the only reader on Stdin.
fn read_u16s_fixup_surrogates(
handle: c::HANDLE,
buf: &mut [u16],
buf: &mut [MaybeUninit<u16>],
mut amount: usize,
surrogate: &mut u16,
) -> io::Result<usize> {
// Insert possibly remaining unpaired surrogate from last read.
let mut start = 0;
if *surrogate != 0 {
buf[0] = *surrogate;
buf[0] = MaybeUninit::new(*surrogate);
*surrogate = 0;
start = 1;
if amount == 1 {
Expand All @@ -303,7 +311,10 @@ fn read_u16s_fixup_surrogates(
let mut amount = read_u16s(handle, &mut buf[start..amount])? + start;

if amount > 0 {
let last_char = buf[amount - 1];
// Safety: The returned `amount` is the number of values initialized,
// and it is not 0, so we know that `buf[amount - 1]` have been
// initialized.
let last_char = unsafe { buf[amount - 1].assume_init() };
if last_char >= 0xD800 && last_char <= 0xDBFF {
// high surrogate
*surrogate = last_char;
Expand All @@ -313,7 +324,8 @@ fn read_u16s_fixup_surrogates(
Ok(amount)
}

fn read_u16s(handle: c::HANDLE, buf: &mut [u16]) -> io::Result<usize> {
// Returns `Ok(n)` if it initialized `n` values in `buf`.
fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usize> {
// Configure the `pInputControl` parameter to not only return on `\r\n` but also Ctrl-Z, the
// traditional DOS method to indicate end of character stream / user input (SUB).
// See #38274 and https://stackoverflow.com/questions/43836040/win-api-readconsole.
Expand Down Expand Up @@ -346,8 +358,9 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [u16]) -> io::Result<usize> {
}
break;
}

if amount > 0 && buf[amount as usize - 1] == CTRL_Z {
// Safety: if `amount > 0`, then that many bytes were written, so
// `buf[amount as usize - 1]` has been initialized.
if amount > 0 && unsafe { buf[amount as usize - 1].assume_init() } == CTRL_Z {
amount -= 1;
}
Ok(amount as usize)
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon
Submodule nomicon updated 1 files
+1 −1 src/lifetimes.md
2 changes: 1 addition & 1 deletion src/doc/reference
Loading