Skip to content
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

Rollup of 9 pull requests #73206

Merged
merged 29 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
474b16b
Add windows group to triagebot
spastorino May 28, 2020
52f1847
resolve: Pass parent scope to the function providing import suggestions
petrochenkov May 30, 2020
21fca7a
resolve: Do not suggest imports from the same module in which we are …
petrochenkov May 30, 2020
29508ce
normalize adt fields during structural match check
lcnr Jun 1, 2020
4725af3
remove assert
lcnr Jun 2, 2020
7f7729d
Don't create impl candidates when obligation contains errors
Aaron1011 Jun 4, 2020
3295c26
Treat selection error as ambiguous when error type is present
Aaron1011 Jun 5, 2020
ae42c91
Fix typo
Aaron1011 Jun 5, 2020
568cc22
Add regression test for const generic ICE in #72819
ayazhafiz Jun 6, 2020
ab7355a
fixup! Add regression test for const generic ICE in #72819
ayazhafiz Jun 6, 2020
f82382a
fixup! Add regression test for const generic ICE in #72819
ayazhafiz Jun 9, 2020
2981395
fixup! Add regression test for const generic ICE in #72819
ayazhafiz Jun 9, 2020
0fcea2e
Don't lose empty `where` clause when pretty-printing
Aaron1011 Jun 9, 2020
b055552
Remove noisy suggestion of hash_map #72642
Jun 5, 2020
a8640cd
improper_ctypes: add test for #66202
davidtwco Jun 1, 2020
3e7aabb
lint: check for unit ret type after normalization
davidtwco Jun 1, 2020
d4d3d7d
lint: transitive FFI-safety for transparent types
davidtwco Jun 1, 2020
e237e02
Reoder order in which MinGW libs are linked
mati865 Jun 9, 2020
e0ec3d5
fix URLs, include ARM
nikomatsakis Jun 9, 2020
a01485c
Fix rustc-dev-guide url
spastorino Jun 10, 2020
a70fb70
Rollup merge of #72706 - spastorino:add-windows-group, r=nikomatsakis
Dylan-DPC Jun 10, 2020
78d08a2
Rollup merge of #72789 - petrochenkov:impcand, r=davidtwco
Dylan-DPC Jun 10, 2020
fda594e
Rollup merge of #72890 - davidtwco:issue-66202-normalize-and-transpar…
Dylan-DPC Jun 10, 2020
8addb2e
Rollup merge of #72897 - lcnr:structurally-match-normalize, r=pnkfelix
Dylan-DPC Jun 10, 2020
024f025
Rollup merge of #73005 - Aaron1011:fix/error-overflow, r=estebank
Dylan-DPC Jun 10, 2020
e1cd8c4
Rollup merge of #73023 - ayushmishra2005:remove_noisy_suggestion, r=d…
Dylan-DPC Jun 10, 2020
0a77c8c
Rollup merge of #73070 - ayazhafiz:i/72819, r=nikomatsakis
Dylan-DPC Jun 10, 2020
e04e3c8
Rollup merge of #73157 - Aaron1011:where-oh-where-has-my-little-span-…
Dylan-DPC Jun 10, 2020
2b8f1ec
Rollup merge of #73184 - mati865:fix-mingw-libs-order, r=petrochenkov
Dylan-DPC Jun 10, 2020
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
11 changes: 10 additions & 1 deletion src/librustc_ast/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ impl Default for Generics {
fn default() -> Generics {
Generics {
params: Vec::new(),
where_clause: WhereClause { predicates: Vec::new(), span: DUMMY_SP },
where_clause: WhereClause {
has_where_token: false,
predicates: Vec::new(),
span: DUMMY_SP,
},
span: DUMMY_SP,
}
}
Expand All @@ -371,6 +375,11 @@ impl Default for Generics {
/// A where-clause in a definition.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct WhereClause {
/// `true` if we ate a `where` token: this can happen
/// if we parsed no predicates (e.g. `struct Foo where {}
/// This allows us to accurately pretty-print
/// in `nt_to_tokenstream`
pub has_where_token: bool,
pub predicates: Vec<WherePredicate>,
pub span: Span,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ pub fn noop_visit_generics<T: MutVisitor>(generics: &mut Generics, vis: &mut T)
}

pub fn noop_visit_where_clause<T: MutVisitor>(wc: &mut WhereClause, vis: &mut T) {
let WhereClause { predicates, span } = wc;
let WhereClause { has_where_token: _, predicates, span } = wc;
visit_vec(predicates, |predicate| vis.visit_where_predicate(predicate));
vis.visit_span(span);
}
Expand Down
8 changes: 6 additions & 2 deletions src/librustc_ast_pretty/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,7 @@ impl<'a> State<'a> {
}

crate fn print_where_clause(&mut self, where_clause: &ast::WhereClause) {
if where_clause.predicates.is_empty() {
if where_clause.predicates.is_empty() && !where_clause.has_where_token {
return;
}

Expand Down Expand Up @@ -2739,7 +2739,11 @@ impl<'a> State<'a> {
}
let generics = ast::Generics {
params: Vec::new(),
where_clause: ast::WhereClause { predicates: Vec::new(), span: rustc_span::DUMMY_SP },
where_clause: ast::WhereClause {
has_where_token: false,
predicates: Vec::new(),
span: rustc_span::DUMMY_SP,
},
span: rustc_span::DUMMY_SP,
};
let header = ast::FnHeader { unsafety, ext, ..ast::FnHeader::default() };
Expand Down
6 changes: 5 additions & 1 deletion src/librustc_builtin_macros/deriving/generic/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ fn mk_ty_param(
}

fn mk_generics(params: Vec<ast::GenericParam>, span: Span) -> Generics {
Generics { params, where_clause: ast::WhereClause { predicates: Vec::new(), span }, span }
Generics {
params,
where_clause: ast::WhereClause { has_where_token: false, predicates: Vec::new(), span },
span,
}
}

/// Lifetimes and bounds on type parameters
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_parse/parser/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl<'a> Parser<'a> {
Ok(ast::Generics {
params,
where_clause: WhereClause {
has_where_token: false,
predicates: Vec::new(),
span: self.prev_token.span.shrink_to_hi(),
},
Expand All @@ -170,12 +171,16 @@ impl<'a> Parser<'a> {
/// where T : Trait<U, V> + 'b, 'a : 'b
/// ```
pub(super) fn parse_where_clause(&mut self) -> PResult<'a, WhereClause> {
let mut where_clause =
WhereClause { predicates: Vec::new(), span: self.prev_token.span.shrink_to_hi() };
let mut where_clause = WhereClause {
has_where_token: false,
predicates: Vec::new(),
span: self.prev_token.span.shrink_to_hi(),
};

if !self.eat_keyword(kw::Where) {
return Ok(where_clause);
}
where_clause.has_where_token = true;
let lo = self.prev_token.span;

// We are considering adding generics to the `where` keyword as an alternative higher-rank
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/proc-macro/empty-where-clause.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// aux-build:test-macros.rs

extern crate test_macros;
use test_macros::recollect_attr;

#[recollect_attr]
struct FieldStruct where {
field: MissingType1 //~ ERROR cannot find
}

#[recollect_attr]
struct TupleStruct(MissingType2) where; //~ ERROR cannot find

enum MyEnum where {
Variant(MissingType3) //~ ERROR cannot find
}

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/proc-macro/empty-where-clause.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0412]: cannot find type `MissingType1` in this scope
--> $DIR/empty-where-clause.rs:8:12
|
LL | field: MissingType1
| ^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `MissingType2` in this scope
--> $DIR/empty-where-clause.rs:12:20
|
LL | struct TupleStruct(MissingType2) where;
| ^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `MissingType3` in this scope
--> $DIR/empty-where-clause.rs:15:13
|
LL | Variant(MissingType3)
| ^^^^^^^^^^^^ not found in this scope

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0412`.