Skip to content

Commit 5283791

Browse files
committed
Auto merge of #64562 - tmandry:rollup-kfk0nuo, r=tmandry
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
2 parents 7efe1c6 + 93d6108 commit 5283791

File tree

32 files changed

+347
-184
lines changed

32 files changed

+347
-184
lines changed

RELEASES.md

+105
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,108 @@
1+
Version 1.38.0 (2019-09-26)
2+
==========================
3+
4+
Language
5+
--------
6+
- [The `#[global_allocator]` attribute can now be used in submodules.][62735]
7+
- [The `#[deprecated]` attribute can now be used on macros.][62042]
8+
9+
Compiler
10+
--------
11+
- [Added pipelined compilation support to `rustc`.][62766] This will
12+
improve compilation times in some cases. For further information please refer
13+
to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals] thread.
14+
- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`, `i686-uwp-windows-gnu`,
15+
`i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`, and
16+
`x86_64-uwp-windows-msvc` targets.][60260]
17+
- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and
18+
`armv7-unknown-linux-musleabi` targets.][63107]
19+
- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814]
20+
- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784]
21+
22+
\* Refer to Rust's [platform support page][forge-platform-support] for more
23+
information on Rust's tiered platform support.
24+
25+
Libraries
26+
---------
27+
- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421]
28+
- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now
29+
available at the same path as the trait.][63056] (e.g. The `Clone` derive macro
30+
is available at `std::clone::Clone`). This also makes all built-in macros
31+
available in `std`/`core` root. e.g. `std::include_bytes!`.
32+
- [`str::Chars` now implements `Debug`.][63000]
33+
- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to `&T`.][62528]
34+
- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583]
35+
- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator<T>`.][61953]
36+
- [Added euclidean remainder and division operations (`div_euclid`,
37+
`rem_euclid`) to all numeric primitives.][61884] Additionally `checked`,
38+
`overflowing`, and `wrapping` versions are available for all
39+
integer primitives.
40+
- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and
41+
`PartialEq`.][61491]
42+
- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457]
43+
44+
Stabilized APIs
45+
---------------
46+
- [`<*const T>::cast`]
47+
- [`<*mut T>::cast`]
48+
- [`Duration::as_secs_f32`]
49+
- [`Duration::as_secs_f64`]
50+
- [`Duration::div_duration_f32`]
51+
- [`Duration::div_duration_f64`]
52+
- [`Duration::div_f32`]
53+
- [`Duration::div_f64`]
54+
- [`Duration::from_secs_f32`]
55+
- [`Duration::from_secs_f64`]
56+
- [`Duration::mul_f32`]
57+
- [`Duration::mul_f64`]
58+
- [`any::type_name`]
59+
60+
Cargo
61+
-----
62+
- [Added pipelined compilation support to `cargo`.][cargo/7143]
63+
- [You can now pass the `--features` option multiple times to enable
64+
multiple features.][cargo/7084]
65+
66+
Misc
67+
----
68+
- [`rustc` will now warn about some incorrect uses of
69+
`mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346]
70+
71+
[60260]: https://github.com/rust-lang/rust/pull/60260/
72+
[61457]: https://github.com/rust-lang/rust/pull/61457/
73+
[61491]: https://github.com/rust-lang/rust/pull/61491/
74+
[61884]: https://github.com/rust-lang/rust/pull/61884/
75+
[61953]: https://github.com/rust-lang/rust/pull/61953/
76+
[62042]: https://github.com/rust-lang/rust/pull/62042/
77+
[62528]: https://github.com/rust-lang/rust/pull/62528/
78+
[62583]: https://github.com/rust-lang/rust/pull/62583/
79+
[62735]: https://github.com/rust-lang/rust/pull/62735/
80+
[62766]: https://github.com/rust-lang/rust/pull/62766/
81+
[62784]: https://github.com/rust-lang/rust/pull/62784/
82+
[62814]: https://github.com/rust-lang/rust/pull/62814/
83+
[63000]: https://github.com/rust-lang/rust/pull/63000/
84+
[63056]: https://github.com/rust-lang/rust/pull/63056/
85+
[63107]: https://github.com/rust-lang/rust/pull/63107/
86+
[63346]: https://github.com/rust-lang/rust/pull/63346/
87+
[63421]: https://github.com/rust-lang/rust/pull/63421/
88+
[cargo/7084]: https://github.com/rust-lang/cargo/pull/7084/
89+
[cargo/7143]: https://github.com/rust-lang/cargo/pull/7143/
90+
[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
91+
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
92+
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
93+
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
94+
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
95+
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
96+
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
97+
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
98+
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
99+
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64
100+
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
101+
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
102+
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
103+
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
104+
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199
105+
1106
Version 1.37.0 (2019-08-15)
2107
==========================
3108

src/bootstrap/dist.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,8 @@ impl Step for HashSign {
20002000
}
20012001

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

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

src/libcore/intrinsics.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -845,21 +845,26 @@ extern "rust-intrinsic" {
845845
///
846846
/// ```
847847
/// let store = [0, 1, 2, 3];
848-
/// let mut v_orig = store.iter().collect::<Vec<&i32>>();
848+
/// let v_orig = store.iter().collect::<Vec<&i32>>();
849+
///
850+
/// // clone the vector as we will reuse them later
851+
/// let v_clone = v_orig.clone();
849852
///
850853
/// // Using transmute: this is Undefined Behavior, and a bad idea.
851854
/// // However, it is no-copy.
852855
/// let v_transmuted = unsafe {
853-
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(
854-
/// v_orig.clone())
856+
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(v_clone)
855857
/// };
856858
///
859+
/// let v_clone = v_orig.clone();
860+
///
857861
/// // This is the suggested, safe way.
858862
/// // It does copy the entire vector, though, into a new array.
859-
/// let v_collected = v_orig.clone()
860-
/// .into_iter()
861-
/// .map(|r| Some(r))
862-
/// .collect::<Vec<Option<&i32>>>();
863+
/// let v_collected = v_clone.into_iter()
864+
/// .map(Some)
865+
/// .collect::<Vec<Option<&i32>>>();
866+
///
867+
/// let v_clone = v_orig.clone();
863868
///
864869
/// // The no-copy, unsafe way, still using transmute, but not UB.
865870
/// // This is equivalent to the original, but safer, and reuses the
@@ -869,11 +874,12 @@ extern "rust-intrinsic" {
869874
/// // the original inner type (`&i32`) to the converted inner type
870875
/// // (`Option<&i32>`), so read the nomicon pages linked above.
871876
/// let v_from_raw = unsafe {
872-
/// Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&i32>,
873-
/// v_orig.len(),
874-
/// v_orig.capacity())
877+
/// // Ensure the original vector is not dropped.
878+
/// let mut v_clone = std::mem::ManuallyDrop::new(v_clone);
879+
/// Vec::from_raw_parts(v_clone.as_mut_ptr() as *mut Option<&i32>,
880+
/// v_clone.len(),
881+
/// v_clone.capacity())
875882
/// };
876-
/// std::mem::forget(v_orig);
877883
/// ```
878884
///
879885
/// Implementing `split_at_mut`:

src/libcore/pin.rs

+21
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,27 @@ impl<P: DerefMut> Pin<P> {
584584
/// the pointee cannot move after `Pin<Pointer<T>>` got created.
585585
/// "Malicious" implementations of `Pointer::DerefMut` are likewise
586586
/// ruled out by the contract of `Pin::new_unchecked`.
587+
///
588+
/// This method is useful when doing multiple calls to functions that consume the pinned type.
589+
///
590+
/// # Example
591+
///
592+
/// ```
593+
/// use std::pin::Pin;
594+
///
595+
/// # struct Type {}
596+
/// impl Type {
597+
/// fn method(self: Pin<&mut Self>) {
598+
/// // do something
599+
/// }
600+
///
601+
/// fn call_method_twice(mut self: Pin<&mut Self>) {
602+
/// // `method` consumes `self`, so reborrow the `Pin<&mut Self>` via `as_mut`.
603+
/// self.as_mut().method();
604+
/// self.as_mut().method();
605+
/// }
606+
/// }
607+
/// ```
587608
#[stable(feature = "pin", since = "1.33.0")]
588609
#[inline(always)]
589610
pub fn as_mut(&mut self) -> Pin<&mut P::Target> {

src/librustc/infer/equate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
9797
self.tag(),
9898
a,
9999
b);
100-
let origin = Subtype(self.fields.trace.clone());
100+
let origin = Subtype(box self.fields.trace.clone());
101101
self.fields.infcx.borrow_region_constraints()
102102
.make_eqregion(origin, a, b);
103103
Ok(a)

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl NiceRegionError<'me, 'tcx> {
3030
Some(RegionResolutionError::SubSupConflict(
3131
vid,
3232
_,
33-
SubregionOrigin::Subtype(TypeTrace {
33+
SubregionOrigin::Subtype(box TypeTrace {
3434
cause,
3535
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
3636
}),
@@ -50,7 +50,7 @@ impl NiceRegionError<'me, 'tcx> {
5050
Some(RegionResolutionError::SubSupConflict(
5151
vid,
5252
_,
53-
SubregionOrigin::Subtype(TypeTrace {
53+
SubregionOrigin::Subtype(box TypeTrace {
5454
cause,
5555
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
5656
}),
@@ -70,7 +70,7 @@ impl NiceRegionError<'me, 'tcx> {
7070
Some(RegionResolutionError::SubSupConflict(
7171
vid,
7272
_,
73-
SubregionOrigin::Subtype(TypeTrace {
73+
SubregionOrigin::Subtype(box TypeTrace {
7474
cause,
7575
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
7676
}),
@@ -92,7 +92,7 @@ impl NiceRegionError<'me, 'tcx> {
9292
_,
9393
_,
9494
_,
95-
SubregionOrigin::Subtype(TypeTrace {
95+
SubregionOrigin::Subtype(box TypeTrace {
9696
cause,
9797
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
9898
}),
@@ -108,7 +108,7 @@ impl NiceRegionError<'me, 'tcx> {
108108
)),
109109

110110
Some(RegionResolutionError::ConcreteFailure(
111-
SubregionOrigin::Subtype(TypeTrace {
111+
SubregionOrigin::Subtype(box TypeTrace {
112112
cause,
113113
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
114114
}),
@@ -125,7 +125,7 @@ impl NiceRegionError<'me, 'tcx> {
125125
)),
126126

127127
Some(RegionResolutionError::ConcreteFailure(
128-
SubregionOrigin::Subtype(TypeTrace {
128+
SubregionOrigin::Subtype(box TypeTrace {
129129
cause,
130130
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
131131
}),
@@ -142,7 +142,7 @@ impl NiceRegionError<'me, 'tcx> {
142142
)),
143143

144144
Some(RegionResolutionError::ConcreteFailure(
145-
SubregionOrigin::Subtype(TypeTrace {
145+
SubregionOrigin::Subtype(box TypeTrace {
146146
cause,
147147
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
148148
}),

src/librustc/infer/error_reporting/note.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
138138
sup: Region<'tcx>)
139139
-> DiagnosticBuilder<'tcx> {
140140
match origin {
141-
infer::Subtype(trace) => {
141+
infer::Subtype(box trace) => {
142142
let terr = TypeError::RegionsDoesNotOutlive(sup, sub);
143143
let mut err = self.report_and_explain_type_error(trace, &terr);
144144
self.tcx.note_and_explain_region(region_scope_tree, &mut err, "", sup, "...");
@@ -450,7 +450,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
450450
) -> DiagnosticBuilder<'tcx> {
451451
// I can't think how to do better than this right now. -nikomatsakis
452452
match placeholder_origin {
453-
infer::Subtype(trace) => {
453+
infer::Subtype(box trace) => {
454454
let terr = TypeError::RegionsPlaceholderMismatch;
455455
self.report_and_explain_type_error(trace, &terr)
456456
}

src/librustc/infer/glb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
5757
a,
5858
b);
5959

60-
let origin = Subtype(self.fields.trace.clone());
60+
let origin = Subtype(box self.fields.trace.clone());
6161
Ok(self.fields.infcx.borrow_region_constraints().glb_regions(self.tcx(), origin, a, b))
6262
}
6363

src/librustc/infer/lub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
5757
a,
5858
b);
5959

60-
let origin = Subtype(self.fields.trace.clone());
60+
let origin = Subtype(box self.fields.trace.clone());
6161
Ok(self.fields.infcx.borrow_region_constraints().lub_regions(self.tcx(), origin, a, b))
6262
}
6363

src/librustc/infer/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ pub struct TypeTrace<'tcx> {
254254
#[derive(Clone, Debug)]
255255
pub enum SubregionOrigin<'tcx> {
256256
/// Arose from a subtyping relation
257-
Subtype(TypeTrace<'tcx>),
257+
Subtype(Box<TypeTrace<'tcx>>),
258258

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

343+
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
344+
#[cfg(target_arch = "x86_64")]
345+
static_assert_size!(SubregionOrigin<'_>, 32);
346+
343347
/// Places that type/region parameters can appear.
344348
#[derive(Clone, Copy, Debug)]
345349
pub enum ParameterOrigin {

src/librustc/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
130130
// FIXME -- we have more fine-grained information available
131131
// from the "cause" field, we could perhaps give more tailored
132132
// error messages.
133-
let origin = SubregionOrigin::Subtype(self.fields.trace.clone());
133+
let origin = SubregionOrigin::Subtype(box self.fields.trace.clone());
134134
self.fields.infcx.borrow_region_constraints()
135135
.make_subregion(origin, a, b);
136136

0 commit comments

Comments
 (0)