Auto merge of #125379 - matthiaskrgr:rollup-6149w01, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #123122 (Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.)
 - #123492 (add pull request template asking for relevant tracking issues)
 - #125276 (Fix parsing of erroneously placed semicolons)
 - #125310 (Move ~100 tests from tests/ui to subdirs)
 - #125357 (Migrate `run-make/rustdoc-scrape-examples-multiple` to `rmake.rs`)
 - #125369 (Don't do cc detection for synthetic targets)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-05-21 19:29:59 +00:00
commit 39e02f1bd1
143 changed files with 308 additions and 97 deletions

10
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,10 @@
<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.
This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using
r? <reviewer name>
-->

View File

@ -58,9 +58,15 @@ pub fn parse_mod(
let attrs = self.parse_inner_attributes()?; let attrs = self.parse_inner_attributes()?;
let post_attr_lo = self.token.span; let post_attr_lo = self.token.span;
let mut items = ThinVec::new(); let mut items: ThinVec<P<_>> = ThinVec::new();
while let Some(item) = self.parse_item(ForceCollect::No)? {
self.maybe_consume_incorrect_semicolon(Some(&item)); // There shouldn't be any stray semicolons before or after items.
// `parse_item` consumes the appropriate semicolons so any leftover is an error.
loop {
while self.maybe_consume_incorrect_semicolon(items.last().map(|x| &**x)) {} // Eat all bad semicolons
let Some(item) = self.parse_item(ForceCollect::No)? else {
break;
};
items.push(item); items.push(item);
} }

View File

@ -17,6 +17,7 @@
}; };
use rustc_ast_pretty::pprust::where_bound_predicate_to_string; use rustc_ast_pretty::pprust::where_bound_predicate_to_string;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{ use rustc_errors::{
codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
SuggestionStyle, SuggestionStyle,
@ -31,7 +32,7 @@
use rustc_span::edition::Edition; use rustc_span::edition::Edition;
use rustc_span::hygiene::MacroKind; use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::Span; use rustc_span::{Span, DUMMY_SP};
use rustc_middle::ty; use rustc_middle::ty;
@ -2714,8 +2715,17 @@ pub(crate) fn emit_undeclared_lifetime_error(
self.suggest_introducing_lifetime( self.suggest_introducing_lifetime(
&mut err, &mut err,
Some(lifetime_ref.ident.name.as_str()), Some(lifetime_ref.ident.name.as_str()),
|err, _, span, message, suggestion| { |err, _, span, message, suggestion, span_suggs| {
err.span_suggestion(span, message, suggestion, Applicability::MaybeIncorrect); err.multipart_suggestion_with_style(
message,
std::iter::once((span, suggestion)).chain(span_suggs.clone()).collect(),
Applicability::MaybeIncorrect,
if span_suggs.is_empty() {
SuggestionStyle::ShowCode
} else {
SuggestionStyle::ShowAlways
},
);
true true
}, },
); );
@ -2726,13 +2736,20 @@ fn suggest_introducing_lifetime(
&self, &self,
err: &mut Diag<'_>, err: &mut Diag<'_>,
name: Option<&str>, name: Option<&str>,
suggest: impl Fn(&mut Diag<'_>, bool, Span, Cow<'static, str>, String) -> bool, suggest: impl Fn(
&mut Diag<'_>,
bool,
Span,
Cow<'static, str>,
String,
Vec<(Span, String)>,
) -> bool,
) { ) {
let mut suggest_note = true; let mut suggest_note = true;
for rib in self.lifetime_ribs.iter().rev() { for rib in self.lifetime_ribs.iter().rev() {
let mut should_continue = true; let mut should_continue = true;
match rib.kind { match rib.kind {
LifetimeRibKind::Generics { binder: _, span, kind } => { LifetimeRibKind::Generics { binder, span, kind } => {
// Avoid suggesting placing lifetime parameters on constant items unless the relevant // Avoid suggesting placing lifetime parameters on constant items unless the relevant
// feature is enabled. Suggest the parent item as a possible location if applicable. // feature is enabled. Suggest the parent item as a possible location if applicable.
if let LifetimeBinderKind::ConstItem = kind if let LifetimeBinderKind::ConstItem = kind
@ -2761,11 +2778,53 @@ fn suggest_introducing_lifetime(
| LifetimeBinderKind::PolyTrait | LifetimeBinderKind::PolyTrait
| LifetimeBinderKind::WhereBound | LifetimeBinderKind::WhereBound
); );
let mut rm_inner_binders: FxIndexSet<Span> = Default::default();
let (span, sugg) = if span.is_empty() { let (span, sugg) = if span.is_empty() {
let mut binder_idents: FxIndexSet<Ident> = Default::default();
binder_idents.insert(Ident::from_str(name.unwrap_or("'a")));
// We need to special case binders in the following situation:
// Change `T: for<'a> Trait<T> + 'b` to `for<'a, 'b> T: Trait<T> + 'b`
// T: for<'a> Trait<T> + 'b
// ^^^^^^^ remove existing inner binder `for<'a>`
// for<'a, 'b> T: Trait<T> + 'b
// ^^^^^^^^^^^ suggest outer binder `for<'a, 'b>`
if let LifetimeBinderKind::WhereBound = kind
&& let Some(ast::WherePredicate::BoundPredicate(
ast::WhereBoundPredicate { bounded_ty, bounds, .. },
)) = self.diag_metadata.current_where_predicate
&& bounded_ty.id == binder
{
for bound in bounds {
if let ast::GenericBound::Trait(poly_trait_ref, _) = bound
&& let span = poly_trait_ref
.span
.with_hi(poly_trait_ref.trait_ref.path.span.lo())
&& !span.is_empty()
{
rm_inner_binders.insert(span);
poly_trait_ref.bound_generic_params.iter().for_each(|v| {
binder_idents.insert(v.ident);
});
}
}
}
let binders_sugg = binder_idents.into_iter().enumerate().fold(
"".to_string(),
|mut binders, (i, x)| {
if i != 0 {
binders += ", ";
}
binders += x.as_str();
binders
},
);
let sugg = format!( let sugg = format!(
"{}<{}>{}", "{}<{}>{}",
if higher_ranked { "for" } else { "" }, if higher_ranked { "for" } else { "" },
name.unwrap_or("'a"), binders_sugg,
if higher_ranked { " " } else { "" }, if higher_ranked { " " } else { "" },
); );
(span, sugg) (span, sugg)
@ -2780,13 +2839,28 @@ fn suggest_introducing_lifetime(
let sugg = format!("{}, ", name.unwrap_or("'a")); let sugg = format!("{}, ", name.unwrap_or("'a"));
(span, sugg) (span, sugg)
}; };
if higher_ranked { if higher_ranked {
let message = Cow::from(format!( let message = Cow::from(format!(
"consider making the {} lifetime-generic with a new `{}` lifetime", "consider making the {} lifetime-generic with a new `{}` lifetime",
kind.descr(), kind.descr(),
name.unwrap_or("'a"), name.unwrap_or("'a"),
)); ));
should_continue = suggest(err, true, span, message, sugg); should_continue = suggest(
err,
true,
span,
message,
sugg,
if !rm_inner_binders.is_empty() {
rm_inner_binders
.into_iter()
.map(|v| (v, "".to_string()))
.collect::<Vec<_>>()
} else {
vec![]
},
);
err.note_once( err.note_once(
"for more information on higher-ranked polymorphism, visit \ "for more information on higher-ranked polymorphism, visit \
https://doc.rust-lang.org/nomicon/hrtb.html", https://doc.rust-lang.org/nomicon/hrtb.html",
@ -2794,10 +2868,10 @@ fn suggest_introducing_lifetime(
} else if let Some(name) = name { } else if let Some(name) = name {
let message = let message =
Cow::from(format!("consider introducing lifetime `{name}` here")); Cow::from(format!("consider introducing lifetime `{name}` here"));
should_continue = suggest(err, false, span, message, sugg); should_continue = suggest(err, false, span, message, sugg, vec![]);
} else { } else {
let message = Cow::from("consider introducing a named lifetime parameter"); let message = Cow::from("consider introducing a named lifetime parameter");
should_continue = suggest(err, false, span, message, sugg); should_continue = suggest(err, false, span, message, sugg, vec![]);
} }
} }
LifetimeRibKind::Item | LifetimeRibKind::ConstParamTy => break, LifetimeRibKind::Item | LifetimeRibKind::ConstParamTy => break,
@ -3033,11 +3107,11 @@ fn add_missing_lifetime_specifiers_label(
self.suggest_introducing_lifetime( self.suggest_introducing_lifetime(
err, err,
None, None,
|err, higher_ranked, span, message, intro_sugg| { |err, higher_ranked, span, message, intro_sugg, _| {
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
message, message,
std::iter::once((span, intro_sugg)) std::iter::once((span, intro_sugg))
.chain(spans_suggs.iter().cloned()) .chain(spans_suggs.clone())
.collect(), .collect(),
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
@ -3161,11 +3235,11 @@ fn add_missing_lifetime_specifiers_label(
self.suggest_introducing_lifetime( self.suggest_introducing_lifetime(
err, err,
None, None,
|err, higher_ranked, span, message, intro_sugg| { |err, higher_ranked, span, message, intro_sugg, _| {
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
message, message,
std::iter::once((span, intro_sugg)) std::iter::once((span, intro_sugg))
.chain(spans_suggs.iter().cloned()) .chain(spans_suggs.clone())
.collect(), .collect(),
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
@ -3309,7 +3383,6 @@ fn mk_where_bound_predicate(
poly_trait_ref: &ast::PolyTraitRef, poly_trait_ref: &ast::PolyTraitRef,
ty: &Ty, ty: &Ty,
) -> Option<ast::WhereBoundPredicate> { ) -> Option<ast::WhereBoundPredicate> {
use rustc_span::DUMMY_SP;
let modified_segments = { let modified_segments = {
let mut segments = path.segments.clone(); let mut segments = path.segments.clone();
let [preceding @ .., second_last, last] = segments.as_mut_slice() else { let [preceding @ .., second_last, last] = segments.as_mut_slice() else {

View File

@ -80,8 +80,5 @@ fn create_synthetic_target(
customize(spec_map); customize(spec_map);
std::fs::write(&path, serde_json::to_vec_pretty(&spec).unwrap()).unwrap(); std::fs::write(&path, serde_json::to_vec_pretty(&spec).unwrap()).unwrap();
let target = TargetSelection::create_synthetic(&name, path.to_str().unwrap()); TargetSelection::create_synthetic(&name, path.to_str().unwrap())
crate::utils::cc_detect::find_target(builder, target);
target
} }

View File

@ -234,7 +234,6 @@ run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile run-make/rustc-macro-dep-files/Makefile
run-make/rustdoc-io-error/Makefile run-make/rustdoc-io-error/Makefile
run-make/rustdoc-scrape-examples-macros/Makefile run-make/rustdoc-scrape-examples-macros/Makefile
run-make/rustdoc-scrape-examples-multiple/Makefile
run-make/rustdoc-verify-output-files/Makefile run-make/rustdoc-verify-output-files/Makefile
run-make/rustdoc-with-output-option/Makefile run-make/rustdoc-with-output-option/Makefile
run-make/rustdoc-with-short-out-dir-option/Makefile run-make/rustdoc-with-short-out-dir-option/Makefile

View File

@ -16,7 +16,7 @@
// FIXME: The following limits should be reduced eventually. // FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: usize = 1676; const ISSUES_ENTRY_LIMIT: usize = 1676;
const ROOT_ENTRY_LIMIT: usize = 859; const ROOT_ENTRY_LIMIT: usize = 757;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files "rs", // test source files

View File

@ -1,5 +0,0 @@
deps := ex ex2
include ./scrape.mk
all: scrape

View File

@ -0,0 +1,6 @@
#[path = "../rustdoc-scrape-examples-remap/scrape.rs"]
mod scrape;
fn main() {
scrape::scrape(&[]);
}

View File

@ -1,21 +0,0 @@
include ../tools.mk
OUTPUT_DIR := "$(TMPDIR)/rustdoc"
$(TMPDIR)/%.calls: $(TMPDIR)/libfoobar.rmeta
$(RUSTDOC) examples/$*.rs --crate-name $* --crate-type bin --output $(OUTPUT_DIR) \
--extern foobar=$(TMPDIR)/libfoobar.rmeta \
-Z unstable-options \
--scrape-examples-output-path $@ \
--scrape-examples-target-crate foobar \
$(extra_flags)
$(TMPDIR)/lib%.rmeta: src/lib.rs
$(RUSTC) src/lib.rs --crate-name $* --crate-type lib --emit=metadata
scrape: $(foreach d,$(deps),$(TMPDIR)/$(d).calls)
$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \
-Z unstable-options \
$(foreach d,$(deps),--with-examples $(TMPDIR)/$(d).calls)
$(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs

View File

@ -1,5 +1,5 @@
error[E0603]: static `j` is private error[E0603]: static `j` is private
--> $DIR/xcrate-private-by-default.rs:23:29 --> $DIR/private-by-default.rs:23:29
| |
LL | static_priv_by_default::j; LL | static_priv_by_default::j;
| ^ private static | ^ private static
@ -11,7 +11,7 @@ LL | static j: isize = 0;
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error[E0603]: function `k` is private error[E0603]: function `k` is private
--> $DIR/xcrate-private-by-default.rs:25:29 --> $DIR/private-by-default.rs:25:29
| |
LL | static_priv_by_default::k; LL | static_priv_by_default::k;
| ^ private function | ^ private function
@ -23,7 +23,7 @@ LL | fn k() {}
| ^^^^^^ | ^^^^^^
error[E0603]: unit struct `l` is private error[E0603]: unit struct `l` is private
--> $DIR/xcrate-private-by-default.rs:27:29 --> $DIR/private-by-default.rs:27:29
| |
LL | static_priv_by_default::l; LL | static_priv_by_default::l;
| ^ private unit struct | ^ private unit struct
@ -35,7 +35,7 @@ LL | struct l;
| ^^^^^^^^ | ^^^^^^^^
error[E0603]: enum `m` is private error[E0603]: enum `m` is private
--> $DIR/xcrate-private-by-default.rs:29:35 --> $DIR/private-by-default.rs:29:35
| |
LL | foo::<static_priv_by_default::m>(); LL | foo::<static_priv_by_default::m>();
| ^ private enum | ^ private enum
@ -47,7 +47,7 @@ LL | enum m {}
| ^^^^^^ | ^^^^^^
error[E0603]: type alias `n` is private error[E0603]: type alias `n` is private
--> $DIR/xcrate-private-by-default.rs:31:35 --> $DIR/private-by-default.rs:31:35
| |
LL | foo::<static_priv_by_default::n>(); LL | foo::<static_priv_by_default::n>();
| ^ private type alias | ^ private type alias
@ -59,7 +59,7 @@ LL | type n = isize;
| ^^^^^^ | ^^^^^^
error[E0603]: module `foo` is private error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:35:29 --> $DIR/private-by-default.rs:35:29
| |
LL | static_priv_by_default::foo::a; LL | static_priv_by_default::foo::a;
| ^^^ - static `a` is not publicly re-exported | ^^^ - static `a` is not publicly re-exported
@ -73,7 +73,7 @@ LL | mod foo {
| ^^^^^^^ | ^^^^^^^
error[E0603]: module `foo` is private error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:37:29 --> $DIR/private-by-default.rs:37:29
| |
LL | static_priv_by_default::foo::b; LL | static_priv_by_default::foo::b;
| ^^^ - function `b` is not publicly re-exported | ^^^ - function `b` is not publicly re-exported
@ -87,7 +87,7 @@ LL | mod foo {
| ^^^^^^^ | ^^^^^^^
error[E0603]: module `foo` is private error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:39:29 --> $DIR/private-by-default.rs:39:29
| |
LL | static_priv_by_default::foo::c; LL | static_priv_by_default::foo::c;
| ^^^ - unit struct `c` is not publicly re-exported | ^^^ - unit struct `c` is not publicly re-exported
@ -101,7 +101,7 @@ LL | mod foo {
| ^^^^^^^ | ^^^^^^^
error[E0603]: module `foo` is private error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:41:35 --> $DIR/private-by-default.rs:41:35
| |
LL | foo::<static_priv_by_default::foo::d>(); LL | foo::<static_priv_by_default::foo::d>();
| ^^^ - enum `d` is not publicly re-exported | ^^^ - enum `d` is not publicly re-exported
@ -115,7 +115,7 @@ LL | mod foo {
| ^^^^^^^ | ^^^^^^^
error[E0603]: module `foo` is private error[E0603]: module `foo` is private
--> $DIR/xcrate-private-by-default.rs:43:35 --> $DIR/private-by-default.rs:43:35
| |
LL | foo::<static_priv_by_default::foo::e>(); LL | foo::<static_priv_by_default::foo::e>();
| ^^^ - type alias `e` is not publicly re-exported | ^^^ - type alias `e` is not publicly re-exported

View File

@ -1,5 +1,5 @@
error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields` error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields`
--> $DIR/xcrate-unit-struct.rs:9:13 --> $DIR/unit-struct.rs:9:13
| |
LL | let _ = xcrate_unit_struct::StructWithFields; LL | let _ = xcrate_unit_struct::StructWithFields;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }`
@ -10,7 +10,7 @@ LL | pub struct StructWithFields {
| --------------------------- `xcrate_unit_struct::StructWithFields` defined here | --------------------------- `xcrate_unit_struct::StructWithFields` defined here
error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields` error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields`
--> $DIR/xcrate-unit-struct.rs:11:13 --> $DIR/unit-struct.rs:11:13
| |
LL | let _ = xcrate_unit_struct::StructWithPrivFields; LL | let _ = xcrate_unit_struct::StructWithPrivFields;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,11 +1,11 @@
error[E0601]: `main` function not found in crate `main_wrong_location` error[E0601]: `main` function not found in crate `wrong_location`
--> $DIR/main-wrong-location.rs:5:2 --> $DIR/wrong-location.rs:5:2
| |
LL | } LL | }
| ^ the main function must be defined at the crate level (in `$DIR/main-wrong-location.rs`) | ^ the main function must be defined at the crate level (in `$DIR/wrong-location.rs`)
| |
note: here is a function named `main` note: here is a function named `main`
--> $DIR/main-wrong-location.rs:4:5 --> $DIR/wrong-location.rs:4:5
| |
LL | fn main() { } LL | fn main() { }
| ^^^^^^^^^ | ^^^^^^^^^

View File

@ -1,5 +1,5 @@
error[E0580]: `main` function has wrong type error[E0580]: `main` function has wrong type
--> $DIR/main-wrong-type.rs:6:1 --> $DIR/wrong-type.rs:6:1
| |
LL | fn main(foo: S) { LL | fn main(foo: S) {
| ^^^^^^^^^^^^^^^ incorrect number of function parameters | ^^^^^^^^^^^^^^^ incorrect number of function parameters

View File

@ -0,0 +1,28 @@
#![allow(dead_code)]
trait Trait1<T>
where T: for<'a> Trait1<T> + 'b { } //~ ERROR use of undeclared lifetime name `'b`
trait Trait2<T>
where
T: B<'b> + for<'a> A<'a>, //~ ERROR use of undeclared lifetime name `'b`
{
}
trait Trait3<T>
where
T: B<'b> + for<'a> A<'a> + 'c {}
//~^ ERROR use of undeclared lifetime name `'b`
//~| ERROR use of undeclared lifetime name `'c`
trait Trait4<T>
where
T: for<'a> A<'a> + 'x + for<'b> B<'b>, //~ ERROR use of undeclared lifetime name `'x`
{
}
trait A<'a> {}
trait B<'a> {}
fn main() {}

View File

@ -0,0 +1,92 @@
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:4:32
|
LL | where T: for<'a> Trait1<T> + 'b { }
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL - where T: for<'a> Trait1<T> + 'b { }
LL + where for<'b, 'a> T: Trait1<T> + 'b { }
|
help: consider introducing lifetime `'b` here
|
LL | trait Trait1<'b, T>
| +++
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:8:10
|
LL | T: B<'b> + for<'a> A<'a>,
| ^^ undeclared lifetime
|
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL | T: for<'b> B<'b> + for<'a> A<'a>,
| +++++++
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL - T: B<'b> + for<'a> A<'a>,
LL + for<'b, 'a> T: B<'b> + A<'a>,
|
help: consider introducing lifetime `'b` here
|
LL | trait Trait2<'b, T>
| +++
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:14:10
|
LL | T: B<'b> + for<'a> A<'a> + 'c {}
| ^^ undeclared lifetime
|
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL | T: for<'b> B<'b> + for<'a> A<'a> + 'c {}
| +++++++
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL - T: B<'b> + for<'a> A<'a> + 'c {}
LL + for<'b, 'a> T: B<'b> + A<'a> + 'c {}
|
help: consider introducing lifetime `'b` here
|
LL | trait Trait3<'b, T>
| +++
error[E0261]: use of undeclared lifetime name `'c`
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:14:32
|
LL | T: B<'b> + for<'a> A<'a> + 'c {}
| ^^ undeclared lifetime
|
help: consider making the bound lifetime-generic with a new `'c` lifetime
|
LL - T: B<'b> + for<'a> A<'a> + 'c {}
LL + for<'c, 'a> T: B<'b> + A<'a> + 'c {}
|
help: consider introducing lifetime `'c` here
|
LL | trait Trait3<'c, T>
| +++
error[E0261]: use of undeclared lifetime name `'x`
--> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:20:24
|
LL | T: for<'a> A<'a> + 'x + for<'b> B<'b>,
| ^^ undeclared lifetime
|
help: consider making the bound lifetime-generic with a new `'x` lifetime
|
LL - T: for<'a> A<'a> + 'x + for<'b> B<'b>,
LL + for<'x, 'a, 'b> T: A<'a> + 'x + B<'b>,
|
help: consider introducing lifetime `'x` here
|
LL | trait Trait4<'x, T>
| +++
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0261`.

View File

@ -1,11 +1,11 @@
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:4:32 --> $DIR/always-extern.rs:4:32
| |
LL | extern "rust-intrinsic" fn foo(&self); LL | extern "rust-intrinsic" fn foo(&self);
| ^^^ | ^^^
error[E0093]: unrecognized intrinsic function: `hello` error[E0093]: unrecognized intrinsic function: `hello`
--> $DIR/intrinsics-always-extern.rs:12:28 --> $DIR/always-extern.rs:12:28
| |
LL | extern "rust-intrinsic" fn hello() { LL | extern "rust-intrinsic" fn hello() {
| ^^^^^ unrecognized intrinsic | ^^^^^ unrecognized intrinsic
@ -13,7 +13,7 @@ LL | extern "rust-intrinsic" fn hello() {
= help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:8:43 --> $DIR/always-extern.rs:8:43
| |
LL | extern "rust-intrinsic" fn foo(&self) { LL | extern "rust-intrinsic" fn foo(&self) {
| ___________________________________________^ | ___________________________________________^
@ -21,7 +21,7 @@ LL | | }
| |_____^ | |_____^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:12:36 --> $DIR/always-extern.rs:12:36
| |
LL | extern "rust-intrinsic" fn hello() { LL | extern "rust-intrinsic" fn hello() {
| ____________________________________^ | ____________________________________^

View File

@ -1,5 +1,5 @@
error: unused variable: `x` error: unused variable: `x`
--> $DIR/lint-group-forbid-always-trumps-cli.rs:4:9 --> $DIR/group-forbid-always-trumps-cli.rs:4:9
| |
LL | let x = 1; LL | let x = 1;
| ^ help: if this is intentional, prefix it with an underscore: `_x` | ^ help: if this is intentional, prefix it with an underscore: `_x`

View File

@ -0,0 +1,6 @@
// Regression test for issue #124935
// Tests that we do not erroneously emit an error about
// missing main function when the mod starts with a `;`
; //~ ERROR expected item, found `;`
fn main() { }

View File

@ -0,0 +1,8 @@
error: expected item, found `;`
--> $DIR/fn-no-semicolon-issue-124935-semi-after-item.rs:5:1
|
LL | ;
| ^ help: remove this semicolon
error: aborting due to 1 previous error

View File

@ -1,3 +1,3 @@
#![allow(unused_variables)]; //~ ERROR expected item, found `;` #![allow(unused_variables)]; //~ ERROR expected item, found `;`
//~^ ERROR `main` function
fn foo() {} fn foo() {}
//~^ ERROR `main` function

View File

@ -5,10 +5,10 @@ LL | #![allow(unused_variables)];
| ^ help: remove this semicolon | ^ help: remove this semicolon
error[E0601]: `main` function not found in crate `issue_49040` error[E0601]: `main` function not found in crate `issue_49040`
--> $DIR/issue-49040.rs:1:29 --> $DIR/issue-49040.rs:2:12
| |
LL | #![allow(unused_variables)]; LL | fn foo() {}
| ^ consider adding a `main` function to `$DIR/issue-49040.rs` | ^ consider adding a `main` function to `$DIR/issue-49040.rs`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -0,0 +1,5 @@
// Regression test for issue #124935
// Tests that we still emit an error after an item.
fn main() { }
; //~ ERROR expected item, found `;`

View File

@ -0,0 +1,10 @@
error: expected item, found `;`
--> $DIR/missing-main-issue-124935-semi-after-item.rs:5:1
|
LL | ;
| ^ help: remove this semicolon
|
= help: function declarations are not followed by a semicolon
error: aborting due to 1 previous error

View File

@ -3,10 +3,7 @@
#![allow(unused_parens)] #![allow(unused_parens)]
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
#![allow(dead_code)] #![allow(dead_code)]
//@ exec-env:RUST_MIN_STACK=16000000 #![cfg_attr(rustfmt, rustfmt::skip)]
//@ rustc-env:RUST_MIN_STACK=16000000
//
// Big stack is needed for pretty printing, a little sad...
static a: isize = static a: isize =
((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((

Some files were not shown because too many files have changed in this diff Show More