Skip to content

Rollup of 10 pull requests #84425

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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5b9905b
Added CharIndices::offset function
TrolledWoods Feb 27, 2021
772543a
Removed trailing whitespace
TrolledWoods Feb 27, 2021
907eab8
Added feature flag to doc test
TrolledWoods Feb 27, 2021
30fc601
Tests for field is never read diagnostic
sunjay Mar 11, 2021
321aace
Added suggestion and note for when a field is never used
sunjay Mar 12, 2021
7faaf39
Updating test stderr files
sunjay Mar 12, 2021
789186d
Trying out a new message that works a little better for values *and* …
sunjay Mar 12, 2021
2acd8eb
New shorter diagnostic note that is different for items versus fields
sunjay Mar 13, 2021
3e34eb8
Putting help message only under the identifier that needs to be prefixed
sunjay Mar 25, 2021
539242a
Add a suggestion when using a type alias instead of trait alias
JohnTitor Mar 31, 2021
eea27b8
Mention trait alias on the E0404 note
JohnTitor Mar 31, 2021
53a1105
On stable, suggest removing `#![feature]` for features that have been…
jyn514 Mar 31, 2021
fa1624c
Added tracking issue number
TrolledWoods Apr 5, 2021
115e216
Rename AssociatedItems to AssocItems
0xPoe Apr 24, 2020
6c3f5b8
resolve conflicts
0xPoe Apr 5, 2021
37a5b51
implement TrustedRandomAccess for Take iterator adapter
the8472 Apr 8, 2021
7efba4f
Implement indexing slices with pairs of ops::Bound<usize>
AnthonyMikh Oct 8, 2020
904ee68
Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`
CDirkx Apr 14, 2021
2ecc820
Correct typos
CDirkx Apr 14, 2021
03900e4
move core::hint::black_box under its own feature gate
RalfJung Apr 15, 2021
259a368
fix name resolution for param defaults
lcnr Apr 18, 2021
7cb1dcd
loosen ordering restricts for `const_generics_defaults`
lcnr Apr 18, 2021
312b4fd
improve wf check for const param defaults
lcnr Apr 18, 2021
d3e0d2f
supply substs to anon consts in defaults
lcnr Apr 18, 2021
6763a40
Bump slice_index_with_ops_bound_pair to 1.53.0
m-ou-se Apr 21, 2021
c511ebb
Rollup merge of #71511 - hi-rustin:rustin-patch-rename-assoc, r=eddyb…
Dylan-DPC Apr 22, 2021
37d4360
Rollup merge of #77704 - AnthonyMikh:slice_index_with_ops_bound_pair,…
Dylan-DPC Apr 22, 2021
6ecd256
Rollup merge of #82585 - TrolledWoods:master, r=dtolnay
Dylan-DPC Apr 22, 2021
e3fe772
Rollup merge of #83004 - sunjay:field-never-read-issue-81658, r=pnkfelix
Dylan-DPC Apr 22, 2021
cd78afe
Rollup merge of #83722 - jyn514:stable-help, r=estebank
Dylan-DPC Apr 22, 2021
0ca1960
Rollup merge of #83729 - JohnTitor:issue-43913, r=estebank
Dylan-DPC Apr 22, 2021
1ecf9b2
Rollup merge of #83990 - the8472:take-trusted-len, r=dtolnay
Dylan-DPC Apr 22, 2021
c3eb4b8
Rollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-se
Dylan-DPC Apr 22, 2021
1244ccc
Rollup merge of #84216 - RalfJung:black-box, r=Mark-Simulacrum
Dylan-DPC Apr 22, 2021
ab4de79
Rollup merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkor
Dylan-DPC Apr 22, 2021
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
Prev Previous commit
Next Next commit
Explicitly implement !Send and !Sync for sys::{Args, Env}
  • Loading branch information
CDirkx committed Apr 14, 2021
commit 904ee686ca06c78135d356235265997a1faf292e
8 changes: 4 additions & 4 deletions library/std/src/sys/hermit/args.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::ffi::OsString;
use crate::marker::PhantomData;
use crate::vec;

/// One-time global initialization.
Expand All @@ -19,7 +18,6 @@ pub fn args() -> Args {

pub struct Args {
iter: vec::IntoIter<OsString>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl Args {
Expand All @@ -28,6 +26,9 @@ impl Args {
}
}

impl !Send for Args {}
impl !Sync for Args {}

impl Iterator for Args {
type Item = OsString;
fn next(&mut self) -> Option<OsString> {
Expand All @@ -53,7 +54,6 @@ impl DoubleEndedIterator for Args {
mod imp {
use super::Args;
use crate::ffi::{CStr, OsString};
use crate::marker::PhantomData;
use crate::ptr;
use crate::sys_common::os_str_bytes::*;

Expand All @@ -76,7 +76,7 @@ mod imp {
}

pub fn args() -> Args {
Args { iter: clone().into_iter(), _dont_send_or_sync_me: PhantomData }
Args { iter: clone().into_iter() }
}

fn clone() -> Vec<OsString> {
Expand Down
7 changes: 4 additions & 3 deletions library/std/src/sys/hermit/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::error::Error as StdError;
use crate::ffi::{CStr, OsStr, OsString};
use crate::fmt;
use crate::io;
use crate::marker::PhantomData;
use crate::memchr;
use crate::path::{self, PathBuf};
use crate::str;
Expand Down Expand Up @@ -110,9 +109,11 @@ pub fn init_environment(env: *const *const i8) {

pub struct Env {
iter: vec::IntoIter<(OsString, OsString)>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Args {}
impl !Sync for Args {}

impl Iterator for Env {
type Item = (OsString, OsString);
fn next(&mut self) -> Option<(OsString, OsString)> {
Expand All @@ -134,7 +135,7 @@ pub fn env() -> Env {
result.push((key.clone(), value.clone()));
}

return Env { iter: result.into_iter(), _dont_send_or_sync_me: PhantomData };
return Env { iter: result.into_iter() };
}
}

Expand Down
13 changes: 6 additions & 7 deletions library/std/src/sys/unix/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#![allow(dead_code)] // runtime init functions not used during testing

use crate::ffi::OsString;
use crate::marker::PhantomData;
use crate::vec;

/// One-time global initialization.
Expand All @@ -26,9 +25,11 @@ pub fn args() -> Args {

pub struct Args {
iter: vec::IntoIter<OsString>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Args {}
impl !Sync for Args {}

impl Args {
pub fn inner_debug(&self) -> &[OsString] {
self.iter.as_slice()
Expand Down Expand Up @@ -76,7 +77,6 @@ impl DoubleEndedIterator for Args {
mod imp {
use super::Args;
use crate::ffi::{CStr, OsString};
use crate::marker::PhantomData;
use crate::os::unix::prelude::*;
use crate::ptr;
use crate::sync::atomic::{AtomicIsize, AtomicPtr, Ordering};
Expand Down Expand Up @@ -133,7 +133,7 @@ mod imp {
}

pub fn args() -> Args {
Args { iter: clone().into_iter(), _dont_send_or_sync_me: PhantomData }
Args { iter: clone().into_iter() }
}

fn clone() -> Vec<OsString> {
Expand All @@ -155,7 +155,6 @@ mod imp {
mod imp {
use super::Args;
use crate::ffi::CStr;
use crate::marker::PhantomData;

pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}

Expand All @@ -180,7 +179,7 @@ mod imp {
})
.collect::<Vec<_>>()
};
Args { iter: vec.into_iter(), _dont_send_or_sync_me: PhantomData }
Args { iter: vec.into_iter() }
}

// As _NSGetArgc and _NSGetArgv aren't mentioned in iOS docs
Expand Down Expand Up @@ -247,6 +246,6 @@ mod imp {
}
}

Args { iter: res.into_iter(), _dont_send_or_sync_me: PhantomData }
Args { iter: res.into_iter() }
}
}
7 changes: 4 additions & 3 deletions library/std/src/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::ffi::{CStr, CString, OsStr, OsString};
use crate::fmt;
use crate::io;
use crate::iter;
use crate::marker::PhantomData;
use crate::mem;
use crate::memchr;
use crate::path::{self, PathBuf};
Expand Down Expand Up @@ -465,9 +464,11 @@ pub fn current_exe() -> io::Result<PathBuf> {

pub struct Env {
iter: vec::IntoIter<(OsString, OsString)>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Env {}
impl !Sync for Env {}

impl Iterator for Env {
type Item = (OsString, OsString);
fn next(&mut self) -> Option<(OsString, OsString)> {
Expand Down Expand Up @@ -515,7 +516,7 @@ pub fn env() -> Env {
environ = environ.add(1);
}
}
return Env { iter: result.into_iter(), _dont_send_or_sync_me: PhantomData };
return Env { iter: result.into_iter() };
}

fn parse(input: &[u8]) -> Option<(OsString, OsString)> {
Expand Down
10 changes: 4 additions & 6 deletions library/std/src/sys/wasi/args.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![deny(unsafe_op_in_unsafe_fn)]

use crate::ffi::{CStr, OsStr, OsString};
use crate::marker::PhantomData;
use crate::os::wasi::ffi::OsStrExt;
use crate::vec;

Expand All @@ -11,15 +10,14 @@ pub unsafe fn cleanup() {}

pub struct Args {
iter: vec::IntoIter<OsString>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Args {}
impl !Sync for Args {}

/// Returns the command line arguments
pub fn args() -> Args {
Args {
iter: maybe_args().unwrap_or(Vec::new()).into_iter(),
_dont_send_or_sync_me: PhantomData,
}
Args { iter: maybe_args().unwrap_or(Vec::new()).into_iter() }
}

fn maybe_args() -> Option<Vec<OsString>> {
Expand Down
7 changes: 4 additions & 3 deletions library/std/src/sys/wasi/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::error::Error as StdError;
use crate::ffi::{CStr, CString, OsStr, OsString};
use crate::fmt;
use crate::io;
use crate::marker::PhantomData;
use crate::os::wasi::prelude::*;
use crate::path::{self, PathBuf};
use crate::str;
Expand Down Expand Up @@ -129,9 +128,11 @@ pub fn current_exe() -> io::Result<PathBuf> {
}
pub struct Env {
iter: vec::IntoIter<(OsString, OsString)>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Args {}
impl !Sync for Args {}

impl Iterator for Env {
type Item = (OsString, OsString);
fn next(&mut self) -> Option<(OsString, OsString)> {
Expand All @@ -155,7 +156,7 @@ pub fn env() -> Env {
environ = environ.add(1);
}
}
return Env { iter: result.into_iter(), _dont_send_or_sync_me: PhantomData };
return Env { iter: result.into_iter() };
}

// See src/libstd/sys/unix/os.rs, same as that
Expand Down
7 changes: 4 additions & 3 deletions library/std/src/sys/wasm/args.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::ffi::OsString;
use crate::marker::PhantomData;
use crate::vec;

pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
Expand All @@ -9,14 +8,16 @@ pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
pub unsafe fn cleanup() {}

pub fn args() -> Args {
Args { iter: Vec::new().into_iter(), _dont_send_or_sync_me: PhantomData }
Args { iter: Vec::new().into_iter() }
}

pub struct Args {
iter: vec::IntoIter<OsString>,
_dont_send_or_sync_me: PhantomData<*mut ()>,
}

impl !Send for Args {}
impl !Sync for Args {}

impl Args {
pub fn inner_debug(&self) -> &[OsString] {
self.iter.as_slice()
Expand Down