Skip to content

Commit 445f34b

Browse files
committed
Auto merge of rust-lang#76186 - tmandry:rollup-49nliiy, r=tmandry
Rollup of 12 pull requests Successful merges: - rust-lang#75945 (Use `env::func()`, not 'the function env::func' in docs for std::env) - rust-lang#76002 (Fix `-Z instrument-coverage` on MSVC) - rust-lang#76003 (Adds two source span utility functions used in source-based coverage) - rust-lang#76059 (Clean up E0764) - rust-lang#76103 (Clean up E0769) - rust-lang#76139 (Make `cow_is_borrowed` methods const) - rust-lang#76154 (Fix rustdoc strings indentation) - rust-lang#76161 (Remove notrust in rustc_middle) - rust-lang#76163 (README: Adjust Linux and macOS support platform and architecture) - rust-lang#76166 (Make `StringReader` private) - rust-lang#76172 (Revert rust-lang#75463) - rust-lang#76178 (Update expect-test to 1.0) Failed merges: r? @ghost
2 parents d824b23 + 8d328d7 commit 445f34b

File tree

39 files changed

+313
-308
lines changed

39 files changed

+313
-308
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,9 @@ dependencies = [
998998

999999
[[package]]
10001000
name = "expect-test"
1001-
version = "0.1.0"
1001+
version = "1.0.1"
10021002
source = "registry+https://github.com/rust-lang/crates.io-index"
1003-
checksum = "a3e383741ea1982866572109d1a8c807bd36aad91fca701489fdca56ef92b3b8"
1003+
checksum = "ceb96f3eaa0d4e8769c52dacfd4eb60183b817ed2f176171b3c691d5022b0f2e"
10041004
dependencies = [
10051005
"difference",
10061006
"once_cell",

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,17 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
211211
212212
Snapshot binaries are currently built and tested on several platforms:
213213
214-
| Platform / Architecture | x86 | x86_64 |
215-
|----------------------------|-----|--------|
216-
| Windows (7, 8, 10, ...) | ✓ | ✓ |
217-
| Linux (2.6.18 or later) | ✓ | ✓ |
218-
| macOS (10.7 Lion or later) | ✓ | ✓ |
214+
| Platform / Architecture | x86 | x86_64 |
215+
|---------------------------------------------|-----|--------|
216+
| Windows (7, 8, 10, ...) | ✓ | ✓ |
217+
| Linux (kernel 2.6.32, glibc 2.11 or later) | ✓ | ✓ |
218+
| macOS (10.7 Lion or later) | (\*) | ✓ |
219+
220+
(\*): Apple dropped support for running 32-bit binaries starting from macOS 10.15 and iOS 11.
221+
Due to this decision from Apple, the targets are no longer useful to our users.
222+
Please read [our blog post][macx32] for more info.
223+
224+
[macx32]: https://blog.rust-lang.org/2020/01/03/reducing-support-for-32-bit-apple-targets.html
219225
220226
You may find that other platforms work, but these are our officially
221227
supported build environments that are most likely to work.

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
16681668
// FIXME: Order dependent, applies to the following objects. Where should it be placed?
16691669
// Try to strip as much out of the generated object by removing unused
16701670
// sections if possible. See more comments in linker.rs
1671-
if sess.opts.cg.link_dead_code != Some(true) {
1671+
if !sess.link_dead_code() {
16721672
let keep_metadata = crate_type == CrateType::Dylib;
16731673
cmd.gc_sections(keep_metadata);
16741674
}

compiler/rustc_error_codes/src/error_codes/E0764.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
Mutable references (`&mut`) can only be used in constant functions, not statics
2-
or constants. This limitation exists to prevent the creation of constants that
3-
have a mutable reference in their final value. If you had a constant of `&mut
4-
i32` type, you could modify the value through that reference, making the
5-
constant essentially mutable. While there could be a more fine-grained scheme
6-
in the future that allows mutable references if they are not "leaked" to the
7-
final value, a more conservative approach was chosen for now. `const fn` do not
8-
have this problem, as the borrow checker will prevent the `const fn` from
9-
returning new mutable references.
1+
A mutable reference was used in a constant.
102

113
Erroneous code example:
124

@@ -19,6 +11,18 @@ fn main() {
1911
}
2012
```
2113

14+
Mutable references (`&mut`) can only be used in constant functions, not statics
15+
or constants. This limitation exists to prevent the creation of constants that
16+
have a mutable reference in their final value. If you had a constant of
17+
`&mut i32` type, you could modify the value through that reference, making the
18+
constant essentially mutable.
19+
20+
While there could be a more fine-grained scheme in the future that allows
21+
mutable references if they are not "leaked" to the final value, a more
22+
conservative approach was chosen for now. `const fn` do not have this problem,
23+
as the borrow checker will prevent the `const fn` from returning new mutable
24+
references.
25+
2226
Remember: you cannot use a function call inside a constant or static. However,
2327
you can totally use it in constant functions:
2428

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
A tuple struct or tuple variant was used in a pattern as if it were a
2-
struct or struct variant.
1+
A tuple struct or tuple variant was used in a pattern as if it were a struct or
2+
struct variant.
33

44
Erroneous code example:
55

66
```compile_fail,E0769
77
enum E {
88
A(i32),
99
}
10+
1011
let e = E::A(42);
12+
1113
match e {
12-
E::A { number } => println!("{}", x),
14+
E::A { number } => { // error!
15+
println!("{}", number);
16+
}
1317
}
1418
```
1519

@@ -21,19 +25,23 @@ To fix this error, you can use the tuple pattern:
2125
# }
2226
# let e = E::A(42);
2327
match e {
24-
E::A(number) => println!("{}", number),
28+
E::A(number) => { // ok!
29+
println!("{}", number);
30+
}
2531
}
2632
```
2733

28-
Alternatively, you can also use the struct pattern by using the correct
29-
field names and binding them to new identifiers:
34+
Alternatively, you can also use the struct pattern by using the correct field
35+
names and binding them to new identifiers:
3036

3137
```
3238
# enum E {
3339
# A(i32),
3440
# }
3541
# let e = E::A(42);
3642
match e {
37-
E::A { 0: number } => println!("{}", number),
43+
E::A { 0: number } => { // ok!
44+
println!("{}", number);
45+
}
3846
}
3947
```

compiler/rustc_lexer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ doctest = false
2020
unicode-xid = "0.2.0"
2121

2222
[dev-dependencies]
23-
expect-test = "0.1"
23+
expect-test = "1.0"

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'tcx> MonoItem<'tcx> {
8585
.debugging_opts
8686
.inline_in_all_cgus
8787
.unwrap_or_else(|| tcx.sess.opts.optimize != OptLevel::No)
88-
&& tcx.sess.opts.cg.link_dead_code != Some(true);
88+
&& !tcx.sess.link_dead_code();
8989

9090
match *self {
9191
MonoItem::Fn(ref instance) => {

compiler/rustc_middle/src/ty/walk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl GenericArg<'tcx> {
5555
/// that appear in `self`, it does not descend into the fields of
5656
/// structs or variants. For example:
5757
///
58-
/// ```notrust
58+
/// ```text
5959
/// isize => { isize }
6060
/// Foo<Bar<isize>> => { Foo<Bar<isize>>, Bar<isize>, isize }
6161
/// [isize] => { [isize], isize }
@@ -80,7 +80,7 @@ impl<'tcx> super::TyS<'tcx> {
8080
/// that appear in `self`, it does not descend into the fields of
8181
/// structs or variants. For example:
8282
///
83-
/// ```notrust
83+
/// ```text
8484
/// isize => { isize }
8585
/// Foo<Bar<isize>> => { Foo<Bar<isize>>, Bar<isize>, isize }
8686
/// [isize] => { [isize], isize }

compiler/rustc_mir/src/monomorphize/partitioning/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub fn partition<'tcx>(
190190

191191
// Next we try to make as many symbols "internal" as possible, so LLVM has
192192
// more freedom to optimize.
193-
if tcx.sess.opts.cg.link_dead_code != Some(true) {
193+
if !tcx.sess.link_dead_code() {
194194
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_internalize_symbols");
195195
partitioner.internalize_symbols(tcx, &mut post_inlining, inlining_map);
196196
}
@@ -327,7 +327,7 @@ fn collect_and_partition_mono_items<'tcx>(
327327
}
328328
}
329329
None => {
330-
if tcx.sess.opts.cg.link_dead_code == Some(true) {
330+
if tcx.sess.link_dead_code() {
331331
MonoItemCollectionMode::Eager
332332
} else {
333333
MonoItemCollectionMode::Lazy

compiler/rustc_parse/src/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct UnmatchedBrace {
2727
pub candidate_span: Option<Span>,
2828
}
2929

30-
pub struct StringReader<'a> {
30+
crate struct StringReader<'a> {
3131
sess: &'a ParseSess,
3232
/// Initial position, read-only.
3333
start_pos: BytePos,
@@ -41,7 +41,7 @@ pub struct StringReader<'a> {
4141
}
4242

4343
impl<'a> StringReader<'a> {
44-
pub fn new(
44+
crate fn new(
4545
sess: &'a ParseSess,
4646
source_file: Lrc<rustc_span::SourceFile>,
4747
override_span: Option<Span>,
@@ -66,7 +66,7 @@ impl<'a> StringReader<'a> {
6666
}
6767

6868
/// Returns the next token, including trivia like whitespace or comments.
69-
pub fn next_token(&mut self) -> Token {
69+
fn next_token(&mut self) -> Token {
7070
let start_src_index = self.src_index(self.pos);
7171
let text: &str = &self.src[start_src_index..self.end_src_index];
7272

0 commit comments

Comments
 (0)