Skip to content

Rollup of 6 pull requests #105008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
40a0533
small method code cleanup
lcnr Nov 25, 2022
a215b7b
remove `TypeError::ObjectUnsafeCoercion`
lcnr Nov 25, 2022
4f07008
remove confusing comment
lcnr Nov 25, 2022
6436c34
Remove SelectionContext::infcx() in favor of field access
compiler-errors Nov 25, 2022
61e185b
simplify some binder shifting logic
compiler-errors Nov 26, 2022
881862e
Rename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaning
WaffleLapkin Nov 22, 2022
d0c7ed3
Remove `ty::ClosureKind::from_def_id`
WaffleLapkin Nov 22, 2022
4b6e1d1
Add `TyCtxt::is_fn_trait`
WaffleLapkin Nov 22, 2022
fa89f53
Simplify `ty::ClosureKind::extends`
WaffleLapkin Nov 22, 2022
ea44792
micro doc fixes
WaffleLapkin Nov 22, 2022
5ba0056
Use `TyCtxt::is_fn_trait` is a couple more places
WaffleLapkin Nov 22, 2022
5b0e80e
Stabilize native library modifier `verbatim`
petrochenkov Nov 13, 2022
99c3dda
fix type
lcnr Nov 27, 2022
ab04080
Change multiline span ASCII art visual order
estebank Nov 23, 2022
6f64432
Tweak output
estebank Nov 23, 2022
136ffa2
fix clippy tests
estebank Nov 28, 2022
f33d409
Rollup merge of #104360 - petrochenkov:stabverb, r=TaKO8Ki
Dylan-DPC Nov 28, 2022
f90484d
Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errors
Dylan-DPC Nov 28, 2022
79fe15c
Rollup merge of #104795 - estebank:multiline-spans, r=TaKO8Ki
Dylan-DPC Nov 28, 2022
8a84dd8
Rollup merge of #104890 - lcnr:small-cleanup, r=fee1-dead
Dylan-DPC Nov 28, 2022
9178bc0
Rollup merge of #104907 - compiler-errors:selcx-infcx, r=oli-obk
Dylan-DPC Nov 28, 2022
d5de2a8
Rollup merge of #104927 - compiler-errors:binder-shifting-logic, r=ol…
Dylan-DPC Nov 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change multiline span ASCII art visual order
  • Loading branch information
estebank committed Nov 28, 2022
commit ab04080b56448c4bcd7e5b79215a1097e1a9b217
8 changes: 7 additions & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2300,8 +2300,14 @@ impl FileWithAnnotatedLines {
}

