Skip to content

Commit

Permalink
Revert old span change
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Apr 17, 2020
1 parent ac2fb7a commit 8272465
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 21 deletions.
12 changes: 1 addition & 11 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,18 +1015,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1);

let path_span = if let [segment] = &trait_ref.path.segments[..] {
// FIXME: `trait_ref.path.span` can point to a full path with multiple
// segments, even though `trait_ref.path.segments` is of length `1`. Work
// around that bug here, even though it should be fixed elsewhere.
// This would otherwise cause an invalid suggestion. For an example, look at
// `src/test/ui/issues/issue-28344.rs`.
segment.ident.span
} else {
trait_ref.path.span
};
let (substs, assoc_bindings, arg_count_correct) = self.create_substs_for_ast_trait_ref(
path_span,
trait_ref.path.span,
trait_def_id,
self_ty,
trait_ref.path.segments.last().unwrap(),
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/suggestions/missing-lifetime-specifier.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1
--> $DIR/missing-lifetime-specifier.rs:54:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime arguments
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments

error[E0107]: wrong number of lifetime arguments: expected 2, found 1
--> $DIR/missing-lifetime-specifier.rs:54:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime arguments
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
--> $DIR/missing-lifetime-specifier.rs:54:45
Expand All @@ -236,7 +236,7 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1
--> $DIR/missing-lifetime-specifier.rs:54:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime arguments
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
--> $DIR/missing-lifetime-specifier.rs:54:45
Expand All @@ -248,7 +248,7 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1
--> $DIR/missing-lifetime-specifier.rs:54:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime arguments
| ^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments

error: aborting due to 28 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0658]: parenthetical notation is only stable when used with `Fn`-family t
--> $DIR/unboxed-closure-feature-gate.rs:13:20
|
LL | let x: Box<dyn Foo(isize)>;
| ^^^
| ^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje
--> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:17
|
LL | fn bar1(x: &dyn Fn<(), Output=()>) {
| ^^ help: use parenthetical notation instead: `Fn() -> ()`
| ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn() -> ()`
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
Expand All @@ -11,7 +11,7 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subje
--> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:7:28
|
LL | fn bar2<T>(x: &T) where T: Fn<()> {
| ^^ help: use parenthetical notation instead: `Fn() -> ()`
| ^^^^^^ help: use parenthetical notation instead: `Fn() -> ()`
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 0
--> $DIR/unboxed-closure-sugar-region.rs:30:51
|
LL | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) {
| ^^^ expected 1 lifetime argument
| ^^^^^^^^^^ expected 1 lifetime argument

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: wrong number of type arguments: expected 3, found 1
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
LL | fn foo(_: &dyn Three())
| ^^^^^ expected 3 type arguments
| ^^^^^^^ expected 3 type arguments

error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unspecified-self-in-trait-ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LL | | }
| |_- type parameter `A` must be specified for this
...
LL | let e = Bar::<usize>::lol();
| ^^^ missing reference to `A`
| ^^^^^^^^^^^^^^^^^ missing reference to `A`
|
= note: because of the default `Self` reference, type parameters must be specified on object types

Expand Down

0 comments on commit 8272465

Please sign in to comment.