Skip to content

Commit c06e4ac

Browse files
committed
Auto merge of #68201 - JohnTitor:rollup-26e39gu, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #67854 (Use `report_in_external_macro` for internal lints) - #67989 (rustdoc: Don't allow `#![feature(...)]` on stable or beta) - #68036 (libterm: parse extended terminfo format) - #68127 (Clarify the relationship between `extended` and `tools` in `config.toml`) - #68143 (Forbid elided lifetimes within const generic parameter types) - #68150 (Document behavior of set_nonblocking on UnixListener) - #68166 (rustdoc: HTML escape arrows on help popup) - #68176 (Clean up err codes) - #68179 (Remove unneeded scope) - #68188 (Tweak assertion note in format check) Failed merges: r? @ghost
2 parents 30ca215 + b8c0e31 commit c06e4ac

File tree

17 files changed

+183
-76
lines changed

17 files changed

+183
-76
lines changed

config.toml.example

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,23 @@
181181
# Indicate whether the vendored sources are used for Rust dependencies or not
182182
#vendor = false
183183

184-
# Typically the build system will build the rust compiler twice. The second
184+
# Typically the build system will build the Rust compiler twice. The second
185185
# compiler, however, will simply use its own libraries to link against. If you
186186
# would rather to perform a full bootstrap, compiling the compiler three times,
187187
# then you can set this option to true. You shouldn't ever need to set this
188188
# option to true.
189189
#full-bootstrap = false
190190

191-
# Enable a build of the extended rust tool set which is not only the compiler
191+
# Enable a build of the extended Rust tool set which is not only the compiler
192192
# but also tools such as Cargo. This will also produce "combined installers"
193193
# which are used to install Rust and Cargo together. This is disabled by
194-
# default.
194+
# default. The `tools` option (immediately below) specifies which tools should
195+
# be built if `extended = true`.
195196
#extended = false
196197

197-
# Installs chosen set of extended tools if enabled. By default builds all.
198-
# If chosen tool failed to build the installation fails.
198+
# Installs chosen set of extended tools if `extended = true`. By default builds all.
199+
# If chosen tool failed to build the installation fails. If `extended = false`, this
200+
# option is ignored.
199201
#tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"]
200202

201203
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose

src/bootstrap/format.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ fn rustfmt(src: &Path, rustfmt: &Path, path: &Path, check: bool) {
2020
cmd.arg(&path);
2121
let cmd_debug = format!("{:?}", cmd);
2222
let status = cmd.status().expect("executing rustfmt");
23-
assert!(status.success(), "running {} successful", cmd_debug);
23+
if !status.success() {
24+
eprintln!(
25+
"Running `{}` failed.\nIf you're running `tidy`, \
26+
try again with `--bless` flag. Or, you just want to format \
27+
code, run `./x.py fmt` instead.",
28+
cmd_debug,
29+
);
30+
std::process::exit(1);
31+
}
2432
}
2533

2634
#[derive(serde::Deserialize)]

src/librustc_ast_lowering/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,12 +2120,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21202120

21212121
(hir::ParamName::Plain(param.ident), kind)
21222122
}
2123-
GenericParamKind::Const { ref ty } => (
2124-
hir::ParamName::Plain(param.ident),
2125-
hir::GenericParamKind::Const {
2126-
ty: self.lower_ty(&ty, ImplTraitContext::disallowed()),
2127-
},
2128-
),
2123+
GenericParamKind::Const { ref ty } => {
2124+
let ty = self
2125+
.with_anonymous_lifetime_mode(AnonymousLifetimeMode::ReportError, |this| {
2126+
this.lower_ty(&ty, ImplTraitContext::disallowed())
2127+
});
2128+
2129+
(hir::ParamName::Plain(param.ident), hir::GenericParamKind::Const { ty })
2130+
}
21292131
};
21302132

