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

Syn/2.0 #3563

Merged
merged 4 commits into from
Mar 24, 2023
Merged

Syn/2.0 #3563

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ jobs:
sudo apt-get update
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
- name: Check diesel_derives
run: cargo +1.65.0 minimal-versions check -p diesel_derives --all-features
run: cargo +1.65.0 minimal-versions check -p diesel_derives --features "postgres sqlite mysql 32-column-tables 64-column-tables 128-column-tables without-deprecated with-deprecated r2d2"
Copy link
Member

Choose a reason for hiding this comment

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

Why not? Wouldn't we want to check that all features work on minimal dep versions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because --all-features would enable the nightly feature for diesel-derives, which in turn would enable an unstable rustc feature, which in turn will not compile on a stable release.
The feature list is equivalent to --all-features with the nightly feature removed.

- name: Check diesel
run: cargo +1.65.0 minimal-versions check -p diesel --features "postgres mysql sqlite extras"
- name: Check diesel_dynamic_schema
Expand Down
2 changes: 1 addition & 1 deletion diesel_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ diffy = "0.3.0"
regex = "1.0.6"
serde_regex = "1.1"
diesel_table_macro_syntax = {version = "0.1", path = "../diesel_table_macro_syntax"}
syn = { version = "1", features = ["visit"] }
syn = { version = "2", features = ["visit"] }

[dependencies.diesel]
version = "~2.0.0"
Expand Down
70 changes: 28 additions & 42 deletions diesel_compile_tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: Deriving `AsChangeset` on a structure that only contains primary keys isn't supported.
help: If you want to change the primary key of a row, you should do so with `.set(table::id.eq(new_id))`.
note: `#[derive(AsChangeset)]` never changes the primary key of a row.
--> tests/fail/derive/as_changeset_struct_with_only_primary_key.rs:18:10
|
18 | #[derive(AsChangeset)]
| ^^^^^^^^^^^
|
= help: If you want to change the primary key of a row, you should do so with `.set(table::id.eq(new_id))`.
= note: `#[derive(AsChangeset)]` never changes the primary key of a row.
= note: this error originates in the derive macro `AsChangeset` (in Nightly builds, run with -Z macro-backtrace for more info)

error: Deriving `AsChangeset` on a structure that only contains primary keys isn't supported.
help: If you want to change the primary key of a row, you should do so with `.set(table::id.eq(new_id))`.
note: `#[derive(AsChangeset)]` never changes the primary key of a row.
--> tests/fail/derive/as_changeset_struct_with_only_primary_key.rs:24:10
|
24 | #[derive(AsChangeset)]
| ^^^^^^^^^^^
|
= help: If you want to change the primary key of a row, you should do so with `.set(table::id.eq(new_id))`.
= note: `#[derive(AsChangeset)]` never changes the primary key of a row.
= note: this error originates in the derive macro `AsChangeset` (in Nightly builds, run with -Z macro-backtrace for more info)
6 changes: 2 additions & 4 deletions diesel_compile_tests/tests/fail/derive/bad_belongs_to.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
error: unexpected end of input, expected parentheses
help: The correct format looks like `#[diesel(belongs_to(Foo, foreign_key = foo_id))]`
--> tests/fail/derive/bad_belongs_to.rs:29:20
|
29 | #[diesel(belongs_to)]
| ^
|
= help: The correct format looks like `#[diesel(belongs_to(Foo, foreign_key = foo_id))]`

error: expected parentheses
--> tests/fail/derive/bad_belongs_to.rs:36:21
Expand All @@ -31,12 +30,11 @@ error: expected `,`
| ^

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(belongs_to(Foo, foreign_key = foo_id))]`
--> tests/fail/derive/bad_belongs_to.rs:64:37
|
64 | #[diesel(belongs_to(Bar, foreign_key))]
| ^
|
= help: The correct format looks like `#[diesel(belongs_to(Foo, foreign_key = foo_id))]`

error: expected `=`
--> tests/fail/derive/bad_belongs_to.rs:71:37
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(column_name = foo)]`
--> tests/fail/derive/bad_column_name.rs:16:25
|
16 | #[diesel(column_name)]
| ^
|
= help: The correct format looks like `#[diesel(column_name = foo)]`

error: expected `=`
--> tests/fail/derive/bad_column_name.rs:23:25
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(deserialize_as = Foo)]`
--> tests/fail/derive/bad_deserialize_as.rs:7:28
|
7 | #[diesel(deserialize_as)]
| ^
|
= help: The correct format looks like `#[diesel(deserialize_as = Foo)]`

error: expected `=`
--> tests/fail/derive/bad_deserialize_as.rs:14:28
Expand Down
9 changes: 3 additions & 6 deletions diesel_compile_tests/tests/fail/derive/bad_mysql_type.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
error: unexpected end of input, expected parentheses
help: The correct format looks like `#[diesel(mysql_type(name = "foo"))]`
--> tests/fail/derive/bad_mysql_type.rs:6:20
|
6 | #[diesel(mysql_type)]
| ^
|
= help: The correct format looks like `#[diesel(mysql_type(name = "foo"))]`

