parent
51cc3cdcf0
commit
051835b903
@ -1931,7 +1931,7 @@ impl<'a> LoweringContext<'a> {
|
|||||||
|
|
||||||
fn lower_parenthesized_parameter_data(
|
fn lower_parenthesized_parameter_data(
|
||||||
&mut self,
|
&mut self,
|
||||||
data: &ParenthesisedArgs,
|
data: &ParenthesizedArgs,
|
||||||
) -> (hir::GenericArgs, bool) {
|
) -> (hir::GenericArgs, bool) {
|
||||||
// Switch to `PassThrough` mode for anonymous lifetimes: this
|
// Switch to `PassThrough` mode for anonymous lifetimes: this
|
||||||
// means that we permit things like `&Ref<T>`, where `Ref` has
|
// means that we permit things like `&Ref<T>`, where `Ref` has
|
||||||
@ -1941,7 +1941,7 @@ impl<'a> LoweringContext<'a> {
|
|||||||
self.with_anonymous_lifetime_mode(
|
self.with_anonymous_lifetime_mode(
|
||||||
AnonymousLifetimeMode::PassThrough,
|
AnonymousLifetimeMode::PassThrough,
|
||||||
|this| {
|
|this| {
|
||||||
let &ParenthesisedArgs { ref inputs, ref output, span } = data;
|
let &ParenthesizedArgs { ref inputs, ref output, span } = data;
|
||||||
let inputs = inputs
|
let inputs = inputs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed()))
|
.map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed()))
|
||||||
|
@ -136,7 +136,7 @@ pub enum GenericArgs {
|
|||||||
/// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>`
|
/// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>`
|
||||||
AngleBracketed(AngleBracketedArgs),
|
AngleBracketed(AngleBracketedArgs),
|
||||||
/// The `(A,B)` and `C` in `Foo(A,B) -> C`
|
/// The `(A,B)` and `C` in `Foo(A,B) -> C`
|
||||||
Parenthesized(ParenthesisedArgs),
|
Parenthesized(ParenthesizedArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenericArgs {
|
impl GenericArgs {
|
||||||
@ -173,7 +173,7 @@ impl Into<Option<P<GenericArgs>>> for AngleBracketedArgs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Option<P<GenericArgs>>> for ParenthesisedArgs {
|
impl Into<Option<P<GenericArgs>>> for ParenthesizedArgs {
|
||||||
fn into(self) -> Option<P<GenericArgs>> {
|
fn into(self) -> Option<P<GenericArgs>> {
|
||||||
Some(P(GenericArgs::Parenthesized(self)))
|
Some(P(GenericArgs::Parenthesized(self)))
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ impl Into<Option<P<GenericArgs>>> for ParenthesisedArgs {
|
|||||||
|
|
||||||
/// A path like `Foo(A,B) -> C`
|
/// A path like `Foo(A,B) -> C`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ParenthesisedArgs {
|
pub struct ParenthesizedArgs {
|
||||||
/// Overall span
|
/// Overall span
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ pub struct ParenthesisedArgs {
|
|||||||
pub output: Option<P<Ty>>,
|
pub output: Option<P<Ty>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParenthesisedArgs {
|
impl ParenthesizedArgs {
|
||||||
pub fn as_angle_bracketed_args(&self) -> AngleBracketedArgs {
|
pub fn as_angle_bracketed_args(&self) -> AngleBracketedArgs {
|
||||||
AngleBracketedArgs {
|
AngleBracketedArgs {
|
||||||
span: self.span,
|
span: self.span,
|
||||||
|
@ -207,8 +207,8 @@ pub trait Folder : Sized {
|
|||||||
noop_fold_angle_bracketed_parameter_data(p, self)
|
noop_fold_angle_bracketed_parameter_data(p, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_parenthesized_parameter_data(&mut self, p: ParenthesisedArgs)
|
fn fold_parenthesized_parameter_data(&mut self, p: ParenthesizedArgs)
|
||||||
-> ParenthesisedArgs
|
-> ParenthesizedArgs
|
||||||
{
|
{
|
||||||
noop_fold_parenthesized_parameter_data(p, self)
|
noop_fold_parenthesized_parameter_data(p, self)
|
||||||
}
|
}
|
||||||
@ -504,12 +504,12 @@ pub fn noop_fold_angle_bracketed_parameter_data<T: Folder>(data: AngleBracketedA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesisedArgs,
|
pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedArgs,
|
||||||
fld: &mut T)
|
fld: &mut T)
|
||||||
-> ParenthesisedArgs
|
-> ParenthesizedArgs
|
||||||
{
|
{
|
||||||
let ParenthesisedArgs { inputs, output, span } = data;
|
let ParenthesizedArgs { inputs, output, span } = data;
|
||||||
ParenthesisedArgs {
|
ParenthesizedArgs {
|
||||||
inputs: inputs.move_map(|ty| fld.fold_ty(ty)),
|
inputs: inputs.move_map(|ty| fld.fold_ty(ty)),
|
||||||
output: output.map(|ty| fld.fold_ty(ty)),
|
output: output.map(|ty| fld.fold_ty(ty)),
|
||||||
span: fld.new_span(span)
|
span: fld.new_span(span)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use rustc_target::spec::abi::{self, Abi};
|
use rustc_target::spec::abi::{self, Abi};
|
||||||
use ast::{AngleBracketedArgs, ParenthesisedArgs, AttrStyle, BareFnTy};
|
use ast::{AngleBracketedArgs, ParenthesizedArgs, AttrStyle, BareFnTy};
|
||||||
use ast::{GenericBound, TraitBoundModifier};
|
use ast::{GenericBound, TraitBoundModifier};
|
||||||
use ast::Unsafety;
|
use ast::Unsafety;
|
||||||
use ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind};
|
use ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind};
|
||||||
@ -2203,7 +2203,7 @@ impl<'a> Parser<'a> {
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
ParenthesisedArgs { inputs, output, span }.into()
|
ParenthesizedArgs { inputs, output, span }.into()
|
||||||
};
|
};
|
||||||
|
|
||||||
PathSegment { ident, args, id: ast::DUMMY_NODE_ID }
|
PathSegment { ident, args, id: ast::DUMMY_NODE_ID }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0609]: no field `opts` on type `*const Session`
|
error[E0609]: no field `opts` on type `*const Session`
|
||||||
--> $DIR/parenthesised-deref-suggestion.rs:7:30
|
--> $DIR/parenthesized-deref-suggestion.rs:7:30
|
||||||
|
|
|
|
||||||
LL | (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session`
|
LL | (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session`
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@ -9,7 +9,7 @@ LL | (*(sess as *const Session)).opts; //~ ERROR no field `opts` on type `*c
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0609]: no field `0` on type `[u32; 1]`
|
error[E0609]: no field `0` on type `[u32; 1]`
|
||||||
--> $DIR/parenthesised-deref-suggestion.rs:10:21
|
--> $DIR/parenthesized-deref-suggestion.rs:10:21
|
||||||
|
|
|
|
||||||
LL | (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]`
|
LL | (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]`
|
||||||
| ----------------^
|
| ----------------^
|
Loading…
Reference in New Issue
Block a user