Skip to content

Commit a6624ed

Browse files
committed
Auto merge of #64293 - Centril:rollup-blnhxwl, r=Centril
Rollup of 4 pull requests Successful merges: - #64078 (compiletest: disable -Aunused for run-pass tests) - #64263 (Replace "feature gated" wording with "unstable".) - #64280 (Factor out pluralisation into syntax::errors) - #64288 (use 'get_toml' instead of regular expression) Failed merges: r? @ghost
2 parents 2b8116d + 51b110f commit a6624ed

File tree

77 files changed

+177
-101
lines changed

Some content is hidden

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

77 files changed

+177
-101
lines changed

src/bootstrap/bootstrap.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ def get_toml(self, key, section=None):
523523
'value2'
524524
>>> rb.get_toml('key', 'c') is None
525525
True
526+
527+
>>> rb.config_toml = 'key1 = true'
528+
>>> rb.get_toml("key1")
529+
'true'
526530
"""
527531

528532
cur_section = None
@@ -571,6 +575,12 @@ def get_string(line):
571575
572576
>>> RustBuild.get_string(' "devel" ')
573577
'devel'
578+
>>> RustBuild.get_string(" 'devel' ")
579+
'devel'
580+
>>> RustBuild.get_string('devel') is None
581+
True
582+
>>> RustBuild.get_string(' "devel ')
583+
''
574584
"""
575585
start = line.find('"')
576586
if start != -1:
@@ -822,13 +832,13 @@ def bootstrap(help_triggered):
822832
except (OSError, IOError):
823833
pass
824834

825-
match = re.search(r'\nverbose = (\d+)', build.config_toml)
826-
if match is not None:
827-
build.verbose = max(build.verbose, int(match.group(1)))
835+
config_verbose = build.get_toml('verbose', 'build')
836+
if config_verbose is not None:
837+
build.verbose = max(build.verbose, int(config_verbose))
828838

829-
build.use_vendored_sources = '\nvendor = true' in build.config_toml
839+
build.use_vendored_sources = build.get_toml('vendor', 'build') == 'true'
830840

831-
build.use_locked_deps = '\nlocked-deps = true' in build.config_toml
841+
build.use_locked_deps = build.get_toml('locked-deps', 'build') == 'true'
832842

833843
build.check_vendored_status()
834844

src/librustc/ty/error.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::borrow::Cow;
44
use std::fmt;
55
use rustc_target::spec::abi;
66
use syntax::ast;
7+
use syntax::errors::pluralise;
78
use errors::{Applicability, DiagnosticBuilder};
89
use syntax_pos::Span;
910

@@ -82,12 +83,6 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
8283
}
8384
};
8485

85-
macro_rules! pluralise {
86-
($x:expr) => {
87-
if $x != 1 { "s" } else { "" }
88-
};
89-
}
90-
9186
match *self {
9287
CyclicTy(_) => write!(f, "cyclic type of infinite size"),
9388
Mismatch => write!(f, "types differ"),

src/librustc_errors/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -845,3 +845,10 @@ impl Level {
845845
}
846846
}
847847
}
848+
849+
#[macro_export]
850+
macro_rules! pluralise {
851+
($x:expr) => {
852+
if $x != 1 { "s" } else { "" }
853+
};
854+
}

src/librustc_metadata/native_libs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ impl Collector<'tcx> {
159159
sym::link_cfg,
160160
span.unwrap(),
161161
GateIssue::Language,
162-
"is feature gated");
162+
"is unstable");
163163
}
164164
if lib.kind == cstore::NativeStaticNobundle &&
165165
!self.tcx.features().static_nobundle {
166166
feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
167167
sym::static_nobundle,
168168
span.unwrap_or_else(|| syntax_pos::DUMMY_SP),
169169
GateIssue::Language,
170-
"kind=\"static-nobundle\" is feature gated");
170+
"kind=\"static-nobundle\" is unstable");
171171
}
172172
self.libs.push(lib);
173173
}

src/librustc_typeck/astconv.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rustc_target::spec::abi;
2323
use crate::require_c_abi_if_c_variadic;
2424
use smallvec::SmallVec;
2525
use syntax::ast;
26+
use syntax::errors::pluralise;
2627
use syntax::feature_gate::{GateIssue, emit_feature_err};
2728
use syntax::util::lev_distance::find_best_match_for_name;
2829
use syntax::symbol::sym;
@@ -377,7 +378,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
377378
quantifier,
378379
bound,
379380
kind,
380-
if bound != 1 { "s" } else { "" },
381+
pluralise!(bound),
381382
))
382383
};
383384