let mut max_depth = 0; // max overlapping multiline spans
for (file, ann) in multiline_annotations {
for (_, ann) in &multiline_annotations {
max_depth = max(max_depth, ann.depth);
}
// Change order of multispan depth to minimize the number of overlaps in the ASCII art.
for (_, a) in multiline_annotations.iter_mut() {
a.depth = max_depth - a.depth + 1;
}
for (file, ann) in multiline_annotations {
let mut end_ann = ann.as_end();
if !ann.overlaps_exactly {
// avoid output like
Expand Down
108 changes: 54 additions & 54 deletions compiler/rustc_expand/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ error: foo
--> test.rs:3:3
|
3 | X0 Y0
| ____^__-
| | ___|
| ___^__-
| |___|
| ||
4 | || X1 Y1
5 | || X2 Y2
| ||____^__- `Y` is a good letter too
| |____|
| |_____|
| `X` is a good letter

"#,
Expand Down Expand Up @@ -311,12 +311,12 @@ error: foo
--> test.rs:3:3
|
3 | X0 Y0
| ____^__-
| | ___|
| ___^__-
| |___|
| ||
4 | || Y1 X1
| ||____-__^ `X` is a good letter
| |_____|
| |____|
| `Y` is a good letter too

"#,
Expand Down Expand Up @@ -351,13 +351,13 @@ error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^
4 | | X1 Y1 Z1
| |_________-
| _______^
4 | | X1 Y1 Z1
| | _________-
5 | || X2 Y2 Z2
| ||____^ `X` is a good letter
6 | | X3 Y3 Z3
| |_____- `Y` is a good letter too
6 | | X3 Y3 Z3
| |____- `Y` is a good letter too

"#,
);
Expand Down Expand Up @@ -395,15 +395,15 @@ error: foo
--> test.rs:3:3
|
3 | X0 Y0 Z0
| _____^__-__-
| | ____|__|
| || ___|
| ___^__-__-
| |___|__|
| ||___|
| |||
4 | ||| X1 Y1 Z1
5 | ||| X2 Y2 Z2
| |||____^__-__- `Z` label
| ||____|__|
| |____| `Y` is a good letter too
| ||_____|__|
| |______| `Y` is a good letter too
| `X` is a good letter

"#,
Expand Down Expand Up @@ -487,17 +487,17 @@ error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^
4 | | X1 Y1 Z1
| |____^_-
| _______^
4 | | X1 Y1 Z1
| | ____^_-
| ||____|
| | `X` is a good letter
5 | | X2 Y2 Z2
| |____-______- `Y` is a good letter too
| ____|
| |
6 | | X3 Y3 Z3
| |________- `Z`
| | `X` is a good letter
5 | | X2 Y2 Z2
| |___-______- `Y` is a good letter too
| ___|
| |
6 | | X3 Y3 Z3
| |_______- `Z`

"#,
);
Expand Down Expand Up @@ -570,14 +570,14 @@ error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^
4 | | X1 Y1 Z1
| |____^____-
| _______^
4 | | X1 Y1 Z1
| | ____^____-
| ||____|
| | `X` is a good letter
5 | | X2 Y2 Z2
6 | | X3 Y3 Z3
| |___________- `Y` is a good letter too
| | `X` is a good letter
5 | | X2 Y2 Z2
6 | | X3 Y3 Z3
| |__________- `Y` is a good letter too

"#,
);
Expand Down Expand Up @@ -941,18 +941,18 @@ error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^
4 | | X1 Y1 Z1
| |____^____-
| _______^
4 | | X1 Y1 Z1
| | ____^____-
| ||____|
| | `X` is a good letter
5 | | 1
6 | | 2
7 | | 3
... |
15 | | X2 Y2 Z2
16 | | X3 Y3 Z3
| |___________- `Y` is a good letter too
| | `X` is a good letter
5 | | 1
6 | | 2
7 | | 3
... |
15 | | X2 Y2 Z2
16 | | X3 Y3 Z3
| |__________- `Y` is a good letter too

"#,
);
Expand Down Expand Up @@ -996,21 +996,21 @@ error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^
4 | | 1
5 | | 2
6 | | 3
7 | | X1 Y1 Z1
| |_________-
| _______^
4 | | 1
5 | | 2
6 | | 3
7 | | X1 Y1 Z1
| | _________-
8 | || 4
9 | || 5
10 | || 6
11 | || X2 Y2 Z2
| ||__________- `Z` is a good letter too
... |
15 | | 10
16 | | X3 Y3 Z3
| |_______^ `Y` is a good letter
... |
15 | | 10
16 | | X3 Y3 Z3
| |________^ `Y` is a good letter

