Skip to content

Commit

Permalink
Auto merge of rust-lang#93308 - matthiaskrgr:rollup-9tc73ft, r=matthi…
Browse files Browse the repository at this point in the history
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#93250 (Remove deduplication of early lints)
 - rust-lang#93286 (Add white-space: nowrap to links in the sidebar)
 - rust-lang#93291 (minor fix for rust-lang#93231)
 - rust-lang#93300 (make Windows abort_internal Miri-compatible)
 - rust-lang#93303 (Fix ICE when parsing bad turbofish with lifetime argument)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jan 25, 2022
2 parents 8cdb3cd + 086be2b commit c54dfee
Show file tree
Hide file tree
Showing 31 changed files with 428 additions and 46 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub enum ExternDepSpec {

// This could be a closure, but then implementing derive trait
// becomes hacky (and it gets allocated).
#[derive(PartialEq, Debug)]
#[derive(Debug)]
pub enum BuiltinLintDiagnostics {
Normal,
AbsPathWithModule(Span),
Expand All @@ -309,7 +309,6 @@ pub enum BuiltinLintDiagnostics {

/// Lints that are buffered up early on in the `Session` before the
/// `LintLevels` is calculated.
#[derive(PartialEq)]
pub struct BufferedEarlyLint {
/// The span of code that we are linting on.
pub span: MultiSpan,
Expand All @@ -336,9 +335,7 @@ pub struct LintBuffer {
impl LintBuffer {
pub fn add_early_lint(&mut self, early_lint: BufferedEarlyLint) {
let arr = self.map.entry(early_lint.node_id).or_default();
if !arr.contains(&early_lint) {
arr.push(early_lint);
}
arr.push(early_lint);
}

pub fn add_lint(
Expand Down
30 changes: 12 additions & 18 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,28 +731,22 @@ impl<'a> Parser<'a> {
match x {
Ok((_, _, false)) => {
if self.eat(&token::Gt) {
let turbo_err = e.span_suggestion_verbose(
e.span_suggestion_verbose(
binop.span.shrink_to_lo(),
TURBOFISH_SUGGESTION_STR,
"::".to_string(),
Applicability::MaybeIncorrect,
);
if self.check(&TokenKind::Semi) {
turbo_err.emit();
*expr = self.mk_expr_err(expr.span);
return Ok(());
} else {
match self.parse_expr() {
Ok(_) => {
turbo_err.emit();
*expr = self
.mk_expr_err(expr.span.to(self.prev_token.span));
return Ok(());
}
Err(mut err) => {
turbo_err.cancel();
err.cancel();
}
)
.emit();
match self.parse_expr() {
Ok(_) => {
*expr =
self.mk_expr_err(expr.span.to(self.prev_token.span));
return Ok(());
}
Err(mut err) => {
*expr = self.mk_expr_err(expr.span);
err.cancel();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ impl<'a> Parser<'a> {
self.parse_block_expr(label, lo, BlockCheckMode::Default, attrs)
} else if !ate_colon && (self.check(&TokenKind::Comma) || self.check(&TokenKind::Gt)) {
// We're probably inside of a `Path<'a>` that needs a turbofish, so suppress the
// "must be followed by a colon" error.
// "must be followed by a colon" error, and the "expected one of" error.
self.diagnostic().delay_span_bug(lo, "this label wasn't parsed correctly");
consume_colon = false;
Ok(self.mk_expr_err(lo))
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
#[allow(unreachable_code)]
pub fn abort_internal() -> ! {
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
#[cfg(not(miri))] // inline assembly does not work in Miri
unsafe {
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ nav.sub {
overflow: hidden;
}

.sidebar-links a {
white-space: nowrap;
}

.sidebar h2 {
border-bottom: none;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ a.result-keyword:focus { background-color: #afc6e4; }
.sidebar a.current.traitalias { color: #4b349e; }
.sidebar a.current.fn,
.sidebar a.current.method,
.sidebar a.current.tymethod { color: #32d479; }
.sidebar a.current.tymethod { color: #a67736; }
.sidebar a.current.keyword { color: #356da4; }

nav.main .current {
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ assert-text: (".sidebar > .location", "Module sub_sub_module")
assert-false: ".sidebar-elems .crate"
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + .item-table .item-left > a", "foo")

// Links to trait implementations in the sidebar should not wrap even if they are long.
goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html
assert-property: (".sidebar-links a", {"offsetHeight": 29})
6 changes: 6 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ pub mod too_long {
pub fn foo(&self) {}
}
}

pub struct HasALongTraitWithParams {}

pub trait LongTraitWithParamsBananaBananaBanana<T> {}

impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
#![cfg_attr(foo, crate_type="bin")]
//~^ERROR `crate_type` within
//~| WARN this was previously accepted
//~|ERROR `crate_type` within
//~| WARN this was previously accepted
#![cfg_attr(foo, crate_name="bar")]
//~^ERROR `crate_name` within
//~| WARN this was previously accepted
//~|ERROR `crate_name` within
//~| WARN this was previously accepted

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,31 @@ LL | #![deny(warnings)]
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>

error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:8:18
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
|
LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>

error: aborting due to 2 previous errors
error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18
|
LL | #![cfg_attr(foo, crate_type="bin")]
| ^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>

error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
|
LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>

error: aborting due to 4 previous errors

4 changes: 4 additions & 0 deletions src/test/ui/parser/issues/issue-93282.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
f<'a,>
//~^ ERROR expected
}
13 changes: 13 additions & 0 deletions src/test/ui/parser/issues/issue-93282.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error: expected one of `.`, `:`, `;`, `?`, `for`, `loop`, `while`, `{`, `}`, or an operator, found `,`
--> $DIR/issue-93282.rs:2:9
|
LL | f<'a,>
| ^ expected one of 10 possible tokens
|
help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
|
LL | f::<'a,>
| ++

error: aborting due to previous error

9 changes: 8 additions & 1 deletion src/test/ui/proc-macro/issue-73933-procedural-masquerade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
extern crate test_macros;

#[derive(Print)]
enum ProceduralMasqueradeDummyType { //~ ERROR using
enum ProceduralMasqueradeDummyType {
//~^ ERROR using
//~| WARN this was previously
//~| ERROR using
//~| WARN this was previously
//~| ERROR using
//~| WARN this was previously
//~| ERROR using
//~| WARN this was previously
Input
}
Expand Down
65 changes: 64 additions & 1 deletion src/test/ui/proc-macro/issue-73933-procedural-masquerade.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,37 @@ LL | enum ProceduralMasqueradeDummyType {
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

error: aborting due to previous error
error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

error: aborting due to 4 previous errors

Future incompatibility report: Future breakage diagnostic:
error: using `procedural-masquerade` crate
Expand All @@ -23,3 +53,36 @@ LL | enum ProceduralMasqueradeDummyType {
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

Future breakage diagnostic:
error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

Future breakage diagnostic:
error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

Future breakage diagnostic:
error: using `procedural-masquerade` crate
--> $DIR/issue-73933-procedural-masquerade.rs:7:6
|
LL | enum ProceduralMasqueradeDummyType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. Versions of this crate below 0.1.7 will eventually stop compiling.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
stream: TokenStream [
Ident {
ident: "Input",
span: #0 bytes(173..178),
span: #0 bytes(315..320),
},
],
span: #0 bytes(121..180),
span: #0 bytes(121..322),
},
]
14 changes: 13 additions & 1 deletion src/test/ui/proc-macro/issue-75930-derive-cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@ LL | #[derive(Print)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>

warning: 1 warning emitted
warning: derive helper attribute is used before it is introduced
--> $DIR/issue-75930-derive-cfg.rs:19:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
...
LL | #[derive(Print)]
| ----- the attribute is introduced here
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>

warning: 2 warnings emitted

14 changes: 14 additions & 0 deletions src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,28 @@ crate mod foo {
use crate::foo::{bar::{baz::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

use crate::foo::{bar::{XX, baz::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

use crate::foo::{bar::{baz::{}, baz1::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

fn main() {
}
14 changes: 14 additions & 0 deletions src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,28 @@ crate mod foo {
use foo::{bar::{baz::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

use foo::{bar::{XX, baz::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

use foo::{bar::{baz::{}, baz1::{}}};
//~^ ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition
//~| ERROR absolute paths must start with
//~| WARN this is accepted in the current edition

fn main() {
}
Loading

0 comments on commit c54dfee

Please sign in to comment.