src/librustc_typeck/check/compare_method.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc::util::common::ErrorReported;
1010
use errors::{Applicability, DiagnosticId};
1111

1212
use syntax_pos::Span;
13+
use syntax::errors::pluralise;
1314

1415
use super::{Inherited, FnCtxt, potentially_plural_count};
1516

@@ -648,9 +649,9 @@ fn compare_number_of_generics<'tcx>(
648649
declaration has {} {kind} parameter{}",
649650
trait_.ident,
650651
impl_count,
651-
if impl_count != 1 { "s" } else { "" },
652+
pluralise!(impl_count),
652653
trait_count,
653-
if trait_count != 1 { "s" } else { "" },
654+
pluralise!(trait_count),
654655
kind = kind,
655656
),
656657
DiagnosticId::Error("E0049".into()),
@@ -665,7 +666,7 @@ fn compare_number_of_generics<'tcx>(
665666
"expected {} {} parameter{}",
666667
trait_count,
667668
kind,
668-
if trait_count != 1 { "s" } else { "" },
669+
pluralise!(trait_count),
669670
));
670671
}
671672
for span in spans {
@@ -680,7 +681,7 @@ fn compare_number_of_generics<'tcx>(
680681
"found {} {} parameter{}{}",
681682
impl_count,
682683
kind,
683-
if impl_count != 1 { "s" } else { "" },
684+
pluralise!(impl_count),
684685
suffix.unwrap_or_else(|| String::new()),
685686
));
686687
}

src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// check-pass
22

33
#![feature(associated_type_bounds)]
44

src/test/ui/associated-type-bounds/fn-apit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// aux-build:fn-aux.rs
33

4+
#![allow(unused)]
45
#![feature(associated_type_bounds)]
56

67
extern crate fn_aux;

src/test/ui/associated-type-bounds/fn-dyn-apit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// aux-build:fn-dyn-aux.rs
33

4+
#![allow(unused)]
45
#![feature(associated_type_bounds)]
56

67
extern crate fn_dyn_aux;

src/test/ui/associated-type-bounds/fn-inline.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// aux-build:fn-aux.rs
33

4+
#![allow(unused)]
45
#![feature(associated_type_bounds)]
56

67
extern crate fn_aux;

src/test/ui/associated-type-bounds/fn-where.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// aux-build:fn-aux.rs
33

4+
#![allow(unused)]
45
#![feature(associated_type_bounds)]
56

67
extern crate fn_aux;

src/test/ui/associated-type-bounds/fn-wrap-apit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// aux-build:fn-aux.rs
33

44
#![feature(associated_type_bounds)]
5+
#![allow(dead_code)]
56

67
extern crate fn_aux;
78

src/test/ui/associated-type-bounds/struct-bounds.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22

3+
#![allow(unused)]
34
#![feature(associated_type_bounds)]
45

56
trait Tr1 { type As1; }

src/test/ui/async-await/argument-patterns.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// edition:2018
2-
// run-pass
2+
// check-pass
33

4-
#![allow(unused_variables)]
54
#![deny(unused_mut)]
65

76
type A = Vec<u32>;

src/test/ui/async-await/async-await.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// run-pass
22

3+
#![allow(unused)]
4+
35
// edition:2018
46
// aux-build:arc_wake.rs
57

src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
// run-pass
44

55
#![deny(dead_code)]
6+
#![allow(unused_variables)]
7+
#![allow(unused_must_use)]
8+
#![allow(path_statements)]
69

710
// Test that the drop order for locals in a fn and async fn matches up.
811
extern crate arc_wake;
912

1013
use arc_wake::ArcWake;
1114
use std::cell::RefCell;
1215
use std::future::Future;
13-
use std::marker::PhantomData;
1416
use std::pin::Pin;
1517
use std::rc::Rc;
1618
use std::sync::Arc;
@@ -42,7 +44,7 @@ struct NeverReady;
4244

4345
impl Future for NeverReady {
4446
type Output = ();
45-
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
47+
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
4648
Poll::Pending
4749
}
4850
}

src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// parameters (used or unused) are not dropped until the async fn is cancelled.
77
// This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs
88

