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

Make generic parameters always use modern hygiene #63083

Merged
merged 3 commits into from
Jul 30, 2019

Conversation

matthewjasper
Copy link
Contributor

@matthewjasper matthewjasper commented Jul 28, 2019

  • E0263 (lifetime parameter declared twice in the same scope) now compares modernized identifiers.
  • Const parameters are now resolved with modern hygiene.

Closes #58307
Closes #60746
Closes #61574
Closes #62433

They were resolved with modern hygiene, making this just a strange way
to shadow lifetimes.
Declarations were already modernized, resulting in cases where a macro
couldn't resolve it's own identifier.
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2019
@petrochenkov
Copy link
Contributor

r? @petrochenkov

@petrochenkov
Copy link
Contributor

@matthewjasper
Could you check whether this fixes other related issues - #60746, #61574 (perhaps some test cases are missing?).

@@ -872,8 +872,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
debug!("(resolving function) entering function");
let rib_kind = match function_kind {
FnKind::ItemFn(..) => FnItemRibKind,
FnKind::Method(..) => AssocItemRibKind,
FnKind::Closure(_) => NormalRibKind,
FnKind::Method(..) | FnKind::Closure(_) => NormalRibKind,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changed, and why did it work previously?
I don't quite remember all the differences between many kinds of ribs that act as "barriers" for names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason that this has little effect is that there is already an AssocItemRib around all associated items that holds any generic parameters. Since generic parameters can be seen through associated items, this rib isn't stopping any names from being visible.
The reason for the change is so that function parameters don't end up in an associated item rib, and get resolved with the wrong hygiene.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 28, 2019
@matthewjasper matthewjasper changed the title Make generics parameters always use modern hygiene Make generic parameters always use modern hygiene Jul 29, 2019
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 29, 2019

📌 Commit 0fb9295 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 29, 2019
Centril added a commit to Centril/rust that referenced this pull request Jul 29, 2019
…petrochenkov

Make generic parameters always use modern hygiene

* E0263 (lifetime parameter declared twice in the same scope) now compares modernized identifiers.
* Const parameters are now resolved with modern hygiene.

Closes rust-lang#58307
Closes rust-lang#60746
Closes rust-lang#61574
Closes rust-lang#62433
Centril added a commit to Centril/rust that referenced this pull request Jul 30, 2019
…petrochenkov

Make generic parameters always use modern hygiene

* E0263 (lifetime parameter declared twice in the same scope) now compares modernized identifiers.
* Const parameters are now resolved with modern hygiene.

Closes rust-lang#58307
Closes rust-lang#60746
Closes rust-lang#61574
Closes rust-lang#62433
Centril added a commit to Centril/rust that referenced this pull request Jul 30, 2019
…petrochenkov

Make generic parameters always use modern hygiene

* E0263 (lifetime parameter declared twice in the same scope) now compares modernized identifiers.
* Const parameters are now resolved with modern hygiene.

Closes rust-lang#58307
Closes rust-lang#60746
Closes rust-lang#61574
Closes rust-lang#62433
bors added a commit that referenced this pull request Jul 30, 2019
Rollup of 12 pull requests

Successful merges:

 - #61965 (Remove mentions of removed `offset_to` method from `align_offset` docs)
 - #62928 (Syntax: Recover on `for ( $pat in $expr ) $block`)
 - #63000 (Impl Debug for Chars)
 - #63083 (Make generic parameters always use modern hygiene)
 - #63087 (Add very simple edition check to tidy.)
 - #63093 (Properly check the defining scope of existential types)
 - #63096 (Add tests for some `existential_type` ICEs)
 - #63099 (vxworks: Remove Linux-specific comments.)
 - #63106 (ci: Skip installing SWIG/xz on OSX )
 - #63108 (Add links to None in Option doc)
 - #63109 (std: Fix a failing `fs` test on Windows)
 - #63111 (Add syntactic and semantic tests for rest patterns, i.e. `..`)

Failed merges:

r? @ghost
@bors bors merged commit 0fb9295 into rust-lang:master Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-const_generics `#![feature(const_generics)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
6 participants