"#,
);
Expand Down
24 changes: 12 additions & 12 deletions src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ error[E0308]: mismatched types
LL | #[alloc_error_handler]
| ---------------------- in this procedural macro expansion
LL | fn oom(
| _^
| |_|
| __^
| | _|
| ||
LL | || info: &Layout,
LL | || ) -> ()
| ||_______- arguments to this function are incorrect
LL | | {
LL | | loop {}
LL | | }
| |__^ expected `&Layout`, found struct `Layout`
LL | | {
LL | | loop {}
LL | | }
| |_^ expected `&Layout`, found struct `Layout`
|
note: function defined here
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
Expand All @@ -30,16 +30,16 @@ error[E0308]: mismatched types
LL | #[alloc_error_handler]
| ---------------------- in this procedural macro expansion
LL | fn oom(
| _^
| |_|
| __^
| | _|
| ||
LL | || info: &Layout,
LL | || ) -> ()
| ||_______^ expected `!`, found `()`
LL | | {
LL | | loop {}
LL | | }
| |__- expected `!` because of return type
LL | | {
LL | | loop {}
LL | | }
| |_- expected `!` because of return type
|
= note: expected type `!`
found unit type `()`
Expand Down
24 changes: 12 additions & 12 deletions src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ error[E0308]: mismatched types
LL | #[alloc_error_handler]
| ---------------------- in this procedural macro expansion
LL | fn oom(
| _^
| |_|
| __^
| | _|
| ||
LL | || info: Layout,
LL | || ) {
| || -
| ||_|
| | arguments to this function are incorrect
LL | | loop {}
LL | | }
| |__^ expected struct `Layout`, found struct `core::alloc::Layout`
| | arguments to this function are incorrect
LL | | loop {}
LL | | }
| |_^ expected struct `Layout`, found struct `core::alloc::Layout`
|
= note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
note: struct `core::alloc::Layout` is defined in crate `core`
Expand Down Expand Up @@ -42,17 +42,17 @@ error[E0308]: mismatched types
LL | #[alloc_error_handler]
| ---------------------- in this procedural macro expansion
LL | fn oom(
| _^
| |_|
| __^
| | _|
| ||
LL | || info: Layout,
LL | || ) {
| || ^
| ||_|
| | expected `!`, found `()`
LL | | loop {}
LL | | }
| |__- expected `!` because of return type
| | expected `!`, found `()`
LL | | loop {}
LL | | }
| |_- expected `!` because of return type
|
= note: expected type `!`
found unit type `()`
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/inference/deref-suggestion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,19 @@ error[E0308]: `if` and `else` have incompatible types
--> $DIR/deref-suggestion.rs:69:12
|
LL | let val = if true {
| _______________-
LL | | *a
| | -- expected because of this
LL | | } else if true {
| |____________^
| ________________-
LL | | *a
| | -- expected because of this
LL | | } else if true {
| | ____________^
LL | ||
LL | || b
LL | || } else {
LL | || &0
LL | || };
| || ^
| ||_____|
| |______`if` and `else` have incompatible types
| |_____`if` and `else` have incompatible types
| expected `i32`, found `&{integer}`

error: aborting due to 13 previous errors
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/issues/issue-13497-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ error[E0515]: cannot return value referencing local variable `rawLines`
--> $DIR/issue-13497-2.rs:3:5
|
LL | rawLines
| _____^
| |_____|
| ______^
| | _____|
| ||
LL | || .iter().map(|l| l.trim()).collect()
| ||_______________-___________________________^ returns a value referencing data owned by the current function
| |________________|
| |_______________|
| `rawLines` is borrowed here

error: aborting due to previous error
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/lint/suggestions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ warning: variable does not need to be mutable
--> $DIR/suggestions.rs:54:13
|
LL | let mut
| _____________^
| |_____________|
| ______________^
| | _____________|
| ||
LL | || b = 1;
| ||____________-^
| |____________|
| |_____________|
| help: remove this `mut`

error: const items should never be `#[no_mangle]`
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/return/issue-86188-return-not-in-fn-body.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ LL | | }
error[E0572]: return statement outside of function body
--> $DIR/issue-86188-return-not-in-fn-body.rs:36:10
|
LL | / fn main() {
LL | |
LL | | [(); return || {
| |__________^
LL | / fn main() {
LL | |
LL | | [(); return || {
| | __________^
LL | ||
LL | ||
LL | || let tx;
LL | || }];
| ||_____^ the return is part of this body...
LL | | }
| |_- ...not the enclosing function body
LL | | }
| |__- ...not the enclosing function body

error: aborting due to 4 previous errors

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/suggestions/issue-99240-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ LL | Unit,
| ---- enum variant `Alias::Unit` defined here
...
LL | Alias::
| _____^
| |_____|
| ______^
| | _____|
| ||
LL | || Unit();
| ||________^_- call expression requires function
| |_________|
| |________|
|
|
help: `Alias::Unit` is a unit enum variant, and does not take parentheses to be constructed
Expand Down
Loading