9+
#![allow(unused_variables)]
10+
911
extern crate arc_wake;
1012

1113
use arc_wake::ArcWake;
@@ -43,7 +45,7 @@ struct NeverReady;
4345

4446
impl Future for NeverReady {
4547
type Output = ();
46-
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
48+
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
4749
Poll::Pending
4850
}
4951
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: unnecessary parentheses around assigned value
2+
--> $DIR/issue-54752-async-block.rs:6:22
3+
|
4+
LL | fn main() { let _a = (async { }); }
5+
| ^^^^^^^^^^^^ help: remove these parentheses
6+
|
7+
= note: `#[warn(unused_parens)]` on by default
8+

src/test/ui/async-await/issues/issue-59972.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// run-pass
66

7-
// compile-flags: --edition=2018
7+
// compile-flags: --edition=2018 -Aunused
88

99
pub enum Uninhabited { }
1010

src/test/ui/async-await/multiple-lifetimes/hrtb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// edition:2018
2-
// run-pass
2+
// check-pass
33

44
// Test that we can use async fns with multiple arbitrary lifetimes.
55

src/test/ui/attributes/obsolete-attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Obsolete attributes fall back to feature gated custom attributes.
1+
// Obsolete attributes fall back to unstable custom attributes.
22

33
#[ab_isize="stdcall"] extern {}
44
//~^ ERROR cannot find attribute macro `ab_isize` in this scope

src/test/ui/attributes/unknown-attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Unknown attributes fall back to feature gated custom attributes.
1+
// Unknown attributes fall back to unstable custom attributes.
22

33
#![feature(custom_inner_attributes)]
44

src/test/ui/borrowck/borrowck-migrate-to-nll.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// revisions: zflag edition
1818
//[zflag]compile-flags: -Z borrowck=migrate
1919
//[edition]edition:2018
20-
//[zflag] run-pass
20+
//[zflag] check-pass
2121

2222
pub struct Block<'a> {
2323
current: &'a u8,

src/test/ui/borrowck/issue-10876.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// check-pass
22

33
enum Nat {
44
S(Box<Nat>),

src/test/ui/borrowck/two-phase-multiple-activations.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ pub trait FakeRead {
1111
}
1212

1313
impl FakeRead for Foo {
14-
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
14+
fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> Result<usize> {
1515
Ok(4)
1616
}
1717
}
1818

1919
fn main() {
2020
let mut a = Foo {};
2121
let mut v = Vec::new();
22-
a.read_to_end(&mut v);
22+
a.read_to_end(&mut v).unwrap();
2323
}

src/test/ui/const-generics/apit-with-const-param.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// check-pass
22

33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

src/test/ui/const-generics/array-wrapper-struct-ctor.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
55

6+
#![allow(dead_code)]
7+
68
struct ArrayStruct<T, const N: usize> {
79
data: [T; N],
810
}

src/test/ui/const-generics/const-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
55

6-
#[allow(dead_code)]
6+
#![allow(dead_code, unused_variables)]
77

88
struct ConstArray<T, const LEN: usize> {
99
array: [T; LEN],

src/test/ui/const-generics/issue-61422.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// check-pass
22

33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
@@ -8,7 +8,7 @@ use std::mem;
88
fn foo<const SIZE: usize>() {
99
let arr: [u8; SIZE] = unsafe {
1010
#[allow(deprecated)]
11-
let mut array: [u8; SIZE] = mem::uninitialized();
11+
let array: [u8; SIZE] = mem::uninitialized();
1212
array
1313
};
1414
}

src/test/ui/const-generics/unused-const-param.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// check-pass
22

33
#![feature(const_generics)]
44
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

src/test/ui/consts/const-eval/const_transmute.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22

33
#![feature(const_fn_union)]
4+
#![allow(dead_code)]
45

56
#[repr(C)]
67
union Transmute<T: Copy, U: Copy> {

src/test/ui/consts/const-labeled-break.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// run-pass
1+
// build-pass
22

33
// Using labeled break in a while loop has caused an illegal instruction being
44
// generated, and an ICE later.
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: unreachable pattern
2+
--> $DIR/packed_pattern.rs:16:9
3+
|
4+
LL | FOO => unreachable!(),
5+
| ^^^
6+
|
7+
= note: `#[warn(unreachable_patterns)]` on by default
8+

0 commit comments

Comments
 (0)