Skip to content

Commit ce1ab35

Browse files
committed
Auto merge of #71180 - Dylan-DPC:rollup-pscpg6q, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #69903 (Do not ICE in the face of invalid enum discriminant) - #70354 (Update RELEASES.md for 1.43.0) - #70774 (End cleanup on rustdoc-js tools) - #70990 (Improve rustdoc source code a bit) - #71145 (Add illumos triple) - #71166 (Clean up E0518 explanation) Failed merges: r? @ghost
2 parents d223029 + 41dc51e commit ce1ab35

File tree

41 files changed

+1123
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1123
-478
lines changed

Diff for: Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1808,9 +1808,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
18081808

18091809
[[package]]
18101810
name = "libc"
1811-
version = "0.2.66"
1811+
version = "0.2.69"
18121812
source = "registry+https://github.com/rust-lang/crates.io-index"
1813-
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
1813+
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
18141814
dependencies = [
18151815
"rustc-std-workspace-core",
18161816
]
@@ -4683,9 +4683,9 @@ checksum = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86"
46834683

46844684
[[package]]
46854685
name = "socket2"
4686-
version = "0.3.11"
4686+
version = "0.3.12"
46874687
source = "registry+https://github.com/rust-lang/crates.io-index"
4688-
checksum = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
4688+
checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
46894689
dependencies = [
46904690
"cfg-if",
46914691
"libc",

Diff for: RELEASES.md

+149
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,152 @@
1+
Version 1.43.0 (2020-04-23)
2+
==========================
3+
4+
Language
5+
--------
6+
- [Fixed using binary operations with `&{number}` (e.g. `&1.0`) not having
7+
the type inferred correctly.][68129]
8+
- [Attributes such as `#[cfg()]` can now be used on `if` expressions.][69201]
9+
10+
**Syntax only changes**
11+
- [Allow `type Foo: Ord` syntactically.][69361]
12+
- [Fuse associated and extern items up to defaultness.][69194]
13+
- [Syntactically allow `self` in all `fn` contexts.][68764]
14+
- [Merge `fn` syntax + cleanup item parsing.][68728]
15+
- [`item` macro fragments can be interpolated into `trait`s, `impl`s, and `extern` blocks.][69366]
16+
For example, you may now write:
17+
```rust
18+
macro_rules! mac_trait {
19+
($i:item) => {
20+
trait T { $i }
21+
}
22+
}
23+
mac_trait! {
24+
fn foo() {}
25+
}
26+
```
27+
28+
These are still rejected *semantically*, so you will likely receive an error but
29+
these changes can be seen and parsed by macros and
30+
conditional compilation.
31+
32+
33+
Compiler
34+
--------
35+
- [You can now pass multiple lint flags to rustc to override the previous
36+
flags.][67885] For example; `rustc -D unused -A unused-variables` denies
37+
everything in the `unused` lint group except `unused-variables` which
38+
is explicitly allowed. However, passing `rustc -A unused-variables -D unused` denies
39+
everything in the `unused` lint group **including** `unused-variables` since
40+
the allow flag is specified before the deny flag (and therefore overridden).
41+
- [rustc will now prefer your system MinGW libraries over its bundled libraries
42+
if they are available on `windows-gnu`.][67429]
43+
- [rustc now buffers errors/warnings printed in JSON.][69227]
44+
45+
Libraries
46+
---------
47+
- [`Arc<[T; N]>`, `Box<[T; N]>`, and `Rc<[T; N]>`, now implement
48+
`TryFrom<Arc<[T]>>`,`TryFrom<Box<[T]>>`, and `TryFrom<Rc<[T]>>`
49+
respectively.][69538] **Note** These conversions are only available when `N`
50+
is `0..=32`.
51+
- [You can now use associated constants on floats and integers directly, rather
52+
than having to import the module.][68952] e.g. You can now write `u32::MAX` or
53+
`f32::NAN` with no imports.
54+
- [`u8::is_ascii` is now `const`.][68984]
55+
- [`String` now implements `AsMut<str>`.][68742]
56+
- [Added the `primitive` module to `std` and `core`.][67637] This module
57+
reexports Rust's primitive types. This is mainly useful in macros
58+
where you want avoid these types being shadowed.
59+
- [Relaxed some of the trait bounds on `HashMap` and `HashSet`.][67642]
60+
- [`string::FromUtf8Error` now implements `Clone + Eq`.][68738]
61+
62+
Stabilized APIs
63+
---------------
64+
- [`Once::is_completed`]
65+
- [`f32::LOG10_2`]
66+
- [`f32::LOG2_10`]
67+
- [`f64::LOG10_2`]
68+
- [`f64::LOG2_10`]
69+
- [`iter::once_with`]
70+
71+
Cargo
72+
-----
73+
- [You can now set config `[profile]`s in your `.cargo/config`, or through
74+
your environment.][cargo/7823]
75+
- [Cargo will now set `CARGO_BIN_EXE_<name>` pointing to a binary's
76+
executable path when running integration tests or benchmarks.][cargo/7697]
77+
`<name>` is the name of your binary as-is e.g. If you wanted the executable
78+
path for a binary named `my-program`you would use `env!("CARGO_BIN_EXE_my-program")`.
79+
80+
Misc
81+
----
82+
- [Certain checks in the `const_err` lint were deemed unrelated to const
83+
evaluation][69185], and have been moved to the `unconditional_panic` and
84+
`arithmetic_overflow` lints.
85+
86+
Compatibility Notes
87+
-------------------
88+
89+
- [Having trailing syntax in the `assert!` macro is now a hard error.][69548] This
90+
has been a warning since 1.36.0.
91+
- [Fixed `Self` not having the correctly inferred type.][69340] This incorrectly
92+
led to some instances being accepted, and now correctly emits a hard error.
93+
94+
[69340]: https://github.com/rust-lang/rust/pull/69340
95+
96+
Internal Only
97+
-------------
98+
These changes provide no direct user facing benefits, but represent significant
99+
improvements to the internals and overall performance of `rustc` and
100+
related tools.
101+
102+
- [All components are now built with `opt-level=3` instead of `2`.][67878]
103+
- [Improved how rustc generates drop code.][67332]
104+
- [Improved performance from `#[inline]`-ing certain hot functions.][69256]
105+
- [traits: preallocate 2 Vecs of known initial size][69022]
106+
- [Avoid exponential behaviour when relating types][68772]
107+
- [Skip `Drop` terminators for enum variants without drop glue][68943]
108+
- [Improve performance of coherence checks][68966]
109+
- [Deduplicate types in the generator witness][68672]
110+
- [Invert control in struct_lint_level.][68725]
111+
112+
[67332]: https://github.com/rust-lang/rust/pull/67332/
113+
[67429]: https://github.com/rust-lang/rust/pull/67429/
114+
[67637]: https://github.com/rust-lang/rust/pull/67637/
115+
[67642]: https://github.com/rust-lang/rust/pull/67642/
116+
[67878]: https://github.com/rust-lang/rust/pull/67878/
117+
[67885]: https://github.com/rust-lang/rust/pull/67885/
118+
[68129]: https://github.com/rust-lang/rust/pull/68129/
119+
[68672]: https://github.com/rust-lang/rust/pull/68672/
120+
[68725]: https://github.com/rust-lang/rust/pull/68725/
121+
[68728]: https://github.com/rust-lang/rust/pull/68728/
122+
[68738]: https://github.com/rust-lang/rust/pull/68738/
123+
[68742]: https://github.com/rust-lang/rust/pull/68742/
124+
[68764]: https://github.com/rust-lang/rust/pull/68764/
125+
[68772]: https://github.com/rust-lang/rust/pull/68772/
126+
[68943]: https://github.com/rust-lang/rust/pull/68943/
127+
[68952]: https://github.com/rust-lang/rust/pull/68952/
128+
[68966]: https://github.com/rust-lang/rust/pull/68966/
129+
[68984]: https://github.com/rust-lang/rust/pull/68984/
130+
[69022]: https://github.com/rust-lang/rust/pull/69022/
131+
[69185]: https://github.com/rust-lang/rust/pull/69185/
132+
[69194]: https://github.com/rust-lang/rust/pull/69194/
133+
[69201]: https://github.com/rust-lang/rust/pull/69201/
134+
[69227]: https://github.com/rust-lang/rust/pull/69227/
135+
[69548]: https://github.com/rust-lang/rust/pull/69548/
136+
[69256]: https://github.com/rust-lang/rust/pull/69256/
137+
[69361]: https://github.com/rust-lang/rust/pull/69361/
138+
[69366]: https://github.com/rust-lang/rust/pull/69366/
139+
[69538]: https://github.com/rust-lang/rust/pull/69538/
140+
[cargo/7823]: https://github.com/rust-lang/cargo/pull/7823
141+
[cargo/7697]: https://github.com/rust-lang/cargo/pull/7697
142+
[`Once::is_completed`]: https://doc.rust-lang.org/std/sync/struct.Once.html#method.is_completed
143+
[`f32::LOG10_2`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG10_2.html
144+
[`f32::LOG2_10`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG2_10.html
145+
[`f64::LOG10_2`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG10_2.html
146+
[`f64::LOG2_10`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG2_10.html
147+
[`iter::once_with`]: https://doc.rust-lang.org/std/iter/fn.once_with.html
148+
149+
1150
Version 1.42.0 (2020-03-12)
2151
==========================
3152

Diff for: src/bootstrap/test.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,14 @@ impl Step for RustdocJSStd {
627627
if let Some(ref nodejs) = builder.config.nodejs {
628628
let mut command = Command::new(nodejs);
629629
command
630-
.arg(builder.src.join("src/tools/rustdoc-js-std/tester.js"))
630+
.arg(builder.src.join("src/tools/rustdoc-js/tester.js"))
631+
.arg("--crate-name")
632+
.arg("std")
633+
.arg("--resource-suffix")
634+
.arg(crate::channel::CFG_RELEASE_NUM)
635+
.arg("--doc-folder")
631636
.arg(builder.doc_out(self.target))
637+
.arg("--test-folder")
632638
.arg(builder.src.join("src/test/rustdoc-js-std"));
633639
builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage });
634640
builder.run(&mut command);

Diff for: src/librustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cc = "1.0.1"
1515
num_cpus = "1.0"
1616
memmap = "0.7"
1717
log = "0.4.5"
18-
libc = "0.2.44"
18+
libc = "0.2.50"
1919
jobserver = "0.1.11"
2020
tempfile = "3.1"
2121

Diff for: src/librustc_codegen_ssa/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
761761
}
762762
}
763763
LinkerFlavor::Gcc => {
764-
if cfg!(target_os = "solaris") {
764+
if cfg!(any(target_os = "solaris", target_os = "illumos")) {
765765
// On historical Solaris systems, "cc" may have
766766
// been Sun Studio, which is not flag-compatible
767767
// with "gcc". This history casts a long shadow,

Diff for: src/librustc_error_codes/error_codes/E0518.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
This error indicates that an `#[inline(..)]` attribute was incorrectly placed
2-
on something other than a function or method.
1+
An `#[inline(..)]` attribute was incorrectly placed on something other than a
2+
function or method.
33

4-
Examples of erroneous code:
4+
Example of erroneous code:
55

66
```compile_fail,E0518
77
#[inline(always)]

Diff for: src/librustc_middle/ty/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,11 @@ impl<'tcx> AdtDef {
23992399
None
24002400
}
24012401
Err(ErrorHandled::TooGeneric) => {
2402-
span_bug!(tcx.def_span(expr_did), "enum discriminant depends on generic arguments",)
2402+
tcx.sess.delay_span_bug(
2403+
tcx.def_span(expr_did),
2404+
"enum discriminant depends on generic arguments",
2405+
);
2406+
None
24032407
}
24042408
}
24052409
}

Diff for: src/librustc_mir_build/hair/cx/expr.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_middle::ty::adjustment::{
1212
Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast,
1313
};
1414
use rustc_middle::ty::subst::{InternalSubsts, SubstsRef};
15-
use rustc_middle::ty::{self, AdtKind, Ty};
15+
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
1616
use rustc_span::Span;
1717

1818
impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr<'tcx> {
@@ -718,8 +718,7 @@ fn convert_path_expr<'a, 'tcx>(
718718

719719
Res::Def(DefKind::Ctor(_, CtorKind::Const), def_id) => {
720720
let user_provided_types = cx.tables.user_provided_types();
721-
let user_provided_type = user_provided_types.get(expr.hir_id).copied();
722-
debug!("convert_path_expr: user_provided_type={:?}", user_provided_type);
721+
let user_ty = user_provided_types.get(expr.hir_id).copied();
723722
let ty = cx.tables().node_type(expr.hir_id);
724723
match ty.kind {
725724
// A unit struct/variant which is used as a value.
@@ -728,10 +727,17 @@ fn convert_path_expr<'a, 'tcx>(
728727
adt_def,
729728
variant_index: adt_def.variant_index_with_ctor_id(def_id),
730729
substs,
731-
user_ty: user_provided_type,
730+
user_ty,
732731
fields: vec![],
733732
base: None,
734733
},
734+
_ if ty.references_error() => {
735+
// Handle degenerate input without ICE (#67377).
736+
ExprKind::Literal {
737+
literal: ty::Const::zero_sized(cx.tcx, cx.tcx.types.err),
738+
user_ty: None,
739+
}
740+
}
735741
_ => bug!("unexpected ty: {:?}", ty),
736742
}
737743
}

Diff for: src/librustc_target/spec/illumos_base.rs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2+
use std::default::Default;
3+
4+
pub fn opts() -> TargetOptions {
5+
let mut late_link_args = LinkArgs::new();
6+
late_link_args.insert(
7+
LinkerFlavor::Gcc,
8+
vec![
9+
// LLVM will insert calls to the stack protector functions
10+
// "__stack_chk_fail" and "__stack_chk_guard" into code in native
11+
// object files. Some platforms include these symbols directly in
12+
// libc, but at least historically these have been provided in
13+
// libssp.so on illumos and Solaris systems.
14+
"-lssp".to_string(),
15+
],
16+
);
17+
18+
TargetOptions {
19+
dynamic_linking: true,
20+
executables: true,
21+
has_rpath: true,
22+
target_family: Some("unix".to_string()),
23+
is_like_solaris: true,
24+
limit_rdylib_exports: false, // Linker doesn't support this
25+
eliminate_frame_pointer: false,
26+
late_link_args,
27+
28+
// While we support ELF TLS, rust requires a way to register
29+
// cleanup handlers (in C, this would be something along the lines of:
30+
// void register_callback(void (*fn)(void *), void *arg);
31+
// (see src/libstd/sys/unix/fast_thread_local.rs) that is currently
32+
// missing in illumos. For now at least, we must fallback to using
33+
// pthread_{get,set}specific.
34+
//has_elf_tls: true,
35+
36+
// FIXME: Currently, rust is invoking cc to link, which ends up
37+
// causing these to get included twice. We should eventually transition
38+
// to having rustc invoke ld directly, in which case these will need to
39+
// be uncommented.
40+
//
41+
// We want XPG6 behavior from libc and libm. See standards(5)
42+
//pre_link_objects_exe: vec![
43+
// "/usr/lib/amd64/values-Xc.o".to_string(),
44+
// "/usr/lib/amd64/values-xpg6.o".to_string(),
45+
//],
46+
..Default::default()
47+
}
48+
}

Diff for: src/librustc_target/spec/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ mod fuchsia_base;
5555
mod haiku_base;
5656
mod hermit_base;
5757
mod hermit_kernel_base;
58+
mod illumos_base;
5859
mod l4re_base;
5960
mod linux_base;
6061
mod linux_kernel_base;
@@ -438,6 +439,8 @@ supported_targets! {
438439
("x86_64-sun-solaris", "x86_64-pc-solaris", x86_64_sun_solaris),
439440
("sparcv9-sun-solaris", sparcv9_sun_solaris),
440441

442+
("x86_64-unknown-illumos", x86_64_unknown_illumos),
443+
441444
("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
442445
("i686-pc-windows-gnu", i686_pc_windows_gnu),
443446
("i686-uwp-windows-gnu", i686_uwp_windows_gnu),

Diff for: src/librustc_target/spec/x86_64_unknown_illumos.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetResult};
2+
3+
pub fn target() -> TargetResult {
4+
let mut base = super::illumos_base::opts();
5+
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string(), "-std=c99".to_string()]);
6+
base.cpu = "x86-64".to_string();
7+
base.max_atomic_width = Some(64);
8+
9+
Ok(Target {
10+
// LLVM does not currently have a separate illumos target,
11+
// so we still pass Solaris to it
12+
llvm_target: "x86_64-pc-solaris".to_string(),
13+
target_endian: "little".to_string(),
14+
target_pointer_width: "64".to_string(),
15+
target_c_int_width: "32".to_string(),
16+
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
17+
arch: "x86_64".to_string(),
18+
target_os: "illumos".to_string(),
19+
target_env: String::new(),
20+
target_vendor: "unknown".to_string(),
21+
linker_flavor: LinkerFlavor::Gcc,
22+
options: base,
23+
})
24+
}

Diff for: src/librustdoc/clean/cfg.rs

+1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ impl<'a> fmt::Display for Html<'a> {
360360
"fuchsia" => "Fuchsia",
361361
"haiku" => "Haiku",
362362
"hermit" => "HermitCore",
363+
"illumos" => "illumos",
363364
"ios" => "iOS",
364365
"l4re" => "L4Re",
365366
"linux" => "Linux",

0 commit comments

Comments
 (0)