error: expected attribute `name`
help: The correct format looks like #[diesel(mysql_type(name = "foo"))]
--> tests/fail/derive/bad_mysql_type.rs:10:21
|
10 | #[diesel(mysql_type())]
| ^
|
= help: The correct format looks like #[diesel(mysql_type(name = "foo"))]

error: expected parentheses
--> tests/fail/derive/bad_mysql_type.rs:14:21
Expand All @@ -21,12 +19,11 @@ error: expected parentheses
| ^

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(mysql_type(name = "foo"))]`
--> tests/fail/derive/bad_mysql_type.rs:18:25
|
18 | #[diesel(mysql_type(name))]
| ^
|
= help: The correct format looks like `#[diesel(mysql_type(name = "foo"))]`

error: expected `=`
--> tests/fail/derive/bad_mysql_type.rs:22:25
Expand Down
30 changes: 10 additions & 20 deletions diesel_compile_tests/tests/fail/derive/bad_postgres_type.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
error: unexpected end of input, expected parentheses
help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`
--> tests/fail/derive/bad_postgres_type.rs:6:23
|
6 | #[diesel(postgres_type)]
| ^
|
= help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`

error: expected `oid` and `array_oid` attribute or `name` attribute
help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:10:24
|
10 | #[diesel(postgres_type())]
| ^
|
= help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`

error: expected parentheses
--> tests/fail/derive/bad_postgres_type.rs:14:24
Expand All @@ -21,12 +19,11 @@ error: expected parentheses
| ^

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`
--> tests/fail/derive/bad_postgres_type.rs:18:28
|
18 | #[diesel(postgres_type(name))]
| ^
|
= help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`

error: expected `=`
--> tests/fail/derive/bad_postgres_type.rs:22:28
Expand All @@ -41,28 +38,25 @@ error: expected string literal
| ^^^

error: unexpected `oid` when `name` is present
help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:30:38
|
30 | #[diesel(postgres_type(name = "foo", oid = 2, array_oid = 3))]
| ^^^
|
= help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`

error: unexpected `array_oid` when `name` is present
help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:34:38
|
34 | #[diesel(postgres_type(name = "foo", array_oid = 3))]
| ^^^^^^^^^
|
= help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`

error: expected `oid` and `array_oid` attribute or `name` attribute
help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:38:31
|
38 | #[diesel(postgres_type(oid = 2))]
| ^
|
= help: The correct format looks like either `#[diesel(postgres_type(name = "foo", schema = "public"))]` or `#[diesel(postgres_type(oid = 37, array_oid = 54))]`

error: expected integer literal
--> tests/fail/derive/bad_postgres_type.rs:42:45
Expand All @@ -77,12 +71,11 @@ error: expected integer literal
| ^^^

error: expected `name` to be also present
help: make sure `name` is present, `#[diesel(postgres_type(name = "...", schema = "foo"))]`
--> tests/fail/derive/bad_postgres_type.rs:50:24
|
50 | #[diesel(postgres_type(schema = "foo"))]
| ^^^^^^
|
= help: make sure `name` is present, `#[diesel(postgres_type(name = "...", schema = "foo"))]`

error: unknown attribute, expected one of `oid`, `array_oid`, `name`, `schema`
--> tests/fail/derive/bad_postgres_type.rs:54:24
Expand All @@ -91,25 +84,22 @@ error: unknown attribute, expected one of `oid`, `array_oid`, `name`, `schema`
| ^^^^

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`
--> tests/fail/derive/bad_postgres_type.rs:58:30
|
58 | #[diesel(postgres_type(schema))]
| ^
|
= help: The correct format looks like `#[diesel(postgres_type(name = "foo", schema = "public"))]`

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:62:27
|
62 | #[diesel(postgres_type(oid))]
| ^
|
= help: The correct format looks like `#[diesel(postgres_type(oid = 37, array_oid = 54))]`

error: unexpected end of input, expected `=`
help: The correct format looks like `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
--> tests/fail/derive/bad_postgres_type.rs:66:33
|
66 | #[diesel(postgres_type(array_oid))]
| ^
|
= help: The correct format looks like `#[diesel(postgres_type(oid = 37, array_oid = 54))]`
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ error: expected `,`
| ^

error: unexpected end of input, expected parentheses
help: The correct format looks like `#[diesel(key1, key2)]`
--> tests/fail/derive/bad_primary_key.rs:26:21
|
26 | #[diesel(primary_key)]
| ^
|
= help: The correct format looks like `#[diesel(key1, key2)]`

error: expected parentheses
--> tests/fail/derive/bad_primary_key.rs:33:22
Expand Down
Loading