Skip to content

Commit

Permalink
Auto merge of #64562 - tmandry:rollup-kfk0nuo, r=tmandry
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - #61626 (Get rid of special const intrinsic query in favour of `const_eval`)
 - #64283 (Updated RELEASES.md for 1.38.0)
 - #64394 (Shrink `SubregionOrigin`.)
 - #64429 (Fix failure note `to_str` implementation)
 - #64436 (improve Vec example soundness in mem::transmute docs)
 - #64502 (avoid duplicate issues for Miri build failures)
 - #64505 (Fix inconsistent link formatting)
 - #64529 (Add an example to Pin::as_mut)
 - #64541 (document Miri error categories)
 - #64544 (build-manifest: re-add some comments)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Sep 17, 2019
2 parents 7efe1c6 + 93d6108 commit 5283791
Show file tree
Hide file tree
Showing 32 changed files with 347 additions and 184 deletions.
105 changes: 105 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,108 @@
Version 1.38.0 (2019-09-26)
==========================

Language
--------
- [The `#[global_allocator]` attribute can now be used in submodules.][62735]
- [The `#[deprecated]` attribute can now be used on macros.][62042]

Compiler
--------
- [Added pipelined compilation support to `rustc`.][62766] This will
improve compilation times in some cases. For further information please refer
to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals] thread.
- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`, `i686-uwp-windows-gnu`,
`i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`, and
`x86_64-uwp-windows-msvc` targets.][60260]
- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and
`armv7-unknown-linux-musleabi` targets.][63107]
- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814]
- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421]
- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now
available at the same path as the trait.][63056] (e.g. The `Clone` derive macro
is available at `std::clone::Clone`). This also makes all built-in macros
available in `std`/`core` root. e.g. `std::include_bytes!`.
- [`str::Chars` now implements `Debug`.][63000]
- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to `&T`.][62528]
- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583]
- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator<T>`.][61953]
- [Added euclidean remainder and division operations (`div_euclid`,
`rem_euclid`) to all numeric primitives.][61884] Additionally `checked`,
`overflowing`, and `wrapping` versions are available for all
integer primitives.
- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and
`PartialEq`.][61491]
- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457]

Stabilized APIs
---------------
- [`<*const T>::cast`]
- [`<*mut T>::cast`]
- [`Duration::as_secs_f32`]
- [`Duration::as_secs_f64`]
- [`Duration::div_duration_f32`]
- [`Duration::div_duration_f64`]
- [`Duration::div_f32`]
- [`Duration::div_f64`]
- [`Duration::from_secs_f32`]
- [`Duration::from_secs_f64`]
- [`Duration::mul_f32`]
- [`Duration::mul_f64`]
- [`any::type_name`]

Cargo
-----
- [Added pipelined compilation support to `cargo`.][cargo/7143]
- [You can now pass the `--features` option multiple times to enable
multiple features.][cargo/7084]