21312133
hir::GenericParam {

src/librustc_error_codes/error_codes/E0191.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Trait objects need to have all associated types specified. Erroneous code
2-
example:
1+
An associated type wasn't specified for a trait object.
2+
3+
Erroneous code example:
34

45
```compile_fail,E0191
56
trait Trait {
@@ -10,8 +11,9 @@ type Foo = Trait; // error: the value of the associated type `Bar` (from
1011
// the trait `Trait`) must be specified
1112
```
1213

13-
Please verify you specified all associated types of the trait and that you
14-
used the right trait. Example:
14+
Trait objects need to have all associated types specified. Please verify that
15+
all associated types of the trait were specified and the correct trait was used.
16+
Example:
1517

1618
```
1719
trait Trait {

src/librustc_error_codes/error_codes/E0192.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
A negative impl was added on a trait implementation.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0192
6+
trait Trait {
7+
type Bar;
8+
}
9+
10+
struct Foo;
11+
12+
impl !Trait for Foo { } //~ ERROR E0192
13+
14+
fn main() {}
15+
```
16+
117
Negative impls are only allowed for auto traits. For more
218
information see the [opt-in builtin traits RFC][RFC 19].
319

src/librustc_lint/internal.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use syntax::ast::{Ident, Item, ItemKind};
1212
declare_tool_lint! {
1313
pub rustc::DEFAULT_HASH_TYPES,
1414
Allow,
15-
"forbid HashMap and HashSet and suggest the FxHash* variants"
15+
"forbid HashMap and HashSet and suggest the FxHash* variants",
16+
report_in_external_macro: true
1617
}
1718

1819
pub struct DefaultHashTypes {
@@ -52,19 +53,22 @@ impl EarlyLintPass for DefaultHashTypes {
5253
declare_tool_lint! {
5354
pub rustc::USAGE_OF_TY_TYKIND,
5455
Allow,
55-
"usage of `ty::TyKind` outside of the `ty::sty` module"
56+
"usage of `ty::TyKind` outside of the `ty::sty` module",
57+
report_in_external_macro: true
5658
}
5759

5860
declare_tool_lint! {
5961
pub rustc::TY_PASS_BY_REFERENCE,
6062
Allow,
61-
"passing `Ty` or `TyCtxt` by reference"
63+
"passing `Ty` or `TyCtxt` by reference",
64+
report_in_external_macro: true
6265
}
6366

6467
declare_tool_lint! {
6568
pub rustc::USAGE_OF_QUALIFIED_TY,
6669
Allow,
67-
"using `ty::{Ty,TyCtxt}` instead of importing it"
70+
"using `ty::{Ty,TyCtxt}` instead of importing it",
71+
report_in_external_macro: true
6872
}
6973

7074
declare_lint_pass!(TyTyKind => [

src/librustc_span/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ pub mod kw {
10491049
}
10501050

10511051
// This module has a very short name because it's used a lot.
1052+
#[allow(rustc::default_hash_types)]
10521053
pub mod sym {
10531054
use super::Symbol;
10541055
use std::convert::TryInto;

src/librustdoc/clean/auto_trait.rs

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
560560
lifetime_to_bounds.entry(lifetime).or_default().extend(bounds);
561561
}
562562
WherePredicate::EqPredicate { lhs, rhs } => {
563-
match &lhs {
564-
&Type::QPath { name: ref left_name, ref self_type, ref trait_ } => {
563+
match lhs {
564+
Type::QPath { name: ref left_name, ref self_type, ref trait_ } => {
565565
let ty = &*self_type;
566566
match **trait_ {
567567
Type::ResolvedPath {
@@ -580,36 +580,30 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
580580
continue;
581581
}
582582

583-
// FIXME: Remove this scope when NLL lands
584-
{
585-
let args = &mut new_trait_path
586-
.segments
587-
.last_mut()
588-
.expect("segments were empty")
589-
.args;
590-
591-
match args {
592-
// Convert somethiung like '<T as Iterator::Item> = u8'
593-
// to 'T: Iterator<Item=u8>'
594-
&mut GenericArgs::AngleBracketed {
595-
ref mut bindings,
596-
..
597-
} => {
598-
bindings.push(TypeBinding {
599-
name: left_name.clone(),
600-
kind: TypeBindingKind::Equality { ty: rhs },
601-
});
602-
}
603-
&mut GenericArgs::Parenthesized { .. } => {
604-
existing_predicates.push(
605-
WherePredicate::EqPredicate {
606-
lhs: lhs.clone(),
607-
rhs,
608-
},
609-
);
610-
continue; // If something other than a Fn ends up
611-
// with parenthesis, leave it alone
612-
}
583+
let args = &mut new_trait_path
584+
.segments
585+
.last_mut()
586+
.expect("segments were empty")
587+
.args;
588+
589+
match args {
590+
// Convert somethiung like '<T as Iterator::Item> = u8'
591+
// to 'T: Iterator<Item=u8>'
592+
GenericArgs::AngleBracketed {
593+
ref mut bindings, ..
594+
} => {
595+
bindings.push(TypeBinding {
596+
name: left_name.clone(),
597+
kind: TypeBindingKind::Equality { ty: rhs },
598+
});
599+
}
600+
GenericArgs::Parenthesized { .. } => {
601+
existing_predicates.push(WherePredicate::EqPredicate {
602+
lhs: lhs.clone(),
603+
rhs,
604+
});
605+
continue; // If something other than a Fn ends up
606+
// with parenthesis, leave it alone
613607
}
614608
}
615609

src/librustdoc/core.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
307307
cg: codegen_options,
308308
externs,
309309
target_triple: target,
310-
// Ensure that rustdoc works even if rustc is feature-staged
311-
unstable_features: UnstableFeatures::Allow,
310+
unstable_features: UnstableFeatures::from_environment(),
312311
actually_rustdoc: true,
313312
debugging_opts: debugging_options,
314313
error_format,

src/librustdoc/html/static/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,8 +2663,8 @@ function getSearchElement() {
26632663
"Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
26642664
<code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \
26652665
and <code>const</code>.",
2666-
"Search functions by type signature (e.g., <code>vec -> usize</code> or \
2667-
<code>* -> vec</code>)",
2666+
"Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \
2667+
<code>* -&gt; vec</code>)",
26682668
"Search multiple things at once by splitting your query with comma (e.g., \
26692669
<code>str,u8</code> or <code>String,struct:Vec,test</code>)",
26702670
"You can look for items with an exact name by putting double quotes around \

0 commit comments

Comments
 (0)