-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Get diesel_derives2 working with hygiene turned on #1521
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,8 @@ authors = ["Sean Griffin <[email protected]>"] | |
| [workspace] | ||
|
|
||
| [dependencies] | ||
| diesel = { version = "1.1.0", features = ["extras", "sqlite", "postgres", "mysql"] } | ||
| compiletest_rs = "=0.3.3" | ||
| diesel = { version = "1.1.0", features = ["extras", "sqlite", "postgres", "mysql", "unstable"] } | ||
| compiletest_rs = "=0.3.6" | ||
|
|
||
| [replace] | ||
| "diesel:1.1.1" = { path = "../diesel" } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
diesel_compile_tests/tests/ui/as_changeset_bad_column_name.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #[macro_use] | ||
| extern crate diesel; | ||
|
|
||
| table! { | ||
| users { | ||
| id -> Integer, | ||
| } | ||
| } | ||
|
|
||
| #[derive(AsChangeset)] | ||
| #[table_name = "users"] | ||
| struct UserStruct { | ||
| name: String, | ||
| #[column_name = "hair_color"] | ||
| color_de_pelo: String, | ||
| } | ||
|
|
||
| #[derive(AsChangeset)] | ||
| #[table_name = "users"] | ||
| struct UserTuple(#[column_name = "name"] String); |
40 changes: 40 additions & 0 deletions
40
diesel_compile_tests/tests/ui/as_changeset_bad_column_name.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| error[E0412]: cannot find type `name` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:13:5 | ||
| | | ||
| 13 | name: String, | ||
| | ^^^^ not found in `users` | ||
|
|
||
| error[E0412]: cannot find type `hair_color` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:14:5 | ||
| | | ||
| 14 | #[column_name = "hair_color"] | ||
| | ^ not found in `users` | ||
|
|
||
| error[E0425]: cannot find value `name` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:13:5 | ||
| | | ||
| 13 | name: String, | ||
| | ^^^^ not found in `users` | ||
|
|
||
| error[E0425]: cannot find value `hair_color` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:14:5 | ||
| | | ||
| 14 | #[column_name = "hair_color"] | ||
| | ^ not found in `users` | ||
|
|
||
| error[E0412]: cannot find type `name` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:20:18 | ||
| | | ||
| 20 | struct UserTuple(#[column_name = "name"] String); | ||
| | ^ not found in `users` | ||
|
|
||
| error[E0425]: cannot find value `name` in module `users` | ||
| --> $DIR/as_changeset_bad_column_name.rs:20:18 | ||
| | | ||
| 20 | struct UserTuple(#[column_name = "name"] String); | ||
| | ^ not found in `users` | ||
|
|
||
| error[E0601]: main function not found | ||
|
|
||
| error: aborting due to 7 previous errors | ||
|
|
17 changes: 17 additions & 0 deletions
17
diesel_compile_tests/tests/ui/as_changeset_missing_table_import.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #[macro_use] | ||
| extern crate diesel; | ||
|
|
||
| #[derive(AsChangeset)] | ||
| struct User { | ||
| id: i32, | ||
| name: String, | ||
| } | ||
|
|
||
| #[derive(AsChangeset)] | ||
| #[table_name = "users"] | ||
| struct UserForm { | ||
| id: i32, | ||
| name: String, | ||
| } | ||
|
|
||
| fn main() {} |
14 changes: 14 additions & 0 deletions
14
diesel_compile_tests/tests/ui/as_changeset_missing_table_import.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| error[E0433]: failed to resolve. Use of undeclared type or module `users` | ||
| --> $DIR/as_changeset_missing_table_import.rs:5:8 | ||
| | | ||
| 5 | struct User { | ||
| | ^^^^ Use of undeclared type or module `users` | ||
|
|
||
| error[E0433]: failed to resolve. Use of undeclared type or module `users` | ||
| --> <macro expansion>:1:1 | ||
| | | ||
| 1 | #[table_name = "users"] | ||
| | ^ Use of undeclared type or module `users` | ||
|
|
||
| error: aborting due to 2 previous errors | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
| # file at the top-level directory of this distribution and at | ||
| # http://rust-lang.org/COPYRIGHT. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| # option. This file may not be copied, modified, or distributed | ||
| # except according to those terms. | ||
|
|
||
| # A script to update the references for particular tests. The idea is | ||
| # that you do a run, which will generate files in the build directory | ||
| # containing the (normalized) actual output of the compiler. This | ||
| # script will then copy that output and replace the "expected output" | ||
| # files. You can then commit the changes. | ||
| # | ||
| # If you find yourself manually editing a foo.stderr file, you're | ||
| # doing it wrong. | ||
|
|
||
| if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then | ||
| echo "usage: $0 <build-directory> <relative-path-to-rs-files>" | ||
| echo "" | ||
| echo "For example:" | ||
| echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" | ||
| fi | ||
|
|
||
| MYDIR=$(dirname $0) | ||
|
|
||
| BUILD_DIR="$1" | ||
| shift | ||
|
|
||
| while [[ "$1" != "" ]]; do | ||
| STDERR_NAME="${1/%.rs/.stderr}" | ||
| STDOUT_NAME="${1/%.rs/.stdout}" | ||
| shift | ||
| if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ | ||
| ! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then | ||
| echo updating $MYDIR/$STDOUT_NAME | ||
| cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME | ||
| fi | ||
| if [ -f $BUILD_DIR/$STDERR_NAME ] && \ | ||
| ! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then | ||
| echo updating $MYDIR/$STDERR_NAME | ||
| cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME | ||
| fi | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quote_spanned!can make this more concise but it is up to you whether you prefer the explicit way or the concise way.