Misc
----
- [`rustc` will now warn about some incorrect uses of
`mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346]

[60260]: https://github.com/rust-lang/rust/pull/60260/
[61457]: https://github.com/rust-lang/rust/pull/61457/
[61491]: https://github.com/rust-lang/rust/pull/61491/
[61884]: https://github.com/rust-lang/rust/pull/61884/
[61953]: https://github.com/rust-lang/rust/pull/61953/
[62042]: https://github.com/rust-lang/rust/pull/62042/
[62528]: https://github.com/rust-lang/rust/pull/62528/
[62583]: https://github.com/rust-lang/rust/pull/62583/
[62735]: https://github.com/rust-lang/rust/pull/62735/
[62766]: https://github.com/rust-lang/rust/pull/62766/
[62784]: https://github.com/rust-lang/rust/pull/62784/
[62814]: https://github.com/rust-lang/rust/pull/62814/
[63000]: https://github.com/rust-lang/rust/pull/63000/
[63056]: https://github.com/rust-lang/rust/pull/63056/
[63107]: https://github.com/rust-lang/rust/pull/63107/
[63346]: https://github.com/rust-lang/rust/pull/63346/
[63421]: https://github.com/rust-lang/rust/pull/63421/
[cargo/7084]: https://github.com/rust-lang/cargo/pull/7084/
[cargo/7143]: https://github.com/rust-lang/cargo/pull/7143/
[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199

Version 1.37.0 (2019-08-15)
==========================

Expand Down
14 changes: 10 additions & 4 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,8 @@ impl Step for HashSign {
}

fn run(self, builder: &Builder<'_>) {
// This gets called by `promote-release`
// (https://github.com/rust-lang/rust-central-station/tree/master/promote-release).
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
if builder.config.dry_run {
return;
Expand All @@ -2010,10 +2012,14 @@ impl Step for HashSign {
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
});
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
});
let pass = t!(fs::read_to_string(&file));
let pass = if env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err() {
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
});
t!(fs::read_to_string(&file))
} else {
String::new()
};

let today = output(Command::new("date").arg("+%Y-%m-%d"));

Expand Down
28 changes: 17 additions & 11 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,21 +845,26 @@ extern "rust-intrinsic" {
///
/// ```
/// let store = [0, 1, 2, 3];
/// let mut v_orig = store.iter().collect::<Vec<&i32>>();
/// let v_orig = store.iter().collect::<Vec<&i32>>();
///
/// // clone the vector as we will reuse them later
/// let v_clone = v_orig.clone();
///
/// // Using transmute: this is Undefined Behavior, and a bad idea.
/// // However, it is no-copy.
/// let v_transmuted = unsafe {
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(
/// v_orig.clone())
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(v_clone)
/// };
///
/// let v_clone = v_orig.clone();
///
/// // This is the suggested, safe way.
/// // It does copy the entire vector, though, into a new array.
/// let v_collected = v_orig.clone()
/// .into_iter()
/// .map(|r| Some(r))
/// .collect::<Vec<Option<&i32>>>();
/// let v_collected = v_clone.into_iter()
/// .map(Some)
/// .collect::<Vec<Option<&i32>>>();
///
/// let v_clone = v_orig.clone();
///
/// // The no-copy, unsafe way, still using transmute, but not UB.
/// // This is equivalent to the original, but safer, and reuses the
Expand All @@ -869,11 +874,12 @@ extern "rust-intrinsic" {
/// // the original inner type (`&i32`) to the converted inner type
/// // (`Option<&i32>`), so read the nomicon pages linked above.
/// let v_from_raw = unsafe {
/// Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&i32>,
/// v_orig.len(),
/// v_orig.capacity())
/// // Ensure the original vector is not dropped.
/// let mut v_clone = std::mem::ManuallyDrop::new(v_clone);
/// Vec::from_raw_parts(v_clone.as_mut_ptr() as *mut Option<&i32>,
/// v_clone.len(),
/// v_clone.capacity())
/// };
/// std::mem::forget(v_orig);
/// ```
///
/// Implementing `split_at_mut`:
Expand Down
21 changes: 21 additions & 0 deletions src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,27 @@ impl<P: DerefMut> Pin<P> {
/// the pointee cannot move after `Pin<Pointer<T>>` got created.
/// "Malicious" implementations of `Pointer::DerefMut` are likewise
/// ruled out by the contract of `Pin::new_unchecked`.
///
/// This method is useful when doing multiple calls to functions that consume the pinned type.
///
/// # Example
///
/// ```
/// use std::pin::Pin;
///
/// # struct Type {}
/// impl Type {
/// fn method(self: Pin<&mut Self>) {
/// // do something
/// }
///
/// fn call_method_twice(mut self: Pin<&mut Self>) {
/// // `method` consumes `self`, so reborrow the `Pin<&mut Self>` via `as_mut`.
/// self.as_mut().method();
/// self.as_mut().method();
/// }
/// }
/// ```
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn as_mut(&mut self) -> Pin<&mut P::Target> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/equate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
self.tag(),
a,
b);
let origin = Subtype(self.fields.trace.clone());
let origin = Subtype(box self.fields.trace.clone());
self.fields.infcx.borrow_region_constraints()
.make_eqregion(origin, a, b);
Ok(a)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl NiceRegionError<'me, 'tcx> {
Some(RegionResolutionError::SubSupConflict(
vid,
_,
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -50,7 +50,7 @@ impl NiceRegionError<'me, 'tcx> {
Some(RegionResolutionError::SubSupConflict(
vid,
_,
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -70,7 +70,7 @@ impl NiceRegionError<'me, 'tcx> {
Some(RegionResolutionError::SubSupConflict(
vid,
_,
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -92,7 +92,7 @@ impl NiceRegionError<'me, 'tcx> {
_,
_,
_,
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -108,7 +108,7 @@ impl NiceRegionError<'me, 'tcx> {
)),

Some(RegionResolutionError::ConcreteFailure(
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -125,7 +125,7 @@ impl NiceRegionError<'me, 'tcx> {
)),

Some(RegionResolutionError::ConcreteFailure(
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand All @@ -142,7 +142,7 @@ impl NiceRegionError<'me, 'tcx> {
)),

Some(RegionResolutionError::ConcreteFailure(
SubregionOrigin::Subtype(TypeTrace {
SubregionOrigin::Subtype(box TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
sup: Region<'tcx>)
-> DiagnosticBuilder<'tcx> {
match origin {
infer::Subtype(trace) => {
infer::Subtype(box trace) => {
let terr = TypeError::RegionsDoesNotOutlive(sup, sub);
let mut err = self.report_and_explain_type_error(trace, &terr);
self.tcx.note_and_explain_region(region_scope_tree, &mut err, "", sup, "...");
Expand Down Expand Up @@ -450,7 +450,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
) -> DiagnosticBuilder<'tcx> {
// I can't think how to do better than this right now. -nikomatsakis
match placeholder_origin {
infer::Subtype(trace) => {
infer::Subtype(box trace) => {
let terr = TypeError::RegionsPlaceholderMismatch;
self.report_and_explain_type_error(trace, &terr)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/glb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
a,
b);

let origin = Subtype(self.fields.trace.clone());
let origin = Subtype(box self.fields.trace.clone());
Ok(self.fields.infcx.borrow_region_constraints().glb_regions(self.tcx(), origin, a, b))
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/lub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
a,
b);

let origin = Subtype(self.fields.trace.clone());
let origin = Subtype(box self.fields.trace.clone());
Ok(self.fields.infcx.borrow_region_constraints().lub_regions(self.tcx(), origin, a, b))
}

Expand Down
6 changes: 5 additions & 1 deletion src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub struct TypeTrace<'tcx> {
#[derive(Clone, Debug)]
pub enum SubregionOrigin<'tcx> {
/// Arose from a subtyping relation
Subtype(TypeTrace<'tcx>),
Subtype(Box<TypeTrace<'tcx>>),

/// Stack-allocated closures cannot outlive innermost loop
/// or function so as to ensure we only require finite stack
Expand Down Expand Up @@ -340,6 +340,10 @@ pub enum SubregionOrigin<'tcx> {
},
}

// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
static_assert_size!(SubregionOrigin<'_>, 32);

/// Places that type/region parameters can appear.
#[derive(Clone, Copy, Debug)]
pub enum ParameterOrigin {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
// FIXME -- we have more fine-grained information available
// from the "cause" field, we could perhaps give more tailored
// error messages.
let origin = SubregionOrigin::Subtype(self.fields.trace.clone());
let origin = SubregionOrigin::Subtype(box self.fields.trace.clone());
self.fields.infcx.borrow_region_constraints()
.make_subregion(origin, a, b);

Expand Down
Loading

0 comments on commit 5283791

Please sign in to comment.